* {
  box-sizing:border-box
}

/* Tabular figures everywhere — keeps numeric columns aligned regardless
   of digit width. Inherited; individual rules can opt out if needed. */
body {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* Page-level scrollbar — hidden by default, scrolling still works.
   Firefox: scrollbar-width: none.  Chromium/Safari: zero-size webkit
   scrollbar.  Applied to html/body so admin + dashboard get it. The
   metrics drawer keeps its own scrollbar so users can see how much
   of the metrics list they have left. */
html, body {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* Old Edge / IE */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* ==========================================
   KPI SKELETON (loading placeholders)
   Rendered server-side inside #kpi-container so the user sees shimmering
   blocks immediately while client JS hydrates the real cards.
   updateKpiCards() replaces innerHTML on DOMContentLoaded, so the
   skeletons vanish automatically once data is ready.
   ========================================== */
@keyframes skel-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.kpi-skel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: 20px;
  min-height: 180px;
}
.kpi-skel-bar {
  background: linear-gradient(90deg, var(--surface-hover) 0%, var(--surface-alt) 50%, var(--surface-hover) 100%);
  background-size: 800px 100%;
  animation: skel-shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
  height: 14px;
  margin-bottom: 12px;
}
.kpi-skel-bar-lg {
  height: 30px;
  width: 60%;
  margin-bottom: 18px;
}
.kpi-skel-bar-sm { height: 12px; width: 85%; }
.kpi-skel-bar-xs { height: 10px; width: 50%; margin-bottom: 18px; }

/* Version stamp — small dot in the top-right of .hero. Default cursor
   (no question mark). On hover, a custom dark tooltip slides in. */
.hero { position: relative; }

.hero-version {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  cursor: default;
  transition: background 0.15s ease;
}
.hero-version:hover {
  background: rgba(255,255,255,0.7);
}

.hero-version-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 18px;
  right: 0;
  background: var(--stoked-dark);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.15s;
  pointer-events: none;
  letter-spacing: 0.03em;
}
.hero-version:hover .hero-version-tip {
  visibility: visible;
  opacity: 1;
}

/* ==========================================
   DATASET TOGGLE (IFM Monthly / MMM Weekly)
   Sits in the hero, next to the date picker.
   Click reloads the page with ?dataset=KEY.
   ========================================== */
.dataset-toggle {
  display: inline-flex;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  /* Match the period picker's min-width so the two rows in the hero
     align on both their left edge (label) and right edge (control). */
  min-width: 140px;
  justify-content: center;
}
.dataset-btn {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  outline: none;
}
.dataset-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.dataset-btn.active {
  background: #fff;
  color: var(--stoked-dark);
  cursor: default;
}

/* Date picker — show only items that match the active band toggles.
   When body.hide-prev (or hide-actual / hide-forecast) is set, the
   matching .band-X items in the picker disappear. Mirrors the table
   column visibility behavior. */
body.hide-prev .month-picker-panel .month-item.band-prev,
body.hide-actual .month-picker-panel .month-item.band-actual,
body.hide-forecast .month-picker-panel .month-item.band-forecast {
  display: none !important;
}

/* ==========================================
   OPTIONS BUTTON + PANEL (View / Show toggles)
   ========================================== */
.table-options {
  position: relative;
  pointer-events: auto;
}
.table-options-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--stoked-dark);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.15s;
  outline: none;
}
.table-options-btn:hover {
  background: var(--surface-alt);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.table-options-btn.open {
  background: var(--stoked-blue);
  color: #fff;
}
.table-options-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.08);
  z-index: 1200;
  padding: 10px 12px;
  flex-direction: column;
  gap: 8px;
}
/* Sized to content — let the panel be just as wide as the buttons inside. */
.table-options-panel .tox-section { gap: 6px; }
.table-options-panel .tox-section-title { font-size: 10px; }
.table-options-panel .granularity-control .seg-btn { padding: 6px 14px; font-size: 12px; }
/* Invisible bridge between button and panel — prevents the hover from
   breaking as the mouse crosses the 8px gap. */
.table-options-panel::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}
/* Open on hover (primary interaction) or via .open class (click fallback,
   still works for touch / keyboard). */
.table-options-panel.open,
.table-options:hover .table-options-panel {
  display: flex;
  animation: fadeIn 0.15s ease;
}
.table-options:hover .table-options-btn {
  background: var(--stoked-blue);
  color: #fff;
}
.tox-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tox-section-title {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.granularity-control {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.granularity-control .seg-btn {
  padding: 8px 20px;
}
.band-check-group {
  display: inline-flex;
  gap: 4px;
  align-items: flex-start;
  padding: 4px 0;
}
.band-check {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  min-width: 56px;
}
.band-check:hover {
  background: rgba(31,119,180,0.08);
}
.band-check-box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--stoked-blue);
  border-radius: 3px;
  background: #fff;
  transition: background 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.band-check.active .band-check-box {
  background: var(--stoked-blue);
  box-shadow: 0 2px 4px rgba(31,119,180,0.3);
}
.band-check-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stoked-dark);
  line-height: 1;
}
/* Annual view ignores band toggles — yearly columns are atomic */
body.view-annual .band-check-group {
  opacity: 0.45;
  pointer-events: none;
}

/* ==========================================
   PERIOD COLUMN VISIBILITY (driven by body classes)
   View: which TIER of columns is visible
   Show: which BAND (prev/actual/forecast) within that tier
   ========================================== */
table.model.period-view .col-blank {
  display: none !important;
}
body.view-annual table.model.period-view .col-monthly,
body.view-annual table.model.period-view .col-quarterly {
  display: none !important;
}
body.view-quarterly table.model.period-view .col-monthly,
body.view-quarterly table.model.period-view .col-yearly {
  display: none !important;
}
body.view-monthly table.model.period-view .col-quarterly,
body.view-monthly table.model.period-view .col-yearly {
  display: none !important;
}
/* Weekly view (MMM dataset) — same column visibility as Monthly. The
   underlying columns are still tagged col-monthly by the classifier
   because they live in the sheet's "monthly" section; calling the view
   "Weekly" is a UI label only. */
body.view-weekly table.model.period-view .col-quarterly,
body.view-weekly table.model.period-view .col-yearly {
  display: none !important;
}
body.hide-prev .col-band-prev {
  display: none !important;
}
body.hide-actual .col-band-actual {
  display: none !important;
}
body.hide-forecast .col-band-forecast {
  display: none !important;
}
/* Annual view ignores Show toggles — yearly cells are atomic, so hiding
   "Prev" or "Forecast" would blank the table out. Higher specificity than
   the band rules above, so this wins. */
body.view-annual table.model.period-view .col-yearly {
  display: table-cell !important;
}

/* ==========================================
   MONTH PICKER (custom dropdown)
   Replaces the native <select> in the hero bar.
   ========================================== */
.month-picker {
  position: relative;
  display: inline-block;
}

.month-picker-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 8px 14px 8px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.month-picker-btn:hover {
  background: rgba(255,255,255,0.12);
}

.month-picker-btn:focus-visible {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.month-picker-year {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.02em;
}
/* Small year subtitle under weekly column headers (Mar-07 / 2025).
   Block-level so it sits on a second line, very compact. */
.header-year {
  display: block;
  font-size: 9px;
  font-weight: 400;
  opacity: 0.55;
  letter-spacing: 0.05em;
  margin-top: 1px;
  line-height: 1;
}
.month-picker-caret {
  font-size: 10px;
  opacity: 0.8;
  transition: transform 0.15s ease;
}

.month-picker.open .month-picker-caret {
  transform: rotate(180deg);
}

.month-picker-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  max-height: 360px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 24px -6px rgba(0,0,0,0.25), 0 4px 8px -4px rgba(0,0,0,0.1);
  padding: 6px;
  z-index: 1000;
  animation: monthPickerIn 0.15s ease;
}

@keyframes monthPickerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.month-year-label {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--stoked-dark);
  text-transform: uppercase;
  padding: 10px 12px 6px;
  position: sticky;
  top: -6px;
  background: #fff;
  z-index: 1;
}

.month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.month-item:hover {
  background: var(--surface-hover);
}

.month-item.forecast {
  font-style: italic;
  color: var(--forecast-text);
}

