/* ============================================================
   Pinnex Compliance Tracker — v0.7.2 brand restyle
   Palette sourced from pinnexaccounting.com (2026-05-23):
     Website primary blue : hsl(214 100% 50%) = #006eff
     Website amber CTA    : rgb(245,158,11)   = #f59e0b
     Website body text    : rgb(2,8,23)       = #020817
     Website font (body)  : Inter, Segoe UI, Roboto
     Website font (heads) : Montserrat
   Tracker uses a deepened brand blue so dense data tables
   stay comfortable. Amber reserved for the logo mark only.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Neutral scale — slate */
  --gray-50:  #f7f9fc;
  --gray-100: #f0f4f8;
  --gray-150: #e8edf3;
  --gray-200: #dde4ed;
  --gray-300: #c8d3e0;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Pinnex brand palette — brightened to mirror pinnexaccounting.com */
  --brand-navy:         #0a2540;   /* header — deep navy, ~15% darker than before */
  --brand-blue:         #0d6efd;   /* primary action — vibrant brand blue         */
  --brand-blue-deep:    #0a58ca;   /* hover / pressed                             */
  --brand-blue-soft:    #e7f0ff;   /* tinted surface for active/selected states   */
  --brand-blue-border:  #a8c8f5;   /* tinted borders                              */
  --brand-blue-text:    #084298;   /* text on brand-blue-soft bg                  */
  --brand-amber:        #f59e0b;   /* amber accent — matches website CTA          */
  --brand-amber-deep:   #d97706;   /* amber hover                                 */

  /* Primary alias → Pinnex blue */
  --primary:        var(--brand-blue);
  --primary-hover:  var(--brand-blue-deep);
  --primary-soft:   var(--brand-blue-soft);
  --primary-border: var(--brand-blue-border);
  --primary-text:   var(--brand-blue-text);

  /* Semantic */
  --success:        #059669;
  --success-soft:   #ecfdf5;
  --success-border: #a7f3d0;
  --warning:        #b45309;
  --warning-soft:   #fffbeb;
  --warning-border: #fde68a;
  --danger:         #dc2626;
  --danger-soft:    #fef2f2;
  --danger-border:  #fecaca;

  /* Aliases used across the codebase (compat) */
  --bg:           var(--gray-50);
  --surface:      #ffffff;
  --surface-alt:  var(--gray-50);
  --border:       var(--gray-200);
  --border-soft:  var(--gray-150);
  --text:         var(--gray-900);
  --text-muted:   var(--gray-500);
  --text-faint:   var(--gray-400);
  --neutral-soft: var(--gray-100);

  /* Radii */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 40px rgba(15,23,42,0.10);

  /* Motion */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 240ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-w:           204px;
  --sidebar-w-collapsed: 64px;
  --header-h:            56px;
  --content-max:         1320px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

/* Tabular numbers for any element that wants them */
.tnum, .kpi-value, td.num, .num,
input[type="number"], input[type="date"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #dceeff 0%, #eaf2fb 60%, #f0f6ff 100%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  width: 380px;
  box-shadow: var(--shadow-md);
}
.brand-stack { text-align: center; margin-bottom: 28px; }
.brand-stack .brand-logo {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.brand-stack h1 {
  font-size: 16px; font-weight: 600; margin: 0;
  letter-spacing: -0.01em; color: var(--text);
}
.login-card label {
  display: block; margin-bottom: 14px;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.login-card input {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-top: 6px; font-size: 13.5px;
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.18);
}
.login-card button {
  width: 100%; padding: 10px;
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; margin-top: 8px;
  transition: background var(--t-fast);
}
.login-card button:hover { background: var(--primary-hover); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ============================================================
   Layout — header on top, sidebar left, content right
   ============================================================ */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  background: var(--brand-navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0 20px;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 0 var(--brand-amber), 0 2px 8px rgba(10, 37, 64, 0.18);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 28px; height: 28px;
  background: var(--brand-amber);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 13px;
  letter-spacing: -0.02em;
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: rgba(255,255,255,0.92); }

.header-right { display: flex; align-items: center; gap: 10px; }

.search-bar {
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); padding: 7px 11px;
  width: 280px; font-size: 13px;
  font-family: inherit; color: rgba(255,255,255,0.90);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-bar::placeholder { color: rgba(255,255,255,0.38); }
.search-bar:focus {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.32);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.07);
  outline: none;
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 11px; border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--gray-700);
  font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

/* btn-secondary when inside the dark header */
.header .btn-secondary {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.82);
}
.header .btn-secondary:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.95);
}

.user-menu { display: flex; align-items: center; gap: 10px; padding-left: 6px; border-left: 1px solid rgba(255,255,255,0.12); }
.user-name { color: rgba(255,255,255,0.60); font-size: 12.5px; font-weight: 500; }
.btn-link {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.60); font-size: 12.5px; font-family: inherit;
  transition: color var(--t-fast);
}
.btn-link:hover { color: rgba(255,255,255,0.90); }

/* Sidebar toggle (mobile hamburger) */
.sidebar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 6px; margin-right: 4px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.72);
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.10); }
.sidebar-toggle svg { width: 20px; height: 20px; display: block; }

