/* =============================================================
   Forecast — modern data UI in the Dashboard's light theme
   Palette aligned with /dashboard (navy #1e3a5f, slate text,
   light background). Modern touches: mono figures, gradient
   KPI top, subtle shadows, hover lifts, dashed baselines.
   ============================================================= */

:root {
  --fc-bg:          #f0f2f5;
  --fc-paper:       #ffffff;
  --fc-surface:     #f8fafc;
  --fc-surface-hi:  #f1f5f9;

  --fc-border:      #e2e8f0;
  --fc-border-soft: #eef2f7;
  --fc-border-hi:   #cbd5e1;

  --fc-text:        #0f172a;
  --fc-text-soft:   #334155;
  --fc-text-mute:   #64748b;
  --fc-text-dim:    #94a3b8;

  --fc-navy:        #1e3a5f;
  --fc-navy-ink:    #142743;
  --fc-navy-weak:   rgba(30,58,95,0.08);
  --fc-navy-glow:   rgba(30,58,95,0.18);

  --fc-positive:    #16a34a;
  --fc-positive-bg: rgba(22,163,74,0.10);
  --fc-negative:    #dc2626;
  --fc-negative-bg: rgba(220,38,38,0.10);
  --fc-warn:        #d97706;
  --fc-warn-bg:     rgba(217,119,6,0.10);
  --fc-accent:      #0284c7;
  --fc-accent-bg:   rgba(2,132,199,0.10);

  --fc-event-cost:  #7c3aed;
  --fc-event-rev:   #0284c7;
  --fc-event-cost-bg: rgba(124,58,237,0.10);
  --fc-event-rev-bg:  rgba(2,132,199,0.10);

  --fc-radius:      12px;
  --fc-radius-sm:   8px;
  --fc-shadow-sm:   0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.03);
  --fc-shadow-md:   0 6px 24px rgba(15,23,42,0.08);
  --fc-shadow-lg:   0 24px 64px rgba(15,23,42,0.18);
  --fc-focus:       0 0 0 3px rgba(30,58,95,0.16);

  --fc-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --fc-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --fc-body:    'Inter', system-ui, sans-serif;
}

/* Escape the app's max-1400 container */
main.container:has(.fc-root) {
  max-width: none;
  padding: 0;
  margin: 0;
}

body:has(.fc-root) { background: var(--fc-bg); color: var(--fc-text); }

.fc-root {
  font-family: var(--fc-body);
  color: var(--fc-text);
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 2vw, 2.25rem) 3rem;
}
.fc-root * { box-sizing: border-box; }

/* Figures → mono tabular */
.fc-root [data-kpi],
.fc-root .fc-matrix-cell,
.fc-root .fc-cash-input,
.fc-root .fc-driver-value,
.fc-root .fc-event-row-amt,
.fc-root .fc-kpi-delta,
.fc-root .fc-driver-base {
  font-family: var(--fc-mono);
  font-feature-settings: 'tnum' 1, 'zero' 1;
  font-variant-numeric: tabular-nums;
}

/* ── Masthead ─────────────────────────────────────────── */
.fc-masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-end;
  gap: 2rem;
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--fc-border);
}
.fc-masthead-left { min-width: 0; }
.fc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--fc-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fc-navy);
  margin-bottom: 0.65rem;
}
.fc-eyebrow::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fc-positive);
  box-shadow: 0 0 10px rgba(22,163,74,0.5);
  animation: fc-pulse 2s ease-in-out infinite;
}
@keyframes fc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.fc-title {
  font-family: var(--fc-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--fc-navy);
  margin-bottom: 0.5rem;
}
.fc-subtitle {
  font-size: 0.875rem;
  color: var(--fc-text-soft);
}
.fc-baseline-pill {
  display: inline-block;
  font-family: var(--fc-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fc-navy);
  background: var(--fc-navy-weak);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.fc-masthead-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}
