:root {
  --ink: #08271f;
  --ink-2: #103a30;
  --paper: #f5f1e7;
  --paper-2: #ebe4d6;
  --mint: #79d2af;
  --mint-2: #4ca783;
  --coral: #e87b61;
  --gold: #d7b84b;
  --blue: #6f9fc5;
  --muted: #6f7e78;
  --line: rgba(8, 39, 31, 0.13);
  --shadow: 0 16px 48px rgba(8, 39, 31, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, select { font: inherit; }
a { color: inherit; }

.dashboard-header { position: sticky; top: 0; z-index: 20; display: flex; min-height: 76px; padding: 0 clamp(22px, 5vw, 72px); align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(245, 241, 231, 0.94); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span { display: grid; width: 38px; aspect-ratio: 1; place-items: center; border-radius: 50%; color: var(--paper); background: var(--ink); font-size: .72rem; font-weight: 700; }
.brand strong { font-family: Manrope, sans-serif; font-size: .95rem; }
.header-actions { display: flex; align-items: center; gap: 25px; }
.header-actions nav { display: flex; gap: 7px; font-size: .72rem; font-weight: 700; }
.header-actions nav a { text-decoration: none; opacity: .48; }
.header-actions nav a.active { opacity: 1; text-decoration: underline; text-underline-offset: 5px; }
.data-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; }
.data-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint-2); box-shadow: 0 0 0 4px rgba(76,167,131,.12); }

main { width: min(1500px, 100%); margin: auto; padding: clamp(42px, 6vw, 84px) clamp(18px, 4vw, 62px) 90px; }
.dashboard-intro { display: grid; align-items: end; grid-template-columns: 1.4fr .6fr; gap: 40px; }
.eyebrow, .panel-heading p, .insight-panel > p { margin: 0 0 12px; color: var(--mint-2); font-size: .68rem; font-weight: 700; letter-spacing: .14em; }
.dashboard-intro h1 { max-width: 850px; margin: 0; font-family: Manrope, sans-serif; font-size: clamp(2.35rem, 5.2vw, 5.4rem); letter-spacing: -.065em; line-height: .98; }
.dashboard-intro > div > p:last-child { max-width: 760px; margin: 24px 0 0; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.65; }
.dashboard-intro aside { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.38); }
.dashboard-intro aside span, .dashboard-intro aside small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.dashboard-intro aside strong { display: block; margin: 8px 0; font-family: Manrope, sans-serif; }

.filter-panel { display: grid; margin: clamp(38px, 5vw, 65px) 0 22px; padding: 18px; align-items: end; border: 1px solid var(--line); border-radius: 20px; background: #fffdf8; box-shadow: var(--shadow); grid-template-columns: repeat(3, minmax(130px, 1fr)) auto minmax(180px, 1.2fr); gap: 12px; }
.filter-panel > label span, .month-control > span { display: block; margin: 0 0 7px 3px; color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.filter-panel select { width: 100%; min-height: 44px; padding: 0 38px 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--paper); }
.filter-panel button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 11px; color: white; background: var(--ink); cursor: pointer; }
.filter-panel p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }

