/* ═══════════════════════════════════════════════════════════════
   Qiiub Portal — Shared Design System Styles  v2.0
   Source of truth: assets/design-system/qiiub-design-system.html
   Fonts: Poppins (UI) · Inter (data) · JetBrains Mono (code/IDs)
   Base: 16px · WCAG 2.1 AA compliant
═══════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Brand */
  --purple:      #930EA5;
  --purple-lt:   #9B1DC8;
  --purple-dk:   #5A0078;
  --purple-md:   #C05FE8;
  --purple-sm:   #E0C1F0;
  --purple-xs:   #f9f6fb;

  /* Ink (text) */
  --ink-primary:   #1A1040;
  --ink-secondary: #4A4A5A;
  --ink-tertiary:  #6B6B80;
  --ink-disabled:  #A0A0B0;
  --ink-placeholder: #8B8B9E;

  /* Ink aliases (backward compat with mockup inline styles) */
  --black:    #1A1040;
  --gray-dk:  #4A4A5A;
  --gray:     #6B6B80;
  --gray-lt:  #A0A0B0;

  /* Surfaces */
  --bg:       #FFFFFF;
  --bg-page:  #f8f7fc;
  --bg-card:  #FFFFFF;
  --bg-sunken:#f3f0f8;
  --bg-brand: #f9f6fb;

  /* Surface aliases (backward compat) */
  --bg2:      #f8f7fc;
  --bg3:      #f9f6fb;

  /* Borders */
  --border:        #e2ddf0;
  --border-strong: #c4b8df;
  --border-focus:  #930EA5;
  --border-subtle: #f0ecf8;

  /* Dark backgrounds */
  --navy:     #1A1040;
  --navy-lt:  #261660;

  /* Status — Success */
  --success-bg:     #edfaf3;
  --success-border: #a3e6c4;
  --success-text:   #166534;
  --success-icon:   #22c55e;

  /* Status — Warning */
  --warning-bg:     #fffbeb;
  --warning-border: #fde68a;
  --warning-text:   #854d0e;
  --warning-icon:   #f59e0b;

  /* Status — Error */
  --error-bg:     #fff1f1;
  --error-border: #fecaca;
  --error-text:   #991b1b;
  --error-icon:   #ef4444;

  /* Status — Info */
  --info-bg:     #eff6ff;
  --info-border: #bfdbfe;
  --info-text:   #1e40af;
  --info-icon:   #3b82f6;

  /* Harmony (product verticals) */
  --teal:    #00897B;
  --gold:    #92680A;
  --coral:   #DC2626;
  --sky:     #2563EB;
  --emerald: #047857;

  /* Fonts */
  --font-ui:   'Poppins', -apple-system, sans-serif;
  --font-data: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing (4px base) */
  --sp-1:  0.25rem;   /* 4px  */
  --sp-2:  0.5rem;    /* 8px  */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */

  /* Typography scale */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  1.875rem;  /* 30px */

  /* Radius */
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* Elevation (purple-tinted) */
  --shadow-xs:    0 1px 2px rgba(147, 14, 165, 0.06);
  --shadow-sm:    0 2px 6px rgba(147, 14, 165, 0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 16px rgba(147, 14, 165, 0.12), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 8px 32px rgba(147, 14, 165, 0.16), 0 4px 8px rgba(0,0,0,0.08);
  --shadow-xl:    0 16px 48px rgba(147, 14, 165, 0.20), 0 8px 16px rgba(0,0,0,0.10);
  --shadow-focus: 0 0 0 3px rgba(147, 14, 165, 0.25);

  /* Transitions */
  --ease-fast: 120ms ease;
  --ease-base: 200ms ease;
  --ease-slow: 300ms ease;

  /* Z-index */
  --z-base:     0;
  --z-raised:   10;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;

  /* Layout */
  --topnav-h:  56px;
  --sidebar-w: 260px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  font-weight: 400;
  background: var(--bg-page);
  color: var(--ink-secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--purple); text-decoration: none; transition: color var(--ease-fast); }
a:hover { color: var(--purple-lt); }
button { cursor: pointer; font-family: var(--font-ui); font-size: var(--text-sm); }
input, select, textarea { font-family: var(--font-data); font-size: var(--text-sm); }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Accessibility: Focus ────────────────────────────────────── */
*:focus-visible {
  outline: 3px solid var(--purple-md);
  outline-offset: 2px;
}
.topnav :focus-visible { outline-color: #C05FE8; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.toggle input:focus-visible + .toggle-slider {
  outline: 3px solid var(--purple-md);
  outline-offset: 2px;
}