.fc-cash-block {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.9rem;
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  min-width: 240px;
  box-shadow: var(--fc-shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fc-cash-block:focus-within {
  border-color: var(--fc-navy);
  box-shadow: var(--fc-focus);
}
.fc-cash-label {
  font-family: var(--fc-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fc-text-dim);
}
.fc-cash-input {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--fc-navy);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  width: 100%;
}

.fc-scenario-block {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.fc-select {
  font-family: var(--fc-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-paper);
  color: var(--fc-text);
  min-width: 190px;
  box-shadow: var(--fc-shadow-sm);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fc-text-mute) 50%),
                    linear-gradient(135deg, var(--fc-text-mute) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 1.75rem;
}
.fc-select:focus {
  border-color: var(--fc-navy);
  outline: none;
  box-shadow: var(--fc-focus);
}

.fc-btn {
  font-family: var(--fc-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--fc-radius-sm);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(.2,.8,.2,1);
  border: 1px solid transparent;
  white-space: nowrap;
  box-shadow: var(--fc-shadow-sm);
}
.fc-btn-primary {
  background: var(--fc-navy);
  color: #fff;
  border-color: var(--fc-navy);
  font-weight: 600;
}
.fc-btn-primary:hover {
  background: var(--fc-navy-ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--fc-navy-glow);
}
.fc-btn-ghost {
  background: var(--fc-paper);
  color: var(--fc-text-soft);
  border-color: var(--fc-border);
}
.fc-btn-ghost:hover {
  border-color: var(--fc-border-hi);
  color: var(--fc-text);
  background: var(--fc-surface);
}
.fc-btn-add {
  padding: 0.55rem 0.9rem;
  background: transparent;
  color: var(--fc-navy);
  border: 1px dashed var(--fc-border-hi);
  border-radius: var(--fc-radius-sm);
  font-weight: 500;
  font-size: 0.8125rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.15s;
  box-shadow: none;
}
.fc-btn-add:hover {
  border-color: var(--fc-navy);
  background: var(--fc-navy-weak);
}

/* ── Tabs ─────────────────────────────────────────────── */
.fc-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 0.75rem;
  border-bottom: 1px solid var(--fc-border);
}
.fc-tab {
  font-family: var(--fc-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fc-text-mute);
  padding: 0.9rem 1.25rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.fc-tab:hover { color: var(--fc-text); }
.fc-tab.is-active {
  color: var(--fc-navy);
  border-bottom-color: var(--fc-navy);
}
.fc-tabs-spacer { flex: 1; }
.fc-drawer-toggle {
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  padding: 0.4rem 0.85rem;
  font-family: var(--fc-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fc-text-soft);
  cursor: pointer;
  margin-bottom: 0.4rem;
  box-shadow: var(--fc-shadow-sm);
}
.fc-drawer-toggle:hover { color: var(--fc-text); border-color: var(--fc-border-hi); }

/* ── Driver drawer ────────────────────────────────────── */
.fc-drawer {
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-top: none;
  border-radius: 0 0 var(--fc-radius) var(--fc-radius);
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(.2,.8,.2,1);
  max-height: 800px;
  box-shadow: var(--fc-shadow-sm);
}
.fc-drawer.is-collapsed { max-height: 0; border-bottom: none; }
.fc-drawer-inner {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
}
.fc-drawer-col {
  padding: 1.1rem 1.35rem 1.25rem;
  border-right: 1px solid var(--fc-border-soft);
  min-width: 0;
}
.fc-drawer-col:last-child { border-right: none; }
.fc-drawer-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--fc-border-soft);
}
.fc-drawer-title {
  font-family: var(--fc-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fc-text);
  letter-spacing: -0.015em;
}
.fc-drawer-sub {
  font-size: 0.75rem;
  color: var(--fc-text-mute);
}

.fc-driver { display: flex; flex-direction: column; gap: 0.4rem; }
.fc-driver + .fc-driver { margin-top: 0.875rem; }
.fc-driver-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fc-text-soft);
  min-width: 0;
}
.fc-driver-label-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fc-driver-value {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--fc-text);
  text-align: right;
  flex-shrink: 0;
}
.fc-driver-value.is-changed { color: var(--fc-navy); font-weight: 600; }
.fc-driver-base {
  font-size: 0.6875rem;
  color: var(--fc-text-dim);
}

