/* ─────────────────────────────────────────────────────────────────────────
   JARVIS — design system.
   For Sturlite Electric. Premium, calm, mobile-ready.
   ───────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ── Surfaces ── */
  --bg:           #FAFAFA;
  --surface:      #FFFFFF;
  --surface-2:    #F5F5F7;
  --surface-3:    #EBEBEF;
  --glass:        rgba(255, 255, 255, 0.72);

  /* ── Borders ── */
  --border:        rgba(0, 0, 0, 0.06);
  --border-soft:   rgba(0, 0, 0, 0.04);
  --border-strong: rgba(0, 0, 0, 0.12);
  --separator:     rgba(0, 0, 0, 0.08);

  /* ── Ink ── */
  --text:    #1D1D1F;
  --text-2:  #6E6E73;
  --text-3:  #86868B;
  --text-4:  #AEAEB2;
  --text-inverse: #FFFFFF;

  /* ── Brand: Sturlite teal, single accent ── */
  --primary:        #2EC4B9;
  --primary-hover:  #28AFA5;
  --primary-dark:   #1A8A82;
  --primary-50:     #EAF8F7;
  --primary-100:    #D2F2EE;
  --primary-tint:   rgba(46, 196, 185, 0.10);

  /* ── Semantic (Apple system colors) ── */
  --success:      #30B14A;
  --success-bg:   #E8F8EC;
  --success-fg:   #1F7A33;
  --warning:      #F08C00;
  --warning-bg:   #FFF4E0;
  --warning-fg:   #92590A;
  --danger:       #E5394C;
  --danger-bg:    #FCE9EC;
  --danger-fg:    #A8202F;
  --info:         #0A84FF;
  --info-bg:      #E4F0FF;
  --info-fg:      #024EA8;

  /* ── Shadows: soft and layered (Apple-style) ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 36px 72px rgba(0, 0, 0, 0.14);
  --shadow-focus: 0 0 0 4px rgba(46, 196, 185, 0.18);

  /* ── Radii: rounder ── */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-2xl: 28px;
  --r-pill: 9999px;

  /* ── Layout ── */
  --sidebar-w:  248px;
  --topbar-h:   60px;
  --content-max: 1280px;

  /* ── Motion ── */
  --ease:       cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --motion-fast: 140ms;
  --motion:      200ms;
  --motion-slow: 320ms;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary-dark); text-decoration: none; transition: color var(--motion-fast) var(--ease); }
a:hover { color: var(--primary); }

/* Constrain inline SVGs globally — fixes the icon-blowing-up bug */
svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* Tabular numbers in data displays */
.font-mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Selection */
::selection { background: var(--primary-tint); color: var(--primary-dark); }

/* Scrollbar (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ─── App shell ─── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ─── Sidebar (LIGHT) ─── */
.sidebar {
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -.02em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.18);
}
.sidebar-brand .name {
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -.015em;
  color: var(--text);
}
.sidebar-brand .sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}
.sidebar-tenant {
  margin: 10px 14px 6px;
  padding: 14px 14px 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-tenant .t-logo-row {
  padding: 6px 10px;
  background: #0B0C10;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  min-height: 32px;
}
.sidebar-tenant .t-logo-row img {
  max-width: 100%;
  height: 18px;
  width: auto;
  display: block;
}
.sidebar-tenant .t-name {
  font-size: 13px; font-weight: 600; line-height: 1.2;
  color: var(--text);
}
.sidebar-tenant .t-meta {
  font-size: 10.5px; color: var(--text-3); margin-top: 2px;
  display: flex; align-items: center; gap: 5px;
}
.sidebar-tenant .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(48, 177, 74, 0.18); }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 10px;
}
.nav-section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 14px 12px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  color: var(--text-2);
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 13.5px;
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item .icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: color var(--motion-fast) var(--ease);
}
.nav-item .icon svg { width: 18px; height: 18px; }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.active {
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-weight: 600;
}
.nav-item.active .icon { color: var(--primary); }
.nav-item .count {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 1px 8px;
  font-size: 11px;
  border-radius: var(--r-pill);
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.nav-item.active .count {
  background: var(--primary);
  color: #fff;
}

.sidebar-user {
  padding: 14px 14px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .name { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--text); }
.sidebar-user .role { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.sidebar-user .out {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--r-sm);
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.sidebar-user .out:hover { background: var(--surface-2); color: var(--text); }
.sidebar-user .out svg { width: 16px; height: 16px; }

/* ─── Main / topbar ─── */
.main {
  background: var(--bg);
  min-width: 0;
}
.topbar {
  height: var(--topbar-h);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px;
  position: sticky; top: 0;
  z-index: 10;
}
.topbar .breadcrumb {
  font-size: 14px;
  color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
  font-weight: 500;
}
.topbar .breadcrumb b {
  color: var(--text);
  font-weight: 600;
}
.topbar .breadcrumb-sep { color: var(--text-4); }
.topbar .spacer { flex: 1; }
.topbar .search {
  position: relative;
  width: 320px;
}
.topbar .search input {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0 14px 0 38px;
  font: inherit;
  font-size: 13.5px;
  background: var(--surface-2);
  color: var(--text);
  transition: background var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.topbar .search input::placeholder { color: var(--text-3); }
.topbar .search input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--shadow-focus);
}
.topbar .search .icon {
  position: absolute; left: 12px; top: 9px;
  width: 18px; height: 18px; color: var(--text-3);
  pointer-events: none;
}
.topbar .search .icon svg { width: 18px; height: 18px; }
.topbar .icon-btn {
  width: 36px; height: 36px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--text-2);
  transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
  position: relative;
}
.topbar .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.topbar .icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--danger);
  border: 2px solid var(--bg);
  border-radius: 50%;
}
.topbar .icon-btn svg { width: 19px; height: 19px; }