/* ---------- Layout shell ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  flex: 1;
  min-height: 0;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  position: sticky; top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  transition: transform var(--t-base), width var(--t-base);
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-section-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 10px 10px 6px; margin-top: 4px;
}

/* Tab links repurposed as nav items */
a.tab {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
  border-bottom: none;  /* override prior tab style */
  cursor: pointer;
}
a.tab:hover { background: var(--gray-100); color: var(--text); }
a.tab.active {
  background: var(--primary-soft);
  color: var(--primary-text);
}
a.tab .nav-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--gray-500);
  transition: color var(--t-fast);
}
a.tab.active .nav-icon { color: var(--primary); }
a.tab:hover .nav-icon { color: var(--gray-700); }
a.tab .nav-label { flex: 1; min-width: 0; white-space: nowrap; }
a.tab .nav-badge {
  font-size: 10.5px; font-weight: 600;
  background: var(--gray-200); color: var(--gray-600);
  padding: 1px 6px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
a.tab.active .nav-badge { background: var(--primary-border); color: var(--primary-text); }
a.tab .nav-badge:empty { display: none; }

/* ── Sidebar compliance categories ──────────────────────────────────────── */
.cat-group { display: flex; flex-direction: column; }
.cat-row {
  display: flex; align-items: stretch;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast);
}
.cat-row:hover { background: var(--gray-100); }
.cat-row .cat-link {
  flex: 1; padding: 7px 4px 7px 10px;
  display: flex; align-items: center; gap: 8px;
  color: var(--gray-700); font-size: 12.5px; font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.cat-row .cat-icon {
  width: 18px; text-align: center;
  font-size: 14px; line-height: 1;
  flex-shrink: 0;
}
.cat-row .cat-link.active {
  color: var(--primary-text); background: var(--primary-soft);
}
.cat-toggle {
  background: transparent; border: none; cursor: pointer;
  padding: 0 10px; color: var(--gray-400);
  font-size: 10px; line-height: 1;
  display: flex; align-items: center;
  transition: transform var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}
.cat-toggle:hover { color: var(--gray-700); }
.cat-toggle[aria-expanded="true"] { transform: rotate(90deg); }
.cat-children {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 0 4px 38px;
}
.cat-children[hidden] { display: none; }
.cat-children a {
  font-size: 12px; color: var(--gray-500);
  padding: 5px 8px; border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.cat-children a:hover { background: var(--gray-100); color: var(--text); }
.cat-children a.active {
  background: var(--primary-soft); color: var(--primary-text); font-weight: 500;
}

/* Content panel */
.content {
  min-width: 0;
  padding: 0;
}

/* ============================================================
   Digest banner
   ============================================================ */
.digest-banner {
  display: none;
  padding: 9px 20px;
  background: var(--warning-soft);
  color: var(--warning);
  border-bottom: 1px solid var(--warning-border);
  font-size: 12.5px;
}
.digest-banner.active { display: block; }
.digest-banner a { color: var(--warning); font-weight: 600; }

/* ============================================================
   KPI strip — refined, no colored backgrounds
   ============================================================ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 18px 20px 6px;
  max-width: var(--content-max);
  margin: 0 auto;
}
a.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  display: block;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
/* Tinted KPI cards — semantic colour wash, brightens the dashboard */
a.kpi-card.danger  { background: linear-gradient(180deg, #fff5f5 0%, #ffffff 100%); border-color: #fee2e2; }
a.kpi-card.warning { background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%); border-color: #fde68a; }
a.kpi-card.neutral { background: linear-gradient(180deg, #e7f0ff 0%, #ffffff 100%); border-color: #c7dcfc; }
a.kpi-card.success { background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%); border-color: #bbf7d0; }
a.kpi-card.waived  { background: linear-gradient(180deg, #f4f6f9 0%, #ffffff 100%); border-color: #e2e8f0; }
a.kpi-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(13, 110, 253, 0.10);
  transform: translateY(-1px);
}
a.kpi-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.kpi-card .kpi-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.kpi-card .kpi-label::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
  display: inline-block;
  flex-shrink: 0;
}
.kpi-card.danger  .kpi-label::before { background: var(--danger); }
.kpi-card.warning .kpi-label::before { background: var(--warning); }
.kpi-card.neutral .kpi-label::before { background: var(--gray-400); }
.kpi-card.success .kpi-label::before { background: var(--success); }
/* v0.6.8 — "Waived" card: muted gray. Waived isn't a problem state, so it
   reads quietly — deliberately distinct from the red Overdue / amber Due
   cards. */
.kpi-card.waived  .kpi-label::before { background: var(--gray-500); }
.kpi-card .kpi-value {
  font-size: 30px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.kpi-card.danger  .kpi-value { color: var(--danger); }
.kpi-card.warning .kpi-value { color: var(--warning); }
.kpi-card.neutral .kpi-value { color: var(--text); }
.kpi-card.success .kpi-value { color: var(--success); }
.kpi-card.waived  .kpi-value { color: var(--gray-500); }
.kpi-card .kpi-sub {
  color: var(--text-faint);
  font-size: 11.5px;
  margin-top: 6px;
}
.kpi-card .kpi-arrow {
  position: absolute; top: 14px; right: 14px;
  color: var(--gray-300);
  font-size: 13px;
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.kpi-card:hover .kpi-arrow {
  opacity: 1; transform: translateX(0);
  color: var(--primary);
}

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  max-width: var(--content-max);
  margin: 0 auto;
  flex-wrap: wrap;
}
a.filter-chip, button.filter-chip {
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px; font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
a.filter-chip:hover, button.filter-chip:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--text);
}
a.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}
a.filter-chip.active:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--surface);
}
a.filter-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.filter-chip.bulk {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 11px;
}
.filter-divider {
  width: 1px; height: 18px;
  background: var(--border);
  margin: 0 6px;
}

/* ============================================================
   Main content
   ============================================================ */
.main {
  padding: 8px 20px 32px;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ============================================================
   v0.19.0 — Instruction chatbox on Runs view
   ============================================================ */
.instruction-chatbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.ic-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.ic-title { font-weight: 600; font-size: 15px; color: var(--text); }
.ic-hint { color: var(--text-muted); font-size: 12px; }
.ic-form { display: flex; gap: 8px; }
.ic-form input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.ic-form input:focus { outline: none; border-color: var(--accent, #4a7); }
.ic-form button { padding: 8px 18px; }
.ic-form button[disabled] { opacity: 0.6; cursor: wait; }
.ic-status { margin-top: 10px; min-height: 0; font-size: 13px; }
.ic-status:empty { display: none; }
.ic-status.success {
  color: #2a7a3a;
  padding: 10px 12px;
  background: rgba(42, 122, 58, 0.08);
  border-left: 3px solid #2a7a3a;
  border-radius: 4px;
}
.ic-status.error {
  color: #b3261e;
  padding: 10px 12px;
  background: rgba(179, 38, 30, 0.08);
  border-left: 3px solid #b3261e;
  border-radius: 4px;
}
.ic-status.loading {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   v0.19.0 cont. — Awaiting-input banner + approval gates
   ============================================================ */
.ic-awaiting-banner {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(255, 196, 0, 0.10);
  border-left: 3px solid #d39e00;
  border-radius: 4px;
  font-size: 13px;
  color: #6b5300;
}
.ic-awaiting-banner .label { font-weight: 600; }
.ic-awaiting-banner .q { font-style: italic; margin-top: 4px; display: block; }

#approval-gates { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.approval-card {
  padding: 12px;
  background: rgba(180, 38, 30, 0.06);
  border-left: 3px solid #b3261e;
  border-radius: 4px;
  font-size: 13px;
}
.approval-card .actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.approval-card .btn-approve {
  background: #2a7a3a; color: #fff; padding: 6px 14px;
  border: none; border-radius: 4px; cursor: pointer; font: inherit;
}
.approval-card .btn-approve:hover:not([disabled]) { background: #246a32; }
.approval-card .btn-reject {
  background: #b3261e; color: #fff; padding: 6px 14px;
  border: none; border-radius: 4px; cursor: pointer; font: inherit;
}
.approval-card .btn-reject:hover:not([disabled]) { background: #962017; }
.approval-card .btn-approve[disabled],
.approval-card .btn-reject[disabled] { opacity: 0.6; cursor: wait; }

/* View-window segmented control */
.view-window-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.view-window-bar .label {
  color: var(--text-faint);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.seg {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--gray-600);
  border-radius: 6px;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.expand-toggle {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font: inherit; font-size: 12.5px;
  padding: 8px 14px;
  margin: 10px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%; text-align: center;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.expand-toggle:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--text); }

/* ============================================================
   Table
   ============================================================ */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
/* Constrain table cells: most columns shrink to natural content;
   let "growable" columns (text-heavy ones) soak up slack via 100%.   */
.table-card tbody td,
.table-card thead th { width: 1%; white-space: nowrap; }
/* Compliances table: column 2 = Client name (allow wrap) */
#view-compliances thead th:nth-child(2),
#view-compliances tbody td:nth-child(2) { width: 100%; white-space: normal; max-width: 320px; }
/* Clients table: column 2 = Client name */
#view-clients thead th:nth-child(2),
#view-clients tbody td:nth-child(2) { width: 100%; white-space: normal; max-width: 320px; }
/* Completed-docs-missing: column 1 = Client */
#view-completed-docs-missing thead th:nth-child(1),
#view-completed-docs-missing tbody td:nth-child(1) { width: 100%; white-space: normal; max-width: 320px; }
/* ITC pending: column 1 = Client */
#view-itc-pending thead th:nth-child(1),
#view-itc-pending tbody td:nth-child(1) { width: 100%; white-space: normal; max-width: 320px; }
/* Learnings: column 4 = Rule */
#view-learnings thead th:nth-child(4),
#view-learnings tbody td:nth-child(4) { width: 100%; white-space: normal; }
/* Audit: column 5 = Details */
#view-audit thead th:nth-child(5),
#view-audit tbody td:nth-child(5) { width: 100%; white-space: normal; }
thead th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text-faint);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  user-select: none;
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--t-fast);
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child { border-bottom: none; }
tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  color: var(--gray-700);
  font-variant-numeric: tabular-nums;
}
tbody td:first-child:not(.checkbox-cell) {
  color: var(--text);
  font-weight: 500;
}
.empty {
  text-align: center;
  color: var(--text-faint);
  padding: 48px 24px;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--gray-700); }
th.sortable .sort-arrow {
  margin-left: 4px;
  color: var(--text-faint);
  font-size: 9px;
}
th.sortable.active { color: var(--gray-700); }
th.sortable.active .sort-arrow { color: var(--primary); }

.checkbox-cell { width: 28px; padding: 0 8px; }
.checkbox-cell input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
}

.client-name { font-weight: 600; color: var(--text); }
.client-sub  { color: var(--text-faint); font-size: 11px; margin-top: 2px; }

/* Linkified client name in tables */
a.client-name-link {
  color: var(--text); text-decoration: none;
  font-weight: 600;
}
a.client-name-link:hover { color: var(--primary); }
a.due-link { text-decoration: none; color: inherit; }
a.due-link:hover { text-decoration: underline; }

/* Generic pill (for code, jurisdiction) */
.pill {
  display: inline-flex; align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.code {
  background: var(--gray-100);
  color: var(--gray-700);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 500;
  margin-right: 8px;
  letter-spacing: 0;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}
a.pill.code:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
}
.pill.india  { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.pill.canada { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.pill.docs-missing {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--warning-border);
  margin-left: 0;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  line-height: 1.4;
  padding: 3px 8px;
}
/* Status-pill inline variant keeps the uppercase short-pill style */
.status-pill.docs-missing,
a.status-pill[data-state="missing"] {
  text-transform: none;
}

/* Service flags */
.service-flag {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  margin-right: 4px;
  background: var(--gray-100);
  color: var(--gray-500);
  border: 1px solid transparent;
}
.service-flag.on {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: var(--primary-border);
}

/* Due indicator */
.due { display: flex; align-items: center; gap: 7px; }
.due-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.due-dot.overdue { background: var(--danger); }
.due-dot.urgent  { background: var(--warning); }
.due-dot.normal  { background: var(--success); }
.due-text-overdue { color: var(--danger); font-weight: 600; }
.due-text-urgent  { color: var(--warning); font-weight: 600; }

/* Status pills v2 — refined chips */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px; font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: 0;
  transition: background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  font-variant-numeric: normal;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.status-pill:hover { filter: none; }
.status-pill .ic {
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
}
.status-pill[data-state="filed"]    { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.status-pill[data-state="working"]  { background: var(--primary-soft); color: var(--primary-text); border-color: var(--primary-border); }
.status-pill[data-state="pending"]  { background: var(--gray-100);     color: var(--gray-600);    border-color: var(--gray-200); }
.status-pill[data-state="urgent"]   { background: var(--warning-soft); color: var(--warning);     border-color: var(--warning-border); }
.status-pill[data-state="overdue"]  { background: var(--danger-soft);  color: var(--danger);      border-color: var(--danger-border); }
.status-pill[data-state="waived"]   { background: var(--gray-100);     color: var(--gray-500);    border-color: var(--gray-200); }
.status-pill[data-state="na"]       { background: var(--gray-100);     color: var(--text-faint);  border-color: var(--gray-200); }
.status-pill[data-state="missing"]  { background: var(--warning-soft); color: var(--warning);     border-color: var(--warning-border); }
.status-pill[data-state="docs-ok"]  { background: var(--success-soft); color: var(--success);     border-color: var(--success-border); }
.status-pill:hover { background-color: color-mix(in srgb, currentColor 10%, transparent); }

/* Row action button */
.row-action {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.row-action:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--text);
}
/* v0.6.8 — two-button action cell (Waive + Edit) */
.row-actions-cell { white-space: nowrap; }
.row-actions-cell .row-action + .row-action { margin-left: 6px; }

/* Bulk action bar */
.compliance-edit-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 9px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--primary-text);
}
.compliance-edit-bar.hidden { display: none; }

/* ============================================================
   Empty / skeleton
   ============================================================ */
.empty-rich {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-rich .icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 12px;
  color: var(--success);
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
}
.empty-rich .title {
  font-size: 14px; font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.empty-rich .sub {
  font-size: 12.5px;
  color: var(--text-muted);
}
.empty-rich a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.empty-rich a:hover { text-decoration: underline; }

/* Skeleton shimmer */
@keyframes skel-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skel {
  display: inline-block;
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel.w-30 { width: 30%; }
.skel.w-50 { width: 50%; }
.skel.w-70 { width: 70%; }
.skel.w-90 { width: 90%; }

/* ============================================================
   Client-detail header
   ============================================================ */
.client-detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 14px;
}
.client-detail-header .crumbs {
  width: 100%;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.client-detail-header .crumbs a { color: var(--text-muted); text-decoration: none; transition: color var(--t-fast); }
.client-detail-header .crumbs a:hover { color: var(--primary); }
.client-detail-header .name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.client-detail-header .meta { color: var(--text-muted); font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.client-detail-header .actions { margin-left: auto; display: flex; gap: 8px; }

/* Active-filter summary bar */
.active-filter-bar {
  display: none;
  align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--primary-text);
}
.active-filter-bar.shown { display: flex; }
.active-filter-bar .clear {
  margin-left: auto;
  color: var(--primary-text);
  text-decoration: none;
  font-weight: 600;
}
.active-filter-bar .clear:hover { text-decoration: underline; }
.active-filter-bar .tag {
  background: rgba(255,255,255,0.7);
  padding: 1px 8px; border-radius: 999px;
  font-weight: 500;
}

/* ============================================================
   Drawer
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.32);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-base), visibility var(--t-base);
  z-index: 100;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 92vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  z-index: 101;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 1;
}
.drawer-close {
  float: right;
  background: var(--gray-100);
  border: none;
  width: 28px; height: 28px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--gray-600);
  font-size: 16px; line-height: 1;
  transition: background var(--t-fast);
}
.drawer-close:hover { background: var(--gray-200); }
.drawer-title {
  font-size: 15px; font-weight: 600; margin: 0 0 2px;
  letter-spacing: -0.005em;
}
.drawer-sub { color: var(--text-muted); font-size: 12px; }
.drawer-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section-title {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 12px;
}

.edit-row {
  display: flex; flex-direction: column;
  margin: 8px 0;
}
.edit-row label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.edit-row input, .edit-row select, .edit-row textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font: inherit; font-size: 13px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.edit-row input:focus, .edit-row select:focus, .edit-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.18);
}
.edit-row textarea { min-height: 64px; resize: vertical; }
.edit-actions { display: flex; gap: 8px; margin-top: 14px; }

.btn-primary {
  background: var(--primary); color: white; border: none;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 13px;
  cursor: pointer; font-family: inherit;
  transition: background var(--t-fast);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 7px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: inherit; font-weight: 500; font-size: 13px;
  transition: background var(--t-fast);
}
.btn-danger:hover { background: var(--danger); color: white; }

.audit-entry {
  font-size: 11.5px; color: var(--text-muted);
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}
.audit-entry .ts { font-family: ui-monospace, "SF Mono", monospace; }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  display: none;
  z-index: 70;
  transition: opacity var(--t-base);
}
.modal-backdrop.open { display: flex; align-items: center; justify-content: center; }
/* v0.6.8 — the waive modal can be opened from inside the edit drawer
   (z-index 101), so it must sit above it. */
#waive-modal-backdrop { z-index: 110; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 720px; width: 92%;
  max-height: 84vh; overflow: auto;
  padding: 22px;
  border: 1px solid var(--border);
}
.modal h2 { margin-top: 0; font-size: 16px; letter-spacing: -0.01em; }
.modal table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12.5px; }
.modal th, .modal td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border-soft); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center; padding: 22px;
  color: var(--text-faint); font-size: 11px;
  line-height: 1.8;
}
.footer strong { color: var(--gray-600); font-weight: 600; }
.footer a { color: var(--primary); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-sep { margin: 0 4px; }

/* ============================================================
   View visibility (only active view shows)
   ============================================================ */
.view { display: none; }
.view.active { display: block; }

/* Jurisdiction column hidden — Canada removed, India-only. */
.col-jurisdiction { display: none !important; }

/* ============================================================
   Zoho pill — preserve markup expected by tracker-ui-patch.js
   (.zoho-pill, .dot, .label, data-state, data-client-code on tr).
   Refined to match the new pill aesthetic.
   ============================================================ */
.zoho-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px; font-weight: 500;
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.zoho-pill .dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.zoho-pill[data-state="fresh"] { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.zoho-pill[data-state="fresh"] .dot { background: var(--success); }
.zoho-pill[data-state="stale"] { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.zoho-pill[data-state="stale"] .dot { background: var(--warning); }
.zoho-pill[data-state="never"] { background: var(--gray-100); color: var(--gray-600); border-color: var(--gray-200); }
.zoho-pill[data-state="never"] .dot { background: var(--gray-400); }

/* Zoho modal */
#zoho-modal { position: fixed; inset: 0; background: rgba(15,23,42,0.4); display: none; align-items: center; justify-content: center; z-index: 9999; }
#zoho-modal.open { display: flex; }
#zoho-modal .card {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  max-width: 520px; width: 92%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
#zoho-modal h2 { margin: 0 0 12px; font-size: 16px; letter-spacing: -0.01em; }
#zoho-modal label { display: block; margin: 12px 0 4px; font-size: 12px; color: var(--text-muted); font-weight: 500; }
#zoho-modal input, #zoho-modal select {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  font-family: inherit; font-size: 13px;
  background: var(--surface);
}
#zoho-modal input:focus, #zoho-modal select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.18);
}
#zoho-modal .actions { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }
#zoho-modal button {
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--gray-700);
  transition: background var(--t-fast), border-color var(--t-fast);
}
#zoho-modal button:hover { background: var(--gray-50); }
#zoho-modal button.primary {
  background: var(--primary); color: var(--surface); border-color: var(--primary);
}
#zoho-modal button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
#zoho-modal pre.cmd {
  background: var(--gray-900); color: var(--gray-100);
  padding: 12px; border-radius: var(--radius-sm);
  font-size: 11.5px; overflow-x: auto; user-select: all;
  font-family: ui-monospace, "SF Mono", monospace;
}