.month-item.selected {
  background: var(--surface-blue-soft);
  color: var(--stoked-blue);
  font-weight: 700;
}

.month-item.selected:hover {
  background: var(--surface-blue-softer);
}

.month-item-badge {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--line);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-style: normal;
}

.month-item.selected .month-item-badge {
  background: rgba(36,148,198,0.15);
  color: var(--stoked-blue);
}

html,body {
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Inter',sans-serif
}

body {
  padding:24px
}

.app {
  max-width:1800px;
  margin:0 auto;
  position:relative;
  /* Smooth shift when the metrics drawer slides in/out. */
  transition: padding-right 0.25s ease;
}

/* When the metrics drawer is open, push the main dashboard content left
   so cards don't sit behind the 320 px drawer panel. Padding (not margin)
   so .app's centering stays anchored. */
body.drawer-open .app {
  padding-right: 320px;
}

.hero {
  background:var(--stoked-blue);
  color:#fff;
  border-radius:var(--radius);
  padding:24px 32px;
  box-shadow:var(--shadow);
  margin-bottom:24px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px
}

.hero h1 {
  margin:0;
  font-family:'Oswald',sans-serif;
  text-transform:uppercase;
  font-size:36px;
  line-height:1.1;
  font-weight:700;
  letter-spacing:0.03em
}

.hero-controls {
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px
}

.month-selector-group {
  display:flex;
  align-items:center;
  gap:16px;
  /* Force both Model: and Week: rows to the same width so the labels
     align in column 1 and the controls align in column 2, even though
     the toggle and picker have different intrinsic widths. */
  min-width:230px;
  justify-content:flex-start
}

#month-select {
  background:rgba(255,255,255,0.08);
  color:#fff;
  border:1px solid rgba(255,255,255,0.2);
  border-radius:8px;
  padding:8px 16px;
  font-family:inherit;
  font-weight:600;
  font-size:15px;
  cursor:pointer;
  outline:none;
  transition:all 0.2s;
  min-width:140px
}

#month-select option {
  color:#0f172a;
  background:#fff
}

#month-select:hover {
  background:rgba(255,255,255,0.12)
}

#month-select:focus {
  border-color:#fff;
  box-shadow:0 0 0 2px rgba(255,255,255,0.2)
}

.loading {
  font-size:13px;
  color:rgba(255,255,255,0.7);
  display:none;
  font-weight:600
}

.tabs-wrapper {
  border-bottom:2px solid var(--line);
  margin-bottom:20px
}

.tabs-container {
  display:flex;
  gap:32px;
  margin-bottom:-2px
}

.tab-btn {
  background:transparent;
  border:none;
  border-bottom:2px solid transparent;
  padding:10px 4px;
  font-family:'Oswald',sans-serif;
  font-size:16px;
  font-weight:600;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:0.05em;
  cursor:pointer;
  transition:color 0.2s,border-color 0.2s
}

.tab-btn:hover {
  color:var(--stoked-blue)
}

.tab-btn.active {
  color:var(--stoked-blue);
  border-bottom-color:var(--stoked-blue)
}

.tab-panel {
  animation:fadeIn 0.3s ease
}

@keyframes fadeIn {
  from {
    opacity:0;
    transform:translateY(4px)
  }
  to {
    opacity:1;
    transform:translateY(0)
  }
}

.floating-toggle-wrapper {
  position:relative;
  z-index:999;
  display:flex;
  justify-content:flex-end;
  width:100%;
  pointer-events:none;
  margin-bottom:-36px
}

.segmented-control {
  display:inline-flex;
  border:1px solid var(--stoked-blue);
  border-radius:6px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 4px 12px rgba(0,0,0,0.15);
  pointer-events:auto
}

.seg-btn {
  background:transparent;
  color:var(--stoked-blue);
  border:none;
  padding:8px 24px;
  font-size:13px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.05em;
  font-family:'Inter',sans-serif;
  cursor:pointer;
  transition:all 0.2s;
  outline:none
}

.seg-btn.active {
  background:var(--stoked-blue);
  color:#fff
}

.seg-btn:not(.active):hover {
  background:rgba(36,148,198,0.1)
}

.kpi-grid {
  gap:20px;
  margin-bottom:24px
}

.kpi-card {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-1);
  padding:20px;
  min-height:180px;
  transition:transform 0.2s ease,box-shadow 0.2s ease,border-color 0.2s ease;
  cursor:pointer
}

.kpi-card:hover {
  transform:translateY(-2px);
  border-color:var(--line-strong);
  z-index:10;
  position:relative;
  box-shadow:var(--shadow-3)
}

.kpi-card.kpi-negative {
  border-left:3px solid var(--bad)
}

.tooltip-wrap {
  position:relative;
  display:inline-flex;
  cursor:help
}

.tooltip-icon {
  color:var(--muted);
  font-size:10px;
  font-weight:700;
  font-family:monospace;
  flex-shrink:0;
  border:1.5px solid var(--muted);
  border-radius:50%;
  width:16px;
  height:16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:all 0.2s ease
}

.tooltip-wrap:hover .tooltip-icon {
  color:var(--stoked-blue);
  border-color:var(--stoked-blue)
}

.tooltip-text {
  visibility:hidden;
  width:220px;
  background-color:var(--stoked-dark);
  color:#fff;
  text-align:left;
  border-radius:6px;
  padding:10px 14px;
  position:absolute;
  z-index:100;
  bottom:135%;
  left:-20px;
  opacity:0;
  transition:opacity 0.2s;
  font-size:12px;
  font-weight:400;
  font-family:'Inter',sans-serif;
  text-transform:none;
  letter-spacing:normal;
  box-shadow:var(--shadow);
  line-height:1.4
}

.tooltip-text::after {
  content:"";
  position:absolute;
  top:100%;
  left:28px;
  margin-left:-5px;
  border-width:5px;
  border-style:solid;
  border-color:var(--stoked-dark) transparent transparent transparent
}

.tooltip-wrap:hover .tooltip-text,.tooltip-wrap.touch-open .tooltip-text {
  visibility:visible;
  opacity:1
}

.kpi-title {
  display:flex;
  align-items:center;
  gap:6px;
  font-family:'Oswald',sans-serif;
  font-size:15px;
  font-weight:600;
  color:var(--stoked-dark);
  margin-bottom:12px;
  text-transform:uppercase;
  letter-spacing:0.05em
}

.title-text {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  display:inline-block;
  max-width:80%
}

.kpi-value {
  font-size:36px;
  line-height:1;
  font-weight:700;
  letter-spacing:-0.025em;
  color:var(--text);
  font-variant-numeric:tabular-nums
}

.kpi-label {
  font-size:11px;
  color:var(--muted);
  font-weight:600;
  letter-spacing:0.06em;
  text-transform:uppercase;
  margin-bottom:10px;
  border-bottom:1px solid var(--line);
  padding-bottom:8px
}

.comp-row {
  display:grid;
  grid-template-columns:1fr auto 20px auto;
  align-items:center;
  gap:8px;
  padding:6px 0;
  font-size:13px;
  border-bottom:1px solid var(--line)
}

.comp-row:last-child {
  border-bottom:none
}

.comp-name {
  color:var(--muted);
  font-weight:500
}

.comp-base {
  color:var(--text);
  font-weight:600;
  white-space:nowrap
}

.comp-arrow {
  font-size:12px;
  font-weight:700;
  text-align:center;
  line-height:1
}

.comp-value {
  font-weight:700;
  white-space:nowrap;
  text-align:right;
  min-width:50px
}

.up.good,.flat.good,.down.good {
  color:var(--good)
}

.up.bad,.flat.bad,.down.bad {
  color:var(--bad)
}

.viewer-shell {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  padding-top:8px
}

.table-wrap {
  overflow:auto;
  max-height:650px;
  background:#fff
}

table.model {
  border-collapse:separate;
  border-spacing:0;
  min-width:max-content;
  width:100%;
  background:#fff
}

table.model td {
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  padding:10px 20px 10px 12px;
  height:36px;
  min-width:90px;
  font-size:13px;
  white-space:nowrap;
  vertical-align:middle;
  text-align:right;
  background:#fff;
  color:#000!important;
  transition:background-color 0.15s ease,color 0.15s ease,font-weight 0.15s ease
}

