:root {
  --bg: #faf6f1;
  --panel: #ffffff;
  --panel-alt: #f4ece3;
  --border: #e7ddd0;
  --border-strong: #d9cbb8;
  --text: #22303a;
  --heading: #0b485d;
  --muted: #7c8792;
  --accent: #0b485d;
  --accent-hover: #0e5773;
  --accent-tint: #e6eef0;
  --warm: #cc664e;
  --warm-tint: #f7e9e4;
  --gold: #e59500;
  --good: #2f8f5b;
  --bad: #c1443b;
  --shadow-sm: 0 1px 2px rgba(11, 72, 93, 0.06);
  --shadow-md: 0 4px 16px rgba(11, 72, 93, 0.10);
  --radius: 10px;
}

:root[data-theme="dark"] {
  --bg: #0d2229;
  --panel: #15313a;
  --panel-alt: #1b3c46;
  --border: #274852;
  --border-strong: #345c67;
  --text: #e8f0ee;
  --heading: #6fc3d6;
  --muted: #8fa8ac;
  --accent: #4fb3c9;
  --accent-hover: #6fc3d6;
  --accent-tint: #1e454f;
  --warm: #e08267;
  --warm-tint: #3a2620;
  --gold: #f0ac2e;
  --good: #4bb682;
  --bad: #e0685d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

#appShell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---- Top bar (brand + view switcher; the only persistent chrome — channel
   selection lives entirely on the landing page reached via the brand wordmark) ---- */
#topBar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  width: fit-content;
}
.sidebar-brand:hover .brand-name { opacity: 0.85; }
.sidebar-brand .brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
}
.sidebar-brand .brand-name-warm {
  color: var(--gold);
}
.sidebar-sub {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.view-select {
  margin-left: auto;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.view-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.view-select.hidden { display: none; }

#mainHeader.hidden { display: none; }

.theme-toggle {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.theme-toggle:hover {
  border-color: var(--border-strong);
}

/* ---- Login gate ---- */
.login-gate {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(11, 72, 93, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-gate.hidden { display: none; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 30px;
  width: 320px;
  max-width: calc(100vw - 40px);
}
.login-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 6px;
}
.login-card p.muted {
  font-size: 12px;
  margin: 0 0 16px;
}
.login-card label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}
.login-card input {
  display: block;
  margin-top: 5px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.login-card button {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}
.login-card button:hover { background: var(--accent-hover); }
.login-error {
  color: var(--bad);
  font-size: 12px;
  margin: 10px 0 0;
}
.login-error.hidden { display: none;
}

#mainArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  position: relative;
}

/* ---- Header ---- */
header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  z-index: 10;
  flex-shrink: 0;
  flex-wrap: wrap;
  row-gap: 10px;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
  color: var(--heading);
  white-space: nowrap;
}

header label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

header input, header select {
  display: block;
  margin-top: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
}
header input:focus, header select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

#status {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

/* ---- Tables ---- */
.table-wrap {
  overflow: auto;
  flex: 1;
  /* A floor, not 0 — guarantees the table always keeps a usable, scrollable amount
     of space even if panels above it (e.g. the expanded trend panel) are tall. */
  min-height: 180px;
  background: var(--panel);
}
.table-wrap.hidden { display: none; }

table {
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
}

#forecastTable thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  z-index: 5;
  color: var(--heading);
  font-weight: 700;
}

#forecastTable thead tr.month-row th {
  top: 34px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

#forecastTable thead tr.total-row td {
  position: sticky;
  top: 59px;
  background: var(--accent-tint);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 700;
  padding: 9px 10px;
  z-index: 6;
  color: var(--heading);
}

#tlfComparisonTable thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  z-index: 5;
  color: var(--heading);
  font-weight: 700;
}

#tlfComparisonTable thead tr.month-row th {
  top: 34px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

#skuBaseTable thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  z-index: 5;
  color: var(--heading);
  font-weight: 700;
}

#skuBaseTable td.calc-cell {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: normal;
  min-width: 320px;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  color: var(--accent);
}