/* Skip-to-content link */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  background: var(--purple);
  color: #fff;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top var(--ease-fast);
}
.skip-link:focus { top: var(--sp-2); }

/* ── Top Nav ─────────────────────────────────────────────────── */
.topnav {
  height: var(--topnav-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  gap: 0;
}
.topnav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-right: var(--sp-8);
  flex-shrink: 0;
  text-decoration: none;
}
.topnav-logo .wordmark {
  font-size: 1.375rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
}
.topnav-logo .wordmark span { color: var(--purple-md); }
.topnav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--purple);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topnav-logo .logo-icon svg { width: 18px; height: 18px; }
.topnav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.12);
  margin: 0 var(--sp-4);
}
.topnav-links { display: flex; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.topnav-links a {
  color: rgba(255,255,255,0.65);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all var(--ease-fast);
  white-space: nowrap;
}
.topnav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.topnav-links a.active { color: #fff; background: rgba(255,255,255,0.14); font-weight: 600; }
.topnav-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.topnav-tenant,
.topnav-merchant {
  font-size: var(--text-xs);
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.02em;
  font-family: var(--font-data);
}
.topnav-notif {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--ease-fast);
  position: relative;
}
.topnav-notif:hover { background: rgba(255,255,255,0.16); }
.topnav-notif svg { width: 16px; height: 16px; stroke-width: 1.75; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--error-icon);
  border-radius: 50%;
  border: 1.5px solid var(--navy);
}
.topnav-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--purple), var(--purple-lt));
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.2);
  transition: border-color var(--ease-fast);
}
.topnav-avatar:hover { border-color: rgba(255,255,255,0.4); }

/* ── App Shell ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: calc(100vh - var(--topnav-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: var(--sp-3) 0;
  flex-shrink: 0;
  overflow-y: auto;
  position: sticky;
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }

.sidebar-section {
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sidebar-section::before {
  content: '';
  display: block;
  width: 14px;
  height: 2px;
  background: var(--purple);
  border-radius: 2px;
  flex-shrink: 0;
}
.sidebar-section:first-child { padding-top: var(--sp-2); }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-secondary);
  border-left: 3px solid transparent;
  transition: all var(--ease-fast);
  text-decoration: none;
  line-height: 1.375;
}
.sidebar-link:hover { background: var(--bg-brand); color: var(--purple); text-decoration: none; }
.sidebar-link.active {
  background: var(--bg-brand);
  color: var(--purple);
  border-left-color: var(--purple);
  font-weight: 600;
}
.sidebar-link .ico { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; opacity: 0.7; }
.sidebar-link:hover .ico { opacity: 1; }
.sidebar-link.active .ico { opacity: 1; }
.sidebar-link svg { width: 16px; height: 16px; stroke-width: 1.75; flex-shrink: 0; opacity: 0.55; transition: opacity var(--ease-fast); }
.sidebar-link:hover svg { opacity: 0.85; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-badge {
  margin-left: auto;
  background: var(--error-icon);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-family: var(--font-data);
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: var(--sp-6) var(--sp-6) 60px;
  min-width: 0;
  overflow-y: auto;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: -0.5px;
  line-height: 1.25;
}
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  margin-top: var(--sp-1);
  font-family: var(--font-data);
}
.page-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-shrink: 0;
  margin-left: var(--sp-4);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  margin-bottom: var(--sp-5);
  font-family: var(--font-data);
}
.breadcrumb a { color: var(--ink-tertiary); text-decoration: none; transition: color var(--ease-fast); }
.breadcrumb a:hover { color: var(--purple); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb .current { color: var(--ink-primary); font-weight: 500; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease-fast);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card + .card { margin-top: var(--sp-4); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title { font-size: var(--text-base); font-weight: 600; color: var(--ink-primary); }
.card-subtitle { font-size: var(--text-sm); color: var(--ink-tertiary); margin-top: 2px; font-family: var(--font-data); }

/* ── Stat Cards ──────────────────────────────────────────────── */
.stat-row {
  display: grid;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat-row.c4 { grid-template-columns: repeat(4, 1fr); }
.stat-row.c3 { grid-template-columns: repeat(3, 1fr); }
.stat-row.c2 { grid-template-columns: repeat(2, 1fr); }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease-base), transform var(--ease-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
  font-family: var(--font-data);
}
.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.1;
  letter-spacing: -0.5px;
  font-family: var(--font-data);
}
.stat-delta {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--sp-1);
  font-family: var(--font-data);
}
.stat-delta.up { color: var(--success-text); }
.stat-delta.dn { color: var(--error-text); }
.stat-delta.ne { color: var(--ink-tertiary); }
.stat-icon {
  font-size: 1.75rem;
  margin-bottom: var(--sp-2);
  display: block;
}