table.model td:not(.sheet-gutter):hover {
  font-weight:700!important;
  color:var(--stoked-blue)!important;
  background-color:var(--surface-blue-soft)!important
}

table.model td.sheet-gutter {
  position:sticky;
  left:0;
  z-index:15;
  background:var(--surface-alt)!important;
  border-right:1px solid #dadce0!important;
  padding:0!important;
  width:var(--local-gutter);
  min-width:var(--local-gutter);
  max-width:var(--local-gutter);
  vertical-align:top
}

.gutter-container {
  position:relative;
  width:100%;
  height:100%;
  min-height:36px
}

.sheet-group-box {
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:16px;
  height:16px;
  border:1px solid var(--stoked-blue);
  background:#fff;
  color:var(--stoked-blue);
  font-size:9px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:3;
  user-select:none;
  box-sizing:border-box;
  transition:background 0.15s ease,color 0.15s ease;
  border-radius:3px
}

.sheet-group-box::before {
  content:"";
  display:inline-block;
  width:5px;
  height:5px;
  border-right:2px solid var(--stoked-blue);
  border-bottom:2px solid var(--stoked-blue);
  transform:rotate(45deg);
  transition:transform 0.2s ease,border-color 0.15s ease;
  margin-top:-3px
}

.sheet-group-box:hover::before {
  border-color:#fff
}

.sheet-group-box.collapsed::before {
  transform:rotate(-45deg);
  margin-top:0
}

.sheet-group-box:hover {
  background:var(--stoked-blue)!important;
  color:#fff!important
}

.sheet-group-line-hitbox {
  position:absolute;
  top:0;
  bottom:0;
  width:22px;
  cursor:pointer;
  z-index:2;
  transition:background 0.15s ease
}

.sheet-group-line-hitbox:hover {
  background:rgba(36,148,198,0.12)
}

.sheet-group-line-hitbox::after {
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:10px;
  width:2px;
  background:rgba(36,148,198,0.3);
  transition:all 0.15s ease
}

.sheet-group-line-hitbox:hover::after {
  background:var(--stoked-blue);
  width:3px;
  transform:translateX(-0.5px);
  box-shadow:0 0 4px rgba(36,148,198,0.4)
}

.master-toggle-box {
  position:relative;
  left:auto;
  top:auto;
  transform:none;
  margin-right:8px;
  border-color:rgba(255,255,255,0.8)!important;
  background:transparent!important;
  color:#fff!important
}

.master-toggle-box::before {
  border-color:#fff!important
}

.master-toggle-box.collapsed::before {
  border-color:#fff!important
}

.master-toggle-box:hover {
  background:rgba(255,255,255,0.25)!important;
  border-color:#fff!important;
  color:#fff!important
}

.section-major .sheet-group-box {
  border-color:rgba(255,255,255,0.8)!important;
  background:transparent!important;
  color:#fff!important
}

.section-major .sheet-group-box:hover {
  background:rgba(255,255,255,0.25)!important;
  border-color:#fff!important;
  color:#fff!important
}

table.model td:nth-child(2) {
  position:sticky;
  left:var(--local-gutter);
  z-index:12;
  min-width:var(--sticky-left-width);
  white-space:nowrap;
  text-align:left!important;
  border-right:2px solid var(--line-strong)
}

table.model tr:first-child td {
  position:sticky;
  top:0;
  z-index:20;
  border-bottom:2px solid var(--stoked-dark);
  box-shadow:0 4px 6px -1px rgba(0,0,0,0.1);
  background:var(--stoked-dark)!important;
  color:#fff!important;
  font-weight:600!important;
  text-align:right!important;
  padding-right:12px
}

table.model tr:first-child td.sheet-gutter {
  z-index:25;
  background:var(--stoked-dark)!important;
  border-right:none!important;
  border-bottom:2px solid var(--stoked-dark)!important;
  box-shadow:none!important;
  color:#fff!important
}

table.model tr:first-child td:nth-child(2) {
  z-index:24;
  text-align:left!important;
  background:var(--stoked-dark)!important
}

/* td.active-col formerly added a light-green fill to the
   currently-selected period column. Removed at user request — the
   selected-month context is already clear from the month picker
   above the table. The .active-col class is still applied to cells
   by tables.py:get_cell_class so downstream code/JS that targets
   the selector keeps working; it just has no visual effect now. */

td.forecast-cell {
  background:var(--forecast-bg)!important;
  color:#000!important;
  font-style:italic
}

table.model tr:first-child td.forecast-cell {
  background:var(--forecast-header-bg)!important;
  color:var(--stoked-dark)!important;
  font-style:italic
}

body.hide-forecast .forecast-cell {
  display:none!important
}

.blank {
  color:transparent
}

table.model tr.section-major td {
  background:var(--stoked-blue)!important;
  color:#fff!important;
  font-family:'Oswald',sans-serif;
  font-weight:600!important;
  font-size:15px;
  letter-spacing:0.05em;
  text-transform:uppercase;
  border-top:2px solid var(--primary-mid);
  border-bottom:2px solid var(--primary-mid)
}

table.model tr.section-major td:nth-child(2) {
  background:var(--primary-mid)!important;
  color:#fff!important
}

table.model tr.section-major:hover td {
  background:var(--primary-mid)!important;
  color:#fff!important
}

table.model tr.section-major td.sheet-gutter {
  background:var(--stoked-blue)!important;
  border-right:none!important;
  border-top:none!important;
  border-bottom:none!important;
  color:#fff!important
}

table.model tr.section-major:hover td.sheet-gutter {
  background:var(--primary-mid)!important
}

table.model tr.section-sub td {
  background:var(--sub-bg, var(--sub-header-bg))!important;
  color:var(--sub-fg, var(--sub-header-text))!important;
  font-weight:600!important;
  font-size:12px;
  letter-spacing:0.06em;
  text-transform:uppercase;
  border-top:1px solid var(--line-strong);
  border-bottom:1px solid var(--line-strong)
}

table.model tr.section-sub td:nth-child(2) {
  background:var(--sub-bg, var(--sub-header-bg))!important;
  color:var(--sub-fg, var(--sub-header-text))!important
}

table.model tr.section-sub:hover td {
  background:var(--line-strong)!important;
  color:var(--sub-fg, var(--sub-header-text))!important
}

table.model tr.section-sub td.sheet-gutter {
  background:var(--sub-bg, var(--sub-header-bg))!important;
  border-right:none!important;
  border-top:none!important;
  border-bottom:none!important
}

tr.is-parent {
  cursor:pointer;
  transition:background-color 0.15s ease
}

tr.is-parent:hover td {
  background-color:#e2f1f7!important
}

tr.is-parent:hover td:nth-child(2) {
  background-color:#e2f1f7!important
}

tr.collapsed-hidden {
  display:none!important
}

#kpi-modal-overlay {
  display:none;
  position:fixed;
  inset:0;
  z-index:2000;
  background:rgba(15,23,42,0.55);
  backdrop-filter:blur(4px);
  align-items:center;
  justify-content:center;
  padding:24px
}

#kpi-modal-overlay.open {
  display:flex;
  animation:kpiOverlayIn 0.2s ease
}

@keyframes kpiOverlayIn {
  from {
    opacity:0
  }
  to {
    opacity:1
  }
}

#kpi-modal {
  background:#fff;
  border-radius:16px;
  box-shadow:0 25px 50px -12px rgba(0,0,0,0.3);
  width:100%;
  max-width:860px;
  padding:28px 32px;
  animation:kpiModalIn 0.25s ease
}

@keyframes kpiModalIn {
  from {
    opacity:0;
    transform:translateY(16px) scale(0.98)
  }
  to {
    opacity:1;
    transform:translateY(0) scale(1)
  }
}

#kpi-modal-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px
}

#kpi-modal-title {
  font-family:'Oswald',sans-serif;
  font-size:22px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:var(--stoked-dark)
}

#kpi-modal-close {
  width:32px;
  height:32px;
  border-radius:50%;
  border:none;
  flex-shrink:0;
  background:var(--line);
  color:var(--muted);
  font-size:20px;
  line-height:1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:background 0.15s,color 0.15s
}

#kpi-modal-close:hover {
  background:var(--stoked-blue);
  color:#fff
}

