/* ============================================================
   Fletchers Dashboard — css/shared.css
   Design tokens · Shell · All components
   Sources: DESIGN.md §2 §3 §4 §5 §10
   ============================================================ */

/* 1 · DESIGN TOKENS ---------------------------------------- */
:root {
  /* Navy scale */
  --navy-50:  #f0f4f9;
  --navy-100: #d9e4f0;
  --navy-200: #b3c9e1;
  --navy-300: #7da4c8;
  --navy-400: #4a7eaf;
  --navy-500: #2d5f96;
  --navy-600: #1e3a5f;   /* sidebar */
  --navy-700: #162d4a;   /* topbar */
  --navy-800: #0f2035;   /* primary text */
  --navy-900: #081220;

  /* Gold scale */
  --gold-50:  #fdf8ec;
  --gold-100: #faefd0;
  --gold-200: #f4dda0;
  --gold-300: #edc56a;
  --gold-400: #e4aa3a;   /* gold on dark */
  --gold-500: #c9a84c;   /* CTA, active nav */
  --gold-600: #b08a35;   /* CTA hover */
  --gold-700: #8d6c27;
  --gold-800: #6b511e;   /* accessible gold text on white */
  --gold-900: #4a3815;

  /* App UI surfaces */
  --color-bg:           #f0f4f9;
  --color-surface:      #ffffff;
  --color-surface-alt:  #f7fafd;
  --color-border:       #d9e4f0;
  --color-border-strong:#b3c9e1;
  --color-text:         #0f2035;
  --color-text-sec:     #475569;
  --color-text-muted:   #7da4c8;

  /* Status — danger */
  --danger-50:   #fdf2f2;
  --danger-100:  #fbe3e3;
  --danger-500:  #c0392b;
  --danger-600:  #a93226;
  --danger-700:  #8c2b20;

  /* Status — warning */
  --warning-50:  #fdf6e9;
  --warning-100: #f9e9c6;
  --warning-500: #b8860b;
  --warning-600: #9a6f09;

  /* Status — success */
  --success-50:  #eef6f0;
  --success-100: #d4e9da;
  --success-500: #2e7d4f;
  --success-600: #246340;

  /* Status — info */
  --info-50:  #eef2f9;
  --info-500: #2d5f96;

  /* Status — neutral badge */
  --neutral-badge-bg:   #eef2f7;
  --neutral-badge-text: #475569;

  /* Typography */
  --font-sans:    Inter, system-ui, sans-serif;
  --font-heading: "Playfair Display", Georgia, serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  /* Shape */
  --radius:    6px;
  --radius-sm: 4px;
  --shadow-card: 0 1px 2px rgba(15,32,53,.06), 0 1px 3px rgba(15,32,53,.10);
  --shadow-pop:  0 8px 24px rgba(15,32,53,.16);
}

/* 2 · RESET & BASE ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 13px; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-200); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-300); }

/* 3 · APP SHELL -------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  overflow: hidden;
}
.app-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* 4 · SIDEBAR ---------------------------------------------- */
.sidebar {
  background: var(--navy-600);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-logo-mark {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-400);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.sidebar-logo-sub {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.4);
  margin-top: 3px;
}
.sidebar-nav {
  flex: 1;
  padding: 10px 0 8px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  user-select: none;
  white-space: nowrap;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
  flex-shrink: 0;
  opacity: .7;
}
.nav-item:hover {
  background: var(--navy-500);
  color: rgba(255,255,255,.92);
}
.nav-item:hover svg { opacity: .9; }
.nav-item.active {
  background: var(--navy-700);
  color: #fff;
  border-left-color: var(--gold-500);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--gold-500);
  color: var(--navy-800);
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 6px 0;
}
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.s-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-400);
  flex-shrink: 0;
}
.s-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.88);
  line-height: 1.2;
}
.s-role {
  font-size: 10.5px;
  color: rgba(255,255,255,.4);
  margin-top: 1px;
}
.s-logout {
  margin-left: auto;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  transition: color 150ms;
  flex-shrink: 0;
}
.s-logout:hover { color: rgba(255,255,255,.75); }
.s-logout svg { width: 15px; height: 15px; }