/* ── Layout Patterns ─────────────────────────────────────────── */
.layout-split { display: flex; gap: var(--sp-6); align-items: flex-start; }
.layout-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.layout-aside { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: var(--sp-4); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: var(--sp-6);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-track { background: transparent; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.tab-bar::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
.tab-btn {
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-tertiary);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--ease-fast), border-color var(--ease-fast);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font-ui);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--purple); }
.tab-btn.active { color: var(--purple); border-bottom-color: var(--purple); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all var(--ease-fast);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-ui);
  min-height: 40px;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-primary:hover { background: var(--purple-dk); border-color: var(--purple-dk); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: transparent; color: var(--purple); border-color: var(--purple); }
.btn-secondary:hover { background: var(--bg-brand); }
.btn-ghost { background: transparent; color: var(--ink-secondary); border-color: transparent; padding: 10px var(--sp-3); }
.btn-ghost:hover { background: var(--bg-page); color: var(--ink-primary); }
.btn-danger { background: var(--error-icon); color: #fff; border-color: var(--error-icon); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-sm { padding: 6px var(--sp-3); font-size: var(--text-xs); min-height: 32px; }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--text-base); min-height: 48px; }
.btn-icon {
  padding: 6px;
  width: 34px; height: 34px;
  justify-content: center;
  border-radius: var(--radius);
  min-height: 34px;
}
.btn svg { width: 14px; height: 14px; stroke-width: 1.75; flex-shrink: 0; }
.btn-icon svg { width: 16px; height: 16px; }
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-grid { display: grid; gap: var(--sp-4); }
.form-grid.c2 { grid-template-columns: 1fr 1fr; }
.form-grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.form-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-primary);
  padding: var(--sp-3) 0 var(--sp-2);
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: var(--sp-1);
  letter-spacing: -0.2px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-primary);
}
.field label .required { color: var(--error-icon); font-weight: 700; }
.field input,
.field select,
.field textarea {
  padding: 10px var(--sp-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-data);
  font-size: var(--text-sm);
  color: var(--ink-primary);
  background: var(--bg);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  width: 100%;
  min-height: 40px;
}
.field input:hover,
.field select:hover { border-color: var(--border-strong); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.field input::placeholder { color: var(--ink-placeholder); }
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: var(--text-xs); color: var(--ink-tertiary); font-family: var(--font-data); }
.field-error {
  font-size: var(--text-xs);
  color: var(--error-text);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-data);
}
.field input[readonly] { background: var(--bg-sunken); color: var(--ink-tertiary); }
.field input.error { border-color: var(--error-icon); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

/* Input group */
.input-group { display: flex; }
.input-group input { border-radius: var(--radius) 0 0 var(--radius); flex: 1; }
.input-group .input-addon {
  padding: 10px var(--sp-3);
  background: var(--bg-sunken);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  white-space: nowrap;
  font-family: var(--font-data);
}

/* ── Toggles ─────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-info { flex: 1; padding-right: var(--sp-4); }
.toggle-label { font-size: var(--text-sm); font-weight: 500; color: var(--ink-primary); }
.toggle-desc { font-size: var(--text-xs); color: var(--ink-tertiary); margin-top: 2px; font-family: var(--font-data); }
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--ease-base);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--ease-base);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: var(--purple); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Tables ──────────────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-data);
  font-size: var(--text-sm);
}
.tbl thead th {
  background: var(--purple);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
  white-space: nowrap;
  font-family: var(--font-data);
}
.tbl thead th:first-child { border-radius: var(--radius-lg) 0 0 0; }
.tbl thead th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
.tbl thead th.num { text-align: right; }
.tbl tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--ink-secondary);
  vertical-align: middle;
  font-family: var(--font-data);
}
.tbl tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody td.muted { color: var(--ink-tertiary); font-size: var(--text-xs); }
.tbl tbody td.mono { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--purple); }
.tbl tbody td.bold { font-weight: 600; color: var(--ink-primary); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--ease-fast); }
.tbl tbody tr:hover { background: var(--bg-brand); }
.tbl input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--purple);
}
.tbl-actions { display: flex; gap: var(--sp-1); }

/* Sortable columns */
.tbl thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: opacity var(--ease-fast);
}
.tbl thead th.sortable:hover { opacity: 0.85; }
.tbl thead th.sortable::after {
  content: '↕';
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
  vertical-align: middle;
}
.tbl thead th.sortable.asc::after { content: '↑'; opacity: 1; }
.tbl thead th.sortable.desc::after { content: '↓'; opacity: 1; }