#kpi-modal-stats {
  display:flex;
  gap:0;
  margin-bottom:20px;
  background:var(--bg);
  border-radius:10px;
  border:1px solid var(--line);
  overflow:hidden
}

.kpi-stat-item {
  flex:1;
  padding:14px 20px;
  display:flex;
  flex-direction:column;
  gap:4px;
  border-right:1px solid var(--line)
}

.kpi-stat-item:last-child {
  border-right:none
}

.kpi-stat-label {
  font-size:11px;
  color:var(--muted);
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.06em
}

.kpi-stat-value {
  font-size:18px;
  font-weight:700;
  color:var(--text);
  font-variant-numeric:tabular-nums;
  letter-spacing:-0.01em
}

.kpi-stat-sub {
  font-size:11px;
  color:var(--muted);
  font-weight:500
}

.kpi-stat-value.good {
  color:var(--good)
}

.kpi-stat-value.bad {
  color:var(--bad)
}

#kpi-modal-controls {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px
}

.range-btns {
  display:flex;
  gap:4px
}

.range-btn {
  padding:6px 14px;
  font-size:12px;
  font-weight:700;
  font-family:'Inter',sans-serif;
  text-transform:uppercase;
  letter-spacing:0.04em;
  border-radius:6px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--muted);
  cursor:pointer;
  transition:all 0.15s
}

.range-btn.active {
  background:var(--stoked-blue);
  color:#fff;
  border-color:var(--stoked-blue)
}

.range-btn:not(.active):hover {
  border-color:var(--stoked-blue);
  color:var(--stoked-blue)
}

.range-btn:disabled,
.range-btn.disabled {
  opacity:0.4;
  cursor:not-allowed;
  pointer-events:none
}

#kpi-chart-wrap {
  position:relative;
  height:300px
}

@media (max-width:1250px) {
  #kpi-container {
    grid-template-columns:repeat(3,minmax(0,1fr))!important
  }
}

@media (max-width:1050px) {
  #kpi-container {
    grid-template-columns:repeat(2,minmax(0,1fr))!important
  }
}

@media (max-width:850px) {
  .hero {
    flex-direction:column;
    align-items:flex-start
  }
  .hero h1 {
    font-size:28px
  }
  :root {
    --sticky-left-width:260px
  }
  #kpi-container {
    grid-template-columns:repeat(2,minmax(0,1fr))!important
  }
  .hero-controls {
    align-items:flex-start
  }
}

@media (max-width:600px) {
  #kpi-container {
    grid-template-columns:1fr!important
  }
}

@media print {
  .floating-toggle-wrapper,#month-select,.tabs-wrapper,.sheet-group-box,.sheet-group-line-hitbox,.master-toggle-box {
    display:none!important
  }
  .table-wrap {
    max-height:none!important;
    overflow:visible!important
  }
  .viewer-shell {
    box-shadow:none!important;
    border:1px solid #ccc!important
  }
  body {
    padding:0!important
  }
  .hero {
    border-radius:0!important
  }
  tr.collapsed-hidden {
    display:table-row!important
  }
  .tab-panel {
    display:block!important;
    margin-bottom:40px
  }
}

/* ==========================================
   KPI card drag-and-drop (SortableJS)
   ----
   Drop-target dimming during drag, plus a crisp SVG grip indicator
   hint. We don't set cursor:grab on the card itself because the OS
   hand cursor renders pixelated at high DPI — instead the grip icon
   below telegraphs draggability visually and SortableJS handles the
   feedback during the actual drag (which uses the OS grabbing cursor
   only mid-drag, where pixel quality matters less).
   ========================================== */
.kpi-card {
  position: relative;
}

/* Canvas-card grip indicator: suppressed in v2 of the edit model.
   Drag is now gated on the drawer being open (= explicit edit mode);
   when the drawer is open, the × remove button already telegraphs
   "interactive card" and a grip in the same corner would stack. When
   the drawer is closed, the canvas is read-only — no drag cue should
   appear at all. Leaving the rule as `content: none` so any prior
   ::after pseudo-element is fully suppressed. */
body[data-can-edit="true"] .kpi-card::after {
  content: none;
}

/* Ghost class applied by SortableJS to the currently-dragging card. */
.kpi-card-dragging {
  opacity: 0.35;
  background: var(--surface-blue-soft) !important;
}

/* Stakeholders (non-editors) never see the grab cursor or the small
   grip indicator — cards are visually identical to before edit-mode
   was introduced. */
body:not([data-can-edit="true"]) .kpi-card {
  cursor: default;
}
body:not([data-can-edit="true"]) .kpi-card::after {
  content: none;
}

/* ==========================================
   KPI editor — drawer, edit button, × remove, toast
   ----
   All scoped to body[data-can-edit="true"] so stakeholders see nothing.
   The × remove button only appears in active edit mode
   (body.drawer-open) to keep the canvas clean when just browsing.
   ========================================== */

/* "Edit cards" launcher — a fixed tab-handle on the right edge of the
   viewport, vertically centered. Lives outside .app on purpose so it
   floats above the page and slides in lock-step with the drawer. The
   chevron is pure SVG with geometricPrecision rendering so it stays
   crisp at any zoom level. */
.metrics-drawer-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 30px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: -4px 0 14px rgba(15, 23, 42, 0.10);
  z-index: 1201;  /* above drawer so it stays clickable when drawer is open */
  transition: right 0.25s ease, background 0.15s ease, color 0.15s ease;
  -webkit-font-smoothing: antialiased;
}
.metrics-drawer-toggle:hover {
  background: var(--surface-hover);
  color: var(--stoked-dark);
}
.metrics-drawer-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.metrics-drawer-toggle svg {
  display: block;
  transition: transform 0.25s ease;
}
/* When drawer is open: handle rides along with the panel, chevron flips
   to point right (close direction). */
body.drawer-open .metrics-drawer-toggle {
  right: 360px;
  background: var(--surface);
}
body.drawer-open .metrics-drawer-toggle svg {
  transform: rotate(180deg);
}

/* Drawer panel — slides in from the right. Width chosen to fit the
   inline per-metric editor (format dropdown + direction segmented
   control + tooltip textarea) without horizontal cramping. */
.metrics-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(15,23,42,0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', sans-serif;
}
body.drawer-open .metrics-drawer {
  transform: translateX(0);
}

.metrics-drawer-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.metrics-drawer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.metrics-drawer-title-row h3 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.metrics-drawer-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}
.metrics-drawer-close:hover { color: var(--text); }

#metrics-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 13px 'Inter', sans-serif;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}
#metrics-search:focus {
  border-color: var(--stoked-blue);
}

.metrics-drawer-reset {
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 11px 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.metrics-drawer-reset:hover {
  color: var(--bad);
  border-color: var(--bad);
}

.metrics-drawer-list {
  flex: 1;
  overflow-y: auto;
  /* Removed top/bottom padding — when the list has padding, sticky
     section headers leave a transparent strip at the top edge that
     scrolling rows briefly show through. Spacing is now provided by
     each section header's own padding. */
  padding: 0;
}

/* Drawer section header. Visually loud enough to stand out when the
   drawer has 30+ metrics — readable as you scroll. The left accent
   bar + tinted background separate this from regular item rows. */
.metrics-drawer-section {
  padding: 14px 16px 10px 22px;
  margin: 0;
  font: 700 12px/1.2 'Oswald', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: #eaf1fb;
  border-bottom: 1px solid #d6e2f0;
  position: sticky;
  top: 0;
  z-index: 10;
  transform: translateZ(0);
  isolation: isolate;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06);
}
/* Left accent bar — colored stripe so the section header reads as
   "this is a category divider" rather than another metric row. */
.metrics-drawer-section::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  background: var(--stoked-blue);
  border-radius: 2px;
}
/* The very first header on the list has a slight top margin
   adjustment so it sits flush against the search/reset area above. */
.metrics-drawer-list > .metrics-drawer-section:first-child {
  margin-top: 0;
}