.fc-cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem 1.5rem;
}
.fc-cost-grid .fc-driver + .fc-driver { margin-top: 0; }

/* Modern slider */
.fc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--fc-border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.fc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--fc-navy);
  border: 2px solid var(--fc-paper);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 0 1px var(--fc-navy), 0 1px 4px rgba(15,23,42,0.25);
  transition: transform 0.12s;
}
.fc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 1px var(--fc-navy), 0 0 0 4px var(--fc-navy-glow);
}
.fc-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--fc-navy);
  border: 2px solid var(--fc-paper);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 0 1px var(--fc-navy), 0 1px 4px rgba(15,23,42,0.25);
}

/* Events list */
.fc-events-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.fc-event-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--fc-surface);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.fc-event-row:hover {
  border-color: var(--fc-border-hi);
  background: var(--fc-paper);
}
.fc-event-row-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; color: var(--fc-text);
}
.fc-event-row-meta {
  font-family: var(--fc-mono);
  font-size: 0.625rem;
  color: var(--fc-text-dim);
  letter-spacing: 0.05em;
}
.fc-event-row-amt {
  font-weight: 600; color: var(--fc-navy);
  font-size: 0.8125rem;
}
.fc-event-row-amt.is-revenue { color: var(--fc-positive); }
.fc-event-row-remove {
  border: none; background: transparent;
  color: var(--fc-text-dim);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem;
}
.fc-event-row-remove:hover { color: var(--fc-negative); }

/* ── KPI strip ────────────────────────────────────────── */
.fc-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-top: 1.25rem;
  gap: 0.75rem;
}
@media (max-width: 1280px) {
  .fc-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .fc-kpis { grid-template-columns: repeat(2, 1fr); }
}
.fc-kpi {
  padding: 1.15rem 1.35rem;
  position: relative;
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  overflow: hidden;
  box-shadow: var(--fc-shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.fc-kpi:hover {
  transform: translateY(-1px);
  box-shadow: var(--fc-shadow-md);
}
.fc-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--fc-kpi-color, var(--fc-navy));
}
.fc-kpi::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 60px;
  background: radial-gradient(ellipse 240px 60px at 50% -10px, var(--fc-kpi-color, var(--fc-navy)), transparent 70%);
  opacity: 0.05;
  pointer-events: none;
}
.fc-kpi--revenue { --fc-kpi-color: var(--fc-positive); }
.fc-kpi--costs   { --fc-kpi-color: var(--fc-warn); }
.fc-kpi--profit  { --fc-kpi-color: var(--fc-navy); }
.fc-kpi--margin  { --fc-kpi-color: var(--fc-accent); }
.fc-kpi--cash    { --fc-kpi-color: var(--fc-event-cost); }