/* 5 · TOP BAR ---------------------------------------------- */
.topbar {
  height: 56px;
  background: var(--navy-700);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.tb-search {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.tb-search input {
  width: 100%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 7px 12px 7px 34px;
  font-size: 13px;
  color: rgba(255,255,255,.88);
  outline: none;
  transition: background 150ms, border-color 150ms;
}
.tb-search input::placeholder { color: rgba(255,255,255,.38); }
.tb-search input:focus {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
}
.tb-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.38);
  display: flex;
}
.tb-search-icon svg { width: 14px; height: 14px; stroke-width: 2; }
.tb-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.tb-date {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.45);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tb-date strong { color: rgba(255,255,255,.8); font-weight: 600; }
.tb-notif {
  position: relative;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  transition: color 150ms;
  display: flex;
}
.tb-notif:hover { color: rgba(255,255,255,.88); }
.tb-notif svg { width: 19px; height: 19px; stroke-width: 1.8; }
.tb-dot {
  position: absolute;
  top: -1px;
  right: -2px;
  width: 7px;
  height: 7px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 1.5px solid var(--navy-700);
}
.tb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.tb-avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--navy-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-400);
}
.tb-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.82);
  line-height: 1.2;
  white-space: nowrap;
}
.tb-user-role {
  font-size: 10.5px;
  color: rgba(255,255,255,.38);
}

/* 6 · CONTENT AREA ----------------------------------------- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--color-bg);
}
.content-hdr {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--navy-700);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.page-sub {
  font-size: 13px;
  color: var(--color-text-sec);
  margin-top: 3px;
}
.hdr-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  padding-top: 2px;
  flex-shrink: 0;
}

/* 7 · BUTTONS ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.01em;
}
.btn svg { width: 14px; height: 14px; stroke-width: 2.2; flex-shrink: 0; }
.btn-sm { font-size: 12px; padding: 5px 11px; }
.btn-sm svg { width: 12px; height: 12px; }

.btn-primary {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: var(--navy-800);
}
.btn-primary:hover { background: var(--gold-600); border-color: var(--gold-600); }

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--navy-200);
  color: var(--navy-600);
}
.btn-secondary:hover { background: var(--navy-50); border-color: var(--navy-300); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--navy-600);
}
.btn-ghost:hover { background: var(--navy-50); }

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

.btn-outline-gold {
  background: transparent;
  border-color: var(--gold-500);
  color: var(--gold-500);
}
.btn-outline-gold:hover { background: var(--gold-500); color: var(--navy-800); }

/* 8 · CARDS & PANELS --------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-800);
  line-height: 1.2;
}
.card-title svg { width: 15px; height: 15px; stroke-width: 1.8; color: var(--color-text-sec); }
.card-body { padding: 18px; }
.card-body-tight { padding: 12px 16px; }

/* 9 · SECTION LABELS --------------------------------------- */
.section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-800);
  line-height: 1;
}
.section-label-dark { color: var(--gold-400); }

/* 10 · STATUS CHIPS ---------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1;
}
.chip svg { width: 10px; height: 10px; stroke-width: 2.5; }
.chip-overdue  { background: var(--danger-50);   color: var(--danger-500); }
.chip-warning  { background: var(--warning-50);  color: var(--warning-500); }
.chip-success  { background: var(--success-50);  color: var(--success-500); }
.chip-info     { background: var(--info-50);     color: var(--info-500); }
.chip-awaiting { background: var(--neutral-badge-bg); color: var(--neutral-badge-text); }
.chip-onstop   { background: var(--danger-600);  color: #fff; }
.chip-inprog   { background: var(--info-50);     color: var(--info-500); }

/* 11 · TABLES ---------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: var(--color-surface-alt);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-sec);
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table thead th.r { text-align: right; }
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
.data-table tbody td.r {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) td { background: var(--color-surface-alt); }
.data-table tbody tr:hover td { background: var(--navy-50); }
.tr-danger { border-left: 3px solid var(--danger-500) !important; }
.tr-warn   { border-left: 3px solid var(--warning-500) !important; }
.tr-ok     { border-left: 3px solid var(--success-500) !important; }
.tr-info   { border-left: 3px solid var(--info-500) !important; }

/* 12 · KPI TILES ------------------------------------------- */
.kpi-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-800);
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  color: var(--navy-700);
  letter-spacing: -0.02em;
  line-height: 1;
}
.kpi-value-md {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--navy-700);
  letter-spacing: -0.02em;
  line-height: 1;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--color-text-sec);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-sub svg { width: 12px; height: 12px; stroke-width: 2.5; }
.kpi-danger { color: var(--danger-500); }
.kpi-success { color: var(--success-500); }
.kpi-warning { color: var(--warning-500); }