.metrics-drawer-item {
  position: relative;
  display: block;       /* container; the .row inside is flex */
  padding: 0;
  border-bottom: 1px solid var(--surface-alt);
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s ease;
}
.metrics-drawer-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 28px;  /* room for SVG grip on the left */
  /* `pointer` keeps the cursor crisp at any DPI — Windows renders the
     `grab` cursor as a bitmap that scales badly. The SVG dot-grid grip
     to the left of the title remains the primary draggability cue. */
  cursor: pointer;
  position: relative;
}
/* Crisp inline-SVG grip — pure vector, no bitmap cursor. The handle is
   the row's primary visual drag affordance. Same dot-grid pattern the
   KPI cards use (lines ~1460), positioned to the left of the title. */
.metrics-drawer-item-row::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14' fill='%2364748b' shape-rendering='geometricPrecision'><circle cx='1.5' cy='1.5' r='1.2'/><circle cx='6.5' cy='1.5' r='1.2'/><circle cx='1.5' cy='7' r='1.2'/><circle cx='6.5' cy='7' r='1.2'/><circle cx='1.5' cy='12.5' r='1.2'/><circle cx='6.5' cy='12.5' r='1.2'/></svg>");
  background-repeat: no-repeat;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.metrics-drawer-item-row:hover::before {
  opacity: 0.85;
}
.metrics-drawer-item:hover > .metrics-drawer-item-row {
  background: var(--surface-hover);
}
.metrics-drawer-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Format-related drawer styles previously lived here:
   .metrics-drawer-item-meta (the "amount" badge on On-dashboard rows),
   .metrics-drawer-item-edited ("edited" pill on overridden rows),
   .metrics-format-picker / .metrics-format-btn (Available-section
   symbol selector). All removed — the source Google Sheet's cell
   formatting is the single source of truth for both KPI cards and
   tables, so the library doesn't need to expose format controls. */
/* Inline edit button (kebab icon) on rows already on canvas. Hidden for
   Available rows (no edit until they're added). */
.metrics-drawer-item-edit {
  display: none;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.metrics-drawer-item.added .metrics-drawer-item-edit {
  display: inline-flex;
  align-items: center;
}
.metrics-drawer-item-edit:hover {
  background: var(--surface-hover);
  color: var(--text);
}
/* On-dashboard rows: same hover background but the row click also opens
   the editor (handled in JS). No grip arrow rotation; just visual cue. */
.metrics-drawer-item.added .metrics-drawer-item-row {
  background: transparent;
}
.metrics-drawer-item.added.editing > .metrics-drawer-item-row {
  background: var(--surface-blue-soft);
}

/* Inline editor — pre-fills format / direction / tooltip. */
.metrics-editor {
  padding: 8px 12px 12px 28px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}
.metrics-editor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.metrics-editor-field label {
  font: 600 10px/1 'Oswald', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.metrics-editor-tooltip {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: 12px 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}
.metrics-editor-tooltip:focus {
  border-color: var(--stoked-blue);
}
.metrics-editor-tooltip {
  resize: vertical;
  min-height: 36px;
}
.metrics-editor-direction {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.dir-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  font: 12px 'Inter', sans-serif;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.dir-btn + .dir-btn {
  border-left: 1px solid var(--line);
}
.dir-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.dir-btn.active {
  background: var(--stoked-blue);
  color: #fff;
  font-weight: 600;
}

/* Display-name override input — single text field, same dimensions
   as the tooltip textarea. Empty → revert to canonical title. */
.metrics-editor-label {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: 13px 'Inter', sans-serif;
  color: var(--text);
  box-sizing: border-box;
}
.metrics-editor-label:focus {
  outline: none;
  border-color: var(--stoked-blue);
  box-shadow: 0 0 0 2px rgba(36, 148, 198, 0.15);
}

/* Format segmented control (Amount / Count / Percentage) restored
   to the editor. Same shape as the direction toggle. */
.metrics-editor-format {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.fmt-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  font: 12px 'Inter', sans-serif;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
  text-align: center;
}
.fmt-btn + .fmt-btn { border-left: 1px solid var(--line); }
.fmt-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.fmt-btn.active {
  background: var(--stoked-blue);
  color: #fff;
  font-weight: 600;
}

/* Comparison-mode toggle (MMM editor section, Addendum 8). Same shape
   as the direction toggle — segmented Previous / Custom buttons. */
.metrics-editor-comparison {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.cmp-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  font: 12px 'Inter', sans-serif;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
  text-align: center;
}
.cmp-btn + .cmp-btn { border-left: 1px solid var(--line); }
.cmp-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.cmp-btn.active {
  background: var(--stoked-blue);
  color: #fff;
  font-weight: 600;
}
.metrics-editor-hint {
  font: 11px/1.4 'Inter', sans-serif;
  color: var(--muted);
  margin-top: 4px;
}
.metrics-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 4px;
}
.metrics-editor-cancel,
.metrics-editor-save {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.metrics-editor-cancel {
  background: transparent;
  color: var(--muted);
}
.metrics-editor-cancel:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.metrics-editor-save {
  background: var(--stoked-blue);
  color: #fff;
  border-color: var(--stoked-blue);
}
.metrics-editor-save:hover {
  background: var(--stoked-dark);
  border-color: var(--stoked-dark);
}

.metrics-drawer-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Subheader fill-color editor (v2). Each row: round swatch (opens the
   palette popover) + label + remove (×). Bottom: "+ Add subheader row"
   with a search picker. The palette popover itself lives at body root,
   anchored on open via JS. */
.subheader-color-list {
  display: flex;
  flex-direction: column;
}
.subheader-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 22px;
  border-bottom: 1px solid var(--surface-alt);
  font-size: 13px;
  color: var(--text);
}
.subheader-color-swatch {
  /* Round color chip — mirrors the Google Sheets fill picker. */
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background-color: var(--surface-alt);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.subheader-color-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.06);
}
.subheader-color-swatch:focus-visible {
  outline: 2px solid var(--stoked-blue);
  outline-offset: 1px;
}
.subheader-color-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.subheader-color-save-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
  cursor: default;
  /* Reuses the save-dot-pulse / save-dot-fade keyframes from the KPI
     card save indicator (lines 2280–2288). */
}
.subheader-color-row[data-save-state] .subheader-color-save-dot { display: inline-block; }
.subheader-color-row[data-save-state="pending"] .subheader-color-save-dot {
  background: #f59e0b;  /* amber */
  animation: save-dot-pulse 1.1s ease-in-out infinite;
}
.subheader-color-row[data-save-state="ok"] .subheader-color-save-dot {
  background: var(--good);
  animation: save-dot-fade 1.5s ease forwards;
}
.subheader-color-row[data-save-state="error"] .subheader-color-save-dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.subheader-color-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s ease, background 0.1s ease, color 0.1s ease;
}
.subheader-color-row:hover .subheader-color-remove,
.subheader-color-remove:focus-visible {
  opacity: 1;
}
.subheader-color-remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* "+ Add subheader row" button + its row-picker dropdown. */
.subheader-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 12px 10px 22px;
  padding: 6px 10px;
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.subheader-add-btn:hover {
  color: var(--stoked-blue);
  border-color: var(--stoked-blue);
  background: var(--surface-blue-soft);
}
.subheader-add-plus {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}
.subheader-add-picker {
  margin: 0 12px 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.subheader-add-search {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-bottom: 1px solid var(--surface-alt);
  font: 13px/1.2 'Inter', sans-serif;
  outline: none;
}
.subheader-add-search:focus { background: var(--surface-blue-soft); }
.subheader-add-options {
  max-height: 220px;
  overflow-y: auto;
}
.subheader-add-option {
  display: block;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subheader-add-option:hover { background: var(--surface-hover); }
.subheader-add-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Palette popover — Google-Sheets-style swatch grid. Positioned via JS
   in viewport coords. */
.subheader-palette-popover {
  position: fixed;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-3);
  padding: 8px;
  width: 268px;
  display: none;
}
.subheader-palette-reset {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 6px;
  margin-bottom: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  font: 600 12px/1 'Inter', sans-serif;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.subheader-palette-reset:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.subheader-palette-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.subheader-palette-tile {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.subheader-palette-tile:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.18);
}
.subheader-palette-tile.is-current {
  box-shadow: 0 0 0 2px var(--stoked-blue);
}
.subheader-palette-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--surface-alt);
}
.subheader-palette-footer-label {
  font: 600 10px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-shrink: 0;
}
.subheader-palette-custom-input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 12px/1 'Inter', monospace;
  outline: none;
  transition: border-color 0.12s ease;
}
.subheader-palette-custom-input:focus { border-color: var(--stoked-blue); }
.subheader-palette-custom-apply {
  padding: 5px 10px;
  background: var(--stoked-blue);
  border: none;
  border-radius: 4px;
  color: #fff;
  font: 600 11px/1 'Inter', sans-serif;
  cursor: pointer;
}
.subheader-palette-custom-apply:hover { background: var(--stoked-dark); }

