/* Chestnut Carbon brand — see Brand Guidelines 2026 (color §05, type §04).
   Poppins is the only typeface; self-hosted so the app works offline/LAN. */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url('assets/fonts/poppins-300.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('assets/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/poppins-700.woff2') format('woff2'); }

:root {
  /* Brand palette (hex is authoritative) */
  --cc-midnight: #262338;
  --cc-forest:   #2f4550;
  --cc-powder:   #a5b1c7;
  --cc-sand:     #f2f0e3;
  --cc-white:    #ffffff;
  --cc-autumn:   #d07541;
  --cc-sun:      #f4c158;
  --cc-treetop:  #457e6a;
  --cc-clay:     #c9bfb8;
  --cc-viz-pine: #1e5535;
  --cc-viz-fern: #9db55d;
  --cc-viz-lake: #007a9b;
  --cc-viz-sky:  #83cada;
  --cc-viz-plum: #73495d;
  --cc-viz-ember:#c74a35;
  --cc-powder-30: #e4e8ef;
  --cc-powder-15: #f0f2f6;
  --cc-line:      #d8d4c4;
  --cc-line-cool: #dfe3ea;

  /* App tokens, mapped onto the brand */
  --color-bg: #f2f0e3;
  --color-surface: #ffffff;
  --color-text: #262338;
  --color-accent: #d07541;
  --color-accent-2: #262338;
  --color-divider: #e3e1d3;

  --color-neutral-100: #fafaf5;
  --color-neutral-200: #eeece0;
  --color-neutral-300: #e4e8ef;
  --color-neutral-400: #c9bfb8;
  --color-neutral-500: #a5b1c7;
  --color-neutral-600: #6b6e7e;
  --color-neutral-700: #565271;
  --color-neutral-800: #37384a;
  --color-neutral-900: #262338;

  /* Autumn ramp (secondary accent / calls to action) */
  --color-accent-100: #fcefe7;
  --color-accent-200: #f8dcc9;
  --color-accent-300: #f0bd9c;
  --color-accent-400: #e19a6b;
  --color-accent-500: #d07541;
  --color-accent-600: #bd6535;
  --color-accent-700: #9a4f27;
  --color-accent-800: #6f3818;
  --color-accent-900: #45220d;

  /* Primary action ramp — 800/600/200 are re-set from the chosen theme in app.js */
  --color-accent-2-100: #f0f2f6;
  --color-accent-2-200: #e4e8ef;
  --color-accent-2-300: #cfd5e0;
  --color-accent-2-400: #a5b1c7;
  --color-accent-2-500: #7d8aa6;
  --color-accent-2-600: #565271;
  --color-accent-2-700: #38344c;
  --color-accent-2-800: #262338;
  --color-accent-2-900: #1c1a2b;

  --color-red-100: #f8e4e0;
  --color-red-600: #c74a35;
  --color-red-800: #8a2f20;

  --font-heading: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 13px;
  --space-4: 18px;
  --space-6: 26px;
  --space-8: 35px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-xs: 0 1px 2px rgba(38, 35, 56, 0.06);
  --shadow-sm: 0 2px 6px rgba(38, 35, 56, 0.07);
  --shadow-md: 0 8px 24px rgba(38, 35, 56, 0.09);
  --shadow-lg: 0 20px 48px rgba(38, 35, 56, 0.12);
  --shadow-focus: 0 0 0 3px rgba(69, 126, 106, 0.35);

  --ease-standard: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: #37384a;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.45;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; color: var(--color-text); margin: 0; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

a { color: inherit; }
::selection { background: var(--cc-powder); color: var(--cc-midnight); }
:focus-visible { outline: 2px solid var(--cc-treetop); outline-offset: 2px; }

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

/* ---------- Sidebar ---------- */

.sidebar {
  width: 232px;
  flex: none;
  background: var(--cc-midnight);
  color: var(--cc-sand);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  height: 100vh;
  position: sticky;
  top: 0;
}

.brand { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-8); padding: 0 var(--space-3); }
.brand-mark {
  display: none; width: 34px; height: 34px; border-radius: 8px;
  background: var(--cc-autumn); color: var(--cc-white);
  place-items: center; font-weight: 600; font-size: 16px; flex: none;
}
.brand-text { line-height: 1.1; }
.brand-name { font-weight: 500; font-size: 24px; letter-spacing: -0.02em; color: var(--cc-sand); }
.brand-sub { font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cc-powder); margin-top: 6px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--space-3); border-radius: var(--radius-sm); text-decoration: none;
  color: var(--cc-powder); font-size: 14px; font-weight: 500; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; position: relative;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.nav-link:hover { background: rgba(165, 177, 199, 0.12); color: var(--cc-sand); }