td, th {
  border-right: 1px solid var(--border);
  padding: 7px 10px;
}

tbody tr:nth-child(even) { background: var(--panel-alt); }
tbody tr:hover { background: var(--accent-tint); }

td.category-cell {
  position: sticky;
  left: 0;
  background: var(--panel);
  font-weight: 600;
  color: var(--text);
  min-width: 220px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
tbody tr:nth-child(even) td.category-cell { background: var(--panel-alt); }
tbody tr:hover td.category-cell { background: var(--accent-tint); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pct-pos { color: var(--good); font-weight: 600; }
.pct-neg { color: var(--bad); font-weight: 600; }

input.pct-input {
  width: 58px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 5px;
  padding: 4px 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}
input.pct-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
input.pct-input.dirty {
  border-color: var(--warm);
  background: var(--warm-tint);
}
/* A value nobody has explicitly saved yet — carried forward from the last month
   that WAS set, as a starting point rather than a flat 0%. Dashed border marks it
   as a suggestion; typing in the box (or the dirty state above) confirms it. */
input.pct-input.suggested {
  border-style: dashed;
  color: var(--muted);
}

.final-qty {
  font-weight: 700;
  color: var(--heading);
}

.month-block {
  border-left: 2px solid var(--border-strong);
}

.hist-col {
  color: var(--muted);
  font-style: italic;
  background: rgba(11, 72, 93, 0.03);
}

/* ---- Evidence / TLF panels ---- */
.evidence-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}
.evidence-view.hidden { display: none; }
.trend-panel.hidden { display: none; }

.evidence-downloads {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.evidence-downloads a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.evidence-downloads a:hover { border-color: var(--accent); background: var(--accent-tint); }

.evidence-drilldown label {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}
.evidence-drilldown select {
  display: block;
  margin-top: 6px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  width: 100%;
  max-width: 400px;
  font-family: inherit;
  font-size: 13px;
}

.evidence-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12px;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.evidence-table th, .evidence-table td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  text-align: right;
}
.evidence-table th:first-child, .evidence-table td:first-child { text-align: left; }
.evidence-table th { background: var(--panel-alt); color: var(--heading); font-weight: 700; }
.evidence-table caption {
  text-align: left;
  color: var(--heading);
  font-weight: 700;
  margin-bottom: 8px;
  caption-side: top;
}
.flag-warn { color: var(--bad); }

/* ---- Trend panel ---- */
.trend-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 18px;
  padding: 4px 14px;
  flex-shrink: 0;
  min-width: 0;
  max-width: calc(100% - 36px);
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
}
.trend-panel summary {
  cursor: pointer;
  padding: 12px 4px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--heading);
  list-style: none;
}
.trend-panel summary::-webkit-details-marker { display: none; }
.trend-panel-body {
  padding: 6px 4px 18px;
  border-top: 1px solid var(--border);
  min-width: 0;
  /* Capped well under the full viewport (was 75vh) so opening this panel can never
     squeeze the table below it down to an unusable sliver — the body scrolls inside
     itself instead of eating the whole page. */
  max-height: 32vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.trend-panel-body > p.muted {
  line-height: 1.5;
}
.trend-panel-body label {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 12px 0;
}
.trend-panel-body select {
  display: block;
  margin-top: 6px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 7px;
  width: 100%;
  max-width: 400px;
  font-family: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.trend-panel-body select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.trend-select-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.trend-select-row label {
  flex: 1;
  min-width: 220px;
}

.trend-charts-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.chart-block {
  margin-bottom: 24px;
  flex: 1 1 420px;
  min-width: 320px;
  max-width: 100%;
}
.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 6px;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.chart-legend .swatch {
  display: inline-block;
  width: 14px;
  height: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.chart-svg-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  overflow-x: auto;
  width: 100%;
  box-sizing: border-box;
}
.chart-svg-wrap svg {
  display: block;
}
.chart-svg-wrap svg text {
  fill: var(--muted);
  font-size: 10px;
  font-family: inherit;
}
.chart-hit {
  cursor: pointer;
}

.chart-tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--heading);
  border: 1px solid var(--heading);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #fdf9f5;
  max-width: 280px;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.chart-tooltip.hidden { display: none; }
.chart-tooltip-title {
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--gold);
}