/* × remove button on each card — only visible when actively editing
   (body has both data-can-edit AND drawer-open). */
.kpi-card-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.15s ease, transform 0.15s ease;
}
body[data-can-edit="true"].drawer-open .kpi-card-remove {
  display: inline-flex;
}
.kpi-card-remove:hover {
  background: var(--bad);
  transform: scale(1.1);
}

/* Per-card save-state indicator (Addendum 9). Small dot in the top-right
   corner showing pending/ok/error after a layout save. Hover reveals the
   underlying message; clicking the error dot reopens the editor with the
   unsaved values pre-filled. The pending state pulses; ok auto-fades. */
.kpi-card-save-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  z-index: 2;
  cursor: default;
  pointer-events: auto;
  transition: opacity 0.4s ease, background 0.15s ease;
  /* Hidden until the card's data-save-state attribute is set. The
     per-state rules below toggle display back on for pending/ok/error. */
  display: none;
}
.kpi-card[data-save-state="pending"] .kpi-card-save-dot,
.kpi-card[data-save-state="ok"] .kpi-card-save-dot,
.kpi-card[data-save-state="error"] .kpi-card-save-dot {
  display: block;
}
.kpi-card[data-save-state="pending"] .kpi-card-save-dot {
  background: #f59e0b;  /* amber */
  animation: save-dot-pulse 1.1s ease-in-out infinite;
}
.kpi-card[data-save-state="ok"] .kpi-card-save-dot {
  background: var(--good);
  animation: save-dot-fade 1.5s ease forwards;
}
.kpi-card[data-save-state="error"] .kpi-card-save-dot {
  background: var(--bad);
  cursor: pointer;
  /* Persistent — stays until user retries or refreshes. */
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}
.kpi-card[data-save-state="error"] .kpi-card-save-dot:hover {
  transform: scale(1.3);
}
@keyframes save-dot-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
@keyframes save-dot-fade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
/* When the drawer is open, the remove × already lives top-right.
   Shift the save dot down so they don't overlap. */
body[data-can-edit="true"].drawer-open .kpi-card-save-dot {
  top: 36px;
}

/* Placeholder card shown immediately on drag-in, before /api/card resolves. */
.kpi-card-loading {
  position: relative;
  min-height: 180px;
  opacity: 0.65;
}
.kpi-card-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--stoked-blue);
  border-radius: 50%;
  animation: kpi-card-spin 0.7s linear infinite;
  position: absolute;
  top: 24px;
  right: 24px;
}
@keyframes kpi-card-spin {
  to { transform: rotate(360deg); }
}

/* Inline title for placeholder cards before real content arrives. */
.kpi-card-loading .kpi-card-title {
  font: 600 12px 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 16px;
}
.kpi-card-loading .kpi-card-primary {
  font: 700 28px 'Oswald', sans-serif;
  color: var(--line-strong);
}

/* Drawer item drag-clone — slightly raised, blue-tinted. */
.drawer-item-dragging {
  background: var(--surface-blue-softer) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
}

/* Layout save error toast — fixed bottom-center. */
.layout-save-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: var(--bad);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-3);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 80vw;
}
.layout-save-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================
   Reset-scope dialog — choose tab-only vs. all-tabs reset.
   Centered modal, backdrop blocks the rest of the page.
   ========================================== */
.reset-scope-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}
.reset-scope-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
  padding: 22px 22px 18px;
  width: 380px;
  max-width: calc(100vw - 32px);
  color: var(--text);
}
.reset-scope-dialog h3 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.reset-scope-lead {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.reset-scope-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.reset-scope-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.reset-scope-option:hover {
  background: var(--surface-hover);
}
.reset-scope-option input[type="radio"] {
  margin: 3px 0 0;
  flex-shrink: 0;
  accent-color: var(--stoked-blue);
}
.reset-scope-option:has(input:checked) {
  border-color: var(--stoked-blue);
  background: var(--surface-blue-soft);
}
.reset-scope-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reset-scope-headline {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.reset-scope-detail {
  font-size: 11px;
  color: var(--muted);
}
.reset-scope-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.reset-scope-cancel,
.reset-scope-confirm {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font: 600 12px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.reset-scope-cancel {
  background: transparent;
  color: var(--muted);
}
.reset-scope-cancel:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.reset-scope-confirm {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.reset-scope-confirm:hover {
  filter: brightness(0.92);
}

/* ==========================================
   Admin / client-management page (/admin/clients).
   Self-contained styles — the page reuses the global theme variables
   but has its own layout (centered narrow column, hero header, table).
   ========================================== */

/* Page background mirrors the login page — same SVG chart-arcs +
   soft radial wash, scaled and offset slightly so the two pages
   feel related but not identical. Pure decoration; aria-hidden on
   the inner div. */
body.admin-body { margin: 0; background: var(--bg); }
.admin-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.admin-bg svg { width: 100%; height: 100%; display: block; }

.admin-page {
  position: relative;
  z-index: 1;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  min-height: 100vh;
  padding: 32px 32px 56px;
  max-width: 1100px;
  margin: 0 auto;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--surface-blue-softer);
}
.admin-hero-titles { min-width: 0; flex: 1; }
.admin-hero h1 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 32px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.1;
}
.admin-hero-sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 640px;
}
.admin-hero-meta {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.admin-hero-meta code {
  font-family: 'Inter', monospace;
  font-size: 11px;
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text);
}
.admin-hero-meta a {
  color: var(--stoked-blue);
  text-decoration: none;
}
.admin-hero-meta a:hover { text-decoration: underline; }

/* ===== Admin tab nav =====
   Horizontal pills under the hero. Active tab highlighted; hover state
   tints non-active tabs. The matching .admin-tab-panel below toggles
   visibility via the JS in admin_clients.js. */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin: 6px 0 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.admin-tab {
  position: relative;
  background: transparent;
  border: none;
  padding: 10px 18px;
  margin-bottom: -1px;
  font: 600 12px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.admin-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.admin-tab.active {
  color: var(--stoked-blue);
  border-bottom-color: var(--stoked-blue);
}
.admin-tab.active:hover { background: transparent; }
.admin-tab-panel { animation: fadeInTabPanel 0.18s ease; }
@keyframes fadeInTabPanel {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Audit log viewer ===== */
.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 12px 0 14px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.audit-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.audit-filter > span { padding-left: 2px; }
.audit-filter select,
.audit-filter input {
  font: 13px/1.2 'Inter', sans-serif;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  padding: 6px 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  min-width: 180px;
  outline: none;
}
.audit-filter input:focus,
.audit-filter select:focus { border-color: var(--stoked-blue); }
#audit-refresh-btn { margin-left: auto; }

.audit-table { font-size: 13px; }
.audit-table th, .audit-table td {
  padding: 8px 12px;
  vertical-align: top;
}
.audit-time {
  font-family: 'Inter', monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.audit-type {
  font-size: 11px;
  font-family: 'Inter', monospace;
  background: var(--surface-blue-soft);
  color: var(--stoked-dark);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.audit-row { cursor: pointer; transition: background 0.1s ease; }
.audit-row:hover { background: var(--surface-hover); }
.audit-row.expanded { background: var(--surface-blue-soft); }
.audit-expand {
  width: 24px;
  text-align: center;
  color: var(--muted);
}
.audit-row.expanded .audit-expand { transform: rotate(180deg); }
.audit-row-details td {
  background: var(--surface-alt);
  padding: 0;
  border-top: 1px solid var(--line);
}
.audit-details-pre {
  margin: 0;
  padding: 12px 16px;
  font: 12px/1.5 'Inter', monospace;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
}

.audit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.audit-count {
  font-size: 12px;
  color: var(--muted);
}

/* Placeholder card for the Settings / Audit "coming soon" stubs. */
.admin-stub {
  text-align: center;
  padding: 48px 24px;
}
.admin-stub-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.admin-stub code {
  font-family: 'Inter', monospace;
  font-size: 12px;
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Reusable card wrapper for the SA-notice, Admins, and Clients
   sections. Soft white surface, generous padding, subtle shadow.
   Matches the .login-card aesthetic. */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  margin-bottom: 18px;
}
.admin-card-title {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

.admin-btn {
  border-radius: var(--radius-sm);
  font: 600 12px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 9px 16px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease,
              border-color 0.15s ease, filter 0.15s ease;
}
.admin-btn-primary {
  background: var(--stoked-blue);
  color: #fff;
  border-color: var(--stoked-blue);
  box-shadow: 0 6px 16px rgba(0, 91, 150, 0.18);
  padding: 10px 18px;
  font-size: 13px;
}
.admin-btn-primary:hover {
  background: var(--stoked-dark);
  border-color: var(--stoked-dark);
  box-shadow: 0 8px 20px rgba(0, 91, 150, 0.24);
}
.admin-btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(0, 91, 150, 0.16);
}
.admin-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.admin-btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.admin-btn-secondary:hover {
  color: var(--text);
  border-color: var(--line-strong);
}
.admin-btn-danger {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.admin-btn-danger:hover { filter: brightness(0.92); }
.admin-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* Sync progress bar — replaces the submit button row while New Client
   sync is in flight. Fills 0→90% over the expected 25s duration via a
   CSS animation; JS snaps to 100% on response and resets on error. */
.admin-sync-progress {
  width: 100%;
  padding: 6px 4px;
}
.admin-sync-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.admin-sync-progress-elapsed {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.admin-sync-progress-track {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.admin-sync-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--stoked-blue) 0%,
    var(--stoked-dark) 100%
  );
  border-radius: 999px;
  animation: admin-sync-progress-grow 25s ease-out forwards;
  transition: width 0.25s ease-out;
}
/* Subtle shimmer so the bar reads as "alive" even when growth slows. */
.admin-sync-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: admin-sync-progress-shimmer 1.4s linear infinite;
}
@keyframes admin-sync-progress-grow {
  0%   { width: 0%; }
  15%  { width: 25%; }
  40%  { width: 55%; }
  70%  { width: 78%; }
  100% { width: 90%; }
}
@keyframes admin-sync-progress-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Compact row-level re-sync progress bar — used in the Clients table's
   "Last synced" cell while a re-sync is in flight. Mirrors the modal
   progress bar's animation timing + shimmer; sized down for the row. */
.admin-row-sync-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.admin-row-sync-track {
  flex: 1;
  height: 5px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  min-width: 70px;
}
.admin-row-sync-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--stoked-blue) 0%,
    var(--stoked-dark) 100%
  );
  border-radius: 999px;
  animation: admin-sync-progress-grow 25s ease-out forwards;
  transition: width 0.25s ease-out;
}
.admin-row-sync-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: admin-sync-progress-shimmer 1.4s linear infinite;
}
.admin-row-sync-elapsed {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}