/* ─── Page wrappers ─── */
.page {
  padding: 36px 40px 96px;
  max-width: var(--content-max);
  margin: 0 auto;
  animation: page-in var(--motion-slow) var(--ease-out);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px; flex-wrap: wrap;
}
.page-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0;
  color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
.page-title svg { width: 26px; height: 26px; color: var(--primary); }
.page-sub {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 6px;
  font-weight: 400;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--motion) var(--ease);
}
.card-pad { padding: 28px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 17px; font-weight: 600; margin: 0;
  letter-spacing: -.015em;
  color: var(--text);
}
.card-sub {
  font-size: 13.5px; color: var(--text-2); margin-top: 4px;
  font-weight: 400;
}
.card-body { padding: 24px 26px; }
.card-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px;
  padding: 0 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease),
              border-color var(--motion-fast) var(--ease),
              transform 60ms ease,
              box-shadow var(--motion-fast) var(--ease);
  white-space: nowrap;
  background: transparent;
  color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #C8202E; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #258A3A; }

.btn-dark {
  background: #1D1D1F;
  color: #fff;
}
.btn-dark:hover { background: #2C2C2E; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ─── Inputs ─── */
.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--motion-fast) var(--ease),
              box-shadow var(--motion-fast) var(--ease);
}
.textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 96px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.input.error, .select.error, .textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(229, 57, 76, 0.15);
}
.input[readonly] { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 24px;
  margin-bottom: 8px;
}
.form-row.cols-1 { grid-template-columns: 1fr; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field.span-2 { grid-column: span 2; }
.form-field.span-3 { grid-column: span 3; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  display: flex; align-items: center; gap: 4px;
  letter-spacing: -.005em;
}
.form-label .req { color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: -.005em;
  border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.badge-primary { background: var(--primary-50); color: var(--primary-dark); }
.badge-accent  { background: #FFF4E0; color: #92590A; }
.badge-dark    { background: #1D1D1F; color: #fff; }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-2); }

/* Status-specific */
.status-draft                  { background: var(--surface-3); color: var(--text-2); }
.status-submitted              { background: var(--info-bg); color: var(--info-fg); }
.status-in_review              { background: #FFF4E0; color: #92590A; }
.status-pending_dealer_fill    { background: var(--info-bg); color: var(--info-fg); }
.status-pending_verification   { background: var(--warning-bg); color: var(--warning-fg); }
.status-pending_approval       { background: #FFF4E0; color: #92590A; }
.status-approved               { background: var(--primary-50); color: var(--primary-dark); }
.status-active                 { background: var(--success-bg); color: var(--success-fg); }
.status-pushed_to_sap          { background: var(--success-bg); color: var(--success-fg); }
.status-rejected               { background: var(--danger-bg); color: var(--danger-fg); }
.status-sap_failed             { background: var(--danger-bg); color: var(--danger-fg); }

/* Dealer tiers */
.tier-silver   { background: linear-gradient(135deg, #F1F1F4, #D2D2D7); color: #424247; }
.tier-gold     { background: linear-gradient(135deg, #FFF1C7, #F5C548); color: #6B4F00; }
.tier-platinum { background: linear-gradient(135deg, #1D1D1F, #424247); color: #fff; }

/* ─── Tables ─── */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.tbl thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  background: var(--surface);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.tbl tbody tr { transition: background var(--motion-fast) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .cell-strong { font-weight: 600; color: var(--text); }
.tbl .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.tbl .row-link { cursor: pointer; }

/* ─── Stat cards ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--motion) var(--ease), box-shadow var(--motion) var(--ease);
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-card .label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.stat-card .label .icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--primary-50);
  color: var(--primary-dark);
}
.stat-card .label .icon svg { width: 18px; height: 18px; }
.stat-card .value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 12px 0 6px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-card .value .text-md, .stat-card .value .text-muted { font-size: 16px; }
.stat-card .delta {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  letter-spacing: -.005em;
}
.stat-card .delta.up { color: var(--success-fg); }
.stat-card .delta.down { color: var(--danger-fg); }
.stat-card .delta .pct-label { color: var(--text-3); font-weight: 500; margin-left: 4px; }

.stat-card.accent .label .icon { background: #FFF4E0; color: #92590A; }
.stat-card.warning .label .icon { background: var(--warning-bg); color: var(--warning-fg); }
.stat-card.success .label .icon { background: var(--success-bg); color: var(--success-fg); }
.stat-card.danger  .label .icon { background: var(--danger-bg); color: var(--danger-fg); }

/* ─── Avatar / chip ─── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
  letter-spacing: -.01em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.avatar.lg { width: 42px; height: 42px; font-size: 14px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.avatar svg { width: 14px; height: 14px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
}
.user-chip .name { font-weight: 500; font-size: 14px; color: var(--text); }
.user-chip .sub { font-size: 12px; color: var(--text-3); }

/* ─── Stepper ─── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 32px;
}
.step {
  flex: 1;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.step .dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-3);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  border: 2px solid var(--bg);
  z-index: 2;
  transition: background var(--motion) var(--ease), color var(--motion) var(--ease);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.step .label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 10px;
  max-width: 110px;
}
.step::before, .step::after {
  content: '';
  position: absolute;
  top: 15px;
  height: 2px;
  background: var(--border-strong);
  z-index: 1;
  transition: background var(--motion) var(--ease);
}
.step::before { left: 0; right: 50%; }
.step::after { left: 50%; right: 0; }
.step:first-child::before { display: none; }
.step:last-child::after { display: none; }

.step.done .dot { background: var(--primary); color: #fff; }
.step.done .label { color: var(--text-2); }
.step.done::before, .step.done::after { background: var(--primary); }
.step.current .dot {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-tint);
}
.step.current .label { color: var(--primary-dark); font-weight: 600; }
.step.current::before { background: var(--primary); }

/* ─── Verification rail ─── */
.verify-list { display: flex; flex-direction: column; gap: 12px; }
.verify-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--motion) var(--ease), background var(--motion) var(--ease);
}
.verify-row.pending { border-color: var(--info); background: var(--info-bg); }
.verify-row.passed { border-color: var(--success); background: var(--success-bg); }
.verify-row.failed { border-color: var(--danger); background: var(--danger-bg); }
.verify-row.warning { border-color: var(--warning); background: var(--warning-bg); }
.verify-row .v-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  flex-shrink: 0;
}
.verify-row .v-icon svg { width: 18px; height: 18px; }
.verify-row.passed .v-icon { background: var(--success); color: #fff; border-color: var(--success); }
.verify-row.failed .v-icon { background: var(--danger); color: #fff; border-color: var(--danger); }
.verify-row.warning .v-icon { background: var(--warning); color: #fff; border-color: var(--warning); }
.verify-row .v-body { flex: 1; min-width: 0; }
.verify-row .v-title { font-weight: 600; font-size: 14px; color: var(--text); }
.verify-row .v-sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.verify-row .v-sub strong { color: var(--text); }
.verify-row .v-status { font-size: 12px; font-weight: 600; }
.verify-row.passed .v-status { color: var(--success-fg); }
.verify-row.failed .v-status { color: var(--danger-fg); }
.verify-row.warning .v-status { color: var(--warning-fg); }

.spin {
  width: 18px; height: 18px;
  border: 2.5px solid var(--info);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Document upload ─── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.doc-card {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--motion) var(--ease), background var(--motion) var(--ease), transform var(--motion-fast) var(--ease);
  position: relative;
}
.doc-card:hover { border-color: var(--primary); background: var(--primary-50); }
.doc-card:active { transform: scale(0.99); }
.doc-card.uploaded { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.doc-card .doc-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: var(--primary-50);
  color: var(--primary-dark);
  display: grid; place-items: center;
}
.doc-card .doc-icon svg { width: 18px; height: 18px; }
.doc-card.uploaded .doc-icon { background: var(--success); color: #fff; }
.doc-card .doc-name { font-size: 14px; font-weight: 600; color: var(--text); }
.doc-card .doc-req { font-size: 12px; color: var(--text-3); }
.doc-card .doc-uploaded { font-size: 12px; color: var(--success-fg); font-weight: 500; }
.doc-card input[type=file] { display: none; }

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 100;
  animation: fadein var(--motion) var(--ease-out);
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: min(540px, 100%);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: slidein var(--motion-slow) var(--ease-out);
}
.modal-header {
  padding: 22px 26px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 19px; font-weight: 600; margin: 0; letter-spacing: -.015em; }
.modal-body { padding: 0 26px 22px; }
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ─── Toast ─── */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 10px;
}
.toast {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 300px; max-width: 400px;
  animation: slidein-r var(--motion-slow) var(--ease-out);
  border-left: 3px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.danger  { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast .t-title { font-weight: 600; font-size: 14px; color: var(--text); }
.toast .t-body  { font-size: 13px; color: var(--text-2); margin-top: 3px; }
@keyframes slidein-r { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Tabs ─── */
.tabs {
  display: flex; gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);
  letter-spacing: -.005em;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.tab .count {
  margin-left: 8px;
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}
.tab.active .count { background: var(--primary-50); color: var(--primary-dark); }

/* ─── Empty state ─── */
.empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-2);
}
.empty .icon { width: 56px; height: 56px; color: var(--text-4); margin: 0 auto 18px; }
.empty .icon svg { width: 56px; height: 56px; }
.empty .title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: -.015em; }
.empty .sub { font-size: 14px; color: var(--text-3); }

/* ─── Utilities ─── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.grid { display: grid; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.p-0 { padding: 0; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.text-primary { color: var(--primary-dark); }
.text-success { color: var(--success-fg); }
.text-danger { color: var(--danger-fg); }
.text-warning { color: var(--warning-fg); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.divide-y > * + * { border-top: 1px solid var(--border); }
.cursor-pointer { cursor: pointer; }
.hidden { display: none !important; }

/* ─── Chart helpers ─── */
.bar-chart {
  display: flex; align-items: flex-end; gap: 8px; height: 160px;
  padding: 8px 4px 0;
}
.bar-chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  position: relative;
  cursor: pointer;
  transition: opacity var(--motion-fast) var(--ease);
}
.bar-chart .bar:hover { opacity: .85; }
.bar-chart .bar.alt { background: linear-gradient(180deg, #F5C548 0%, #C49100 100%); }
.bar-chart .bar .label {
  position: absolute; bottom: -24px; left: 0; right: 0;
  text-align: center; font-size: 11px; color: var(--text-3);
}

/* India map placeholder */
.geo-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.geo-tile {
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  transition: transform var(--motion-fast) var(--ease);
}
.geo-tile:hover { transform: translateY(-1px); }
.geo-tile.heat-1 { background: var(--primary-50); color: var(--primary-dark); }
.geo-tile.heat-2 { background: var(--primary-100); color: var(--primary-dark); }
.geo-tile.heat-3 { background: var(--primary); color: #fff; }
.geo-tile.heat-4 { background: var(--primary-hover); color: #fff; }
.geo-tile.heat-5 { background: var(--primary-dark); color: #fff; }
.geo-tile .num { font-size: 16px; font-weight: 700; margin-bottom: 2px; font-variant-numeric: tabular-nums; }

/* ─── Phone mock (WhatsApp preview) ─── */
.phone-mock {
  width: 300px;
  background: #1D1D1F;
  border-radius: 36px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
  margin: 0 auto;
}
.phone-mock .screen {
  background: #ECE5DD;
  border-radius: 24px;
  padding: 18px 12px 14px;
  min-height: 400px;
  position: relative;
}
.phone-mock .wa-header {
  background: #075E54;
  color: #fff;
  margin: -18px -12px 14px;
  padding: 12px 14px;
  border-radius: 24px 24px 0 0;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600;
}
.phone-mock .wa-msg {
  background: #fff;
  padding: 12px 14px;
  border-radius: 2px 14px 14px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 1px 1px rgba(0,0,0,.06);
  max-width: 92%;
  margin-bottom: 8px;
}
.phone-mock .wa-msg .meta {
  font-size: 10px; color: #99A1A8; text-align: right; margin-top: 4px;
}
.phone-mock .wa-msg a { color: #075E54; text-decoration: underline; word-break: break-all; }

/* ─── SAP push panel ─── */
.sap-panel {
  background: linear-gradient(135deg, #1D1D1F 0%, #2C2C2E 100%);
  border-radius: var(--r-lg);
  padding: 28px;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.sap-panel .title {
  font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.sap-panel .title svg { width: 14px; height: 14px; }
.sap-panel .bp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  margin: 10px 0 12px;
}
.sap-panel .meta {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px;
  margin-top: 18px;
  font-size: 13px;
}
.sap-panel .meta .k { color: rgba(255,255,255,0.55); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sap-panel .meta .v { color: #fff; font-weight: 500; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.sap-panel .payload {
  background: rgba(0,0,0,.4);
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: rgba(255,255,255,0.9);
  margin-top: 16px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ─── Login page (separate layout, no app shell) ─── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
}
.login-shell .left {
  background: #1D1D1F;
  background-image: radial-gradient(circle at 20% 20%, rgba(46,196,185,0.25) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(46,196,185,0.12) 0%, transparent 40%);
  color: #fff;
  padding: 64px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-shell .brand-mark {
  display: flex; align-items: center; gap: 14px;
  font-weight: 600; font-size: 18px;
  letter-spacing: -.015em;
}
.login-shell .pitch h1 {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 0 0 18px;
}
.login-shell .pitch p {
  font-size: 16px;
  color: rgba(255,255,255,.7);
  line-height: 1.6;
  max-width: 440px;
}
.login-shell .pitch .features {
  margin-top: 36px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-shell .pitch .feat {
  display: flex; align-items: flex-start; gap: 14px;
  font-size: 14px;
  color: rgba(255,255,255,.85);
  line-height: 1.5;
}
.login-shell .pitch .feat .dot {
  width: 22px; height: 22px;
  border-radius: 50%; background: var(--primary);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
  box-shadow: 0 0 0 4px rgba(46,196,185,0.15);
}
.login-shell .pitch .feat .dot svg { width: 12px; height: 12px; }
.login-shell .right {
  padding: 64px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 500px;
}
.login-form .form-field { margin-bottom: 16px; }
.login-form h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 0 0 8px;
  color: var(--text);
}
.login-form .sub {
  font-size: 15px;
  color: var(--text-2);
  margin: 0 0 36px;
}
.login-form .hint {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
}
.login-form .hint b { color: var(--text); }

/* ─── Detail summary KV ─── */
.kv-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 28px;
}
.kv .k { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kv .v { font-size: 14px; color: var(--text); font-weight: 500; }
.kv .v.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ─── Approval timeline ─── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 12px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border-strong);
  border-radius: 1px;
}
.timeline-item {
  position: relative;
  padding: 0 0 24px 24px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -18px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
}
.timeline-item.done::before { background: var(--success); border-color: var(--success); }
.timeline-item.current::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-tint); }
.timeline-item.rejected::before { background: var(--danger); border-color: var(--danger); }
.timeline-item .ti-title { font-weight: 600; font-size: 14px; color: var(--text); }
.timeline-item .ti-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.timeline-item .ti-body { font-size: 13px; color: var(--text-2); margin-top: 8px; line-height: 1.5; }

/* ─── Mobile responsive ─── */
@media (max-width: 980px) {
  :root { --topbar-h: 56px; }
  body { font-size: 16px; } /* prevents iOS zoom on input focus */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto; height: auto;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 0;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .sidebar-brand, .sidebar-tenant, .sidebar-user, .nav-section { display: none; }
  .nav { display: flex; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-around; }
  .nav-item {
    flex: 1; flex-direction: column; gap: 4px;
    padding: 8px 4px;
    font-size: 10.5px;
    margin: 0;
    text-align: center;
  }
  .nav-item .icon { width: 22px; height: 22px; }
  .nav-item .icon svg { width: 22px; height: 22px; }
  .nav-item.active { background: transparent; color: var(--primary); }
  .nav-item.active::after { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 3px; background: var(--primary); border-radius: 0 0 3px 3px; }
  .nav-item .count { position: absolute; top: 4px; right: calc(50% - 22px); }
  .main { padding-bottom: 72px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar .search { width: auto; flex: 1; }
  .page { padding: 24px 18px 96px; }
  .page-title { font-size: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px 18px; }
  .stat-card .value { font-size: 26px; }
  .form-row { grid-template-columns: 1fr; gap: 16px; }
  .doc-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-shell .left { display: none; }
  .login-shell .right { padding: 40px 24px; }
  .stepper { gap: 0; }
  .step .label { font-size: 10px; max-width: 60px; }
  .card-header { padding: 16px 20px; flex-direction: column; align-items: flex-start; }
  .card-body { padding: 18px 20px; }
  .kv-grid { grid-template-columns: 1fr; gap: 14px; }
  .grid.cols-3 { grid-template-columns: 1fr !important; }
  .grid.cols-2 { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stepper .step .label { display: none; }
  .stepper .step.current .label { display: block; }
}

/* Honour reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