/* Inline table inputs */
.tbl input[type="text"],
.tbl input[type="number"],
.tbl select {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  width: 100%;
  min-width: 70px;
  font-family: var(--font-data);
}
.tbl input:focus, .tbl select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

/* ── Badges ──────────────────────────────────────────────────── */
.bdg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  font-family: var(--font-data);
}
.bdg-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.bdg-green   { background: var(--success-bg); color: var(--success-text); }
.bdg-green .bdg-dot { background: var(--success-icon); }
.bdg-yellow  { background: var(--warning-bg); color: var(--warning-text); }
.bdg-yellow .bdg-dot { background: var(--warning-icon); }
.bdg-red     { background: var(--error-bg); color: var(--error-text); }
.bdg-red .bdg-dot { background: var(--error-icon); }
.bdg-blue    { background: var(--info-bg); color: var(--info-text); }
.bdg-blue .bdg-dot { background: var(--info-icon); }
.bdg-purple  { background: var(--bg-brand); color: var(--purple-dk); }
.bdg-purple .bdg-dot { background: var(--purple); }
.bdg-gray    { background: var(--bg-page); color: var(--ink-secondary); border: 1px solid var(--border); }
.bdg-gray .bdg-dot { background: var(--ink-disabled); }
.bdg-teal    { background: #CCFBF1; color: #134E4A; }
.bdg-teal .bdg-dot { background: var(--teal); }
.bdg-coral   { background: #FFE4E1; color: #9B1C1C; }
.bdg-coral .bdg-dot { background: var(--coral); }

/* ── Filter / Search Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.search-field {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-field input {
  padding: 10px var(--sp-3) 10px 2.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  width: 100%;
  background: var(--bg);
  color: var(--ink-primary);
  font-family: var(--font-data);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  min-height: 40px;
}
.search-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.search-field input::placeholder { color: var(--ink-placeholder); }
.search-field::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%236B6B80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
  pointer-events: none;
}
.filter-bar select {
  padding: 10px var(--sp-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  background: var(--bg);
  color: var(--ink-primary);
  cursor: pointer;
  font-family: var(--font-data);
  min-height: 40px;
}
.filter-bar select:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--shadow-focus); }

/* Pill filters */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 6px var(--sp-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.pill:hover { border-color: var(--purple-md); color: var(--purple); }
.pill.active { background: var(--purple); color: #fff; border-color: var(--purple); font-weight: 600; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  justify-content: flex-end;
  margin-top: var(--sp-4);
}
.page-info {
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  margin-right: var(--sp-2);
  font-family: var(--font-data);
}
.page-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg);
  cursor: pointer;
  transition: all var(--ease-fast);
  font-family: var(--font-data);
}
.page-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); }
.page-btn:hover:not(.active) { background: var(--bg-brand); border-color: var(--border-strong); }

/* ── Bulk Action Bar ─────────────────────────────────────────── */
.bulk-bar {
  display: none;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--navy);
  border-radius: var(--radius);
  margin-bottom: var(--sp-2);
  color: #fff;
}
.bulk-bar.show { display: flex; }
.bulk-count { font-size: var(--text-sm); font-weight: 600; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  background: var(--ink-primary);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--ease-slow);
  z-index: var(--z-toast);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success-text); }
.toast.error { background: var(--error-text); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 16, 64, 0.48);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 480px;
  max-width: 95vw;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title { font-size: var(--text-lg); font-weight: 600; color: var(--ink-primary); }
.modal-close {
  background: none;
  border: none;
  color: var(--ink-tertiary);
  cursor: pointer;
  padding: var(--sp-1);
  border-radius: var(--radius-sm);
  transition: background var(--ease-fast), color var(--ease-fast);
}
.modal-close:hover { background: var(--bg-page); color: var(--ink-primary); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--ink-tertiary);
}
.empty-state .es-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--bg-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-4);
  font-size: 1.5rem;
}
.empty-state .es-title { font-size: var(--text-lg); font-weight: 600; color: var(--ink-primary); margin-bottom: var(--sp-2); }
.empty-state .es-desc { font-size: var(--text-sm); max-width: 360px; margin: 0 auto; line-height: 1.625; font-family: var(--font-data); }