.nav-link.active { background: rgba(165, 177, 199, 0.18); color: var(--cc-white); }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cc-autumn);
}
.nav-link .icon { width: 18px; height: 18px; display: grid; place-items: center; flex: none; }
.nav-link .icon svg { display: block; }
.nav-link .label { flex: 1; }
.nav-divider { height: 1px; background: rgba(165, 177, 199, 0.2); margin: var(--space-3) 0; }

.sidebar-footer { margin-top: auto; padding-top: var(--space-4); }
.fleet-updated { font-size: 10.5px; font-weight: 600; color: var(--cc-powder); text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: var(--space-3); padding: 0 var(--space-3); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-3); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--cc-powder); color: var(--cc-midnight);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-name { font-size: 12.5px; font-weight: 600; line-height: 1.2; color: var(--cc-sand); }
.sidebar .cell-muted { color: var(--cc-powder); }
.sidebar .link-btn { color: var(--cc-powder); }
.sidebar .link-btn:hover { color: var(--cc-sand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Main ---------- */

main { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; padding: var(--space-8) var(--space-8) var(--space-8) 42px; }
.page-header { margin-bottom: var(--space-6); }
.page-header h1 { font-size: 32px; letter-spacing: -0.02em; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }

/* ---------- Cards / surfaces ---------- */

.panel {
  background: var(--color-surface); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-lg); padding: var(--space-6);
  box-shadow: var(--shadow-xs);
}
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat-card { background: var(--color-surface); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-lg); padding: var(--space-4); box-shadow: var(--shadow-xs); }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-neutral-600); margin-bottom: var(--space-2); }
.stat-value { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.02em; font-size: 30px; line-height: 1; margin-bottom: 6px; color: var(--color-text); }
.stat-hint { font-size: 12px; font-weight: 300; color: var(--color-neutral-600); }
.stat-card-clickable { cursor: pointer; transition: box-shadow var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard); }
.stat-card-clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--cc-powder); }

/* Compact variant — smaller cards packed tighter so a row with many items
   (e.g. one per department) fits on one line instead of wrapping. */
