:root {
  --iw-indigo: #2196f3;
  --iw-indigo-dark: #1976d2;
  --iw-indigo-light: #42a5f5;
  --iw-navy: #0f172a;
  --iw-navy-mid: #1e293b;
  --iw-purple: #1976d2;
  --iw-ink: #0f172a;
  --iw-muted: #64748b;
  --iw-border: #e2e8f0;
  --iw-surface: #ffffff;
  --iw-bg: #f1f5f9;
  --erp-sidebar: #0f172a;
  --erp-sidebar-border: rgba(255,255,255,0.06);
  --erp-accent: #2196f3;
  --erp-accent-soft: #e3f2fd;
  --sidebar-width: 272px;
  --topbar-height: 60px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Incentiwise ERP design system v3 — bump APP_STATIC_VERSION on CSS changes */

* { box-sizing: border-box; }

/* Bootstrap isolation inside app shell */
.app-body .btn-primary,
.app-body .btn.btn-primary {
  background: linear-gradient(135deg, var(--iw-indigo), var(--iw-indigo-dark)) !important;
  border: none !important;
  border-radius: 10px !important;
  font-weight: 600;
  box-shadow: none;
}

.app-body .btn-primary:hover,
.app-body .btn.btn-primary:hover {
  background: linear-gradient(135deg, var(--iw-indigo-dark), #4338ca) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.app-body .btn-outline-secondary,
.app-body .btn.btn-outline-secondary {
  border: 1.5px solid var(--iw-indigo) !important;
  color: var(--iw-indigo) !important;
  background: transparent !important;
  border-radius: 10px !important;
  font-weight: 600;
}

.app-body .card {
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-body .btn.btn-iw,
.app-body a.btn-iw,
.app-body button.btn-iw {
  background: linear-gradient(135deg, var(--iw-indigo), var(--iw-indigo-dark)) !important;
  border: none !important;
  color: #fff !important;
}

.app-body .btn.btn-iw-outline,
.app-body a.btn-iw-outline,
.app-body button.btn-iw-outline {
  border: 1.5px solid var(--iw-indigo) !important;
  color: var(--iw-indigo) !important;
  background: transparent !important;
}

body.app-body {
  margin: 0;
  font-family: var(--font-sans, 'Open Sans', system-ui, sans-serif);
  color: var(--iw-ink);
  background: var(--iw-bg);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--erp-sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform var(--transition);
  overflow: hidden;
  border-right: 1px solid var(--erp-sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--erp-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-text strong {
  display: block;
  font-size: 1rem;
  color: #fff;
  line-height: 1.2;
}

.brand-text small {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
  display: block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.nav-section { margin-bottom: 1rem; }

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  padding: 0.25rem 0.75rem 0.5rem;
}

/* Sidebar collapsible dropdowns */
.nav-dropdown {
  margin-bottom: 0.35rem;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 10px;
  transition: all var(--transition);
}

.nav-dropdown-toggle:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.nav-dropdown.open .nav-dropdown-toggle {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-chevron {
  transition: transform var(--transition);
  opacity: 0.7;
}

.nav-dropdown.open .nav-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  opacity: 0;
  padding-left: 0.25rem;
}

.nav-dropdown.open .nav-dropdown-menu {
  max-height: 600px;
  opacity: 1;
  padding-top: 0.15rem;
  padding-bottom: 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--erp-accent);
}

.nav-item-locked {
  opacity: 0.85;
}

.nav-item-locked:hover .nav-premium-tag {
  background: rgba(251, 191, 36, 0.28);
  border-color: rgba(251, 191, 36, 0.55);
}

.nav-premium-tag {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
  flex-shrink: 0;
}

.nav-premium-btn .fa-crown {
  color: #d97706;
}

.nav-lock-icon {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.65;
}

.nav-icon-fa {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  opacity: 0.9;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.trial-pill {
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  text-align: center;
}

.trial-pill.subscribed-pill {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.35rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--iw-indigo), var(--iw-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

.user-meta strong {
  display: block;
  font-size: 0.82rem;
  color: #fff;
  line-height: 1.2;
}

.user-meta span {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
}

.logout-btn { color: rgba(255,255,255,0.6) !important; }
.logout-btn:hover { color: #fca5a5 !important; background: rgba(239,68,68,0.15) !important; }

/* ── Main area ── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.app-topbar {
  height: var(--topbar-height);
  background: var(--iw-surface);
  border-bottom: 1px solid var(--iw-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f8fafc;
  border: 1px solid var(--iw-border);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  color: var(--iw-ink);
  font-size: 1rem;
}

.sidebar-toggle span {
  display: none;
}

.topbar-title {
  font-weight: 800;
  font-size: 1.25rem;
  flex: 1;
  letter-spacing: -0.02em;
}

.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.app-content {
  padding: 1.5rem 1.75rem 2.5rem;
  flex: 1;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1030;
}

/* ── Components ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.page-header p { color: var(--iw-muted); margin: 0; font-size: 0.92rem; }

.page-header-compact {
  margin-bottom: 0.75rem;
}

.page-subtitle {
  color: var(--iw-muted);
  margin: 0;
  font-size: 0.92rem;
}

.iw-card {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.iw-card-body { padding: 1.25rem 1.5rem; }

.iw-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--iw-border);
  font-weight: 700;
  font-size: 0.95rem;
  background: #fafbfc;
}

/* Data entry clerk dashboard */
.de-dashboard {
  max-width: 100%;
  width: 100%;
}

.de-welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.de-welcome h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.de-welcome p {
  color: var(--iw-muted);
  margin: 0;
}

.de-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.de-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.de-badge-active {
  background: #dbeafe;
  color: #1d4ed8;
}

.de-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.de-stat-card {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.de-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.de-stat-icon-purple { background: #ede9fe; color: #5b21b6; }
.de-stat-icon-blue { background: #dbeafe; color: #1d4ed8; }
.de-stat-icon-gold { background: #fef3c7; color: #92400e; }
.de-stat-icon-green { background: #dcfce7; color: #166534; }

.de-stat-label {
  font-size: 0.78rem;
  color: var(--iw-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.de-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.de-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.de-notice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
}

.de-notice-icon {
  font-size: 1rem;
}

.de-notice p {
  margin: 0;
  font-size: 0.85rem;
  color: #1e40af;
}

@media (max-width: 992px) {
  .de-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
  .de-stat-grid { grid-template-columns: 1fr; }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
}

.stat-card .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--iw-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--iw-ink);
}

.stat-card .value.accent { color: var(--iw-indigo); }

.btn-iw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, var(--iw-indigo), var(--iw-indigo-dark));
  border: none;
  color: #fff !important;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-iw.btn-sm {
  padding: 0.42rem 0.95rem;
  font-size: 0.85rem;
}

.btn-iw:hover {
  background: linear-gradient(135deg, var(--iw-indigo-dark), #4338ca);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-iw-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1.5px solid var(--iw-indigo);
  color: var(--iw-indigo) !important;
  background: transparent;
  font-weight: 600;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-iw-outline.btn-sm {
  padding: 0.42rem 0.95rem;
  font-size: 0.85rem;
}

.btn-iw-outline:hover {
  background: var(--iw-indigo);
  color: #fff !important;
}

.iw-table { width: 100%; margin: 0; }
.iw-table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--iw-muted);
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--iw-border);
  background: #fafbfc;
}
.iw-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  vertical-align: middle;
}
.iw-table tr:hover td { background: #f8fafc; }

.role-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.role-badge.admin { background: #ede9fe; color: #5b21b6; }
.role-badge.team_lead { background: #dbeafe; color: #1d4ed8; }
.role-badge.service_engineer { background: #dcfce7; color: #166534; }
.role-badge.data_entry { background: #fef3c7; color: #92400e; }
.role-badge.viewer { background: #f1f5f9; color: #475569; }
.role-badge.recovery_employee { background: #fce7f3; color: #9d174d; }

.iw-form .form-label { font-weight: 600; font-size: 0.88rem; color: var(--iw-ink); }
.iw-form .form-control, .iw-form .form-select {
  border-radius: 10px;
  border: 1.5px solid var(--iw-border);
  padding: 0.6rem 0.85rem;
  font-size: 0.92rem;
}
.iw-form .form-control:focus, .iw-form .form-select:focus {
  border-color: var(--iw-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.status-pill {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.status-pill.success { background: #dcfce7; color: #166534; }
.status-pill.warning { background: #fef3c7; color: #92400e; }
.status-pill.info { background: #dbeafe; color: #1e40af; }
.status-pill.danger { background: #fee2e2; color: #991b1b; }
.status-pill.secondary { background: #f1f5f9; color: #475569; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--iw-muted);
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.feature-pill {
  background: var(--iw-accent-soft);
  color: var(--iw-accent);
  border: 1px solid var(--iw-accent-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}

.feature-pill.is-inactive {
  background: var(--iw-surface-muted, #f9fafb);
  color: var(--iw-subtle, #9ca3af);
  border-color: var(--iw-border, #e5e7eb);
}

/* New bill form */
.iw-input-group {
  display: flex;
  align-items: stretch;
}

.iw-input-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  background: #f8fafc;
  border: 1.5px solid var(--iw-border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  font-weight: 700;
  color: var(--iw-muted);
}

.iw-input-group .form-control {
  border-radius: 0 10px 10px 0 !important;
}

.bill-prefill-hint {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
}

.bill-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bill-recent-list li {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--iw-border);
}

.bill-recent-list li:last-child {
  border-bottom: none;
}

.bill-recent-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.bill-recent-amount {
  font-weight: 700;
  color: var(--iw-indigo);
}

.bill-tips-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--iw-muted);
  font-size: 0.88rem;
}

.bill-tips-list li + li {
  margin-top: 0.5rem;
}

/* Data entry form page */
.entry-page {
  max-width: 720px;
  margin: 0 auto;
}

.entry-page-header {
  margin-bottom: 1.5rem;
}

.entry-page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.entry-page-header p {
  color: var(--iw-muted);
  margin: 0;
  font-size: 0.95rem;
}

.entry-card {
  max-width: 720px;
}

.entry-form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.entry-save-btn {
  min-width: 160px;
}

.entry-footnote {
  text-align: center;
  color: var(--iw-muted);
  font-size: 0.82rem;
  margin: 1.25rem 0 0;
}

.sidebar-role {
  font-size: 0.62rem !important;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* Service engineer dashboard */
.se-dashboard,
.tl-dashboard,
.de-dashboard {
  max-width: 100%;
  width: 100%;
}

.se-welcome,
.tl-welcome,
.de-welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.se-welcome h1,
.tl-welcome h1,
.de-welcome h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.se-welcome p,
.tl-welcome p,
.de-welcome p {
  color: var(--iw-muted);
  margin: 0;
}

.se-badges,
.tl-badges,
.de-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.se-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.se-badge-success {
  background: #dcfce7;
  color: #166534;
}

.se-badge-rank {
  background: #ede9fe;
  color: #5b21b6;
}

.se-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.se-stat-card {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.se-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.se-stat-icon-green { background: #dcfce7; color: #166534; }
.se-stat-icon-purple { background: #ede9fe; color: #5b21b6; }
.se-stat-icon-gold { background: #fef3c7; color: #92400e; }

.se-stat-label {
  font-size: 0.78rem;
  color: var(--iw-muted);
  font-weight: 600;
}

.se-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.se-progress-card {
  margin-bottom: 1.25rem;
}

.se-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.se-progress-pct {
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.se-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.se-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--iw-indigo), #818cf8);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.se-type-pill {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.se-incentive {
  color: #16a34a;
  font-weight: 700;
}

.se-quick-stats {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.se-quick-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
}

.se-quick-row strong {
  color: var(--iw-indigo);
}

.se-notice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
}

.se-notice-icon {
  color: #16a34a;
  font-weight: 700;
}

.se-notice p {
  margin: 0;
  font-size: 0.85rem;
  color: #166534;
}

@media (max-width: 992px) {
  .se-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
  .se-stat-grid { grid-template-columns: 1fr; }
}

.iw-form-vertical .form-field-vertical,
.iw-form-vertical .mb-3 {
  width: 100%;
  max-width: 100%;
}

.iw-form-vertical .row > [class*="col-"] {
  flex: 0 0 100%;
  max-width: 100%;
}

.form-page {
  max-width: 100%;
  width: 100%;
}

.form-page.form-page-narrow {
  max-width: 820px;
}

.form-page-wide {
  max-width: 100%;
  width: 100%;
}

.iw-form-card {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem 1.25rem;
}

.iw-form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--iw-muted);
  margin: 0 0 1.25rem;
}

.iw-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
}

.iw-form-field {
  min-width: 0;
}

.iw-col-3 { grid-column: span 3; }
.iw-col-4 { grid-column: span 4; }
.iw-col-6 { grid-column: span 6; }
.iw-col-8 { grid-column: span 8; }
.iw-col-12 { grid-column: span 12; }

.iw-form-field .form-control,
.iw-form-field .form-select,
.iw-form-field .iw-custom-dropdown,
.iw-form-field input,
.iw-form-field select,
.iw-form-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ice-employee-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem 1.25rem;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 0.75rem 1rem;
  list-style: none;
  border: 1px solid var(--iw-border);
  border-radius: 0.5rem;
  background: var(--iw-surface, #fff);
}

.ice-employee-checklist li {
  margin: 0;
}

.ice-employee-checklist label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  margin: 0;
}

.ice-employee-checklist input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.iw-form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--iw-ink);
  margin-bottom: 0.4rem;
}

.iw-required {
  color: #dc2626;
  margin-left: 0.15rem;
}

.iw-form-help {
  font-size: 0.8rem;
  color: var(--iw-muted);
  margin-top: 0.35rem;
}

.iw-form-error {
  font-size: 0.8rem;
  color: #dc2626;
  margin-top: 0.35rem;
}

.iw-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--iw-border);
}

.iw-form-block {
  grid-column: span 12;
}

.entry-page.form-page-wide {
  max-width: 100%;
  width: 100%;
}

.entry-card.iw-form-card {
  border: 1px solid var(--iw-border);
  box-shadow: var(--shadow);
}

.iw-card.iw-form-card {
  padding: 0;
}

.iw-card.iw-form-card > .iw-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.iw-form-auth .iw-form-field,
.iw-form-vertical.iw-form-single .iw-form-field {
  grid-column: span 12;
}

@media (max-width: 991px) {
  .iw-col-3,
  .iw-col-4,
  .iw-col-6,
  .iw-col-8 {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .iw-form-grid {
    grid-template-columns: 1fr;
  }

  .iw-col-3,
  .iw-col-4,
  .iw-col-6,
  .iw-col-8,
  .iw-col-12 {
    grid-column: span 1;
  }

  .iw-form-card {
    padding: 1.15rem 1rem;
  }
}

.form-page-back {
  display: inline-block;
  color: var(--iw-indigo);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  margin-bottom: 1rem;
}

.ice-reward-block {
  padding: 0.75rem 1rem 0.25rem;
  border: 1px dashed var(--iw-border);
  border-radius: 0.5rem;
  background: rgba(99, 102, 241, 0.03);
}

.ice-example-box .billing-summary-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.ice-example-box .billing-summary-row > span:last-child {
  text-align: right;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .ice-example-box .billing-summary-row {
    flex-direction: column;
  }

  .ice-example-box .billing-summary-row > span:last-child {
    text-align: left;
  }
}

.form-page-back:hover {
  color: var(--iw-indigo-dark);
}

.form-page-header {
  margin-bottom: 1.25rem;
}

.form-page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.form-page-header p {
  color: var(--iw-muted);
  margin: 0;
}

.form-page-card {
  max-width: 100%;
  width: 100%;
}

.form-page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

.category-field-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-field-row .iw-select-wrap,
.category-field-row select {
  width: 100%;
}

.btn-link-add {
  background: none;
  border: none;
  padding: 0;
  color: var(--iw-indigo);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  width: fit-content;
}

.btn-link-add:hover {
  text-decoration: underline;
}

.iw-inline-panel {
  background: #f8fafc;
  border: 1px solid var(--iw-border);
  border-radius: 10px;
  padding: 0.85rem;
}

.layout-role-dashboard .app-topbar {
  display: none;
}

.layout-role-dashboard .app-content {
  padding-top: 1.75rem;
}

.iw-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.iw-select-wrap {
  position: relative;
}

.period-pills {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #f1f5f9;
  border-radius: 12px;
}

.period-pill {
  border: none;
  background: transparent;
  color: var(--iw-muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.period-pill.active {
  background: #fff;
  color: var(--iw-indigo);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.target-team-preview {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  color: #3730a3;
  font-size: 0.9rem;
  line-height: 1.6;
}

.app-alert { border-radius: 10px; border: none; }

/* ── Auth split screen ── */
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-hero {
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #1e3a5f 100%);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  top: -100px;
  right: -100px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 2rem;
  width: fit-content;
}

.auth-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.auth-hero h1 span { color: #93c5fd; }

.auth-hero .lead {
  color: rgba(255,255,255,0.7);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 420px;
  margin-bottom: 2.5rem;
}

.auth-features { list-style: none; padding: 0; margin: 0; }
.auth-features li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
}
.auth-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #fff;
}

.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-wrap h2 { font-weight: 800; font-size: 1.75rem; margin-bottom: 0.35rem; }
.auth-form-wrap .subtitle { color: var(--iw-muted); margin-bottom: 2rem; }

.auth-copyright {
  position: absolute;
  bottom: 2rem;
  left: 3rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

@media (max-width: 576px) {
  .app-content { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Progress & insights ── */
.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--iw-indigo), var(--iw-indigo-light));
  transition: width 0.6s ease;
}

.progress-fill.success { background: linear-gradient(90deg, #16a34a, #4ade80); }
.progress-fill.warning { background: linear-gradient(90deg, #d97706, #fbbf24); }
.progress-fill.danger { background: linear-gradient(90deg, #dc2626, #f87171); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.85rem;
}

.rank-badge.gold { background: #fef3c7; color: #92400e; }
.rank-badge.silver { background: #f1f5f9; color: #475569; }
.rank-badge.bronze { background: #ffedd5; color: #9a3412; }
.rank-badge.default { background: #f1f5f9; color: var(--iw-muted); }

.rate-pill {
  display: inline-block;
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
}

.share-pill {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.active { background: #22c55e; }
.status-dot.inactive { background: #94a3b8; }

.insight-metric {
  text-align: center;
  padding: 1rem;
}

.insight-metric .change {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.insight-metric .change.up { color: #16a34a; }
.insight-metric .change.down { color: #dc2626; }

.compare-card {
  border-radius: var(--radius);
  border: 1px solid var(--iw-border);
  background: var(--iw-surface);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  height: 100%;
}

.compare-card.current { border-left: 4px solid var(--iw-indigo); }
.compare-card.previous { border-left: 4px solid #94a3b8; }

.audit-action {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: var(--iw-ink);
}

.leaderboard-row td:first-child { width: 48px; }

.iw-form .form-control, .iw-form .form-select,
.iw-form input, .iw-form select, .iw-form textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1.5px solid var(--iw-border);
  font-size: 0.92rem;
}

/* ── Custom form dropdowns ── */
.iw-custom-dropdown {
  position: relative;
}

.iw-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: #fff;
  border: 1.5px solid var(--iw-border);
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--iw-ink);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  text-align: left;
}

.iw-dropdown-trigger:hover {
  border-color: var(--iw-indigo-light);
}

.iw-custom-dropdown.open .iw-dropdown-trigger {
  border-color: var(--iw-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.iw-dropdown-label {
  color: var(--iw-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iw-custom-dropdown.has-value .iw-dropdown-label {
  color: var(--iw-ink);
}

.iw-dropdown-chevron {
  flex-shrink: 0;
  margin-left: 0.5rem;
  transition: transform var(--transition);
  color: var(--iw-muted);
}

.iw-custom-dropdown.open .iw-dropdown-chevron {
  transform: rotate(180deg);
}

.iw-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--iw-border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  z-index: 200;
  overflow: hidden;
  animation: dropdownIn 0.2s ease;
}

.iw-custom-dropdown.open .iw-dropdown-panel {
  display: block;
}

/* Let dropdown panels escape card overflow clipping */
.iw-card:has(.iw-custom-dropdown.open),
.iw-form-card:has(.iw-custom-dropdown.open),
.entry-card:has(.iw-custom-dropdown.open) {
  overflow: visible;
  position: relative;
  z-index: 20;
}

.iw-select-wrap:has(.iw-custom-dropdown.open) {
  position: relative;
  z-index: 210;
}

.iw-custom-dropdown.iw-dropdown-up .iw-dropdown-panel {
  top: auto;
  bottom: calc(100% + 6px);
  animation-name: dropdownInUp;
}

@keyframes dropdownInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.iw-dropdown-search-wrap {
  padding: 0.65rem 0.75rem 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}

.iw-dropdown-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--iw-border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.iw-dropdown-search:focus {
  outline: none;
  border-color: var(--iw-indigo);
}

.iw-dropdown-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.iw-dropdown-action {
  background: none;
  border: none;
  color: var(--iw-indigo);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.iw-dropdown-action:hover { text-decoration: underline; }

.iw-dropdown-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.35rem;
}

.iw-dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background var(--transition);
}

.iw-dropdown-option:hover {
  background: #f8fafc;
}

.iw-dropdown-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.iw-option-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--iw-border);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.iw-dropdown-option input:checked ~ .iw-option-check {
  background: var(--iw-indigo);
  border-color: var(--iw-indigo);
}

.iw-dropdown-option input:checked ~ .iw-option-check::after {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f00c";
  color: #fff;
  font-size: 0.65rem;
}

.iw-single-option input:checked ~ .iw-option-text strong {
  color: var(--iw-indigo);
}

.iw-single-option:has(input:checked) {
  background: #eef2ff;
}

.iw-option-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.iw-option-text small {
  color: var(--iw-muted);
  font-size: 0.78rem;
}

.iw-dropdown-empty {
  padding: 1rem;
  text-align: center;
  color: var(--iw-muted);
  font-size: 0.88rem;
}

.iw-dropdown-option.hidden { display: none; }

/* ── ERP layout system v3 ── */
.erp-page { max-width: 100%; width: 100%; }

.erp-page-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.erp-page-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--erp-accent-soft);
  color: var(--erp-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.erp-page-meta h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.2rem;
  letter-spacing: -0.02em;
}

.erp-page-meta p {
  margin: 0;
  color: var(--iw-muted);
  font-size: 0.9rem;
}

.erp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.erp-search {
  display: flex;
  gap: 0.65rem;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.erp-search-filters {
  max-width: none;
  align-items: flex-end;
}

.erp-search-filters .iw-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 150px;
  flex: 1 1 150px;
  max-width: 220px;
}

.erp-search-filters .iw-filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--iw-muted);
  margin: 0;
}

.erp-search-filters .iw-select-wrap,
.erp-search-filters .form-control,
.erp-search-filters .iw-custom-dropdown {
  width: 100%;
}

.erp-search-filters .form-control[type="date"] {
  padding-left: 0.75rem;
  background: #fff;
}

.erp-search .form-control {
  border-radius: 8px;
  border: 1px solid var(--iw-border);
  padding: 0.5rem 0.85rem 0.5rem 2.25rem;
  background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 0.65rem center / 14px;
}

.erp-table-card { border-radius: var(--radius); }

.erp-stat-grid,
.stat-grid.erp-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}

.admin-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 1280px) {
  .admin-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .admin-stat-grid {
    grid-template-columns: 1fr;
  }
}

.erp-stat-card,
.stat-card.erp-stat {
  background: var(--iw-surface);
  border: 1px solid var(--iw-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 0.85rem;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: 0.85rem;
  row-gap: 0.15rem;
  height: 100%;
  min-height: 96px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.erp-stat-card:hover,
.stat-card.erp-stat:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.erp-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
}

.erp-stat-label,
.erp-stat-card .erp-stat-label {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--iw-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

.erp-stat-value,
.erp-stat-card .erp-stat-value {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--iw-ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.erp-stat-value.accent { color: var(--erp-accent); }

.erp-stat-foot {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: flex-end;
  min-height: 0;
}

.erp-stat-card-has-foot .erp-stat-foot {
  padding-top: 0.45rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--iw-border);
}

.erp-stat-subtext {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--iw-muted);
}

.erp-stat-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
}

.erp-stat-breakdown-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.erp-stat-breakdown-pill-rec {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.admin-stat-grid .erp-stat-breakdown {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.admin-stat-grid .erp-stat-breakdown-pill {
  max-width: 100%;
}

.erp-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--iw-muted);
}

.erp-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.erp-alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.erp-alert-icon { opacity: 0.85; }

.erp-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.erp-card-title i { color: var(--erp-accent); font-size: 0.9rem; }

.erp-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--erp-accent);
}

.erp-link:hover { color: var(--iw-indigo-dark); }

.erp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.erp-badge-success { background: #dcfce7; color: #166534; }
.erp-badge-info { background: #dbeafe; color: #1d4ed8; }
.erp-badge-rank { background: #fef3c7; color: #92400e; }

.erp-notice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--iw-border);
  border-left: 3px solid var(--erp-accent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-top: 1rem;
}

.erp-notice-icon {
  color: var(--erp-accent);
  font-size: 1rem;
  margin-top: 0.1rem;
}

.erp-notice p { margin: 0; font-size: 0.85rem; color: var(--iw-muted); }

.form-page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--iw-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.form-page-back:hover { color: var(--erp-accent); }

/* Unify role dashboard stat tiles */
.se-stat-icon i,
.de-stat-icon i,
.erp-stat-blue { background: #dbeafe; color: #1d4ed8; }
.erp-stat-green { background: #dcfce7; color: #166534; }
.erp-stat-purple { background: #ede9fe; color: #5b21b6; }
.erp-stat-gold { background: #fef3c7; color: #92400e; }
.erp-stat-red { background: #fee2e2; color: #991b1b; }
.erp-stat-slate { background: #f1f5f9; color: #475569; }

.erp-stat-icon i { font-size: 1rem; }

.se-stat-icon,
.de-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.se-badge,
.de-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.trial-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.iw-support-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.iw-support-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.45);
  color: #fff;
}

.iw-support-fab i {
  font-size: 1rem;
}

@media (max-width: 575.98px) {
  .iw-support-fab span {
    display: none;
  }
  .iw-support-fab {
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}