/* ── Section Header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.section-title { font-size: var(--text-base); font-weight: 600; color: var(--ink-primary); }
.section-subtitle { font-size: var(--text-sm); color: var(--ink-tertiary); margin-top: 2px; font-family: var(--font-data); }

/* ── Activity Feed ───────────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--purple-md);
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-body { flex: 1; }
.activity-text { font-size: var(--text-sm); color: var(--ink-secondary); font-family: var(--font-data); }
.activity-time { font-size: var(--text-xs); color: var(--ink-tertiary); margin-top: 2px; font-family: var(--font-data); }

/* ── Chip Tags ───────────────────────────────────────────────── */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px var(--sp-3);
  background: var(--bg-brand);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--purple-dk);
  font-family: var(--font-data);
}
.chip .chip-remove {
  cursor: pointer;
  font-size: var(--text-sm);
  line-height: 1;
  color: var(--purple-dk);
  opacity: 0.6;
  transition: opacity var(--ease-fast);
}
.chip .chip-remove:hover { opacity: 1; }
.chip-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--sp-3);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  cursor: pointer;
  transition: all var(--ease-fast);
}
.chip-add:hover { border-color: var(--purple); color: var(--purple); }

/* ── Info Rows (detail read-only) ────────────────────────────── */
.info-row {
  display: flex;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-4);
}
.info-row:last-child { border-bottom: none; }
.info-label {
  width: 170px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-tertiary);
  flex-shrink: 0;
}
.info-value { font-size: var(--text-sm); color: var(--ink-primary); font-family: var(--font-data); }

/* ── Step Wizard ─────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-8);
  gap: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 1;
}
.step:last-child { flex: 0; }
.step-num {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--ink-tertiary);
  font-family: var(--font-data);
  transition: all var(--ease-base);
}
.step-label { font-size: var(--text-sm); font-weight: 500; color: var(--ink-tertiary); }
.step-line { flex: 1; height: 2px; background: var(--border); margin: 0 var(--sp-3); transition: background var(--ease-base); }
.step.done .step-num { background: var(--purple); border-color: var(--purple); color: #fff; }
.step.done .step-label { color: var(--purple-dk); }
.step.done .step-line { background: var(--purple); }
.step.active .step-num { background: var(--bg); border-color: var(--purple); color: var(--purple); font-weight: 800; }
.step.active .step-label { color: var(--purple); font-weight: 600; }

/* ── Alert / Callout ─────────────────────────────────────────── */
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  border: 1px solid;
}
.alert-yellow { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.alert-blue   { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.alert-green  { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert-red    { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.alert-icon   { font-size: 1.125rem; flex-shrink: 0; margin-top: 1px; }
.alert-body   { flex: 1; }
.alert-title  { font-weight: 600; margin-bottom: 3px; }
.alert p      { line-height: 1.625; font-family: var(--font-data); }

/* ── Command Palette (Ctrl+K) ────────────────────────────────── */
.cmd-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 16, 64, 0.48);
  z-index: 600;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
  backdrop-filter: blur(4px);
}
.cmd-overlay.show { display: flex; }
.cmd-palette {
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 560px;
  max-width: 95vw;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border: 1px solid var(--border);
}
.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
}
.cmd-input-wrap svg { width: 18px; height: 18px; color: var(--ink-tertiary); flex-shrink: 0; }
.cmd-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-family: var(--font-ui);
  color: var(--ink-primary);
  background: transparent;
}
.cmd-input::placeholder { color: var(--ink-placeholder); }
.cmd-kbd {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-tertiary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  box-shadow: 0 2px 0 var(--border);
}
.cmd-results { max-height: 340px; overflow-y: auto; padding: 6px 0; }
.cmd-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple);
  padding: var(--sp-3) var(--sp-5) var(--sp-1);
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  color: var(--ink-primary);
  cursor: pointer;
  transition: background var(--ease-fast);
  border-radius: var(--radius);
  margin: 0 var(--sp-1);
}
.cmd-item:hover, .cmd-item.active { background: var(--bg-brand); }
.cmd-item svg { width: 16px; height: 16px; color: var(--ink-tertiary); flex-shrink: 0; }
.cmd-item-label { flex: 1; font-family: var(--font-data); }
.cmd-item-meta { font-size: var(--text-xs); color: var(--ink-tertiary); font-family: var(--font-data); }
.cmd-footer {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--ink-tertiary);
}
.cmd-footer kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  box-shadow: 0 1px 0 var(--border);
}