.dashboard-tabs { display: flex; margin: 0 0 24px; padding: 5px; gap: 4px; overflow-x: auto; border-radius: 14px; background: var(--paper-2); }
.dashboard-tabs button { flex: 1; min-width: max-content; padding: 11px 14px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: .8rem; font-weight: 700; }
.dashboard-tabs button.active { color: var(--paper); background: var(--ink); }
.export-bar { display: flex; margin: -8px 0 22px; padding: 13px 15px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.55); }
.export-bar div { display: grid; margin-right: auto; gap: 2px; }
.export-bar strong { font-size: .78rem; }
.export-bar span { color: var(--muted); font-size: .68rem; }
.export-bar button { padding: 10px 13px; border: 1px solid var(--ink); border-radius: 9px; color: var(--ink); background: transparent; cursor: pointer; font: 700 .7rem "DM Sans", sans-serif; }
.export-bar button:last-child { color: var(--paper); background: var(--ink); }
.statement-heading { display: flex; margin: 0 0 18px; align-items: end; justify-content: space-between; gap: 20px; }
.statement-heading p { margin: 0 0 5px; color: var(--mint-2); font-size: .68rem; font-weight: 700; letter-spacing: .12em; }
.statement-heading h2 { margin: 0; }
.statement-heading span { color: var(--muted); font-size: .78rem; font-weight: 700; }
.statement-table th, .statement-table td { padding: 9px 10px; font-size: .74rem; text-transform: none; letter-spacing: 0; }
.statement-table th { color: var(--muted); font-weight: 500; }
.statement-table td { font-variant-numeric: tabular-nums; }
.statement-table .section-row th { padding-top: 18px; color: var(--ink); font-size: .65rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.statement-table .subtotal-row th, .statement-table .subtotal-row td { border-top: 1px solid var(--ink); color: var(--ink); font-weight: 700; }
.statement-table .total-row th, .statement-table .total-row td { color: #fff; background: var(--ink); font-weight: 700; }
.statement-table .check-row th, .statement-table .check-row td { color: var(--mint-2); font-weight: 700; }
.statement-ratios { display: grid; margin-top: 12px; gap: 6px; color: var(--muted); font-size: .7rem; }
.statement-ratios strong { float: right; color: var(--ink); }
.dashboard-grid.three-statements { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.average-strip { display: grid; margin: 0 0 18px; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.average-strip div { padding: 10px 12px; border-radius: 10px; background: var(--paper-2); }
.average-strip span, .average-strip strong { display: block; }
.average-strip span { color: var(--muted); font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.average-strip strong { margin-top: 3px; font-family: Manrope, sans-serif; font-size: .86rem; }
.assumptions-panel ul { display: grid; margin: 0; padding-left: 20px; grid-template-columns: 1fr 1fr; gap: 10px 28px; }
.assumptions-panel li { color: var(--muted); font-size: .73rem; line-height: 1.45; }
.dashboard-view { display: none; }
.dashboard-view.active { display: block; animation: reveal .25s ease; }
@keyframes reveal { from { opacity: .3; transform: translateY(5px); } }

.kpi-grid { display: grid; margin-bottom: 20px; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-grid.compact { grid-template-columns: repeat(4, 1fr); }
.kpi { min-height: 145px; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: #fffdf8; box-shadow: 0 8px 28px rgba(8,39,31,.045); }
.kpi small { display: block; min-height: 32px; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.kpi strong { display: block; margin: 13px 0 8px; font-family: Manrope, sans-serif; font-size: clamp(1.45rem, 2.4vw, 2.35rem); letter-spacing: -.045em; }
.kpi span { color: var(--mint-2); font-size: .72rem; font-weight: 700; }
.kpi.negative span { color: var(--coral); }

.dashboard-grid { display: grid; margin-bottom: 18px; gap: 18px; }
.dashboard-grid.wide-left { grid-template-columns: 1.55fr .75fr; }
.dashboard-grid.equal { grid-template-columns: repeat(2, 1fr); }
.panel { min-width: 0; padding: clamp(20px, 2.8vw, 34px); border: 1px solid var(--line); border-radius: 20px; background: #fffdf8; box-shadow: var(--shadow); }
.panel-heading { display: flex; margin-bottom: 24px; align-items: start; justify-content: space-between; gap: 20px; }
.panel-heading h2, .insight-panel h2 { margin: 0; font-family: Manrope, sans-serif; font-size: clamp(1.1rem, 1.7vw, 1.55rem); letter-spacing: -.035em; }
.panel-heading > span { color: var(--muted); font-size: .72rem; }
.chart { min-height: 250px; }

.dre-report { overflow-x: auto; }
.dre-table { min-width: 520px; }
.dre-table th, .dre-table td { padding: 10px 12px; font-size: .74rem; }
.dre-table thead th { padding-top: 0; }
.dre-table thead th:not(:first-child) { color: var(--ink); text-align: right; }
.dre-table tbody th { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.dre-table .revenue-row th, .dre-table .revenue-row td { color: var(--ink); font-weight: 700; }
.dre-table .subtotal-row th, .dre-table .subtotal-row td { border-top: 1px solid var(--ink); color: var(--ink); font-weight: 700; }
.dre-table .total-row th, .dre-table .total-row td { color: #fff; background: var(--ink); font-weight: 700; }
.dre-table .total-row th { border-radius: 8px 0 0 8px; }
.dre-table .total-row td:last-child { border-radius: 0 8px 8px 0; }
.dre-table .margin-row th, .dre-table .margin-row td { color: var(--mint-2); font-weight: 700; }
.report-note { margin: 14px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.45; }

.bar-list { display: grid; gap: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(130px, 3fr) auto; align-items: center; gap: 12px; }
.bar-row label { overflow: hidden; font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 11px; overflow: hidden; border-radius: 999px; background: var(--paper-2); }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--mint-2); }
.bar-row:nth-child(2n) .bar-track i { background: var(--coral); }
.bar-row b { min-width: 74px; font-size: .74rem; text-align: right; }

.donut-wrap { display: grid; grid-template-columns: minmax(130px, 180px) 1fr; align-items: center; gap: 18px; }
.data-donut { position: relative; display: grid; width: 100%; aspect-ratio: 1; place-items: center; border-radius: 50%; }
.data-donut::after { width: 55%; height: 55%; content: ""; border-radius: 50%; background: #fffdf8; }
.donut-center { position: absolute; z-index: 1; text-align: center; }
.donut-center strong, .donut-center span { display: block; }
.donut-center strong { font-family: Manrope, sans-serif; font-size: 1.5rem; }
.donut-center span { color: var(--muted); font-size: .67rem; }
.legend { display: grid; gap: 12px; }
.legend div { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; font-size: .73rem; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }
.legend b { white-space: nowrap; }
.legend small { grid-column: 2 / -1; margin-top: -6px; color: var(--muted); font-size: .63rem; }

.trend-svg { width: 100%; height: 270px; overflow: visible; }
.trend-svg text { fill: var(--muted); font: 11px "DM Sans"; }
.trend-svg .grid { stroke: var(--line); stroke-width: 1; }
.trend-svg .area { fill: rgba(76,167,131,.11); }
.trend-svg .line { fill: none; stroke: var(--mint-2); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-svg circle { fill: #fffdf8; stroke: var(--mint-2); stroke-width: 3; }

.combo-legend { display: flex; margin-bottom: 10px; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .7rem; }
.comparison-heading { align-items: end; }
.chart-period-control { display: grid; min-width: 175px; gap: 6px; color: var(--muted); font-size: .65rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chart-period-control select { min-height: 38px; padding: 0 32px 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--paper); font: 500 .72rem "DM Sans", sans-serif; text-transform: none; letter-spacing: 0; }
.chart-period-note { margin: -12px 0 12px; color: var(--muted); font-size: .68rem; }
.combo-legend span::before { display: inline-block; width: 9px; height: 9px; margin-right: 6px; content: ""; border-radius: 50%; background: var(--mint-2); }
.combo-legend .expenses::before { background: var(--coral); }
.combo-legend .result::before { background: rgba(215,184,75,.75); }
.combo-legend .packages-legend::before { border-radius: 2px; background: var(--blue); }
.combo-svg { width: 100%; min-width: 540px; overflow: visible; }
.combo-svg .zero { stroke: #c7cfc9; stroke-width: 1; }
.combo-svg .result-area { fill: rgba(215,184,75,.22); stroke: #b2962f; stroke-width: 1.5; }
.combo-svg .revenue-line, .combo-svg .expense-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.combo-svg .revenue-line { stroke: var(--mint-2); }
.combo-svg .expense-line { stroke: var(--coral); }
.combo-svg .revenue-point { fill: var(--mint-2); }
.combo-svg .expense-point { fill: var(--coral); }
.combo-svg text { fill: var(--muted); font-size: 10px; }
.combo-svg .value-label { paint-order: stroke; stroke: #fffdf8; stroke-width: 4px; stroke-linejoin: round; font-size: 9px; font-weight: 700; }
.combo-svg .revenue-value { fill: #28785d; }
.combo-svg .expense-value { fill: #bd543d; }
.combo-svg .result-value { fill: #92791d; }
.combo-svg .package-bar { fill: rgba(111,159,197,.55); }
.combo-svg .package-value { fill: #416b8e; font-size: 9px; font-weight: 700; }
#revenue-expense-chart { overflow-x: auto; }
#cash-activity-chart, #statement-activity-chart { overflow-x: auto; }

.insight-panel { color: var(--paper); background: var(--ink); }
.insight-panel h2 { color: white; }
.insight-panel ul { margin: 24px 0 0; padding: 0; list-style: none; }
.insight-panel li { position: relative; padding: 15px 0 15px 24px; border-top: 1px solid rgba(255,255,255,.12); color: #c3d1cc; font-size: .86rem; line-height: 1.55; }
.insight-panel li::before { position: absolute; top: 20px; left: 2px; width: 7px; height: 7px; content: ""; border-radius: 50%; background: var(--mint); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: .78rem; text-align: right; white-space: nowrap; }
th { color: var(--muted); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
th:first-child, td:first-child { text-align: left; }
td strong { font-weight: 700; }
.expense-table-wrap { max-height: 620px; overflow: auto; }
.expense-table-wrap thead { position: sticky; z-index: 2; top: 0; background: #fffdf8; }
.expense-table-wrap tfoot { position: sticky; z-index: 2; bottom: 0; color: var(--paper); background: var(--ink); }
.expense-table-wrap tfoot th { color: var(--paper); font-size: .75rem; }
.margin-pill { display: inline-block; min-width: 58px; padding: 5px 8px; border-radius: 999px; color: var(--ink); background: rgba(121,210,175,.25); text-align: center; }
.margin-pill.low { color: #7d2d1c; background: rgba(232,123,97,.2); }

.synthetic-banner { display: flex; margin: 0 0 18px; padding: 15px 18px; align-items: center; gap: 15px; border: 1px solid rgba(215,184,75,.45); border-radius: 14px; background: rgba(215,184,75,.13); }
.synthetic-banner strong { font-size: .78rem; }
.synthetic-banner span { color: var(--muted); font-size: .76rem; }

.capacity-list { display: grid; gap: 14px; }
.capacity-row { display: grid; grid-template-columns: 62px 1fr 80px; align-items: center; gap: 12px; }
.capacity-row > span { color: var(--muted); font-size: .7rem; }
.capacity-track { position: relative; height: 22px; border-radius: 7px; background: var(--paper-2); }
.capacity-track::after { position: absolute; top: -3px; bottom: -3px; left: 70%; width: 2px; content: ""; background: var(--gold); }
.capacity-track i { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--mint-2); }
.capacity-row.high .capacity-track i { background: var(--coral); }
.capacity-row b { font-size: .72rem; text-align: right; }

footer { display: flex; padding: 30px clamp(22px, 5vw, 72px); align-items: center; justify-content: space-between; gap: 20px; color: #b7c8c1; background: var(--ink); font-size: .76rem; }
footer a { color: var(--mint); font-weight: 700; }

@media (max-width: 1050px) {
  .filter-panel { grid-template-columns: repeat(3, 1fr); }
  .filter-panel p { grid-column: 2 / -1; }
  .kpi-grid, .kpi-grid.compact { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid.wide-left { grid-template-columns: 1fr; }
  .dashboard-grid.three-statements { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .dashboard-header { min-height: 66px; }
  .brand strong, .data-status { display: none; }
  .dashboard-intro { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel label:last-of-type { grid-column: 1 / -1; }
  .filter-panel p { grid-column: 1 / -1; }
  .dashboard-grid.equal { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .average-strip { grid-template-columns: 1fr; }
  .data-donut { width: min(210px, 70%); margin: auto; }
  .bar-row { grid-template-columns: minmax(80px, 1fr) minmax(100px, 2fr); }
  .bar-row b { grid-column: 2; text-align: left; }
  footer { align-items: start; flex-direction: column; }
  .export-bar { align-items: stretch; flex-direction: column; }
  .export-bar div { margin: 0 0 4px; }
  .assumptions-panel ul { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { color: #182923; background: white; }
  .dashboard-header, .filter-panel, .export-bar, .dashboard-tabs, footer { display: none !important; }
  main { max-width: none; padding: 0; }
  .dashboard-intro { margin-bottom: 12px; padding: 14px 18px; break-inside: avoid; }
  .dashboard-view { display: none !important; }
  body[data-print-mode="statements"] #view-statements,
  body[data-print-mode="shirley"] #view-executive,
  body[data-print-mode="shirley"] #view-profitability,
  body[data-print-mode="shirley"] #view-expenses { display: block !important; }
  .panel, .kpi, .synthetic-banner { box-shadow: none; break-inside: avoid; }
  .panel { padding: 14px; }
  .kpi { min-height: 92px; padding: 14px; }
  .kpi strong { font-size: 1.35rem; }
  .dashboard-grid { gap: 12px; }
  .statement-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .assumptions-panel li { font-size: .63rem; }
  body[data-print-mode="shirley"] #view-profitability,
  body[data-print-mode="shirley"] #view-expenses { page-break-before: always; }
  .combo-svg { min-width: 0; }
}

@media (max-width: 480px) {
  main { padding-inline: 14px; }
  .filter-panel, .kpi-grid, .kpi-grid.compact { grid-template-columns: 1fr; }
  .filter-panel label:last-of-type, .filter-panel p { grid-column: auto; }
  .kpi { min-height: 120px; }
  .panel { padding: 18px; }
  .synthetic-banner { align-items: start; flex-direction: column; }
  .comparison-heading { align-items: start; flex-direction: column; }
  .chart-period-control { width: 100%; }
}
.month-control { position: relative; min-width: 0; }
.multi-select { position: relative; }
.multi-select summary { display: flex; min-height: 44px; padding: 0 13px; align-items: center; justify-content: space-between; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; list-style: none; }
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary::after { content: "⌄"; font-size: 1rem; }
.month-options { position: absolute; z-index: 20; top: calc(100% + 7px); left: 0; display: grid; width: max(100%, 210px); max-height: 285px; padding: 10px; overflow-y: auto; border: 1px solid var(--line); border-radius: 13px; background: #fffdf8; box-shadow: var(--shadow); grid-template-columns: 1fr 1fr; gap: 4px; }
.month-options label { display: flex; padding: 8px; align-items: center; gap: 8px; border-radius: 8px; cursor: pointer; font-size: .76rem; text-transform: capitalize; }
.month-options label:hover { background: var(--paper-2); }
.month-options input { accent-color: var(--ink); }