.tlf-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 3px;
  vertical-align: middle;
}

/* ---- Landing page ---- */
.landing-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}
.landing-view.hidden { display: none; }

/* Full-bleed rotating photo hero, styled after Zouk's own homepage banner
   (photo + dark scrim + overlaid headline, bottom-left anchored). */
.landing-hero {
  position: relative;
  height: 460px;
  min-height: 460px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.landing-hero-slides {
  position: absolute;
  inset: 0;
}
.landing-hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.landing-hero-slide.active { opacity: 1; }
.landing-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    rgba(8, 30, 38, 0.92) 0%,
    rgba(8, 30, 38, 0.72) 32%,
    rgba(8, 30, 38, 0.32) 62%,
    rgba(8, 30, 38, 0.08) 100%);
}
.landing-hero-dots {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 22px;
  display: flex;
  gap: 7px;
}
.landing-hero-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.landing-hero-dot.active {
  background: #fff;
  transform: scale(1.3);
}
.landing-hero-text {
  position: relative;
  z-index: 2;
  padding: 0 48px 48px;
  max-width: 620px;
}
.landing-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fdeee9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  backdrop-filter: blur(2px);
}
.landing-headline {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 16px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}
.landing-headline .brand-name-warm { color: var(--gold); }
.landing-sub {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  max-width: 520px;
  margin: 0;
}

.landing-channels {
  padding: 8px 48px 56px;
}
.landing-channels-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 16px;
}
.landing-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1000px;
}
.landing-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.landing-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.landing-tile-label {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--heading);
}
.landing-tile-arrow {
  color: var(--warm);
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.12s ease;
}
.landing-tile:hover .landing-tile-arrow { transform: translateX(3px); }
.landing-tile-arrow .lock-icon { font-size: 14px; opacity: 0.7; }

/* ---- Excel-style fill handle (drag a cell's corner across months / down rows) ---- */
.fill-handle {
  position: fixed;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  background: var(--accent);
  border: 1px solid var(--panel);
  border-radius: 2px;
  cursor: crosshair;
  z-index: 60;
}
.fill-handle.hidden { display: none; }
input.pct-input.fill-preview {
  outline: 2px dashed var(--accent);
  outline-offset: -1px;
  background: var(--accent-tint);
}
body.fill-dragging { user-select: none; cursor: crosshair; }

/* ---- Bulk apply bar + reload button ---- */
header.bulk-bar { padding: 10px 22px; gap: 14px; box-shadow: none; }
header.bulk-bar.hidden { display: none; }
.bulk-bar-title { color: var(--heading); font-size: 13px; white-space: nowrap; }
.bulk-bar input[type="text"] { width: 96px; }
.bulk-bar select { max-width: 220px; }
.bulk-btn, .reload-btn {
  background: var(--accent);
  color: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  align-self: flex-end;
}
.bulk-btn:hover { background: var(--accent-hover); }
.bulk-btn.secondary, .reload-btn {
  background: var(--panel);
  color: var(--accent);
}
.bulk-btn.secondary:hover:not(:disabled), .reload-btn:hover { background: var(--accent-tint); }
.bulk-btn:disabled { opacity: 0.45; cursor: default; }
.reload-btn { padding: 5px 10px; font-size: 12px; }
input.pct-input.overridden { font-weight: 700; border-color: var(--accent); }

/* SKU table uses fixed column widths (fast to lay out); long text is clipped. */
#skuBaseTable td, #skuBaseTable th { overflow: hidden; text-overflow: ellipsis; }