.fc-kpi-label {
  font-family: var(--fc-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fc-text-dim);
  margin-bottom: 0.4rem;
}
.fc-kpi-value {
  font-family: var(--fc-display);
  font-weight: 700;
  font-size: 1.625rem;
  letter-spacing: -0.03em;
  color: var(--fc-text);
  line-height: 1.1;
}
.fc-kpi-delta {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.4rem;
  color: var(--fc-text-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.fc-kpi-delta.is-up   { color: var(--fc-positive); }
.fc-kpi-delta.is-up::before   { content: '▲'; font-size: 0.625rem; }
.fc-kpi-delta.is-down { color: var(--fc-negative); }
.fc-kpi-delta.is-down::before { content: '▼'; font-size: 0.625rem; }

/* ── Section caption ──────────────────────────────────── */
.fc-section-caption {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 2rem 0 0.75rem;
}
.fc-section-title {
  font-family: var(--fc-display);
  font-weight: 600;
  font-size: 1.375rem;
  color: var(--fc-text);
  letter-spacing: -0.025em;
}
.fc-section-sub {
  font-size: 0.8125rem;
  color: var(--fc-text-mute);
}

/* ── Matrix ───────────────────────────────────────────── */
.fc-matrix-wrap {
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  box-shadow: var(--fc-shadow-sm);
  overflow: hidden;
}
.fc-matrix-wrap > .fc-section-caption {
  margin: 0;
  padding: 1rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-surface);
}
.fc-matrix-scroll { overflow-x: auto; }
.fc-matrix { min-width: 900px; }

.fc-matrix-header {
  display: grid;
  grid-template-columns: 220px repeat(6, minmax(130px, 1fr));
  background: var(--fc-surface);
  border-bottom: 1px solid var(--fc-border);
  position: sticky; top: 0; z-index: 2;
}
.fc-matrix-header-cell {
  padding: 0.95rem 1rem 0.875rem;
  text-align: right;
  font-family: var(--fc-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fc-text);
  border-right: 1px solid var(--fc-border-soft);
}
.fc-matrix-header-cell:first-child {
  text-align: left;
  font-family: var(--fc-body);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fc-text-mute);
}
.fc-matrix-header-cell:last-child { border-right: none; }
.fc-matrix-header-cell .fc-month-sub {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--fc-mono);
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--fc-accent);
}

.fc-matrix-row {
  display: grid;
  grid-template-columns: 220px repeat(6, minmax(130px, 1fr));
  border-bottom: 1px solid var(--fc-border-soft);
  transition: background 0.1s;
}
.fc-matrix-row:last-child { border-bottom: none; }
.fc-matrix-row:hover { background: var(--fc-surface); }
.fc-matrix-row.is-section-head {
  background: var(--fc-surface);
}
.fc-matrix-row.is-total {
  background: var(--fc-surface);
  border-top: 2px solid var(--fc-navy);
  border-bottom: 2px solid var(--fc-navy);
}
.fc-matrix-row.is-total:hover { background: var(--fc-surface); }
.fc-matrix-row.is-cash {
  background: rgba(2,132,199,0.03);
  border-top: 1px dashed var(--fc-border-hi);
}
.fc-matrix-row.is-margin { background: rgba(217,119,6,0.03); }

.fc-matrix-cell {
  padding: 0.65rem 1rem;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fc-text);
  border-right: 1px solid var(--fc-border-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-matrix-cell:last-child { border-right: none; }
.fc-matrix-cell.fc-row-label {
  text-align: left;
  font-family: var(--fc-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fc-text-soft);
  padding-left: 1.25rem;
}
.fc-matrix-row.is-section-head .fc-row-label {
  font-family: var(--fc-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fc-text-mute);
  font-weight: 600;
}
.fc-matrix-row.is-total .fc-row-label {
  font-family: var(--fc-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fc-navy);
  text-transform: none;
  letter-spacing: -0.015em;
}
.fc-matrix-row.is-total .fc-matrix-cell {
  font-family: var(--fc-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--fc-navy);
}
.fc-matrix-row.is-cash .fc-row-label { color: var(--fc-event-rev); }
.fc-matrix-row.is-margin .fc-row-label { color: var(--fc-warn); }
.fc-matrix-row.is-margin .fc-matrix-cell { color: var(--fc-text-mute); }

.fc-matrix-cell.is-edited {
  background: var(--fc-navy-weak);
  box-shadow: inset 2px 0 0 var(--fc-navy);
  color: var(--fc-navy);
  font-weight: 600;
}
.fc-matrix-cell.is-editable { cursor: text; }
.fc-matrix-cell.is-editable:hover {
  background: var(--fc-surface-hi);
  color: var(--fc-text);
}
.fc-matrix-cell.is-negative { color: var(--fc-negative); }
.fc-matrix-cell input.fc-cell-input {
  width: 100%;
  border: none; outline: none;
  background: transparent;
  text-align: right;
  font: inherit;
  color: var(--fc-navy);
  font-family: var(--fc-mono);
  padding: 0;
}

/* Event chips on month headers */
.fc-month-events {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-top: 0.45rem;
  justify-content: flex-end;
}
.fc-event-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-family: var(--fc-mono);
  font-size: 0.625rem; font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  background: var(--fc-event-cost-bg);
  color: var(--fc-event-cost);
  border: 1px solid transparent;
  letter-spacing: 0.03em;
  transition: border-color 0.12s;
}
.fc-event-chip:hover { border-color: currentColor; }
.fc-event-chip.is-revenue {
  background: var(--fc-event-rev-bg);
  color: var(--fc-event-rev);
}

