@font-face { font-family: "Rajdhani"; font-weight: 700; src: url("fonts/Rajdhani-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Share Tech Mono"; src: url("fonts/ShareTechMono-Regular.ttf") format("truetype"); font-display: swap; }

/* Brand palette (from the Blueberry ES / VLE Holding logos) */
:root {
  --blue: #1E6FBE; --blue-2: #4A90C8; --blue-3: #5BA8D8;
  --gold: #C8921A; --gold-2: #F0C055; --copper: #C88828;
}

/* Classic theme: white, sober, blue/gold rule — group pages and VLE Holding */
[data-theme="classic"] {
  --series-rev: #2a78d6; --series-cost: #eb6834; --series-res: #0b0b0b;   /* dataviz reference slots 1–2 (light) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f6f7f9; --border: #e3e6eb;
  --ink: #18202c; --ink-2: #4b5565; --muted: #8a93a3;
  --accent: var(--blue); --accent-ink: #ffffff; --highlight: var(--gold);
  --good: #2b8a3e; --warn: #a86400; --bad: #c92a2a;
  --good-bg: #e8f5ec; --warn-bg: #fff5e3; --bad-bg: #fdeeee;
  --projected: #f1f6fc;
  --chart-line: var(--blue); --grid: #eceef2;
}

/* Blueberry ES theme: the LinkedIn banner's navy, starfield and gold */
[data-theme="bes"] {
  --series-rev: #3987e5; --series-cost: #d95926; --series-res: #f0efec;   /* dataviz reference slots 1–2 (dark) */
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --bg: #0a1628; --surface: #0f1f36; --surface-2: #132843; --border: #1e3654;
  --ink: #e7eef8; --ink-2: #a9b9cf; --muted: #6f83a0;
  --accent: var(--blue-3); --accent-ink: #0a1628; --highlight: #D4A825;
  --good: #5cc98a; --warn: #f0b84a; --bad: #f07272;
  --good-bg: #123325; --warn-bg: #33280f; --bad-bg: #3a1a1f;
  --projected: #11294a;
  --chart-line: var(--blue-3); --grid: #1b3150;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .brand { font-family: "Rajdhani", system-ui, sans-serif; font-weight: 700; letter-spacing: .02em; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 26px 0 10px; }
h2::after { content: ""; display: block; width: 36px; height: 2px; margin-top: 4px; background: linear-gradient(90deg, var(--accent), var(--highlight)); }
h3 { font-size: 16px; margin: 0 0 8px; }
.num, td.n, th.n { font-family: "Share Tech Mono", ui-monospace, monospace; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { font-family: "Share Tech Mono", ui-monospace, monospace; }

/* Header: always classic white with the blue → gold rule, whatever the page theme */
header.top { background: #ffffff; color: #18202c; position: sticky; top: 0; z-index: 5;
  border-top: 3px solid; border-image: linear-gradient(90deg, var(--blue) 0%, var(--blue-2) 55%, var(--gold) 80%, var(--gold-2) 100%) 1;
  box-shadow: 0 1px 0 #e3e6eb; }
header.top .bar { max-width: 1400px; margin: 0 auto; padding: 6px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
header.top .home { display: flex; align-items: center; gap: 10px; color: #18202c; text-decoration: none; }
header.top .home .logo { height: 54px; width: auto; }
header.top .home .tag { font: 11px "Share Tech Mono", monospace; letter-spacing: .25em; color: #8a93a3; text-transform: uppercase; border-left: 1px solid #e3e6eb; padding-left: 10px; }
nav.main { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav.main a { padding: 6px 7px; color: #4b5565; border-bottom: 2px solid transparent; font-size: 13.5px; white-space: nowrap; }
nav.main a:hover { color: #18202c; text-decoration: none; }
nav.main a.on { color: var(--blue); border-bottom-color: var(--gold); }
.ent-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ent-tabs a { padding: 3px 10px; border: 1px solid #e3e6eb; border-radius: 999px; font: 12px "Share Tech Mono", monospace; color: #4b5565; }
.ent-tabs a.planned { border-style: dashed; color: #8a93a3; }
.ent-tabs a.external { color: #8a93a3; background: #f6f7f9; }
.ent-tabs .sep { width: 1px; background: #e3e6eb; margin: 2px 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 60px; }
.subnav { display: flex; gap: 8px; margin: 10px 0 18px; flex-wrap: wrap; }
.subnav a { padding: 5px 12px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); }
.subnav a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.span2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.card h3 a { color: var(--ink); }
.card.entity-card { border-top: 3px solid var(--ent, var(--accent)); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 8px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.tile .lbl { color: var(--ink-2); font-size: 12px; }
.tile .val { font-family: "Share Tech Mono", ui-monospace, monospace; font-size: 22px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: 12px; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 700; border-top: 2px solid var(--border); }
td.proj, th.proj { background: var(--projected); }
td.neg, .neg { color: var(--bad); }
table.pnl td:first-child, table.pnl th:first-child { position: sticky; left: 0; background: var(--surface); min-width: 260px; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.proj { background: var(--projected); color: var(--accent); border-color: transparent; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 8px 0; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.good { background: var(--good-bg); color: var(--good); }

form.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input, select, button { font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }
button, .btn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); cursor: pointer; padding: 5px 12px; border-radius: 6px; display: inline-block; }
.btn.ghost, button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 5px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; justify-content: space-between; }
ul.plain li:last-child { border-bottom: 0; }
.done { text-decoration: line-through; color: var(--muted); }

.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { fill: var(--muted); font: 11px "Share Tech Mono", ui-monospace, monospace; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; }
.chart .pt { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.chart .pt.neg { fill: var(--bad); }
.chart .line.forecast { stroke-dasharray: 6 5; }
.chart .pt.proj { fill: var(--surface); stroke: var(--chart-line); }
.chart .pt.proj.neg { stroke: var(--bad); }
.chart .bar.rev { fill: var(--series-rev); }
.chart .bar.cost { fill: var(--series-cost); }
.chart .bar.proj { fill-opacity: .42; }
.chart .line.result { stroke: var(--series-res); stroke-width: 2; }
.chart .pt.result { fill: var(--series-res); stroke: var(--surface); stroke-width: 2; }
.chart .pt.result.proj { fill: var(--surface); stroke: var(--series-res); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 4px 0 10px; }
.legend .sw.rev { background: var(--series-rev); } .legend .sw.cost { background: var(--series-cost); }
.legend .sw.proj { opacity: .42; }
.legend .lg.res { border-top-color: var(--series-res); }
.chart .line.s1 { stroke: var(--series-1); } .chart .line.s2 { stroke: var(--series-2); } .chart .line.s3 { stroke: var(--series-3); }
.chart text.direct { font: 12px "Share Tech Mono", ui-monospace, monospace; fill: var(--ink-2); }
.chart .line.ref { stroke-dasharray: 5 4; stroke-width: 1.5; }
.legend .lg.ref { border-top-style: dashed; }
.legend .lg.s1 { border-top-color: var(--series-1); } .legend .lg.s2 { border-top-color: var(--series-2); } .legend .lg.s3 { border-top-color: var(--series-3); }
.legend .lg { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--chart-line); vertical-align: middle; margin: 0 4px 0 10px; }
.legend .lg.forecast { border-top-style: dashed; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; visibility: hidden; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 4px 8px; border-radius: 6px; font: 12px "Share Tech Mono", monospace; display: none; white-space: pre; line-height: 1.5; }

.messages { list-style: none; padding: 0; }

/* Entity heading (classic) */
.entity-head { display: flex; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.entity-head .logo { height: 64px; width: auto; }

/* BES banner — rebuilt from the LinkedIn cover so it stays sharp at any width */
.bes-banner { position: relative; overflow: hidden; border-radius: 10px; margin-bottom: 6px;
  display: grid; grid-template-columns: minmax(260px, 1.1fr) 1px 1fr; align-items: center; gap: 28px; padding: 18px 32px;
  background:
    radial-gradient(1.2px 1.2px at 12% 78%, #cfe3ff 60%, transparent 61%),
    radial-gradient(1px 1px at 38% 22%, #cfe3ff 60%, transparent 61%),
    radial-gradient(1.4px 1.4px at 47% 70%, #ffffff 60%, transparent 61%),
    radial-gradient(1px 1px at 63% 15%, #cfe3ff 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 71% 85%, #cfe3ff 60%, transparent 61%),
    radial-gradient(1px 1px at 88% 30%, #ffffff 60%, transparent 61%),
    radial-gradient(1.2px 1.2px at 95% 72%, #cfe3ff 60%, transparent 61%),
    radial-gradient(ellipse at 20% 50%, #10284a 0%, transparent 60%),
    linear-gradient(100deg, #0a1730 0%, #0c1d3a 55%, #0a1628 100%);
  border: 1px solid #1e3654; }
.bes-banner .logo { width: 100%; max-width: 440px; height: auto; display: block; }
.bes-banner .sep { width: 1px; align-self: stretch; background: linear-gradient(180deg, transparent, #2c4a72 20%, #2c4a72 80%, transparent); }
.bes-banner .eyebrow { font: 11px "Share Tech Mono", monospace; letter-spacing: .3em; color: #6f83a0; text-transform: uppercase; }
.bes-banner .claim { font: 700 26px/1.15 "Rajdhani", sans-serif; color: #e7eef8; margin: 6px 0 10px; }
.bes-banner .motto { font: 12px "Share Tech Mono", monospace; letter-spacing: .22em; color: #D4A825; padding-top: 8px; border-top: 1px solid #1e3654; }
.bes-banner .spark { position: absolute; color: #cfe3ff; opacity: .8; font-size: 14px; line-height: 1; }
.bes-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bes-head h1 { color: var(--highlight); }

/* Identity card */
.ident-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-head form { margin: 0; }
.btn, button { display: inline-flex; align-items: center; gap: 6px; }
.ico { flex: none; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.fields.one { grid-template-columns: 1fr; }
.fields .f { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--border); }
.fields .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.fields .v { min-width: 0; }
.fields .v > * { vertical-align: middle; }
.fields .v button.copy { margin-left: 4px; }
.fields code { font-size: 14px; letter-spacing: .03em; }
.ident .foot { margin: 10px 0 0; }
button.copy { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 2px 4px; border-radius: 5px; cursor: pointer; position: relative; }
button.copy:hover { color: var(--accent); border-color: var(--border); background: var(--surface-2); }
button.copy .ico:last-child { display: none; }
button.copy.copied { color: var(--good); }
button.copy.copied .ico:first-child { display: none; }
button.copy.copied .ico:last-child { display: inline; }
button.copy.failed { color: var(--bad); }
.seat address { font-style: normal; line-height: 1.5; margin-bottom: 10px; }
.seat .map { border-radius: 8px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16 / 10; background: var(--surface-2); }
.seat .map iframe { width: 100%; height: 100%; border: 0; display: block; }
.seat p { margin: 8px 0 0; }
[data-theme="bes"] .seat .map iframe { filter: invert(.92) hue-rotate(180deg) saturate(.6) brightness(.95); }

/* Tasks */
nav.main .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--blue); color: #fff; font: 11px/18px "Share Tech Mono", monospace; text-align: center; }
nav.main .count.late { background: #c92a2a; }
ul.tasks { list-style: none; margin: 0; padding: 0; }
ul.tasks li.task { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
ul.tasks li.task:last-child { border-bottom: 0; }
li.task .tick { margin: 0; }
li.task button.check { width: 24px; height: 24px; padding: 0; justify-content: center; border-radius: 6px; background: var(--surface); border: 1.5px solid var(--muted); color: transparent; }
li.task button.check:hover { border-color: var(--good); color: var(--good); }
li.task button.check.on { background: var(--good); border-color: var(--good); color: #fff; }
li.task .line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
li.task .title { font-weight: 500; }
li.task.done .title { text-decoration: line-through; color: var(--muted); }
li.task .contact { color: var(--ink-2); margin-top: 2px; }
li.task .meta { text-align: right; white-space: nowrap; }
form.upload { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
form.upload input[type=file] { max-width: 260px; font-size: 12px; }
form.upload input[type=text] { width: 190px; }

/* Statement month grid */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin-bottom: 4px; }
.months .m { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 6px; font: 12px "Share Tech Mono", monospace; border: 1px solid var(--border); }
.months .m.ok { background: var(--good-bg); color: var(--good); border-color: transparent; }
.months .m.ok:hover { text-decoration: none; filter: brightness(.97); }
.months .m.missing { color: var(--muted); border-style: dashed; }
.months .m.todo { background: var(--warn-bg); color: var(--warn); border-color: transparent; }

/* Statement review */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; align-items: start; }
.review .scan { position: sticky; top: 84px; }
.scan-view { display: block; width: 100%; height: calc(100vh - 190px); overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.scan-view img { width: 100%; display: block; cursor: zoom-in; }
.scan-view.zoom img { width: 200%; cursor: zoom-out; }
.scan-view iframe { width: 100%; height: 100%; border: 0; display: block; }
.scan-view .page-sep { text-align: center; font: 11px "Share Tech Mono", monospace; color: var(--muted); padding: 6px; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); background: var(--surface); }
.balances { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.balances label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.balances .check { flex: 1; min-width: 220px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.check.good { background: var(--good-bg); color: var(--good); }
.check.bad { background: var(--bad-bg); color: var(--bad); }
.check.warn { background: var(--warn-bg); color: var(--warn); }
table.ops input { width: 100%; border-color: transparent; background: transparent; padding: 4px 6px; }
table.ops input:hover, table.ops input:focus { border-color: var(--border); background: var(--surface); }
table.ops td { padding: 3px 6px; vertical-align: middle; }
table.ops td:first-child { width: 150px; }
table.ops td:nth-child(3), table.ops td:nth-child(4) { width: 120px; }
table.ops td:last-child { width: 30px; text-align: center; }
table.ops input[type=checkbox] { width: auto; }
.num-in { font-family: "Share Tech Mono", ui-monospace, monospace; text-align: right; }
.balances .num-in { width: 150px; }
table.ops tr.deleted td { opacity: .4; text-decoration: line-through; }
table.ops tr.blank input::placeholder { color: var(--muted); font-style: italic; }
.actions-row .force { color: var(--bad); display: inline-flex; gap: 6px; align-items: center; }
.actions-row .force[hidden] { display: none; }
.actions-row { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
pre.ocr { white-space: pre-wrap; font: 11px "Share Tech Mono", monospace; max-height: 300px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 6px; }

/* Recurring suggestions */
ul.reco li { align-items: center; padding: 10px 0; }
ul.reco .reco-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
ul.reco form { display: flex; gap: 6px; margin: 0; }

/* Invoice review form */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-bottom: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.form-grid label.inline { flex-direction: row; align-items: center; gap: 6px; grid-column: 1 / -1; }
.form-grid input, .form-grid select { font-size: 14px; }
.form-grid output.ttc { font-size: 18px; padding: 4px 0; color: var(--ink); }

/* Salary simulation */
.salary-sim { margin-bottom: 16px; border-left: 3px solid var(--highlight); }
.slider-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.slider-row input[type=range] { flex: 1; min-width: 240px; accent-color: var(--accent); padding: 0; border: 0; background: transparent; }
.slider-row output { font-size: 20px; min-width: 200px; }

/* SCI simulator */
.sci-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.sci-grid input { width: 100%; }

/* Forecast zone: everything probable / possible is set apart from facts */
.forecast-zone { background: var(--projected); border: 1px dashed var(--border); border-radius: 8px; padding: 10px 14px; margin-top: 16px; }
.forecast-zone h2 { margin-top: 4px; }
.forecast-zone .card, .forecast-zone .table-wrap, .forecast-zone .tile { background: var(--surface); }
.tiles.forecast-zone { padding: 10px; }
.kv.forecast-zone { padding: 6px 10px; margin-left: -4px; margin-right: -4px; }
.kv .zone-title { font: 600 11px system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }

/* TBD page */
.tbd { text-align: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); }
.tbd .big { font: 700 44px "Rajdhani", sans-serif; letter-spacing: .1em; color: var(--muted); }

@media (max-width: 1640px) { header.top .home .tag { display: none; } }
@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .ident-row, .fields, .review { grid-template-columns: 1fr; }
  .review .scan { position: static; }
  header.top .home .tag { display: none; }
  .bes-banner { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .bes-banner .sep { display: none; }
  .bes-banner .claim { font-size: 20px; }
}

/* Month detail modal (outlook) */
dialog.modal { width: min(720px, calc(100vw - 32px)); max-height: 86vh; overflow: auto; border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 20px; background: var(--surface); color: inherit; }
dialog.modal::backdrop { background: rgba(10, 20, 35, .45); }
dialog.modal header { display: flex; justify-content: space-between; align-items: center; }
dialog.modal header h3 { margin: 0; }
dialog.modal h4 { display: flex; justify-content: space-between; margin: 16px 0 6px; }
.md-group summary { display: flex; justify-content: space-between; cursor: pointer; padding: 6px 0;
  border-bottom: 1px solid var(--border); list-style: none; }
.md-group summary::before { content: "▸"; margin-right: 6px; color: var(--muted); }
.md-group[open] summary::before { content: "▾"; }
.md-group summary span:first-of-type { flex: 1; }
.md-group ul { margin: 4px 0 8px 18px; }
.md-net { display: flex; justify-content: space-between; border-top: 2px solid var(--border); padding-top: 8px; margin-top: 12px; }
/* Integrated P&L: expandable lines */
table.pnl tr.expandable { cursor: pointer; }
table.pnl tr.expandable .caret { display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
table.pnl tr.expandable.open .caret { transform: rotate(90deg); }
table.pnl tr.sub td { font-size: .92em; color: var(--ink-2); }
table.pnl tr.sub td:first-child { padding-left: 28px; }
table.pnl th a.month-detail { color: inherit; text-decoration: underline dotted; }
.proj-key { background: var(--projected); padding: 0 4px; border-radius: 3px; }
/* Outlook: secondary scenario (loan / rent capacity), folded at the bottom */
details.scenario { margin-top: 24px; }
details.scenario > summary { display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none; }
details.scenario > summary::before { content: "▸"; color: var(--muted); }
details.scenario[open] > summary::before { content: "▾"; }
details.scenario > summary h3 { margin: 0; }
.scenario-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .scenario-grid { grid-template-columns: 1fr; } }
.scenario-grid.single { grid-template-columns: 1fr; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); }
.task-family + .task-family { margin-top: 28px; padding-top: 8px; border-top: 2px solid var(--border); }

/* user menu (right of the header bar) and preview banner */
.user-menu { margin-left: 4px; position: relative; font-size: 13.5px; }
.user-menu summary { cursor: pointer; list-style: none; padding: 4px 10px; border: 1px solid #e3e6eb; border-radius: 999px; color: inherit; white-space: nowrap; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { content: " ▾"; font-size: 11px; opacity: .7; }
.user-menu[open] summary { border-color: var(--gold); }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 260px; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(16, 24, 40, .12); }
.user-menu .menu form { display: flex; flex-direction: column; gap: 6px; }
.user-menu .menu select { width: 100%; }
.user-menu .menu a, .user-menu .menu button.link { color: var(--accent); text-align: left; }
.preview-exit { background: #c92a2a; color: #fff; border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.preview-banner { background: #fff4e6; border-bottom: 1px solid #ffd8a8; color: #7a4100; text-align: center; padding: 6px 16px; font-size: 13.5px; }

/* deadlines calendar: month grid (weeks are links to the week view), week view, segmented view switch */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg a { padding: 5px 12px; color: var(--ink-2); font-size: 13px; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a.on { background: var(--accent); color: var(--accent-ink); }
.seg a:hover { text-decoration: none; }
.chip { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; line-height: 17px; padding: 0 5px; margin-top: 2px;
  border-radius: 4px; border-left: 3px solid var(--muted); background: var(--surface-2); color: var(--ink-2); }
.cal-legend .chip { display: inline-block; margin: 0 2px; }
.chip.done { border-left-color: var(--good); background: var(--good-bg); color: var(--good); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--good) 50%, transparent); }
.chip.late { border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.chip.soon { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.chip .dot { width: 6px; height: 6px; margin-right: 3px; vertical-align: 1px; }
.cal-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.cal-nav h2 { margin: 0; min-width: 200px; text-align: center; }
.cal-month { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .55fr)) 58px; }
.cal-head span { padding: 6px 8px; white-space: nowrap; overflow: hidden; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-week { color: inherit; border-bottom: 1px solid var(--border); }
.cal-week:last-child { border-bottom: 0; }
.cal-week:hover { text-decoration: none; background: var(--projected); }
.cal-week:hover .cal-day { border-right-color: var(--accent); }
.cal-week.has-late .cal-load .bar { background: var(--bad); }
.cal-day { min-height: 92px; padding: 4px 5px 6px; border-right: 1px solid var(--border); min-width: 0; }
.cal-day.we { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-day.out { opacity: .45; }
.cal-day .dnum { font: 12px "Share Tech Mono", monospace; color: var(--muted); }
.cal-day.today .dnum { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; }
.cal-day .more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-load { position: relative; display: flex; align-items: flex-end; justify-content: center; padding: 6px 12px; }
.cal-load .bar { width: 100%; background: var(--accent); opacity: .35; border-radius: 3px 3px 0 0; min-height: 2px; }
.cal-load .n { position: absolute; top: 6px; font: 12px "Share Tech Mono", monospace; color: var(--ink-2); }
.cal-weekview { display: flex; gap: 8px; align-items: stretch; }
.cal-weekview section { flex: 1 1 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-width: 0; }
.cal-weekview section.empty { flex-grow: .45; }    /* an empty day (weekend mostly) leaves room to the busy ones */
.cal-weekview section.we { background: var(--surface-2); }
.cal-weekview section.today { border-color: var(--accent); }
.cal-weekview h3 { margin: 0 0 6px; font-size: 15px; text-transform: capitalize; }
.cal-item { border-left: 3px solid var(--muted); background: var(--surface-2); border-radius: 4px; padding: 6px 8px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal-item.done { border-left-color: var(--good); opacity: .7; }
.cal-item.late { border-left-color: var(--bad); background: var(--bad-bg); }
.cal-item.soon { border-left-color: var(--warn); background: var(--warn-bg); }
.cal-item .actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 900px) {
  .cal-head, .cal-week { grid-template-columns: repeat(7, minmax(0, 1fr)) 30px; }
  .cal-day { min-height: 56px; }
  .cal-day .chip { font-size: 0; height: 6px; padding: 0; border-left-width: 0; margin-top: 3px; }   /* phone: coloured ticks only */
  .cal-day .chip.done { background: var(--good); } .cal-day .chip.late { background: var(--bad); }
  .cal-day .chip.soon { background: var(--warn); } .cal-day .chip.todo { background: var(--muted); }
  .cal-weekview { flex-direction: column; }
}