/* SA-notice card: now uses the shared .admin-card wrapper with a
   blue-tinted accent stripe on the left to highlight that it's a
   pre-flight checklist callout, not an empty section. */
.admin-sa-notice {
  position: relative;
  background: linear-gradient(
    to right,
    var(--surface-blue-soft) 0,
    var(--surface-blue-soft) 4px,
    var(--surface) 4px
  );
  border-left: 3px solid var(--stoked-blue);
}
.admin-sa-notice-body p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 640px;
}
.admin-sa-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-sa-notice code {
  font-family: 'Inter', monospace;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.admin-copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font: 600 11px 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.admin-copy-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--line-strong);
}

/* The table now sits inside .admin-card so it doesn't need its own
   bg / shadow / outer border — just a soft border to demarcate the
   table region and rounded corners so the inner stripes don't bleed
   to the card edge. */
.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--surface-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  font: 600 10px/1 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--surface-alt);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-alt);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-hover); }
.admin-table code {
  font-family: 'Inter', monospace;
  font-size: 12px;
  color: var(--muted);
}
.admin-company-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.admin-company-link:hover {
  color: var(--stoked-blue);
  text-decoration: underline;
}
.admin-table-loading {
  text-align: center;
  color: var(--muted);
  padding: 32px 14px !important;
}
/* Generic "do not wrap mid-cell" — used on the Last Synced column so
   dates render as a single line even when the column is narrow. */
.admin-cell-nowrap {
  white-space: nowrap;
}

.admin-row-actions {
  white-space: nowrap;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.admin-row-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  text-decoration: none;  /* anchors used as buttons (e.g., open-sheet) */
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.admin-row-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}
.admin-row-btn:hover {
  color: var(--ink, var(--text));
  border-color: var(--line-strong);
  background: var(--surface-blue-softer, rgba(0,0,0,0.03));
}
.admin-row-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* In-flight Re-sync — slow pulse so the user knows the request is
   running. Restored on response. Addendum 12. */
.admin-row-btn-pending {
  animation: admin-row-btn-pulse 1.1s ease-in-out infinite;
}
@keyframes admin-row-btn-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.admin-row-btn-danger {
  color: var(--bad);
}
.admin-row-btn-danger:hover {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}

/* Per-action icon colors. Hover deepens the same hue and tints the
   border so the affordance reads at a glance. */
.admin-row-btn-resync       { color: #2563eb; }   /* blue */
.admin-row-btn-resync:hover {
  background: rgba(37, 99, 235, 0.10);
  border-color: #2563eb;
  color: #1d4ed8;
}
.admin-row-btn-schedule       { color: #7c3aed; } /* violet */
.admin-row-btn-schedule:hover {
  background: rgba(124, 58, 237, 0.10);
  border-color: #7c3aed;
  color: #6d28d9;
}
.admin-row-btn-stakeholders       { color: #0891b2; } /* teal */
.admin-row-btn-stakeholders:hover {
  background: rgba(8, 145, 178, 0.10);
  border-color: #0891b2;
  color: #0e7490;
}
.admin-row-btn-sheet       { color: #0f9d58; }    /* Google Sheets green */
.admin-row-btn-sheet:hover {
  background: rgba(15, 157, 88, 0.10);
  border-color: #0f9d58;
  color: #0b8043;
}

/* ---- Admin modals (used for New / Stakeholders / Delete confirm). ---- */

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}
.admin-modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
.admin-modal-body {
  padding: 22px 22px 18px;
}
.admin-modal-body h3 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.admin-modal-body h3 code {
  font-size: 14px;
  font-family: 'Inter', monospace;
  background: var(--surface-alt);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 4px;
  letter-spacing: 0;
}
.admin-modal-lead {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.admin-modal-lead code {
  font-family: 'Inter', monospace;
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-form-label {
  font: 600 10px/1 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.admin-form-field input[type="text"],
.admin-form-field input[type="email"],
.admin-form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 13px 'Inter', sans-serif;
  color: var(--text);
  background: var(--surface);
  outline: none;
  box-sizing: border-box;
  resize: vertical;
}
.admin-form-field input:focus,
.admin-form-field textarea:focus {
  border-color: var(--stoked-blue);
}
.admin-form-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.admin-form-hint code {
  font-family: 'Inter', monospace;
  font-size: 11px;
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 3px;
}
.admin-form-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--bad);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}
.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* Stakeholders modal list. */
.admin-stake-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
}
.admin-stake-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-alt);
  font-size: 13px;
}
.admin-stake-list li:last-child { border-bottom: none; }
.admin-stake-empty,
.admin-stake-loading {
  display: block !important;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}
.admin-stake-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 6px;
  line-height: 1;
}
.admin-stake-remove:hover { color: var(--bad); }
.admin-stake-add {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.admin-stake-add input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 13px 'Inter', sans-serif;
  outline: none;
}
.admin-stake-add input:focus { border-color: var(--stoked-blue); }

/* Toast — top-right, ephemeral. */
.admin-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font: 600 13px 'Inter', sans-serif;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 1500;
  max-width: 460px;
}
.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.admin-toast.error {
  background: var(--bad);
}
.admin-toast.ok {
  background: var(--good);
}