/* ============================================================
   Responsive — sidebar collapses below 1024px
   ============================================================ */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0; bottom: 0;
    width: 240px;
    z-index: 60;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(15,23,42,0.3);
    z-index: 55;
    animation: fade-in var(--t-base) ease-out;
  }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   v0.5 — Other compliances multi-select (drawer) + chips (table)
   ============================================================ */

/* Multi-select list inside the client edit drawer */
.oc-list {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.oc-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.oc-item:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.oc-toggle {
  display: flex; align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  font-size: 12.5px;
  margin: 0;
}
.oc-label {
  font-weight: 500;
  color: var(--text);
}
.oc-rule {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}
.oc-meta {
  display: flex; align-items: center;
  gap: 6px;
}
.oc-state, .oc-applicable-from {
  font-size: 11.5px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.oc-state:disabled, .oc-applicable-from:disabled {
  background: var(--gray-50);
  color: var(--text-faint);
}
/* Category strip down the left edge of each row */
.oc-item.oc-cat-labour          { box-shadow: inset 3px 0 0 0 #2563eb; }
.oc-item.oc-cat-corporate       { box-shadow: inset 3px 0 0 0 #0891b2; }
.oc-item.oc-cat-foreign_exchange{ box-shadow: inset 3px 0 0 0 #7c3aed; }
.oc-item.oc-cat-quality         { box-shadow: inset 3px 0 0 0 #059669; }
.oc-item.oc-cat-ip              { box-shadow: inset 3px 0 0 0 #c2410c; }
.oc-item.oc-cat-shop            { box-shadow: inset 3px 0 0 0 #b45309; }

/* Chips rendered on the clients table next to BK/TDS/GST/IT */
.other-chip {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  margin-right: 4px;
  border: 1px solid transparent;
  letter-spacing: 0;
}
.oc-chip-sep {
  display: inline-block;
  width: 1px;
  height: 12px;
  background: var(--border);
  margin: 0 6px 0 2px;
  vertical-align: middle;
}
.other-chip-labour           { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.other-chip-corporate        { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.other-chip-foreign_exchange { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.other-chip-quality          { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.other-chip-ip               { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.other-chip-shop             { background: #fffbeb; color: #b45309; border-color: #fde68a; }

@media (max-width: 800px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .search-bar { width: 180px; }
  .header { padding: 0 14px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 9px 11px; }
  .drawer { width: 100%; }
  .main { padding: 8px 14px 32px; }
}
@media (max-width: 540px) {
  .header { padding: 0 12px; }
  .search-bar { display: none; }
  .main { padding: 8px 12px 24px; }
  .kpi-strip { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
  .kpi-card .kpi-value { font-size: 26px; }
  .filter-bar { padding: 8px 12px; }
  .col-jurisdiction { display: none; }
  .user-name { display: none; }
  .view-window-bar { padding: 8px 10px; }
  .seg button { padding: 5px 10px; }
}

/* ============================================================
   Clients toolbar + Add Client flow
   ============================================================ */
.clients-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.clients-toolbar-title {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text);
}

/* Suggested clients (Drive-folder discovery) panel */
.pending-clients-panel {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.pending-clients-head { margin-bottom: 10px; }
.pending-clients-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin-right: 8px;
}
.pending-clients-sub { font-size: 12px; color: var(--text-muted); }
.pending-client-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--warning-border);
}
.pending-client-grow { flex: 1; }
.pending-client-name { font-size: 13px; font-weight: 500; color: var(--text); }
.pending-client-meta { font-size: 12px; color: var(--text-muted); }
.pending-client-conf {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 9px;
}
.pending-conf-high { background: var(--success-soft); color: var(--success); }
.pending-conf-low { background: var(--gray-150); color: var(--text-muted); }
.pending-client-row .btn-primary,
.pending-client-row .btn-secondary { padding: 5px 11px; font-size: 12px; }

/* Add Client modal extras */
.ac-req { color: var(--danger); font-weight: 600; }
.ac-hint { color: var(--text-faint); font-size: 11px; font-weight: 400; }
.ac-services {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.ac-services label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text);
}
#add-client-error:not(:empty) { margin-top: 14px; }

/* v0.15.0 — First-year compliance preview block in Add Client modal. */
.ac-first-year-preview {
  margin: 10px 0 6px;
  padding: 12px 14px;
  border: 1px solid var(--border, #d9dee5);
  border-left: 3px solid var(--accent, #5b8def);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-subtle, #f7f9fc);
  font-size: 12.5px;
  color: var(--text);
}
.ac-first-year-preview .ac-fy-title {
  font-weight: 600;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.ac-first-year-preview .ac-fy-tag {
  font-size: 10.5px;
  background: var(--accent, #5b8def);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ac-first-year-preview .ac-fy-sub {
  color: var(--text-muted, #6b7280);
  font-size: 11.5px;
  margin-bottom: 8px;
}
.ac-first-year-preview ul.ac-fy-items {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr; gap: 4px;
}
.ac-first-year-preview ul.ac-fy-items li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}
.ac-first-year-preview ul.ac-fy-items li .ac-fy-due {
  font-size: 11.5px;
  color: var(--text-muted, #6b7280);
  font-variant-numeric: tabular-nums;
}
.ac-first-year-preview .ac-fy-empty {
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

/* Toast */
.toast-host {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--gray-900); color: #fff;
  padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--t-base), transform var(--t-base);
  max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success {
  background: var(--success); color: #fff;
}
.toast.toast-error {
  background: var(--danger); color: #fff;
}

/* ============================================================
   v0.8.0 — BookFlow runs dashboard
   ============================================================ */
.bookflow-live {
  font-size: 11px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.bookflow-live::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: bfPulse 1.6s ease-in-out infinite;
}
@keyframes bfPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
.bf-row { cursor: pointer; }
.bf-row:hover { background: var(--gray-50); }
.bf-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 4px;
  font-weight: 500;
}
.bf-platform-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  text-transform: capitalize;
  background: var(--gray-100); color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.bf-platform-badge[data-platform="zoho"]   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.bf-platform-badge[data-platform="tally"]  { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.bf-platform-badge[data-platform="excel"]  { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.bf-fail-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
}
.bf-view-btn {
  background: none; border: none; color: var(--primary);
  cursor: pointer; font: inherit; font-size: 12.5px; padding: 0;
}
.bf-view-btn:hover { text-decoration: underline; }

/* Drawer — progress + tabs */
.bf-progress-section { padding-top: 14px; padding-bottom: 14px; }
.bf-progress-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.bf-progress-cell {
  background: var(--gray-50);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}
.bf-progress-num {
  font-size: 18px; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.bf-progress-num.danger { color: var(--danger); }
.bf-progress-lbl {
  font-size: 10.5px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 4px;
}
.bf-meta-row {
  margin-top: 12px;
  font-size: 12px; color: var(--text-muted);
  display: flex; gap: 4px; flex-wrap: wrap;
}
.bf-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.bf-tab {
  background: none; border: none;
  padding: 8px 12px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.bf-tab:hover { color: var(--text); }
.bf-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.bf-tab-count {
  display: inline-block;
  min-width: 18px; padding: 0 5px;
  background: var(--gray-100); color: var(--text-muted);
  border-radius: 999px;
  font-size: 10.5px;
  margin-left: 4px;
}
.bf-tab.active .bf-tab-count { background: var(--primary-soft); color: var(--primary-text); }

.bf-entries-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.bf-entries-table th, .bf-entries-table td {
  padding: 7px 8px; text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.bf-entries-table th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint);
}
.bf-entry-row { cursor: pointer; }
.bf-entry-row:hover { background: var(--gray-50); }
.bf-entries-table td code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px; color: var(--text-muted);
}
.bf-src {
  max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bf-payload {
  background: var(--gray-50);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  white-space: pre-wrap; word-break: break-word;
  margin: 6px 0 4px; max-height: 280px; overflow: auto;
  color: var(--gray-700);
}
.bf-error-block {
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.bf-error-label {
  font-size: 11px; font-weight: 600;
  color: var(--danger);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.bf-error-msg {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px; color: var(--gray-800);
  white-space: pre-wrap; word-break: break-word;
}
.bf-approval-summary {
  padding: 10px 12px;
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--warning);
}
.bf-notes {
  background: var(--gray-50);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: 12.5px; color: var(--text);
  margin: 0;
}
.bf-footer-section {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.bf-faint { color: var(--text-faint); font-size: 12px; }
.bf-rerun-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   v0.9.0 — Chat tab (LLM gateway)
   ============================================================ */

#view-chat { padding: 0; }
.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 0;
  height: calc(100vh - 220px);
  min-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border-soft);
  background: var(--gray-50);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-head {
  display: flex; gap: 6px; padding: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-sidebar-head .chat-new-btn { flex: 1; }
.chat-settings-btn { padding: 6px 10px; font-size: 14px; }
.chat-session-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-session-item {
  position: relative;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.12s;
}
.chat-session-item:hover { background: var(--gray-150); }
.chat-session-item.active { background: var(--brand-blue-soft); border: 1px solid var(--brand-blue-border); }
.chat-session-title {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-right: 18px;
}
.chat-session-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.chat-session-del {
  position: absolute; right: 8px; top: 8px;
  width: 18px; height: 18px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-faint); font-size: 16px; line-height: 1;
  border-radius: 4px;
}
.chat-session-del:hover { color: var(--danger, #dc2626); background: var(--gray-200); }
.chat-empty { padding: 16px; color: var(--text-faint); font-size: 12.5px; text-align: center; }

.chat-main {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.chat-topbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-title { font-weight: 600; font-size: 14px; color: var(--text); }
.chat-meta  { font-size: 11px; color: var(--text-faint); margin-top: 2px; font-variant-numeric: tabular-nums; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.chat-welcome {
  text-align: center; color: var(--text-faint);
  margin: 30px auto; max-width: 480px;
}
.chat-welcome h2 { font-size: 22px; color: var(--text); margin: 0 0 8px 0; }
.chat-welcome ul { display: inline-block; text-align: left; margin-top: 12px; font-size: 13px; }

.chat-msg { display: flex; flex-direction: column; max-width: 88%; }
.chat-msg-user { align-self: flex-end; }
.chat-msg-assistant { align-self: flex-start; max-width: 100%; }
.chat-msg-body {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px; line-height: 1.5; color: var(--text);
}
.chat-msg-user .chat-msg-body {
  background: var(--brand-blue);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg-user .chat-msg-body p { margin: 0; }
.chat-msg-assistant .chat-msg-body {
  background: var(--gray-50);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
}
.chat-msg-assistant.chat-msg-streaming .chat-msg-body {
  border-color: var(--brand-blue-border);
  box-shadow: 0 0 0 2px var(--brand-blue-soft);
}
.chat-text p { margin: 0 0 8px 0; }
.chat-text p:last-child { margin-bottom: 0; }
.chat-msg-meta {
  margin-top: 6px;
  font-size: 11px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.chat-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--danger-soft, #fee2e2);
  border: 1px solid var(--danger-border, #fecaca);
  border-radius: var(--radius-sm);
  color: var(--danger, #b91c1c);
  font-size: 12.5px;
}

.chat-toolcall, .chat-toolresult {
  margin-top: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  overflow: hidden;
}
.chat-toolcall summary, .chat-toolresult summary {
  padding: 6px 10px;
  cursor: pointer; user-select: none;
  font-size: 12.5px; color: var(--text);
}
.chat-toolresult-error { background: #fef2f2; border-color: #fecaca; }
.chat-tool-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-text);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  margin-right: 6px;
}
.chat-tool-pill.ok  { background: var(--success-soft); color: var(--success); }
.chat-tool-pill.err { background: #fee2e2; color: #b91c1c; }
.chat-tool-json {
  margin: 0;
  padding: 8px 10px;
  background: white;
  border-top: 1px solid var(--border-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  max-height: 280px; overflow: auto;
}
.md-pre {
  background: var(--gray-100); padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; white-space: pre-wrap; word-break: break-word;
  margin: 6px 0;
}
.md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; background: var(--gray-100);
  padding: 1px 4px; border-radius: 3px;
}

.chat-runcard {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  margin: 6px 0;
  background: var(--brand-blue-soft);
  border: 1px solid var(--brand-blue-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--brand-blue-text);
}
.chat-runcard:hover { background: white; }
.chat-runcard-icon { font-size: 14px; }
.chat-runcard-title { display: block; font-weight: 600; font-size: 12.5px; }
.chat-runcard-sub { display: block; font-size: 11px; color: var(--brand-blue-deep); }

.chat-input-bar {
  display: flex; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}
#chat-input {
  flex: 1; resize: none;
  padding: 8px 10px;
  font-size: 14px; font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px; max-height: 200px;
}
#chat-input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 2px var(--brand-blue-soft); }

.chat-rail {
  border-left: 1px solid var(--border-soft);
  background: var(--gray-50);
  padding: 14px;
  overflow-y: auto;
}
.chat-rail-section { margin-bottom: 14px; }
.chat-rail-label {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 3px;
}
.chat-rail-value { font-size: 13px; color: var(--text); font-weight: 500; }
.chat-rail-sub { font-size: 11.5px; color: var(--text-faint); }
.chat-rail-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-rail-tool {
  font-size: 10.5px;
  background: white; border: 1px solid var(--border-soft);
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

/* Settings modal */
.chat-settings-modal { max-width: 520px; width: 90vw; }
.chat-settings-modal h2 { margin-top: 0; }
.chat-settings-form label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-top: 10px;
}
.chat-settings-form input,
.chat-settings-form select {
  display: block; width: 100%;
  padding: 8px 10px; margin-top: 4px;
  font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.cfg-hint { font-weight: 400; color: var(--text-faint); margin-left: 6px; }
.chat-settings-status { margin-top: 10px; font-size: 12px; color: var(--text-faint); min-height: 16px; }
.modal-backdrop#chat-settings-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.5);
  align-items: center; justify-content: center;
}
.modal-backdrop#chat-settings-backdrop.open { display: flex; }

/* ============================================================
   v0.8.0 (refactor) — workflow-run skill badge + extras
   ============================================================ */
.run-skill-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  min-width: 36px; text-align: center;
}
.run-skill-badge[data-skill-color="amber"]   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.run-skill-badge[data-skill-color="violet"]  { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.run-skill-badge[data-skill-color="teal"]    { background: #ccfbf1; color: #115e59; border-color: #99f6e4; }
.run-skill-badge[data-skill-color="indigo"]  { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.run-skill-badge[data-skill-color="slate"]   { background: #e2e8f0; color: #334155; border-color: #cbd5e1; }
.run-skill-badge[data-skill-color="pink"]    { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.run-skill-badge[data-skill-color="neutral"] { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }

.run-kind {
  font-size: 12px; color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* Tighter spacing for the dual-seg row in the Runs view */
#view-runs .view-window-bar .seg { margin-right: 8px; }

/* Chat — active-integrations hint above input bar */
.chat-integrations-hint {
  padding: 4px 18px 0 18px;
  font-size: 11.5px; color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
  background: var(--gray-50);
}
.chat-integrations-hint:empty { display: none; }

/* Chat settings — integrations grid */
.chat-settings-section { margin-top: 10px; }
.chat-settings-section-head {
  font-size: 12px; font-weight: 600;
  color: var(--text); margin-bottom: 4px;
}
.chat-settings-section-sub { font-size: 11.5px; color: var(--text-faint); margin: 0 0 8px 0; }
.cfg-int-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  max-height: 260px; overflow-y: auto;
  padding: 4px;
  background: var(--gray-50); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.cfg-int-card {
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.cfg-int-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-bottom: 4px;
}
.cfg-int-desc { color: var(--text-muted); font-size: 11.5px; line-height: 1.35; }
.cfg-int-meta { color: var(--text-faint); font-size: 10.5px; margin-top: 4px; }
.cfg-int-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  white-space: nowrap;
}
.cfg-int-badge.ok      { background: var(--success-soft); color: var(--success); }
.cfg-int-badge.upgrade { background: var(--brand-blue-soft); color: var(--brand-blue-text); }
.cfg-int-badge.beta    { background: var(--warning-soft); color: var(--warning); }
.cfg-int-badge.planned { background: var(--gray-150); color: var(--text-faint); }

/* Chat settings — skill-sync panel */
.chat-cfg-sync-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px; background: var(--gray-50);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.chat-cfg-sync-meta { flex: 1; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.chat-cfg-sync-meta strong { color: var(--text); }
.chat-cfg-sync-actions { display: flex; flex-direction: column; gap: 4px; }
.chat-cfg-sync-actions button { font-size: 12px; padding: 4px 10px; white-space: nowrap; }
.cfg-sync-status { font-weight: 600; }
.cfg-sync-status.success    { color: var(--success); }
.cfg-sync-status.failed     { color: var(--danger, #b91c1c); }
.cfg-sync-status.no_changes { color: var(--text-faint); }
.cfg-sync-status.pending    { color: var(--warning); }

.chat-cfg-skill-table {
  width: 100%; font-size: 11.5px; border-collapse: collapse;
}
.chat-cfg-skill-table th, .chat-cfg-skill-table td {
  text-align: left; padding: 4px 6px;
  border-bottom: 1px solid var(--border-soft);
}
.chat-cfg-skill-table th {
  font-weight: 600; color: var(--text-faint); text-transform: uppercase;
  font-size: 10.5px;
}
.cfg-src { padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.cfg-src.src-default { background: var(--gray-150); color: var(--text-faint); }
.cfg-src.src-host    { background: var(--brand-blue-soft); color: var(--brand-blue-text); }
.cfg-src.src-firm    { background: var(--success-soft); color: var(--success); }

/* ============================================================
   v0.9.1 — Settings view (Account / Firm / LLM / Integrations / Skills)
   Matches existing flat aesthetic — no gradients, no animations.
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  max-width: 920px;
  margin: 0 auto;
}
.settings-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-self: start;
  position: sticky;
  top: 16px;
}
.settings-subnav-btn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.settings-subnav-btn:hover {
  background: var(--gray-50);
  color: var(--text);
}
.settings-subnav-btn.active {
  background: var(--gray-100, #f1f5f9);
  color: var(--text);
  font-weight: 600;
  border-color: var(--gray-200, #e2e8f0);
}
.settings-main {
  min-width: 0;
}
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}
.settings-section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px 0;
}
.settings-subhead {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 12px 0;
}
.settings-field-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100, #f1f5f9);
}
.settings-field-label {
  width: 160px;
  font-size: 13px;
  color: var(--text-muted);
}
.settings-field-value {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.settings-form input[type="password"],
.settings-form input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--gray-300, #cbd5e1);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: var(--text);
}
.settings-form input[type="password"]:focus,
.settings-form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
}
.settings-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.settings-form-status {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.settings-form-status.error { color: var(--danger, #dc2626); }
.settings-form-status.ok    { color: var(--success, #16a34a); }

/* =========================================================================
   v0.11.0 — Ravya AI Admin
   ========================================================================= */
.settings-field-hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }

.settings-form input[type="url"],
.settings-form input[type="number"],
.settings-form input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border, var(--gray-200));
  border-radius: var(--radius-sm, 6px);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
}
.settings-form input[type="url"]:focus,
.settings-form input[type="number"]:focus,
.settings-form input[type="date"]:focus {
  outline: none;
  border-color: var(--primary, #0d6efd);
}

/* KPI cards */
.admin-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 20px; }
.admin-stat {
  flex: 1 1 130px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, var(--gray-200));
  border-left: 3px solid var(--gray-300, #c8d3e0);
  border-radius: var(--radius, 10px);
  padding: 12px 14px;
}
.admin-stat.ok      { border-left-color: var(--success, #059669); }
.admin-stat.warning { border-left-color: var(--warning, #b45309); }
.admin-stat.danger  { border-left-color: var(--danger, #dc2626); }
.admin-stat.muted   { border-left-color: var(--gray-400, #94a3b8); }
.admin-stat-label { font-size: 12px; color: var(--text-muted); }
.admin-stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }

/* Table helpers */
.admin-empty { text-align: center; color: var(--text-muted); padding: 18px; font-size: 13px; }
.admin-sub { font-size: 11.5px; color: var(--text-muted); }
.admin-fine-print { font-size: 12px; color: var(--text-muted); margin: 10px 2px 0; }
.admin-detail { font-size: 11.5px; color: var(--text-muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-hash { font-size: 11.5px; color: var(--text-muted); }
.admin-row-actions { white-space: nowrap; }

/* Expiry colouring */
.admin-exp-days { font-size: 11px; opacity: 0.8; }
.admin-exp-ok       { color: var(--success, #059669); font-weight: 600; }
.admin-exp-warning  { color: var(--warning, #b45309); font-weight: 600; }
.admin-exp-danger   { color: var(--danger, #dc2626); font-weight: 600; }
.admin-exp-expired  { color: var(--danger, #dc2626); font-weight: 700; text-decoration: line-through; }

/* Status badges */
.admin-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent;
}
.admin-badge.ok     { background: var(--success-soft, #ecfdf5); color: var(--success, #059669); border-color: var(--success-border, #a7f3d0); }
.admin-badge.danger { background: var(--danger-soft, #fef2f2);  color: var(--danger, #dc2626);  border-color: var(--danger-border, #fecaca); }
.admin-badge.muted  { background: var(--gray-100, #f0f4f8);     color: var(--gray-600, #475569); border-color: var(--gray-200, #dde4ed); }

/* Health card */
.admin-health-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, var(--gray-200));
  border-radius: var(--radius, 10px);
  padding: 14px 16px; margin: 8px 0; font-size: 13.5px;
}
.admin-health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray-400, #94a3b8); flex: 0 0 auto; }
.admin-health-dot.ok   { background: var(--success, #059669); box-shadow: 0 0 0 3px var(--success-soft, #ecfdf5); }
.admin-health-dot.warn { background: var(--warning, #b45309); box-shadow: 0 0 0 3px var(--warning-soft, #fffbeb); }
.admin-health-dot.down { background: var(--danger, #dc2626);  box-shadow: 0 0 0 3px var(--danger-soft, #fef2f2); }

/* Issue / upgrade result panel */
.admin-jwt-result {
  margin: 12px 0; padding: 12px; border-radius: var(--radius-sm, 6px);
  background: var(--success-soft, #ecfdf5); border: 1px solid var(--success-border, #a7f3d0);
}
.admin-jwt-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.admin-jwt-label { font-size: 12px; font-weight: 700; color: var(--success, #059669); }
.admin-jwt-result .cmd { word-break: break-all; white-space: pre-wrap; margin: 0; font-size: 11.5px; }
.admin-jwt-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.admin-lic-search { height: auto; }

/* ============================================================
   v0.18.3 — Manage Firms (integrated into Ravya AI Admin)
   ============================================================ */
.afi-pwbox {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #0a2540; color: #fff; border-radius: 8px;
  padding: 9px 12px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 14px; letter-spacing: 0.5px;
  word-break: break-all;
}
.afi-pwbox .btn-link {
  background: rgba(255,255,255,0.16); color: #fff;
  border: none; padding: 4px 9px; border-radius: 5px;
  cursor: pointer; font-size: 11.5px; font-weight: 600;
  text-decoration: none;
}
.afi-pwbox .btn-link:hover { background: rgba(255,255,255,0.28); }

.admin-firms-section .ac-services {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
}
.admin-firms-section .ac-services label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--gray-800, #1f2937); font-weight: 500;
  cursor: pointer;
}

.afi-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.afi-pill.active    { background: var(--success-soft, #ecfdf5); color: var(--success, #047857); }
.afi-pill.suspended { background: #fef3c7; color: #92400e; }
.afi-pill.deleted   { background: var(--danger-soft, #fee2e2); color: var(--danger, #b91c1c); }

/* v0.12 — Run chips on each clients-table row. Click queues a task on the
   operator's local queue server (Ravya's Mac, reached over Tailscale). */
.run-col-header { width: 1%; white-space: nowrap; }
.run-col { white-space: nowrap; }
.run-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  margin: 0 2px;
  padding: 0;
  border: 1px solid var(--primary-border, #c7d2fe);
  background: var(--primary-soft, #eef2ff);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px; line-height: 1;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.run-chip:hover:not(:disabled) {
  background: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
}
.run-chip:active:not(:disabled) { transform: scale(0.95); }
.run-chip:disabled { opacity: 0.55; cursor: progress; }

/* Queue-server header at the top of the Runs view. */
.runs-queue-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.runs-queue-label { font-weight: 600; color: var(--text, #111827); }
.runs-queue-url { font-family: ui-monospace, monospace; word-break: break-all; }
.runs-queue-sep { color: var(--border, #d1d5db); }
.runs-queue-status.ok    { color: var(--success, #059669); font-weight: 600; }
.runs-queue-status.warn  { color: var(--warning, #b45309); font-weight: 600; }