/* ---- Multi-select dropdowns in the bulk bar ---- */
.bulk-field { display: flex; flex-direction: column; gap: 3px; }
.bulk-field > span {
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.msel { position: relative; }
.msel-btn {
  position: relative; min-width: 180px; max-width: 250px; text-align: left;
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  padding: 7px 28px 7px 10px; border-radius: 7px; font-size: 13px; font-family: inherit;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msel-btn::after { content: "\25BE"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.msel-btn:hover { border-color: var(--accent); }
.msel-panel {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 270px; max-width: 380px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: var(--shadow-md); z-index: 80; padding: 8px;
}
.msel-panel.hidden { display: none; }
header.bulk-bar .msel-search { width: 100%; margin: 0 0 6px; }
.msel-actions { display: flex; gap: 10px; margin-bottom: 6px; }
.msel-actions button {
  background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 2px 4px; font-family: inherit;
}
.msel-list { max-height: 280px; overflow-y: auto; }
header.bulk-bar .msel-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px;
  font-size: 13px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0; cursor: pointer;
}
header.bulk-bar .msel-item:hover { background: var(--accent-tint); }
header.bulk-bar .msel-item input { display: inline-block; width: auto; margin: 0; padding: 0; }
header.bulk-bar .msel-all { font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 3px; }

.bulk-confirm-text { color: var(--heading); font-weight: 600; margin-right: 6px; }
#bulkStatus .bulk-btn { padding: 4px 10px; font-size: 12px; align-self: auto; }

/* ---- Bulk apply: slide-in panel (opened from the "Bulk apply" button) ---- */
header.bulk-bar {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 94vw);
  flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 14px; row-gap: 14px;
  padding: 16px 18px 24px; margin: 0;
  background: var(--panel); border-left: 1px solid var(--border-strong); border-bottom: none;
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.25);
  overflow-y: auto; z-index: 200;
  transform: translateX(105%); visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}
header.bulk-bar.open { transform: translateX(0); visibility: visible; transition: transform 0.2s ease, visibility 0s; }
.bulk-drawer-head { display: flex; align-items: center; justify-content: space-between; }
.bulk-drawer-head .bulk-bar-title { font-size: 16px; }
.bulk-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.bulk-close:hover { color: var(--heading); }
.bulk-drawer-hint { margin: 0; font-size: 12px; line-height: 1.4; }
header.bulk-bar select, header.bulk-bar #bulkValue { width: 100%; max-width: none; box-sizing: border-box; }
header.bulk-bar .msel-btn { width: 100%; max-width: none; min-width: 0; }
header.bulk-bar .msel-panel { position: static; margin-top: 6px; min-width: 0; max-width: none; box-shadow: none; }
.bulk-drawer-actions { display: flex; gap: 10px; }
.bulk-drawer-actions .bulk-btn { flex: 1; align-self: auto; padding: 9px 14px; }
header.bulk-bar #bulkStatus { display: block; }
.bulk-open-btn.hidden { display: none; }
.bulk-open-btn.active { background: var(--accent); color: var(--panel); }

/* ---- One scrollbar: the Outlook scrolls with the table instead of having its own ---- */
#tableView > .trend-panel { position: sticky; left: 0; width: calc(100% - 36px); max-width: none; margin: 14px 18px; }
.trend-panel-body { max-height: none; overflow: visible; }