/* ── Charts ───────────────────────────────────────────── */
.fc-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}
.fc-chart-card {
  background: var(--fc-paper);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: var(--fc-shadow-sm);
}
.fc-chart-caption {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--fc-border-soft);
}
.fc-chart-title {
  font-family: var(--fc-display);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--fc-text);
  letter-spacing: -0.02em;
}
.fc-chart-sub {
  font-size: 0.8125rem;
  color: var(--fc-text-mute);
}
.fc-chart-host { position: relative; height: 300px; }
.fc-chart-host canvas { width: 100% !important; height: 100% !important; }

/* ── Modal ────────────────────────────────────────────── */
.fc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fc-modal[hidden] { display: none; }
.fc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.fc-modal-panel {
  position: relative;
  background: var(--fc-paper);
  border-radius: var(--fc-radius);
  border: 1px solid var(--fc-border);
  box-shadow: var(--fc-shadow-lg);
  width: 460px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  z-index: 1;
}
.fc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--fc-border);
  background: var(--fc-surface);
}
.fc-modal-header h3 {
  font-family: var(--fc-display);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--fc-text);
  margin: 0;
  letter-spacing: -0.015em;
}
.fc-modal-close {
  border: none; background: transparent;
  font-size: 1.5rem;
  color: var(--fc-text-mute);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
  transition: color 0.12s;
}
.fc-modal-close:hover { color: var(--fc-text); }
.fc-modal-body {
  display: flex; flex-direction: column; gap: 0.9rem;
  padding: 1.35rem;
  background: var(--fc-paper);
}
.fc-field {
  display: flex; flex-direction: column; gap: 0.4rem;
  flex: 1;
}
.fc-field span {
  font-family: var(--fc-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fc-text-dim);
}
.fc-field input, .fc-field select {
  font-family: var(--fc-body);
  font-size: 0.9375rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm);
  background: var(--fc-paper);
  color: var(--fc-text);
  font-feature-settings: 'tnum' 1;
  transition: all 0.12s;
}
.fc-field input:focus, .fc-field select:focus {
  outline: none;
  border-color: var(--fc-navy);
  box-shadow: var(--fc-focus);
}
.fc-field-row { display: flex; gap: 0.75rem; }
.fc-modal-footer {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--fc-border-soft);
}

/* ── Number update pulse ─────────────────────────────── */
@keyframes fc-flash {
  0%   { background-color: var(--fc-navy-weak); }
  100% { background-color: transparent; }
}
.fc-matrix-cell.is-flash { animation: fc-flash 0.6s ease-out; }