.card-row-compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--space-2); margin-bottom: var(--space-6); }
.card-row-compact .stat-card { padding: var(--space-2) var(--space-3); }
.card-row-compact .stat-label { font-size: 9.5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-row-compact .stat-value { font-size: 19px; margin-bottom: 1px; }
.card-row-compact .stat-hint { font-size: 9.5px; }

/* Single-line variant — every card shares one row (never wraps), however
   many there are; labels shrink/wrap instead. */
.card-row-single { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(104px, 1fr); overflow-x: auto; padding-bottom: 2px; }
.card-row-compact.card-row-single { grid-auto-columns: minmax(78px, 1fr); }
.card-row.card-row-single .stat-card { padding: var(--space-3); }
.card-row.card-row-single .stat-label { font-size: 10px; letter-spacing: 0.06em; }
.card-row.card-row-single .stat-value { font-size: 26px; }

/* ---------- Buttons / inputs ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px; border-radius: var(--radius-md); border: 1.5px solid transparent;
  padding: 9px 18px; font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; cursor: pointer;
  background: var(--cc-powder-30); color: var(--cc-midnight); white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}
.btn:hover { transform: translateY(-1px); background: #d6dce8; }
.btn-primary { background: var(--color-accent-2-800); color: var(--cc-white); }
.btn-primary:hover { background: var(--color-accent-2-600); }
.btn-outline { background: transparent; border-color: var(--cc-powder); color: var(--cc-midnight); }
.btn-outline:hover { background: var(--cc-powder-15); border-color: var(--cc-midnight); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--cc-powder-15); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-danger { background: var(--color-red-100); color: var(--color-red-800); }
.btn-danger:hover { background: #f1d3cd; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.input, select.select, textarea.input {
  background: var(--cc-white); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-md);
  padding: 10px 14px; font-size: 13.5px; outline: none; color: #37384a;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.input:focus, select.select:focus { border-color: var(--cc-treetop); box-shadow: var(--shadow-focus); }
.search-input { flex: 1; min-width: 200px; }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-4); }

.pill-toggle { display: inline-flex; background: var(--cc-powder-30); border-radius: 999px; padding: 3px; gap: 2px; }
.pill-toggle button {
  border: none; background: none; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--color-neutral-700);
}
.pill-toggle button.active { background: var(--color-accent-2-800); color: var(--cc-white); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-neutral-600); padding: 10px 12px; border-bottom: 1px solid var(--cc-line-cool); white-space: nowrap;
}
table.data-table td { padding: 12px; border-bottom: 1px solid #eceef3; vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--cc-powder-15); }
table.data-table tbody tr.row-clickable { cursor: pointer; }
table.data-table tbody tr.row-clickable:hover { background: var(--cc-powder-30); }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table th.col-editable { white-space: normal; cursor: grab; background: var(--cc-powder-15); }
table.data-table th.col-editable.dragging { opacity: 0.35; }
.cell-strong { font-weight: 600; color: var(--color-text); }
.cell-muted { color: var(--color-neutral-600); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-green { background: rgba(69, 126, 106, 0.14); color: #2f5d4c; }
.badge-orange { background: rgba(208, 117, 65, 0.16); color: #8a4a24; }
.badge-neutral { background: var(--cc-powder-30); color: #37384a; }
.badge-red { background: rgba(199, 74, 53, 0.12); color: var(--color-red-800); }

/* ---------- Action list (dashboard) ---------- */

.action-status-select {
  border-radius: var(--radius-sm); border: 1px solid var(--cc-line-cool); background: var(--cc-white);
  padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}

/* ---------- Sync provenance (synced / overridden / manual) ---------- */

.sync-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.sync-chip svg { flex: none; }
.sync-chip-on { background: rgba(0, 122, 155, 0.10); color: #00607a; }
.sync-chip-lock { background: rgba(208, 117, 65, 0.16); color: #8a4a24; }
.sync-chip-differs { background: rgba(244, 193, 88, 0.25); color: #7a5a12; }
.sync-chip-manual { background: var(--cc-powder-30); color: var(--color-neutral-600); }
.sync-mark { display: inline-flex; vertical-align: middle; margin-left: 4px; color: #00607a; cursor: help; text-transform: none; letter-spacing: 0; }
.sync-mark-differs { color: #b8860b; }
.sync-mark-lock { color: #a35a2e; }
.sync-hint { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: #00607a; margin-top: 2px; }
.sync-hint-differs { color: #7a5a12; }
.sync-hint-lock { color: #8a4a24; }
table.sync-table td, table.sync-table th { padding: 7px 10px; font-size: 13px; }
.sync-panel-compact { border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px; }


/* ---------- AI drill-downs & sources ---------- */

.drill-value { font-size: 22px; font-weight: 600; color: var(--color-text); margin-bottom: 12px; }
.drill-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; padding: 12px 14px; background: var(--cc-powder-15); border-radius: var(--radius-sm); }
@media (max-width: 760px) { .drill-meta { grid-template-columns: 1fr; } }
.drill-sources { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.src-line { font-size: 11.5px; color: var(--color-neutral-600); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--cc-line-cool); }
.viz-click { cursor: pointer; }
.viz-click:hover .viz-bar { opacity: 0.75; }
div.row-clickable { cursor: pointer; }
div.row-clickable:hover { background: var(--cc-powder-15); }
.holder-add { display: grid; grid-template-columns: 1.3fr 1.3fr 0.8fr auto; gap: 8px; margin-top: 10px; align-items: center; }
@media (max-width: 760px) { .holder-add { grid-template-columns: 1fr; } }

/* ---------- Charts (AI usage, Copilot) ---------- */

.viz-chart { width: 100%; height: auto; display: block; }
.viz-chart .viz-grid { stroke: #ecebe6; stroke-width: 1; }
.viz-chart .viz-axis { font-size: 10.5px; fill: #898781; }
.viz-chart .viz-axis-strong { fill: var(--color-text); font-weight: 600; }
.viz-chart .viz-label { font-size: 11px; font-weight: 600; fill: var(--color-text); }
.viz-chart .viz-bar:hover { opacity: 0.82; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--color-neutral-600); margin-top: 6px; }
.viz-legend i, .viz-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }
.delta-good { color: #2f5d4c; font-weight: 600; }
.delta-bad { color: var(--color-red-600); font-weight: 600; }
.report-summary { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; line-height: 1.5; max-width: 90ch; }
.report-two { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .report-two { grid-template-columns: 1fr; } }

@media print {
  .sidebar, .no-print, .toast, #modal-root { display: none !important; }
  body, main { background: #fff !important; overflow: visible !important; height: auto !important; }
  #app { display: block !important; }
  main { padding: 0 !important; }
  .panel, .stat-card { box-shadow: none !important; break-inside: avoid; }
  .card-row { break-inside: avoid; }
}

/* ---------- Task spreadsheet ---------- */

.sheet-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); background: var(--cc-white); }
.sheet-wrap.sheet-compact { max-height: 420px; }
table.sheet-table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.sheet-compact table.sheet-table { min-width: 560px; }
table.sheet-table th {
  position: sticky; top: 0; z-index: 1; background: var(--cc-powder-15); text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-neutral-600); padding: 8px 10px;
  border-bottom: 1px solid var(--cc-line-cool); border-right: 1px solid var(--cc-line-cool); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.sheet-table td { padding: 6px 10px; border-bottom: 1px solid #eceef3; border-right: 1px solid #eceef3; vertical-align: middle; height: 38px; }
table.sheet-table th:last-child, table.sheet-table td:last-child { border-right: none; }
table.sheet-table tbody tr { cursor: pointer; }
table.sheet-table tbody tr:nth-child(even) td { background: #fafbfc; }
table.sheet-table tbody tr:hover td { background: var(--cc-powder-30); }
table.sheet-table tbody tr.sheet-selected td { background: #e8eef7; }
table.sheet-table tbody tr.sheet-done td { color: var(--color-neutral-600); }
table.sheet-table tbody tr.sheet-done td.cell-strong { text-decoration: line-through; font-weight: 500; }
.sheet-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-rownum { text-align: center !important; color: var(--color-neutral-600); font-size: 11.5px; background: var(--cc-powder-15) !important; }
.sheet-check { text-align: center !important; }
.sheet-sortable { cursor: pointer; user-select: none; }
.sheet-sortable:hover { color: var(--color-text); }
.sheet-overdue { color: var(--color-red-600); font-weight: 600; }
table.sheet-table .action-status-select { padding: 3px 6px; font-size: 12px; width: 100%; }
.sheet-bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; background: var(--cc-powder-30); border-radius: var(--radius-sm); }

.team-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; max-height: 160px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); }
.team-check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400 !important; cursor: pointer; }
.sw-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.sw-tags-cell { min-width: 150px; }
.tag-dropdown { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border: 1px solid transparent; background: none; border-radius: var(--radius-sm); padding: 2px 4px; cursor: pointer; font: inherit; text-align: left; }
.tag-dropdown:hover, .tag-dropdown:focus-visible { border-color: var(--cc-line-cool); background: var(--cc-powder-30); }
.tag-caret { color: #4b5563; margin-left: 2px; flex: none; }
.tag-menu { position: fixed; z-index: 2000; min-width: 200px; max-height: 320px; overflow-y: auto; background: var(--cc-surface, #fff); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 4px; }
.tag-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: none; padding: 6px 8px; border-radius: 4px; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.tag-menu-item:hover { background: var(--cc-powder-30); }
.tag-menu-check { width: 14px; text-align: center; font-size: 12px; }
.tag-menu-sep { height: 1px; background: var(--cc-line-cool); margin: 4px 0; }
.tag-menu-note { padding: 4px 8px 6px; font-size: 11.5px; color: var(--color-neutral-600); }
.sw-teams-wrap { display: inline-block; }
.sw-people { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; font-size: 13px; }
.sw-person { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.sw-person-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.sw-review-bar { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--cc-line-cool); flex-wrap: wrap; }
.sw-review-progress { display: flex; align-items: center; gap: 16px; padding: 12px 14px; margin-bottom: 14px; background: var(--cc-powder-15); border-radius: var(--radius-sm); }
.hist-table td { padding: 4px 6px !important; }
.hist-table .input-sm, .hist-table .select { width: 100%; padding: 5px 7px; font-size: 12.5px; }
.personal-note { font-size: 13px; background: #fff4e6; border: 1px solid #f0d9a8; border-radius: var(--radius-sm); padding: 10px 12px; margin: -6px 0 16px; }
.task-items-check { list-style: none; padding-left: 0; }
.task-items-check li.item-done { color: var(--color-neutral-600); text-decoration: line-through; }
.item-tick { color: #2f5d4c; font-weight: 700; display: inline-block; width: 16px; text-decoration: none; }
.item-open { color: #b5651d; display: inline-block; width: 16px; }
.item-manual { color: var(--color-neutral-600); display: inline-block; min-width: 16px; margin-right: 2px; font-size: 11.5px; }
.sheet-go { padding: 3px 8px !important; font-size: 12px !important; white-space: nowrap; }
.task-banner { position: sticky; top: 0; z-index: 5; background: #fff8ec; border: 1px solid #f0d9a8; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; box-shadow: var(--shadow-xs); }
.task-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 18px; padding: 12px 14px; background: var(--cc-powder-15); border-radius: var(--radius-sm); font-size: 13.5px; }
.task-meta-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-600); margin-bottom: 4px; }
.task-items { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.task-note-new textarea { width: 100%; resize: vertical; font-family: inherit; }
.task-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.task-note { padding: 10px 12px; border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(38, 35, 56, 0.55); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: var(--space-4);
}
.modal {
  background: var(--color-surface); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-lg); padding: var(--space-6); width: 100%;
  max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal.modal-wide { max-width: 920px; }
.modal h2 { font-size: 22px; margin-bottom: var(--space-4); }
.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--space-3); }
.form-row label { font-size: 12.5px; font-weight: 500; color: var(--color-text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

/* ---------- Misc ---------- */

.empty-state { text-align: center; padding: var(--space-8) var(--space-4); color: var(--color-neutral-600); font-weight: 300; }
.section-title { font-size: 11.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-neutral-600); margin-bottom: var(--space-3); }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-4); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.spend-bar-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 0; }
.spend-bar-label { width: 130px; flex: none; font-size: 13px; font-weight: 600; }
.spend-bar-track { flex: 1; height: 8px; background: var(--cc-powder-30); border-radius: 999px; overflow: hidden; }
.spend-bar-fill { height: 100%; background: var(--cc-treetop); border-radius: 999px; }
.spend-bar-value { width: 90px; flex: none; text-align: right; font-size: 13px; font-weight: 600; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--cc-midnight); color: var(--cc-sand);
  padding: 11px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  z-index: 200; opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.link-btn { background: none; border: none; color: var(--cc-treetop); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; transition: color var(--dur-fast) var(--ease-standard); }
.link-btn:hover { color: var(--cc-forest); text-decoration: underline; text-underline-offset: 2px; }
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--cc-line); margin-bottom: var(--space-4); }
.tab-btn { background: none; border: none; padding: 10px 6px; font-size: 14px; font-weight: 500; color: var(--color-neutral-600); cursor: pointer; border-bottom: 2px solid transparent; margin-right: var(--space-4); margin-bottom: -1px; }
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-text); font-weight: 600; border-bottom-color: var(--cc-autumn); }
.footnote { font-size: 12px; font-weight: 300; color: var(--color-neutral-600); margin-top: var(--space-4); }
.checkbox-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.checkbox-swatch.selected { border-color: var(--color-text); box-shadow: 0 0 0 2px var(--cc-white) inset; }
.swatch-row { display: flex; gap: var(--space-2); }

.ai-import-map { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.ai-import-map .select-xs { width: 100%; }
table.ai-pricing td { padding: 6px 8px; }
table.ai-pricing .input { width: 96px; padding: 6px 8px; }

/* AI Usage overview sections */
.cost-tool { display: flex; flex-direction: column; }
.cost-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cost-figs > div { padding: 10px 12px; border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); }
.cost-figs .stat-value { font-size: 22px; }
table.cost-lines td { padding: 6px 8px; font-size: 13px; }
/* Resizable columns: a handle on each header's right edge (↔ cursor). */
table th { position: relative; }
.col-resizer { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; z-index: 3; user-select: none; }
.col-resizer::after { content: ''; position: absolute; top: 22%; bottom: 22%; right: 3px; width: 2px; border-radius: 1px; background: transparent; transition: background var(--dur-fast) var(--ease-standard); }
th:hover .col-resizer::after { background: var(--cc-line-cool); }
.col-resizer:hover::after, body.col-resizing .col-resizer::after { background: var(--color-accent-2-600); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }
table.rz-fixed { table-layout: fixed; }
table.rz-fixed td, table.rz-fixed th { overflow-wrap: anywhere; }
table.rz-fixed th { white-space: normal; }

/* AI tab overview: one table of reports, grouped by section headings. */
table.ai-reports { table-layout: fixed; }
table.ai-reports tr.ai-sec td, table.checklist tr.ai-sec td { padding: 22px 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-neutral-600); border-bottom: 1px solid var(--cc-line-cool); }
table.ai-reports tr.ai-sec:first-child td, table.checklist tr.ai-sec:first-child td { padding-top: 8px; }
table.ai-reports tr.ai-sec td span { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* Dashboard overview: section headings in the brand accent (Autumn). */
table.dash-overview tr.ai-sec td { color: var(--color-accent-600); border-bottom-color: var(--color-accent-200); }
table.dash-overview tr.ai-sec td span { color: var(--color-neutral-600); }
table.ai-reports tr.ai-sec:hover, table.checklist tr.ai-sec:hover { background: none; }
table.ai-reports td { padding: 14px 12px; }
table.ai-reports td.ai-fig { font-family: var(--font-heading); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.ai-reports td.ai-open { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--color-neutral-600); white-space: nowrap; }
table.ai-reports tr.row-clickable:hover td.ai-open { color: var(--color-text); }
@media (max-width: 640px) {
  table.ai-reports { table-layout: auto; }
  table.ai-reports td.ai-open, table.ai-reports tr.row-clickable td:nth-child(3) { display: none; }
}
.ai-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 10px; vertical-align: 1px; background: var(--cc-line-cool); }
.insights { list-style: none; margin: 0; padding: 0; }
.insights li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--color-divider); font-size: 13.5px; line-height: 1.45; }
.insights li:last-child { border-bottom: none; }
.insights .badge { flex: none; min-width: 64px; text-align: center; }
/* AI Usage: compact metric tiles that open the full report */
.snap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.snap-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.snap-tile { padding: 10px 12px; border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm); }
.snap-val { font-family: var(--font-heading); font-weight: 600; font-size: 20px; line-height: 1.1; margin: 2px 0 4px; }
.adopt-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.adopt-label { width: 170px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adopt-val { width: 120px; flex: none; text-align: right; font-weight: 600; font-size: 12.5px; }
@media (max-width: 760px) { .cost-figs { grid-template-columns: 1fr; } .adopt-label { width: 110px; } }

.two-col.two-even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) {
  .two-col, .two-col.two-even, .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Report builder ---------- */

/* A fixed 6-column grid so widget "size" (span 2/3/6) is predictable —
   dense packing lets smaller cards fill gaps left by wider ones instead
   of leaving blank space. */
.report-canvas { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; grid-auto-flow: dense; }
.report-card {
  position: relative; overflow: hidden;
  background: var(--color-surface); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-4) var(--space-4);
  box-shadow: var(--shadow-xs); grid-column: span 2; min-width: 0;
}
/* The brand's folded-edge motif — a turning-leaf corner on feature cards. */
.report-card::after {
  content: ''; position: absolute; top: 0; right: 0; width: 28px; height: 28px; pointer-events: none;
  background: var(--cc-powder-30); clip-path: polygon(100% 0, 0 0, 100% 100%);
  box-shadow: -1px 1px 2px rgba(38, 35, 56, 0.12);
}
.report-card.editing::after { display: none; }
.report-card.editing { cursor: grab; outline: 1px dashed var(--cc-powder); outline-offset: 2px; }
.report-card-clickable { cursor: pointer; transition: box-shadow var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard); }
.report-card-clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.report-card.size-md { grid-column: span 3; }
.report-card.size-lg { grid-column: span 6; }
.report-card.dragging { opacity: 0.35; }
.size-btn-group { display: inline-flex; gap: 2px; flex: none; margin-right: 4px; }
.size-btn-group .icon-btn { width: 24px; font-size: 10px; font-weight: 700; }
.size-btn-group .icon-btn.active { background: var(--color-accent-2-800); color: var(--cc-white); }

@media (max-width: 720px) {
  .report-canvas { grid-template-columns: 1fr; }
  .report-card, .report-card.size-md, .report-card.size-lg { grid-column: auto; }
}
.report-card-head { display: flex; align-items: center; gap: 4px; margin-bottom: var(--space-2); padding-right: 22px; }
.report-card.editing .report-card-head { padding-right: 0; }
.drag-handle { color: var(--cc-powder); font-size: 13px; cursor: grab; flex: none; line-height: 1; }
.icon-btn {
  border: none; background: none; width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  color: var(--color-neutral-600); font-size: 13px; flex: none; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--cc-powder-30); color: var(--color-text); }