/* ==========================================
   Access denied (403) page.
   Surfaces the actual session email so the user can verify which
   identity OAuth gave them — the diagnostic gift for "I added X but
   it doesn't work" reports.
   ========================================== */

.access-denied-page {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.access-denied-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
}
.access-denied-card h1 {
  margin: 0 0 4px;
  font-family: 'Oswald', sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.access-denied-reason {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--bad);
  line-height: 1.5;
}
.access-denied-facts {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  font-size: 13px;
}
.access-denied-facts dt {
  font: 600 10px/1.4 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  align-self: center;
}
.access-denied-facts dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}
.access-denied-facts dd code {
  font-family: 'Inter', monospace;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
}
.access-denied-facts dd em {
  color: var(--muted);
  font-style: italic;
}
.access-denied-help {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.access-denied-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.access-denied-actions .admin-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ==========================================
   Admins allowlist (subset of internal users with build/edit access).
   Lives above the Clients table on /admin/clients.
   ========================================== */

.admin-section-header {
  margin-bottom: 16px;
}
/* Legacy h2 in section header — kept so any non-card section still
   reads. Cards override via .admin-card-title above. */
.admin-section-header h2 {
  margin: 0 0 4px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.admin-section-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 720px;
}

.admin-admins-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
}
.admin-admins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-alt);
  font-size: 13px;
  gap: 12px;
}
.admin-admins-row:last-child { border-bottom: none; }
.admin-admins-row-bootstrap {
  background: var(--surface-alt);
}
.admin-admins-row-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.admin-admins-row code {
  font-family: 'Inter', monospace;
  font-size: 13px;
  color: var(--text);
}
.admin-admins-meta {
  font-size: 11px;
  color: var(--muted);
}
.admin-admins-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}
.admin-badge {
  display: inline-block;
  font: 600 10px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-blue-soft);
  border: 1px solid var(--surface-blue-softer);
  padding: 3px 6px;
  border-radius: 3px;
}
.admin-admins-self {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  padding: 3px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.admin-admins-remove {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.admin-admins-remove:hover {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.admin-admins-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-admins-add {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.admin-admins-add input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: 13px 'Inter', sans-serif;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.admin-admins-add input:focus { border-color: var(--stoked-blue); }

.admin-admins-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: var(--bad);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
}

/* ==========================================
   Login page (Google + Microsoft chooser).
   Layout: a centered card on top of a subtle SVG background of faded
   chart arcs and dots. Background is decorative only and rendered as
   pure SVG so it stays crisp at any DPI.
   ========================================== */

body.login-body {
  margin: 0;
  background: var(--bg);
}
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-page {
  position: relative;
  z-index: 1;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 36px 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
  text-align: center;
}
.login-card h1 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.login-lead {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.login-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.login-provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font: 600 14px 'Inter', sans-serif;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.05s ease;
}
.login-provider:hover {
  background: var(--surface-alt);
  border-color: var(--line-strong);
}
.login-provider:active {
  transform: translateY(1px);
}
.login-provider svg {
  flex-shrink: 0;
}
.login-foot {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* Sign-in instructions block.
   Two "paths" (Google vs. non-Google) rendered as compact cards with
   provider icons on the left. The non-Google path has a numbered
   list of steps for the one-time Google-account registration. */
.login-notice {
  text-align: left;
  background: var(--surface-blue-soft);
  border: 1px solid var(--surface-blue-softer);
  border-radius: var(--radius-md);
  padding: 18px 18px 14px;
  margin: 0 0 22px;
}
.login-notice h2 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.login-notice-intro {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.login-path {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--surface-blue-softer);
}
.login-path:first-of-type {
  border-top: none;
  padding-top: 6px;
}
.login-path-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.login-path-body {
  flex: 1;
  min-width: 0;
}
.login-path-body h3 {
  margin: 0 0 4px;
  font: 600 13px/1.35 'Inter', sans-serif;
  color: var(--text);
}
.login-path-body p {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.login-path-body p:last-child {
  margin-bottom: 0;
}

.login-steps {
  margin: 6px 0 0;
  padding: 0 0 0 22px;
  counter-reset: login-step;
  list-style: none;
}
.login-steps li {
  position: relative;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.55;
  padding: 5px 0;
}
.login-steps li::before {
  counter-increment: login-step;
  content: counter(login-step);
  position: absolute;
  left: -22px;
  top: 4px;
  width: 18px;
  height: 18px;
  background: var(--stoked-blue);
  color: #fff;
  border-radius: 50%;
  font: 600 10px/18px 'Inter', sans-serif;
  text-align: center;
  flex-shrink: 0;
}
.login-steps em,
.login-notice em {
  font-style: normal;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--text);
  font-weight: 600;
}
.login-notice-foot {
  margin: 12px 0 0 !important;
  padding-top: 12px;
  border-top: 1px solid var(--surface-blue-softer);
  font-size: 12px !important;
  color: var(--muted) !important;
}

/* ==========================================
   Stakeholder landing page (/).
   Shown to external users with 2+ accessible clients, or zero
   (no-access state). Single-client users redirect straight to their
   dashboard, so this page never appears for them.
   ========================================== */

.stakeholder-page {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.stakeholder-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px 32px 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
}
.stakeholder-header {
  text-align: center;
  margin-bottom: 22px;
}
.stakeholder-header h1 {
  margin: 0 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.stakeholder-lead {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.stakeholder-lead-empty {
  color: var(--bad);
}

.stakeholder-tiles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.stakeholder-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.05s ease;
}
.stakeholder-tile:hover {
  background: var(--surface-blue-soft);
  border-color: var(--surface-blue-softer);
}
.stakeholder-tile:active {
  transform: translateY(1px);
}
.stakeholder-tile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.stakeholder-tile-arrow {
  display: inline-flex;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}
.stakeholder-tile:hover .stakeholder-tile-arrow {
  color: var(--stoked-blue);
  transform: translateX(2px);
}

.stakeholder-empty {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 22px;
  text-align: center;
}
.stakeholder-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.stakeholder-foot {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--surface-alt);
  padding-top: 16px;
}
.stakeholder-foot code {
  font-family: 'Inter', monospace;
  background: var(--surface-alt);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text);
}
.stakeholder-foot a {
  color: var(--stoked-blue);
  text-decoration: none;
}
.stakeholder-foot a:hover { text-decoration: underline; }

/* ==========================================
   Schedule badge + modal (Phase 3 — auto-sync).
   ========================================== */

.admin-schedule-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
}
.admin-schedule-badge svg {
  display: block;
  width: 12px;
  height: 12px;
}
.admin-schedule-badge-on {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.admin-schedule-badge-off {
  color: #b45309;                    /* amber-700 */
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* The schedule modal reuses .admin-modal-* scaffolding; these are the
   schedule-specific bits inside. */
.admin-schedule-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-schedule-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.admin-schedule-toggle input[type="checkbox"] {
  margin: 3px 0 0;
  flex-shrink: 0;
  accent-color: var(--stoked-blue);
  width: 16px; height: 16px;
}
.admin-schedule-toggle span:not(.admin-schedule-toggle-meta) {
  font-size: 13px;
  color: var(--text);
}
.admin-schedule-toggle-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.admin-schedule-time-row {
  flex-direction: row !important;
  gap: 10px;
}
.admin-schedule-time-row > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-schedule-time-row select,
#sched-preset,
#sched-tz {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: 13px 'Inter', sans-serif;
  color: var(--text);
}
.admin-schedule-time-row select:focus,
#sched-preset:focus,
#sched-tz:focus,
#sched-cron:focus {
  border-color: var(--stoked-blue);
  outline: none;
}

.admin-schedule-preview {
  font: 12px/1.4 'Inter', monospace;
  background: var(--surface-blue-soft);
  border: 1px solid var(--surface-blue-softer);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  min-height: 18px;
}
.admin-schedule-preview:empty { display: none; }

.admin-schedule-lastrun {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--surface-alt);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.admin-schedule-lastrun-label {
  font: 600 10px/1 'Oswald', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-schedule-lastrun-when {
  color: var(--text);
  font-weight: 500;
}
.admin-schedule-status-ok {
  color: var(--good);
  font-weight: 600;
}
.admin-schedule-status-error {
  color: var(--bad);
  font-weight: 600;
  word-break: break-word;
}