/* 13 · AVATAR ---------------------------------------------- */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.av-rc { background: #dbeafe; color: #1d4ed8; }
.av-jo { background: #dcfce7; color: #166534; }
.av-hm { background: #fef3c7; color: #92400e; }
.av-ps { background: #f3e8ff; color: #6b21a8; }
.av-mh { background: var(--navy-100); color: var(--navy-700); }
.av-client { background: var(--navy-50); color: var(--navy-600); }
.av-rf { background: var(--teal-500, #2d8a7a); color: #fff; }   /* Rebekah Fletcher */
.av-jf { background: var(--warning-500); color: #fff; }          /* Jared Fletcher */
.av-mf { background: var(--navy-700); color: #fff; }             /* Malcolm Fletcher */
.av-jan { background: #7b5ea7; color: #fff; }                    /* Janet Fletcher */
.av-vs { background: #2e7d4f; color: #fff; }                     /* Vicki Skinkis */
.av-gs { background: #1a6b8a; color: #fff; }                     /* Gaurav Savlani */
.av-mol { background: #b05c4e; color: #fff; }                    /* Molly Hall */
.av-jr  { background: #c2410c; color: #fff; }                    /* Jade Rapley */
.av-jd  { background: #0e7490; color: #fff; }                    /* Jean Duke */

/* 14 · EXTENDED SHELL — sidebar-brand, nav-section, topbar-* */
/* Sidebar brand block (used in newer screens instead of sidebar-logo) */
.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--gold-500);
  color: var(--navy-800);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-400);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-sub {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

/* Nav group label (e.g. "Workspace", "Finance") */
.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.3);
  padding: 10px 18px 4px;
}

/* Topbar layout variants (page-title style) */
.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.topbar-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  margin: 0;
}
.topbar-meta {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  font-weight: 400;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Sidebar footer user block */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.88);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10.5px;
  color: rgba(255,255,255,.4);
  margin-top: 1px;
}

/* Small avatar variant */
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }

/* 15 · QUALITY SCORE BAR ----------------------------------- */
.quality-score { display: flex; align-items: center; gap: 8px; }
.quality-bar { display: flex; gap: 2px; }
.q-seg {
  width: 13px;
  height: 5px;
  border-radius: 2px;
  background: var(--color-border);
}
.q-danger  { background: var(--danger-500); }
.q-warning { background: var(--warning-500); }
.q-success { background: var(--success-500); }
.quality-num { font-size: 12.5px; font-weight: 700; color: var(--warning-500); }

/* 15 · JOB CARDS (Focus dashboard) ------------------------- */
.priority-band { margin-bottom: 22px; }
.band-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--color-border);
}
.band-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.band-today   .band-label { color: var(--info-500); }
.band-overdue .band-label { color: var(--danger-500); }
.band-coming  .band-label { color: var(--color-text-sec); }
.band-count { font-size: 11px; color: var(--color-text-muted); font-weight: 500; }
.band-hdr svg { width: 14px; height: 14px; stroke-width: 2; }
.band-today   svg { color: var(--info-500); }
.band-overdue svg { color: var(--danger-500); }
.band-coming  svg { color: var(--color-text-sec); }

.job-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
  margin-bottom: 7px;
  transition: box-shadow 150ms;
}
.job-card:hover { box-shadow: var(--shadow-card); }
.job-card.jc-today   { border-left-color: var(--info-500); }
.job-card.jc-overdue { border-left-color: var(--danger-500); }
.job-card.jc-warn    { border-left-color: var(--warning-500); }
.job-card.jc-ok      { border-left-color: var(--success-500); }
.job-card.jc-urgent  {
  background: var(--danger-50);
  border-left-color: var(--danger-500);
  border-color: var(--danger-100);
}
.job-card.jc-coming  { border-left-color: var(--color-border-strong); }

.jc-client  { font-size: 13.5px; font-weight: 600; color: var(--navy-800); }
.jc-type    { font-size: 12.5px; color: var(--color-text-sec); margin-top: 2px; }
.jc-stage   { font-size: 11.5px; color: var(--color-text-muted); margin-top: 1px; }
.jc-meta    { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.jc-right   { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.jc-due     { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }
.jc-due.overdue { color: var(--danger-500); font-weight: 600; }

.call-prompt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--danger-600);
  background: #fff;
  border: 1.5px solid var(--danger-100);
  padding: 5px 10px;
  border-radius: var(--radius);
  margin-top: 4px;
  cursor: pointer;
  transition: background 150ms;
}
.call-prompt:hover { background: var(--danger-50); }
.call-prompt svg { width: 12px; height: 12px; }
.chase-info {
  font-size: 11px;
  color: var(--warning-500);
  font-weight: 600;
  margin-top: 2px;
}

/* 16 · LAYOUT HELPERS -------------------------------------- */
.layout-rail {
  display: grid;
  grid-template-columns: 1fr 308px;
  gap: 18px;
  align-items: start;
}
.right-rail { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
.gap-16 { gap: 16px; }

/* 17 · TABS ------------------------------------------------ */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 18px;
  gap: 0;
}
.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text-sec);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
}
.tab:hover { color: var(--navy-700); }
.tab.active {
  color: var(--navy-700);
  border-bottom-color: var(--gold-500);
  font-weight: 600;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 18 · QUICK ASSETS (Management) --------------------------- */
.quick-assets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  gap: 1px;
  margin-bottom: 18px;
}
.qa-col { background: var(--color-surface); }
.qa-hdr {
  background: var(--navy-700);
  color: rgba(255,255,255,.88);
  padding: 11px 14px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.qa-hdr-total { color: var(--gold-400); font-family: var(--font-heading); font-size: 14px; font-weight: 700; }
.qa-row {
  padding: 6px 14px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  gap: 6px;
}
.qa-row:last-of-type { border-bottom: none; }
.qa-name {
  color: var(--color-text-sec);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
.qa-val {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--navy-700);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.qa-val.danger { color: var(--danger-500); }
.qa-val.warn   { color: var(--warning-500); }
.qa-foot {
  padding: 9px 14px;
  background: var(--navy-50);
  border-top: 1px solid var(--color-border-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.qa-foot-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-sec); font-weight: 600; }
.qa-foot-val { font-family: var(--font-heading); font-size: 16px; color: var(--navy-700); font-weight: 700; }

/* 19 · ON-STOP TOGGLE -------------------------------------- */
.toggle-wrap { display: inline-flex; align-items: center; gap: 6px; }
.toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: background 200ms;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
}
.toggle input:checked ~ .toggle-track { background: var(--danger-600); }
.toggle input:checked ~ .toggle-track::before { transform: translateX(16px); }

/* 20 · PROGRESS BAR ---------------------------------------- */
.prog-bar {
  height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: var(--gold-500);
  border-radius: 3px;
  transition: width 300ms;
}
.prog-fill.success { background: var(--success-500); }

/* 21 · ONBOARDING STEPS ------------------------------------ */
.step-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}
.step-row:last-child { border-bottom: none; }
.step-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}
.step-icon svg { width: 13px; height: 13px; stroke-width: 2.5; }
.si-done    { background: var(--success-50);  color: var(--success-500); }
.si-current { background: var(--gold-500);    color: var(--navy-800); }
.si-pending { background: var(--color-border); color: var(--color-text-muted); }
.si-blocked { background: var(--danger-50);   color: var(--danger-500); }
.step-body { flex: 1; }
.step-label { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.step-note  { font-size: 11.5px; color: var(--color-text-sec); margin-top: 2px; }

/* 22 · CORRESPONDENCE -------------------------------------- */
.corr-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: start;
}
.corr-item:last-child { border-bottom: none; }
.corr-from    { font-size: 12.5px; font-weight: 600; color: var(--navy-800); }
.corr-subject { font-size: 12.5px; color: var(--color-text-sec); margin-top: 1px; }
.corr-preview { font-size: 11.5px; color: var(--color-text-muted); margin-top: 3px; }
.corr-date    { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }
.corr-dir {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: 6px;
}
.corr-in  { background: var(--info-50);    color: var(--info-500); }
.corr-out { background: var(--success-50); color: var(--success-500); }

/* 23 · UPLOAD ZONE (Portal) -------------------------------- */
.upload-zone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
  background: var(--color-surface-alt);
}
.upload-zone:hover {
  border-color: var(--navy-400);
  background: var(--navy-50);
}
.upload-zone-icon {
  margin: 0 auto 10px;
  color: var(--navy-300);
  display: flex;
  justify-content: center;
}
.upload-zone-icon svg { width: 36px; height: 36px; stroke-width: 1.5; }

/* 24 · EMAIL PREVIEW CARD ---------------------------------- */
.email-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
}
.email-preview-hdr {
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 14px;
  display: grid;
  gap: 2px;
}
.email-meta-row { font-size: 12px; }
.email-meta-label { color: var(--color-text-muted); font-weight: 600; display: inline-block; width: 40px; }
.email-meta-val  { color: var(--color-text-sec); }
.email-body      { padding: 14px; color: var(--color-text); }

/* 25 · UTILITY --------------------------------------------- */
.text-sec     { color: var(--color-text-sec); }
.text-muted   { color: var(--color-text-muted); }
.text-danger  { color: var(--danger-500); }
.text-warning { color: var(--warning-500); }
.text-success { color: var(--success-500); }
.text-info    { color: var(--info-500); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.tabular { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.flex { display: flex; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