/* ── Topnav Search Trigger ──────────────────────────────────── */
.topnav-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.45);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--ease-fast);
  white-space: nowrap;
}
.topnav-search:hover { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.75); background: rgba(255,255,255,0.08); }
.topnav-search svg { width: 14px; height: 14px; }
.topnav-search .search-kbd {
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 5px;
  color: rgba(255,255,255,0.45);
}

/* ── User Menu Dropdown ─────────────────────────────────────── */
.user-menu-wrap { position: relative; }
.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
}
.user-menu.show { display: block; }
.user-menu-header {
  padding: var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-brand);
}
.user-menu-name { font-size: var(--text-sm); font-weight: 700; color: var(--ink-primary); }
.user-menu-email { font-size: var(--text-xs); color: var(--ink-tertiary); margin-top: 2px; font-family: var(--font-data); }
.user-menu-role {
  display: inline-block;
  margin-top: var(--sp-2);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-data);
}
.user-menu-items { padding: 6px 0; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all var(--ease-fast);
  text-decoration: none;
  border-radius: 0;
}
.user-menu-item:hover { background: var(--bg-brand); text-decoration: none; color: var(--ink-primary); }
.user-menu-item svg { width: 15px; height: 15px; color: var(--ink-tertiary); }
.user-menu-item.danger { color: var(--error-text); }
.user-menu-item.danger svg { color: var(--error-icon); }
.user-menu-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ── Confidential Bar ────────────────────────────────────────── */
body::after {
  content: 'CONFIDENTIAL — Internal Use Only';
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  background: var(--navy);
  padding: 5px 0;
  z-index: 9999;
  pointer-events: none;
}

/* ── Responsive ──────────────────────────────────────────────── */

/* Tablet landscape / small desktop */
@media (max-width: 1200px) {
  .stat-row.c4 { grid-template-columns: repeat(2, 1fr); }
  .stat-row.c3 { grid-template-columns: repeat(2, 1fr); }
  .layout-split { flex-direction: column; }
  .layout-aside { width: 100%; }
  .form-grid.c2 { grid-template-columns: 1fr; }
}

/* Hamburger menu button (hidden on desktop) */
.topnav-hamburger {
  display: none;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--ease-fast);
}
.topnav-hamburger:hover { background: rgba(255,255,255,0.16); }
.topnav-hamburger svg { width: 18px; height: 18px; }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 16, 64, 0.48);
  z-index: 299;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }
.sidebar.mobile-open {
  display: flex !important;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: var(--z-overlay);
  background: var(--bg);
  box-shadow: var(--shadow-xl);
  padding: var(--sp-3) 0;
  overflow-y: auto;
}

/* Tablet portrait */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { padding: var(--sp-5) var(--sp-4) 60px; margin-left: 0; }
  .app-shell { display: block; }
  .topnav-hamburger { display: flex; }
  .topnav-links { display: none; }
  .topnav { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .topnav-logo { margin-right: auto; }
  .page-header { flex-direction: column; gap: var(--sp-3); align-items: flex-start; }
  .page-actions { width: auto; }
  .stat-row.c4 { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-wrap: wrap; }
  .search-field { max-width: 100%; min-width: 200px; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 600px; }
  .pagination { flex-wrap: wrap; justify-content: center; }
  .pills { flex-wrap: wrap; }
  .form-grid.c2 { grid-template-columns: 1fr; }
  .cmd-palette { width: 95vw; }
  .user-menu { right: -8px; }
}

/* Phone */
@media (max-width: 600px) {
  .stat-row.c4, .stat-row.c3 { grid-template-columns: 1fr; }
  .topnav-search { display: none; }
  .topnav-merchant { display: none; }
  .stat-value { font-size: var(--text-2xl); }
  .page-title { font-size: var(--text-xl); }
  .breadcrumb { font-size: var(--text-xs); }
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tab-item { flex-shrink: 0; }
  .tbl { min-width: 500px; }
  .modal { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .page-info { width: 100%; text-align: center; margin-bottom: var(--sp-2); }
}