.report-card-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-3); }

/* Onboarding / offboarding checklists (person page). */
.checklist-start { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 16px; font-size: 13px; }
.cl-step { display: flex; align-items: flex-start; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--color-divider); font-size: 13px; }
.cl-step:last-of-type { border-bottom: none; }
.cl-box { width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1.5px solid var(--cc-powder); background: var(--cc-white); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--cc-white); padding: 0; cursor: pointer; margin-top: 1px; }
button.cl-box:hover { border-color: var(--cc-treetop); }
.cl-step.is-done .cl-box { background: var(--cc-treetop); border-color: var(--cc-treetop); }
.cl-step.is-na .cl-box { background: var(--cc-powder-30); border-color: var(--cc-powder); color: var(--color-neutral-600); }
.cl-label { flex: 1; min-width: 0; color: var(--color-text); }
.cl-step.is-done .cl-label, .cl-step.is-na .cl-label { color: var(--color-neutral-600); }
.cl-step.is-na .cl-label { text-decoration: line-through; }
.cl-meta { font-size: 11.5px; color: var(--color-neutral-600); }
.cl-meta:empty { display: none; }
.cl-na { font-size: 12px; flex: none; }
.select-xs {
  background: var(--cc-white); border: 1px solid var(--cc-line-cool); border-radius: var(--radius-sm);
  padding: 4px 10px; font-size: 11.5px; font-weight: 500; outline: none; cursor: pointer; color: var(--color-neutral-800);
}
.select-xs:focus { border-color: var(--cc-treetop); box-shadow: var(--shadow-focus); }

.report-dimensions { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-3); }

/* Metric / Stat widgets — one big number + a hint line, same typography
   as the old fixed KPI stat cards. */
.metric-widget-value { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.02em; font-size: 30px; line-height: 1; margin-bottom: 6px; color: var(--color-text); }
.metric-widget-hint { font-size: 12px; font-weight: 300; color: var(--color-neutral-600); }
.report-filters { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-3); }
.filter-row { display: flex; align-items: center; gap: 6px; }
.filter-row .select-xs { flex: none; }

@media (max-width: 860px) {
  main { padding: var(--space-4); }
}

@media (max-width: 640px) {
  .sidebar { width: 64px; padding: var(--space-4) var(--space-2); align-items: center; }
  .brand { justify-content: center; padding: 0; }
  .brand-mark { display: grid; }
  .brand-text, .nav-link .label, .fleet-updated, .user-name { display: none; }
  .nav-link { justify-content: center; padding: 10px 0; }
  .user-chip { justify-content: center; padding: 0; }
  main { padding: var(--space-3); }
}