/* ── Error banner ─────────────────────────────────────── */
body:has(.fc-root) .error-banner {
  background: var(--fc-negative-bg);
  color: var(--fc-negative);
  border: 1px solid rgba(220,38,38,0.2);
  padding: 0.75rem 1rem;
  border-radius: var(--fc-radius);
  margin: 1rem clamp(1rem, 2vw, 2.25rem);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1280px) {
  .fc-drawer-inner { grid-template-columns: 1fr; }
  .fc-drawer-col { border-right: none; border-bottom: 1px solid var(--fc-border-soft); }
  .fc-drawer-col:last-child { border-bottom: none; }
  .fc-kpis { grid-template-columns: repeat(3, 1fr); }
  .fc-charts { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .fc-root { padding: 0 1rem 2rem; }
  .fc-masthead { grid-template-columns: 1fr; gap: 1rem; padding: 1.25rem 0 1rem; }
  .fc-masthead-right { align-items: stretch; width: 100%; }
  .fc-cash-block { min-width: 0; width: 100%; }
  .fc-scenario-block { justify-content: stretch; }
  .fc-select { flex: 1; min-width: 0; }
  .fc-kpis { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .fc-tabs { overflow-x: auto; }
  .fc-section-title { font-size: 1.125rem; }
  .fc-chart-host { height: 240px; }
}

/* ── Print ────────────────────────────────────────────── */
@media print {
  .fc-tabs, .fc-drawer, .fc-masthead-right, .navbar { display: none !important; }
  body:has(.fc-root) { background: white; }
  .fc-matrix-wrap, .fc-kpi, .fc-chart-card { box-shadow: none !important; }
  @page { size: A4 landscape; margin: 1.2cm; }
}

/* ── VAT reserve KPIs ───────────────────────────────────────────────────── */
.fc-kpi--vat-set-aside  { --fc-kpi-color: #7c3aed; }
.fc-kpi--cash-after-vat { --fc-kpi-color: #5b21b6; }

.fc-kpi-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(100,116,139,0.12);
  color: #475569;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.fc-kpi--cash .fc-kpi-tag         { background: rgba(100,116,139,0.12); color: #475569; }
.fc-kpi--profit .fc-kpi-tag       { background: rgba(30,58,95,0.12);    color: #1e3a5f; }
.fc-kpi--revenue .fc-kpi-tag,
.fc-kpi--costs .fc-kpi-tag        { background: rgba(22,163,74,0.12);   color: #166534; }

/* ── VAT reserve matrix rows ────────────────────────────────────────────── */
.fc-matrix-row.is-vat-divider {
  background: linear-gradient(90deg, rgba(124,58,237,0.08), rgba(124,58,237,0.02));
  border-top: 2px solid rgba(124,58,237,0.25);
  border-bottom: 1px solid rgba(124,58,237,0.15);
}
.fc-matrix-row.is-vat-divider .fc-row-label {
  color: #5b21b6;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}
.fc-matrix-row.is-vat-accrued .fc-row-label,
.fc-matrix-row.is-vat-liability .fc-row-label,
.fc-matrix-row.is-vat-paid .fc-row-label {
  color: #6b21a8;
}
.fc-matrix-row.is-vat-liability {
  background: rgba(124,58,237,0.03);
  font-weight: 600;
}
.fc-matrix-row.is-vat-liability .fc-matrix-cell:not(.fc-row-label) {
  color: #5b21b6;
}
.fc-matrix-row.is-vat-paid {
  background: rgba(124,58,237,0.05);
}
.fc-matrix-row.is-vat-paid .fc-matrix-cell:not(.fc-row-label) {
  color: #6d28d9;
}
.fc-matrix-row.is-cash-after {
  background: linear-gradient(90deg, rgba(124,58,237,0.06), rgba(124,58,237,0.02));
  border-top: 2px solid rgba(124,58,237,0.2);
  font-weight: 700;
}
.fc-matrix-row.is-cash-after .fc-row-label {
  color: #4c1d95;
}
.fc-matrix-row.is-cash-after .fc-matrix-cell:not(.fc-row-label) {
  color: #4c1d95;
  font-variant-numeric: tabular-nums;
}

/* VAT notice banner — multi-line support */
.fc-vat-notice-line {
  display: block;
  line-height: 1.5;
}
.fc-vat-notice-line + .fc-vat-notice-line {
  margin-top: 0.25rem;
}
.fc-vat-notice-sub {
  font-size: 0.8125rem;
  color: #5b21b6;
  border-top: 1px solid rgba(124,58,237,0.15);
  padding-top: 0.4rem;
  margin-top: 0.4rem !important;
}

/* Total tab on forecast — distinct accent */
.fc-tab[href*="tab=total"] {
  margin-left: auto;
  border-left: 2px solid var(--fc-grid);
  padding-left: 1.25rem;
  font-weight: 700;
}
.fc-tab[href*="tab=total"].is-active {
  background: linear-gradient(180deg, transparent 0%, rgba(30,58,95,0.06) 100%);
}