/* ---- Impact preview in the Bulk apply panel ---- */
.bulk-preview { border-top: 1px solid var(--border); padding-top: 14px; }
.bulk-preview-title { font-size: 13px; font-weight: 700; color: var(--heading); margin-bottom: 8px; }
.bulk-preview .chart-legend { flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.bulk-preview .chart-block { margin: 0 0 12px; min-width: 0; flex: none; }
.bulk-preview .chart-svg-wrap { padding: 4px 2px; overflow: visible; }
.bulk-preview p.muted { margin: 4px 0; font-size: 12px; line-height: 1.4; }
.bulk-delta { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.bulk-delta-row { display: flex; justify-content: space-between; gap: 8px; color: var(--text); }
.bulk-delta-row em { font-style: normal; font-weight: 700; margin-left: 4px; }
.bulk-delta-note { margin-top: 2px; }

.bulk-why { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px; background: var(--warm-tint); border: 1px solid var(--border); font-size: 12px; line-height: 1.45; color: var(--text); }
.bulk-why strong { display: block; margin-bottom: 3px; color: var(--heading); }
.bulk-why .muted { margin-top: 4px; font-size: 11.5px; }

.bulk-months { margin: 10px 0 4px; }
.bulk-month { padding: 7px 0; border-top: 1px solid var(--border); font-size: 12px; line-height: 1.45; }
.bulk-month-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.bulk-month-head > strong { min-width: 64px; color: var(--heading); }
.bulk-month .muted { margin-top: 2px; font-size: 11.5px; }

.bp-headline { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--text); }
.bp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.bp-card { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--warm-tint); min-width: 0; }
.bp-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #7a8a8f); }
.bp-big { font-size: 20px; font-weight: 700; color: var(--heading); margin: 2px 0; overflow-wrap: anywhere; }
.bp-was { font-size: 11.5px; color: var(--muted, #7a8a8f); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.bp-chip { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.bp-chip.up { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.bp-chip.down { color: #c0392b; background: color-mix(in srgb, #c0392b 15%, transparent); }
.bp-note { margin: 0 0 10px; padding: 9px 11px; border-radius: 8px; font-size: 12px; line-height: 1.5; border: 1px solid var(--border); }
.bp-note.warn { background: var(--warm-tint); }
.bp-note strong { display: block; margin-bottom: 3px; color: var(--heading); }
.bp-section { margin: 12px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--heading); }
.bp-month { padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; }
.bp-month-name { font-weight: 700; color: var(--heading); margin-bottom: 4px; }
.bp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.bp-row > span:first-child { color: var(--muted, #7a8a8f); }
.bp-row > span:last-child { text-align: right; }
.bp-why { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--text); opacity: .85; }
.bp-foot { margin: 6px 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--muted, #7a8a8f); }

.app-toast { position: fixed; right: 24px; bottom: 24px; z-index: 10000; max-width: 340px; padding: 12px 16px; border-radius: 12px; background: var(--heading, #0f3d4a); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.28); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.app-toast.show { opacity: 1; transform: none; }
.app-toast-title { font-weight: 700; font-size: 14px; }
.app-toast-detail { margin-top: 3px; font-size: 12px; opacity: .85; }

.pct-input.adjusted { border-style: dashed; border-color: var(--warm, #c97b2a); }
.season-modal { position: fixed; inset: 0; z-index: 9000; background: rgba(10,25,30,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.season-card { width: min(980px, 100%); max-height: 86vh; display: flex; flex-direction: column; background: var(--bg, #fff); color: var(--text); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.season-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--heading); }
.season-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text); }
.season-body { padding: 14px 18px 18px; overflow: auto; font-size: 13px; line-height: 1.5; }
.season-scroll { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.season-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.season-table th, .season-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.season-table th { position: sticky; top: 0; background: var(--warm-tint); color: var(--heading); }
.season-table td.num, .season-table th:nth-child(n+3):nth-child(-n+6) { text-align: right; }
.season-foot { margin-top: 12px; }

.pct-input.review { border-style: dotted; border-color: #c0392b; }
.season-list { margin: 6px 0 12px 18px; padding: 0; }
.season-list li { margin: 3px 0; }

.upl-card { width: min(1000px, 100%); }
.upl-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 34px 20px; margin-top: 12px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; background: var(--warm-tint); }
.upl-drop.over, .upl-drop:hover { border-color: var(--accent, #2a8fa5); }
.upl-drop-big { font-size: 16px; font-weight: 700; color: var(--heading); }
.upl-opts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 8px 0 4px; }
.upl-opt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.upl-opt select { max-width: 340px; }
.upl-section { margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--heading); }
.upl-field { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.upl-warn { margin: 6px 0 8px 18px; padding: 0; font-size: 12.5px; color: var(--warm, #c97b2a); }
.upl-error { color: #c0392b; font-weight: 600; }
.upl-none { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--warm-tint); }
.upl-done { font-size: 15px; color: var(--good); }
.upl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.season-body details { margin: 8px 0; }
.season-body summary { cursor: pointer; font-size: 12.5px; color: var(--heading); }
