:root {
  /* Metesa brand: dark green #042426, greens #009252 / #32c973 / #a7dbbf (metesa.com logo). Accent is a shade darker than the
     logo green so text and white-on-accent pass contrast. Layout and components follow the Serpar CRM look (frontend/src/theme.css). */
  --bg: #f3f6f5; --panel: #fff; --text: #10201e; --muted: #5d6e6b; --line: #dfe6e3; --line2: #ecf0ee;
  --accent: #00804a; --accent-strong: #006b3e; --accent-soft: #e1f2e9; --chip: #edf2ef; --warn: #9a5b00; --warn-soft: #fff4e0;
  --heat: 0, 128, 74; --total: #f1f5f3; --shadow: 0 10px 30px rgba(4, 36, 38, .14); --shadow-sm: 0 1px 2px rgba(4, 36, 38, .05);
  --surface-2: #f7f9f8; --nav: #042426; --nav-ink: #b3c8c3; --nav-muted: #6f8c86; --on-accent: #fff;
  --font: "Inter Tight Variable", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  font-family: var(--font); font-size: 14px; color: var(--text); -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1413; --panel: #121e1c; --text: #e2ebe8; --muted: #92a5a0; --line: #253532; --line2: #1c2a27;
    --accent: #3fcf8a; --accent-strong: #6ddca6; --accent-soft: #163428; --chip: #1d2b28; --warn: #f0b45c; --warn-soft: #3a2e19;
    --heat: 63, 207, 138; --total: #172522; --shadow: 0 10px 30px rgba(0, 0, 0, .5); --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --surface-2: #16231f; --nav: #061614; --nav-ink: #a6bbb6; --nav-muted: #627c76; --on-accent: #04241a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, .msel { font: inherit; color: inherit; }
.muted { color: var(--muted); }

/* left-hand menu */
body { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
body.narrow { grid-template-columns: 58px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; background: var(--panel); border-right: 1px solid var(--line); z-index: 20; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 2px 4px 8px; }
.brand .bt { line-height: 1.15; } .brand .bt span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.brand .logo { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.side-fold { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.navh { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px 3px; }
.tabs button { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 7px 8px; border-radius: 8px; cursor: pointer; color: var(--muted); text-align: left; width: 100%; }
.tabs button i { font-style: normal; width: 20px; text-align: center; flex: none; font-size: 13px; letter-spacing: -2px; }
.tabs button:hover { background: var(--chip); color: var(--text); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sync { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 6px; font-size: 12px; padding: 10px 4px 2px; border-top: 1px solid var(--line2); }
body.narrow .brand .bt, body.narrow .tabs button span, body.narrow .sync span { display: none; }
body.narrow .navh { font-size: 0; height: 10px; padding: 0; }
body.narrow .brand { flex-direction: column; } body.narrow .side-fold { margin: 0; transform: rotate(180deg); }
body.narrow .sync .btn { padding: 6px 2px; font-size: 0; } body.narrow .sync .btn::before { content: "\21BB"; font-size: 14px; }
@media (max-width: 760px) {
  body, body.narrow { grid-template-columns: 1fr; }
  .side { height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tabs { flex-direction: row; flex-wrap: wrap; } .tabs button { width: auto; } .navh, .side-fold { display: none; }
  .sync { margin: 0 0 0 auto; border: 0; flex-direction: row; padding: 0; }
}

.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.btn.ghost { background: none; color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.icon { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; align-self: end; }

main { padding: 14px 20px 40px; min-width: 0; }
.tab { display: none; }
.tab.on { display: block; }

.bar { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.bar.quick { align-items: center; padding: 8px 14px; gap: 8px; }
.bar.quick button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.bar.quick button:hover { border-color: var(--accent); color: var(--accent); }
.spacer { flex: 1; }
.bar.topbar { align-items: center; padding: 8px 14px; }
select.views, .msel.views { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); }
/* saved views, same pattern as Pipedrive Forecast's SavedViews */
.views-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 2px 10px; min-height: 30px; }
.views-row .lab { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 2px; }
.vchip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.vchip:hover { border-color: var(--accent); color: var(--accent); }
.vchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.vchip .act { opacity: 0; border-radius: 999px; padding: 0 3px; font-size: 11px; }
.vchip:hover .act, .vchip .act.pinned { opacity: .85; }
.vchip .act:hover { background: rgba(0, 0, 0, .12); }
.vchip.add { border-style: dashed; }
.vedit { display: inline-flex; align-items: center; gap: 5px; }
.vedit input { border: 1px solid var(--accent); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; width: 170px; background: var(--panel); }
.vedit button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.vedit button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.vedit button.share.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.custom-mark { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px;
  border: 1px solid #e6c37a; background: var(--warn-soft); color: var(--warn); }
.custom-mark button { border: 0; border-left: 1px solid #e6c37a; background: none; color: var(--warn); font-weight: 600; cursor: pointer; padding: 0 0 0 7px; font-size: 11.5px; }
/* the pivot setup can be collapsed to one summary line (Collapse / Expand) */
.setup-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; min-height: 28px; }
.setup-bar .setup-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.setup-bar .setup-title .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.setup-bar .setup-tg { margin-left: auto; flex: none; }
.setup-bar.closed { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px 4px 12px; margin-bottom: 10px; }
.setup-sum { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; border: 0; background: none; padding: 2px 0; text-align: left;
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; }
.setup-sum b { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 3px; }
.setup-sum:hover span { color: var(--accent); }
.fields { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.2fr; gap: 10px; margin-bottom: 10px; }
.field { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; min-height: 86px; }
.field h5 { width: 100%; margin: 0 0 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.field h5 span { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.field .chips { display: contents; }
.field.drop-ok { border-color: var(--accent); }
.period-row { width: 100%; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.icon.sm { width: 24px; height: 22px; margin-left: auto; font-size: 12px; align-self: center; }
@media (max-width: 1100px) { .fields { grid-template-columns: 1fr 1fr; } }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.group.grow { flex: 1; }
.group > label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 4px; }
input[type=date] { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--panel); }
.presets { display: flex; gap: 4px; margin-left: 6px; }
.presets button { border: 0; background: var(--chip); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.presets button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 4px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border: 1px solid transparent; border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 13px; cursor: default; user-select: none; }
.chip.dim { cursor: grab; }
.chip.filter { cursor: pointer; }
.chip.filter.set { background: var(--accent-soft); color: var(--accent); }
.chip b { font-weight: 600; }
.chip .x { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 14px; line-height: 1; }
.chip.metric { padding: 4px 11px; cursor: pointer; background: none; border-color: var(--line); color: var(--muted); }
.chip.metric.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.dragging { opacity: .4; }
.chip .ord { display: inline-grid; place-items: center; min-width: 17px; height: 17px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; margin-left: -5px; }
/* a hidden level: kept in the field (place, filters), left out of the table */
.chip.off { border: 1px dashed var(--muted); background: transparent; }
.chip.off b { color: var(--muted); font-weight: 500; }
.chip.off .ord { background: var(--muted); }
.chip .hid { font-size: 10.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 0 6px; }
.chip .x.eye { display: inline-grid; place-items: center; color: var(--muted); }
.chip .x.eye:hover { color: var(--accent); }
.chip .x.eye.on { color: var(--warn); }
.chip .eye { font-size: 10px; }
select.add, .msel.add { border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 3px 8px; font-size: 13px; color: var(--muted); cursor: pointer; max-width: 140px; }

.note { font-size: 12.5px; color: var(--muted); margin: 2px 2px 8px; min-height: 18px; }
.note .warn { color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 6px; }

.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 300px); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
table.pv { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
table.pv th, table.pv td { padding: 5px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.pv thead th { position: sticky; background: var(--panel); z-index: 2; font-weight: 600; border-bottom: 1px solid var(--line); text-align: center; }
table.pv thead th.mh { font-weight: 500; color: var(--muted); font-size: 12px; cursor: pointer; text-align: right; }
table.pv thead th.mh:hover { color: var(--accent); }
table.pv thead th.mh.sorted { color: var(--accent); }
table.pv thead th.rd.mh { text-align: left; color: var(--text); font-size: 13px; font-weight: 600; }
table.pv thead th.rd.mh.sorted { color: var(--accent); }
table.pv th.rd { text-align: left; position: sticky; left: 0; z-index: 3; }
table.pv td.rk, table.pv th.rd { min-width: 200px; max-width: 200px; }
table.pv td.rk { text-align: left; background: var(--panel); position: sticky; z-index: 1; overflow: hidden; text-overflow: ellipsis; }
table.pv td.rk.rep { color: transparent; }
table.pv td.v { text-align: right; }
table.pv td.v.none { color: var(--muted); }
table.pv .tot { background: var(--total); font-weight: 600; }
table.pv td.rk.tot { background: var(--total); }
table.pv tfoot td { position: sticky; bottom: 0; background: var(--total); font-weight: 600; border-top: 1px solid var(--line); z-index: 2; }
table.pv tfoot td.rk { z-index: 3; }
table.pv tbody tr:hover td { background-image: linear-gradient(rgba(var(--heat), .06), rgba(var(--heat), .06)); }
table.pv .sep { border-left: 1px solid var(--line); }

.pop { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); width: 360px; max-height: 460px; display: flex; flex-direction: column; }
.pop header { padding: 10px 12px 6px; display: flex; gap: 8px; align-items: center; }
.pop header input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--bg); }
.pop .list { overflow: auto; padding: 4px 6px; flex: 1; }
.pop .item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pop .item:hover { background: var(--chip); }
.pop .item span.n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pop .item span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop footer { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; font-size: 12px; }
.pop footer button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 2px 4px; }
.pop footer .grow { flex: 1; }

.lead { color: var(--muted); max-width: 900px; line-height: 1.5; }
table.techs { border-collapse: collapse; font-size: 13px; width: 100%; }
table.techs th, table.techs td { padding: 6px 10px; border-bottom: 1px solid var(--line2); text-align: left; white-space: nowrap; }
table.techs th { position: sticky; top: 0; background: var(--panel); font-size: 12px; color: var(--muted); font-weight: 600; }
table.techs td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.techs input[type=number] { width: 70px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }
table.techs input[type=text] { width: 200px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }
table.techs input.def { color: var(--muted); }
table.techs tr.off td { color: var(--muted); }
.cal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; overflow-x: auto; }
.cal-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.cal-head select, .cal-head .msel { border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; background: var(--panel); }
table.cal { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.cal th, table.cal td { padding: 4px 10px; border-bottom: 1px solid var(--line2); text-align: right; }
table.cal th:first-child, table.cal td:first-child { text-align: left; }
table.cal th { color: var(--muted); font-size: 12px; font-weight: 600; }
table.cal td.has-hol { text-decoration: underline dotted; cursor: help; }
table.techs select, table.techs .msel { border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--panel); }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.tag.tech { background: var(--accent-soft); color: var(--accent); }

.doc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 28px 24px; max-width: 900px; line-height: 1.6; }
.doc h1 { font-size: 20px; } .doc h2 { font-size: 16px; margin-top: 22px; }
.doc code { background: var(--chip); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

/* run-rate */
.rr-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 1fr); gap: 12px; align-items: start; }
.rr-stripe-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.rr-stripe { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line2); }
.rr-stripe span { cursor: pointer; }
.rr-stripe span.on { outline: 2px solid var(--text); outline-offset: -2px; }
.rr-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; font-size: 12px; }
.rr-legend span[data-sf] { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.rr-legend span.on { font-weight: 700; }
.rr-legend i, .dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; }
.s-ended { background: #2e9e6a; } .s-open { background: #e3a33b; } .s-excluded { background: #d56a7a; } .s-nr { background: #b9bfca; }
.rr-list { max-height: calc(100vh - 250px); }
table.rr-t { border-collapse: separate; border-spacing: 0; font-size: 12.5px; width: 100%; font-variant-numeric: tabular-nums; }
table.rr-t th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.rr-t td { padding: 4px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.rr-t .num { text-align: right; }
table.rr-t td.name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
table.rr-t tbody tr { cursor: pointer; }
table.rr-t tbody tr:hover td { background: var(--chip); }
table.rr-t tr.sel td { background: var(--accent-soft); }
table.rr-t tr.cut td { border-bottom: 2px dashed var(--accent); }
table.rr-t tr.parked td { opacity: .5; }
table.rr-t .up { color: #2e9e6a; } table.rr-t .down { color: #d56a7a; }
.spark rect { fill: var(--line); } .spark rect.recent { fill: var(--accent); }
.sb { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 22px; height: 20px; font-size: 11px; cursor: pointer; color: var(--muted); margin-right: 2px; padding: 0; }
.sb.inc.on { background: #2e9e6a; border-color: #2e9e6a; color: #fff; }
.sb.exc.on { background: #d56a7a; border-color: #d56a7a; color: #fff; }
td.st .dot { margin: 0 4px 0 2px; vertical-align: middle; }
.rr-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.rr-panel h3 { margin: 0 0 2px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-ph { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.rr-chart { display: block; margin: 8px 0 2px; }
.rr-chart .grid { stroke: var(--line2); } .rr-chart .ax { font-size: 10px; fill: var(--muted); }
.rr-chart .b-actual { fill: var(--accent); opacity: .85; } .rr-chart .b-partial { fill: var(--accent); opacity: .6; }
.rr-chart .b-proj { fill: #8fa8e8; opacity: .55; }
.rr-chart .b-prev { fill: #8fa8e8; opacity: .3; stroke: #8fa8e8; stroke-dasharray: 3 2; }
.k-prev { background: #8fa8e8; opacity: .4; }
.rr-note { font-size: 11.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid #e6c37a; border-radius: 8px; padding: 4px 9px; margin-top: 6px; }
.rr-chart .win { fill: rgba(var(--heat), .08); }
.rr-chart .rate { stroke: #e3a33b; stroke-width: 2; stroke-dasharray: 5 3; }
.rr-chart .now { stroke: var(--muted); stroke-dasharray: 2 3; }
.rr-key { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.rr-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.k-actual { background: var(--accent); } .k-partial { background: var(--accent); opacity: .6; } .k-proj { background: #8fa8e8; } .k-rate { background: #e3a33b; height: 3px !important; vertical-align: 3px !important; }
.rr-form { display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; align-items: center; font-size: 13px; }
.rr-form > label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rr-form input[type=number], .rr-form input[type=month], .rr-form input[type=text] { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--panel); }
.rr-form input[type=number] { width: 130px; }
.trend { display: flex; align-items: center; gap: 10px; } .trend input { width: 220px; }
.trend b.up { color: #2e9e6a; } .trend b.down { color: #d56a7a; }
.rr-result { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; }
.rr-help { font-size: 13px; line-height: 1.5; margin-top: 12px; } .rr-help ul { padding-left: 18px; margin: 6px 0; }
@media (max-width: 1100px) { .rr-grid { grid-template-columns: 1fr; } .rr-panel { position: static; max-height: none; } }

/* Pipedrive / soft backlog */
.pd-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; max-width: 760px; }
.pd-card h3 { margin: 0 0 6px; }
.pd-row { display: flex; gap: 8px; margin: 10px 0; }
.pd-row input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--bg); }
.pd-status { align-items: center; }
.warn-tag { background: var(--warn-soft); color: var(--warn); }
.rv-filter { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rvchip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.rvchip.on.rv-included { background: #e3f4ec; border-color: #2e9e6a; color: #1f7a50; }
.rvchip.on.rv-not_reviewed { background: var(--warn-soft); border-color: #e6c37a; color: var(--warn); }
.rvchip.on.rv-excluded { background: #f9e6e9; border-color: #d56a7a; color: #a8404f; }
table.soft-t td.rvcell { white-space: nowrap; }
.rv { width: 22px; height: 22px; border-radius: 999px; border: 0; background: none; cursor: pointer; color: #b9bfca; font-size: 13px; padding: 0; }
.rv:hover { background: var(--chip); }
.rv.inc.on { background: #d8f0e4; color: #1f7a50; font-weight: 700; }
.rv.exc.on { background: #f7dde2; color: #b23b4d; font-weight: 700; }
table.soft-t tr.rv-row-not_reviewed td { background: rgba(227, 163, 59, .06); }
table.soft-t tr.rv-row-not_reviewed td:not(.rvcell) { opacity: .8; }
table.soft-t tr.rv-row-excluded td:not(.rvcell) { opacity: .4; }
table.soft-t td.alloc { cursor: pointer; background: rgba(var(--heat), .05); min-width: 150px; }
table.soft-t td.alloc:hover, table.soft-t td.alloc.open { background: rgba(var(--heat), .14); }
.splitbar { display: flex; height: 18px; width: 140px; border-radius: 5px; overflow: hidden; background: var(--line2); }
.splitbar span { display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; color: #fff; overflow: hidden; white-space: nowrap; }
.splitbar.dflt { opacity: .55; outline: 1px dashed var(--muted); outline-offset: 1px; }
.splitbar.none { background: none; border: 1px dashed var(--muted); color: var(--muted); font-size: 10.5px; align-items: center; justify-content: center; }
.warnmark { color: var(--warn); margin-right: 4px; }
table.soft-t tr.expand > td { background: var(--accent-soft); padding: 10px 14px; cursor: default; white-space: normal; }
table.soft-t tr.expand:hover td { background-image: none; }
.expand-in { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.split-ed { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.split-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.split-total { margin: 4px 0 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.split-total input { width: 90px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }
.rr-panel .bd { margin-bottom: 10px; }
.split-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.split-t td { padding: 3px 4px; border: 0 !important; }
.split-t select, .split-t input, .split-t .msel { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }
.split-t input { width: 80px; }
.split-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.bd { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; overflow-x: auto; max-width: 100%; }
.bd p { margin: 0 0 4px; }
table.bd-t { border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
table.bd-t th, table.bd-t td { padding: 2px 8px; border-bottom: 1px solid var(--line2) !important; white-space: nowrap; text-align: left; }
table.bd-t .num { text-align: right; }
table.bd-t tr.tot td { font-weight: 700; border-top: 1px solid var(--line) !important; }
table.dept-t { border-collapse: collapse; width: 100%; font-size: 13px; margin-bottom: 6px; }
table.dept-t th { text-align: left; font-size: 11.5px; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.dept-t td { padding: 3px 6px; border-bottom: 1px solid var(--line2); }
table.dept-t input { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }

/* soft backlog v2: list page + deal page (adapted from Pipedrive Forecast's Allocate deals) */
.sb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 2px 2px 10px; flex-wrap: wrap; }
.sb-head h2, .dp h2 { margin: 0; font-size: 20px; font-weight: 650; }
.sb-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sb-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.sb-tools .search { min-width: 220px; }
.rvseg button.on.g { background: #16a34a; } .rvseg button.on.r { background: #ef4444; } .rvseg button.on.a { background: #d97706; }
.sb-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; position: relative; }
#softSummary { padding: 12px 16px; }
.collapse { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.sum-line { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; }
.sum-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .sum-grid { grid-template-columns: 1fr; } }
.stats { display: flex; flex-wrap: wrap; gap: 4px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; border: 1px solid transparent; background: none; border-radius: 10px; padding: 6px 12px; cursor: pointer; text-align: left; }
.stat:hover { background: var(--chip); }
.stat.on { border-color: var(--line); background: var(--chip); }
.stat .sl, .share .sl { font-size: 11.5px; color: var(--muted); }
.stat .sv, .share .sv { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .sw { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stat.g .sl { color: #16a34a; } .stat.r .sl { color: #ef4444; } .stat.a .sl { color: #d97706; }
.share { display: flex; flex-direction: column; padding: 6px 12px; margin-left: auto; border-left: 1px solid var(--line); }
.revbar { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: #fcd9a0; margin: 6px 12px 4px; }
.revbar .g { background: #16a34a; } .revbar .r { background: #ef4444; }
.sum-chart .rr-chart { margin-top: 4px; }
.sb-table { overflow: hidden; }
.sb-scroll { overflow: auto; max-height: calc(100vh - 330px); }
table.soft-t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.soft-t th { position: sticky; top: 0; z-index: 3; background: var(--total); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.soft-t td { padding: 7px 12px; border-bottom: 1px solid var(--line2); background: var(--panel); }
table.soft-t .num { text-align: right; }
table.soft-t .nowrap { white-space: nowrap; }
table.soft-t .stk0 { position: sticky; left: 0; z-index: 2; width: 76px; min-width: 76px; white-space: nowrap; padding: 7px 8px; }
table.soft-t .stk1 { position: sticky; left: 76px; z-index: 2; box-shadow: inset -1px 0 0 var(--line); }
table.soft-t th.stk0, table.soft-t th.stk1 { z-index: 4; }
table.soft-t td.title { max-width: 280px; min-width: 200px; font-weight: 500; }
table.soft-t td.title .deal-open { display: inline-block; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
  color: var(--accent); font-weight: 600; text-decoration: none; }
table.soft-t td.title .deal-open:hover { text-decoration: underline; }
table.soft-t td.title .deal-open::after { content: " ›"; color: var(--muted); }
table.soft-t td.org { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.soft-t tbody tr { cursor: pointer; }
table.soft-t tbody tr:hover td { background: var(--chip); }
table.soft-t tr.rv-not_reviewed td { background: #fffbeb; }
table.soft-t tr.rv-not_reviewed td:not(.stk0) { color: color-mix(in srgb, var(--text) 75%, transparent); }
table.soft-t tr.rv-excluded td:not(.stk0) { opacity: .45; }
table.soft-t td.alloc { white-space: nowrap; }
@media (prefers-color-scheme: dark) { table.soft-t tr.rv-not_reviewed td { background: #2a2416; } }
.psrc { display: inline-block; font-size: 9.5px; font-weight: 700; color: #4f46e5; background: #e0e7ff; border-radius: 4px; padding: 0 4px; margin-right: 5px; }
.pdlink { margin-left: 6px; color: var(--muted); text-decoration: none; font-size: 12px; }
.pdlink:hover { color: var(--accent); }
.pchip { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.pchip.hi { background: #dcfce7; color: #15803d; } .pchip.mid { background: #fef3c7; color: #b45309; } .pchip.lo { background: #fee2e2; color: #b91c1c; }
.spill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; text-transform: capitalize; }
.spill.open { background: #dbeafe; color: #1d4ed8; } .spill.won { background: #dcfce7; color: #15803d; } .spill.lost { background: #fee2e2; color: #b91c1c; }
.rv { width: 24px; height: 24px; }
.rv.inc.on { background: #dcfce7; color: #16a34a; } .rv.exc.on { background: #fee2e2; color: #ef4444; }
.splitbar.big { width: 100%; height: 24px; border-radius: 7px; margin: 6px 0 10px; }
.splitbar.big span { font-size: 11px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; margin-right: 6px; vertical-align: 0; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.seg.sm button { padding: 2px 9px; font-size: 12px; }

.dp { max-width: 980px; margin: 0 auto; }
.dp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.dp-title { display: flex; gap: 10px; align-items: flex-start; }
.dp-title .muted { margin-top: 3px; }
.back { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 16px; flex-shrink: 0; }
.back:hover { border-color: var(--accent); color: var(--accent); }
.dp-value { text-align: right; display: flex; flex-direction: column; }
.dp-value b { font-size: 20px; }
.dp-review { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.rvchip-big { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
.rvchip-big.on.g { background: #dcfce7; border-color: #16a34a; color: #15803d; font-weight: 600; }
.rvchip-big.on.r { background: #fee2e2; border-color: #ef4444; color: #b91c1c; font-weight: 600; }
.rvnote { font-size: 12.5px; color: var(--muted); } .rvnote.a { color: #b45309; background: #fef3c7; padding: 4px 10px; border-radius: 999px; }
.dp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.dp-card h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dp-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); font: inherit; }
.dp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; }
.dp-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.dp-grid input, .dp-grid select, .dp-grid .msel { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); font-weight: 400; color: var(--text); }
.dp-grid .muted { font-weight: 400; }
.dp input::placeholder, .dp textarea::placeholder { color: var(--muted); opacity: .6; }
.pf-row { display: flex; gap: 4px; align-items: center; }
.pf-row input { flex: 1; min-width: 0; }
.dp-grid input.mine { border-color: #6366f1; background: #eef2ff; }
@media (prefers-color-scheme: dark) { .dp-grid input.mine { background: #24264a; } }
.dp-actions { float: right; display: inline-flex; gap: 6px; text-transform: none; letter-spacing: 0; }
.dp-mode { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.dp-mode input { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--panel); }
.arows { display: flex; flex-direction: column; gap: 6px; }
.arow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--bg); }
.arow .aname { flex: 0 0 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.arow input[type=range] { flex: 1; min-width: 80px; accent-color: var(--accent); }
.arow .aval { width: 90px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; text-align: right; background: var(--panel); }
.arow .unit { color: var(--muted); font-size: 12px; width: 26px; }
.arow .acalc { margin-left: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.arow .rate { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; white-space: nowrap; border: 0; cursor: pointer; }
.rate-edit { font-size: 11px; white-space: nowrap; } .rate-edit input { width: 70px; border: 1px solid var(--accent); border-radius: 6px; padding: 2px 5px; }
.arow .rate.none { background: #fef3c7; color: #b45309; }
.afoot { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.afoot select, .afoot .msel { border: 1px dashed var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); color: var(--muted); }
.atotal { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.atotal.ok { background: #dcfce7; color: #15803d; } .atotal.bad { background: #fef3c7; color: #b45309; }
.dp-card .bd { border: 0; padding: 0; }
.dp-card .bd-t td .dot { width: 8px; height: 8px; }

/* raw data */
.raw { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: start; }
.raw-list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.raw-list input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--bg); margin-bottom: 6px; }
.raw-list h4 { margin: 10px 6px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.raw-list .t { display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.raw-list .t:hover { background: var(--chip); }
.raw-list .t.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.raw-list .t span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.raw-main { min-width: 0; }
.raw-head { align-items: center; padding: 8px 14px; }
.raw-title b { font-size: 15px; }
.search { border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; background: var(--bg); min-width: 240px; }
.raw-filters { align-items: center; padding: 6px 14px; gap: 8px; }
.lbl { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.raw-pivot { align-items: center; padding: 8px 14px; }
.raw-pivot select, .raw-pivot .msel { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--panel); max-width: 220px; }
.small { font-size: 12px; }
.raw-wrap { max-height: calc(100vh - 290px); }
table.raw-t { border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.raw-t th, table.raw-t td { padding: 4px 9px; border-bottom: 1px solid var(--line2); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
table.raw-t thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--line); }
table.raw-t thead th:hover { color: var(--accent); }
table.raw-t td.num { text-align: right; }
table.raw-t td.null { color: var(--muted); opacity: .5; }
table.raw-t td.lbl-id { color: var(--accent); }
table.raw-t tbody tr { cursor: pointer; }
table.raw-t tbody tr:hover td { background: var(--chip); }
table.raw-t.pv td.cell { cursor: pointer; text-align: right; }
table.raw-t.pv th.num { text-align: right; }
table.raw-t.pv td.cell:hover { outline: 1px solid var(--accent); }
table.raw-t .tot { background: var(--total); font-weight: 600; }
table.raw-t tfoot td { position: sticky; bottom: 0; background: var(--total); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 13px; color: var(--muted); }
.pager button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }
.record { position: fixed; top: 60px; right: 16px; bottom: 16px; width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: auto; z-index: 40; padding: 12px 16px; font-size: 13px; }
.record header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.record dl { display: grid; grid-template-columns: 170px 1fr; gap: 3px 12px; margin: 0; }
.record dt { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.record dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.record dd.null { color: var(--muted); opacity: .5; }
.fpop { position: fixed; z-index: 55; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; display: flex; gap: 6px; align-items: center; font-size: 13px; }
.fpop select, .fpop input, .fpop .msel { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--bg); }
.colpop { position: fixed; z-index: 55; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); width: 320px; max-height: 70vh; display: flex; flex-direction: column; }
.colpop .list { overflow: auto; padding: 6px 10px; }
.colpop label { display: flex; gap: 6px; align-items: center; padding: 2px 0; font-size: 13px; }
.colpop label span { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.colpop footer { border-top: 1px solid var(--line); padding: 6px 10px; display: flex; gap: 10px; }
.colpop footer button { border: 0; background: none; color: var(--accent); cursor: pointer; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 60; }

/* soft backlog: filter bar */
.fbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fbar .search { min-width: 200px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; color: var(--text); white-space: nowrap; max-width: 300px; }
.fchip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.fchip .fl { color: var(--muted); }
.fchip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.fchip.on .fl { color: var(--accent); }
.fchip .fx { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 13px; line-height: 1; }
.fchip.num { cursor: default; } .fchip.num input { width: 74px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 5px; background: var(--bg); font-size: 12px; }
.fchip select, .fchip .msel { border: 0; background: none; font-size: 12.5px; max-width: 200px; cursor: pointer; }
.fbtn { border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.fbtn:hover { color: var(--accent); border-color: var(--accent); }
.fclear { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12.5px; text-decoration: underline; }
.fpop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); width: 300px; max-height: 440px; display: flex; flex-direction: column; font-size: 13px; }
.fpop header { display: flex; gap: 6px; align-items: center; padding: 9px 10px 6px; border-bottom: 1px solid var(--line2); }
.fpop header b { flex: 1; } .fpop header button { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; }
.fpop input.fq { margin: 6px 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--bg); }
.fpop .fl-list { overflow: auto; padding: 4px 6px 8px; }
.fpop label { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.fpop label:hover { background: var(--chip); }
.fpop label .n { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.fpop .fgrp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 6px 2px; }
.fpop footer { padding: 7px 10px; border-top: 1px solid var(--line2); font-size: 11.5px; color: var(--muted); }
#softSummary .collapse { font-size: 12px; } #softSummary .collapse:hover { color: var(--accent); }
.sum-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* distribution models */
.dm { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .dm { grid-template-columns: 1fr; } }
.dm-list { display: flex; flex-direction: column; gap: 6px; }
.dm-item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.dm-item:hover { border-color: var(--accent); } .dm-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dm-item b { display: block; font-size: 13.5px; } .dm-item small { color: var(--muted); font-size: 11.5px; }
.dm-mini { display: flex; align-items: flex-end; gap: 1px; height: 30px; }
.dm-mini span { flex: 1; background: var(--accent); opacity: .75; border-radius: 1px 1px 0 0; min-height: 1px; }
.dm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.dm-card h4 { margin: 0 0 8px; font-size: 14px; }
.dm-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 10px; }
.dm-row input[type=text] { min-width: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--bg); font-size: 14px; font-weight: 600; }
.dm-row textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--bg); font: inherit; font-size: 13px; }
.dm-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.dm-kind button { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.dm-kind button b { display: block; font-size: 13px; } .dm-kind button span { font-size: 12px; color: var(--muted); }
.dm-kind button.on { border-color: var(--accent); background: var(--accent-soft); }
.dm-edit svg { display: block; width: 100%; touch-action: none; user-select: none; }
.dm-edit .bar { fill: var(--accent); opacity: .8; pointer-events: none; }
.dm-edit .hit { fill: transparent; cursor: ns-resize; } .dm-edit .hit:hover + .bar, .dm-edit .bar.drag { opacity: 1; }
.dm-edit .grid { stroke: var(--line2); } .dm-edit .ax { font-size: 10px; fill: var(--muted); }
.dm-levels { display: flex; gap: 3px; overflow-x: auto; padding: 4px 0; }
.dm-levels input { width: 50px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; text-align: right; background: var(--bg); font-size: 12px; }
.dm-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.dm-prev { display: flex; align-items: flex-end; gap: 2px; height: 90px; margin: 6px 0 2px; }
.dm-prev span { flex: 1; background: #8fa8e8; border-radius: 2px 2px 0 0; min-height: 1px; }
.dm-prev-ax { display: flex; gap: 2px; font-size: 10px; color: var(--muted); } .dm-prev-ax span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.dm-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 10.5px; border-radius: 999px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent); font-weight: 600; margin-left: 4px; vertical-align: 1px; }

/* backlog analysis */
.bl-tools { padding: 10px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.bl-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.bl-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.bl-src { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.bl-src i { width: 10px; height: 10px; border-radius: 3px; border: 2px solid transparent; display: inline-block; }
.bl-src.on { color: var(--text); border-color: var(--text); }
.bl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
@media (max-width: 900px) { .bl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bl-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.bl-kpi .sl { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bl-kpi .sl i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bl-kpi b { font-size: 20px; font-weight: 650; }
.bl-kpi.off { opacity: .45; } .bl-kpi.tot { background: var(--total); }
.bl-main { padding: 10px 0 0; }
.bl-mainhead { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 0 14px 8px; }
.bl-group { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.bl-gchip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.bl-gchip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.bl-gchip em { font-style: normal; background: var(--accent); color: #fff; border-radius: 999px; width: 15px; height: 15px; font-size: 10px; display: grid; place-items: center; }
.bl-scroll { overflow: auto; max-height: calc(100vh - 140px); border-top: 1px solid var(--line); }
table.bl-t { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
table.bl-t td, table.bl-t th { padding: 4px 8px; white-space: nowrap; border-bottom: 1px solid var(--line2); }
table.bl-t .num { text-align: right; min-width: 58px; font-variant-numeric: tabular-nums; }
table.bl-t .bl-name { position: sticky; left: 0; background: var(--panel); z-index: 2; text-align: left; min-width: 280px; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.bl-t thead tr.bl-head th { position: sticky; top: 132px; background: var(--panel); z-index: 3; font-size: 11.5px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
table.bl-t thead tr.bl-head th.bl-name { z-index: 4; }
table.bl-t thead tr.bl-chart td { position: sticky; top: 0; background: var(--panel); z-index: 3; height: 132px; vertical-align: bottom; border-bottom: 0; padding: 4px 3px 2px; }
table.bl-t thead tr.bl-chart td.bl-name { z-index: 4; vertical-align: top; padding-top: 10px; }
table.bl-t .fc { background-color: rgba(245, 158, 11, .05); }
table.bl-t .first { border-left: 2px solid #f59e0b; }
table.bl-t thead tr.bl-chart td.fc { background: linear-gradient(rgba(245, 158, 11, .05), rgba(245, 158, 11, .05)), var(--panel); }
table.bl-t thead tr.bl-head th.fc { background: linear-gradient(rgba(245, 158, 11, .08), rgba(245, 158, 11, .08)), var(--panel); }
.bl-bar { display: flex; flex-direction: column-reverse; align-items: stretch; justify-content: flex-start; height: 110px; position: relative; }
.bl-bar > div { border-radius: 2px 2px 0 0; margin: 0 2px; min-height: 1px; }
.bl-bar > div + div { border-radius: 0; }
.bl-btot { order: 99; font-size: 10px; color: var(--muted); text-align: center; line-height: 1.2; }
.bl-legend { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); white-space: normal; }
.bl-legend i, .bl-t i.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
table.bl-t tbody tr.open-able { cursor: pointer; }
table.bl-t tbody tr:hover td { filter: brightness(.97); }
table.bl-t tbody tr.lvl0 td { font-weight: 600; }
table.bl-t tbody tr.src td, table.bl-t tbody tr.more td { color: var(--muted); }
table.bl-t .chev { display: inline-block; width: 14px; color: var(--muted); font-size: 10px; }
table.bl-t .nm { display: inline-block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
table.bl-t .bl-tot { font-weight: 600; background: var(--total); position: sticky; right: 0; }
table.bl-t tfoot td { position: sticky; bottom: 0; background: var(--total); font-weight: 650; border-top: 1px solid var(--line); z-index: 2; }
table.bl-t tfoot td.bl-name { z-index: 4; }
.bl-letter { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 4px; color: #fff; font-size: 9.5px; font-weight: 700; margin-left: 6px; vertical-align: 1px; }
.bl-link { margin-left: 6px; font-size: 11.5px; color: var(--accent); }
.bl-scen { margin-top: 12px; padding: 10px 0 6px; }
table.bl-sct { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.bl-sct th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 6px 12px; border-bottom: 1px solid var(--line); }
table.bl-sct td { padding: 5px 12px; border-bottom: 1px solid var(--line2); }
table.bl-sct .num { text-align: right; }
table.bl-sct tr.changed td { background: var(--accent-soft); }
table.bl-sct select, table.bl-sct input, table.bl-sct .msel { border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; background: var(--bg); font-size: 12.5px; }

/* scenario tab */
.bl-scenline { background: var(--accent-soft); color: var(--text); border-radius: 10px; padding: 7px 12px; margin-bottom: 10px; font-size: 13px; }
.bl-scenline a { color: var(--accent); margin-left: 6px; }
.bl-kpi b.up, .sc-t .up { color: #2e9e6a; } .bl-kpi b.down, .sc-t .down { color: #d56a7a; }
.sc-t td { vertical-align: middle; white-space: nowrap; }
table.soft-t.sc-t th, table.soft-t.sc-t td { padding-left: 7px; padding-right: 7px; }
.sc-t td.title { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.sc-t .sc-sub { overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.sc-t .seg { flex-wrap: nowrap; } .sc-t .seg.sm button { white-space: nowrap; }
.sc-t tr.sc-changed td { background: var(--accent-soft); }
.sc-t .seg.sm button { padding: 3px 8px; font-size: 12px; }
.sc-t input { border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--bg); font-size: 12.5px; }
.sync-foot { display: block; font-size: 10.5px; margin-top: 1px; line-height: 1.4; }
.sync { gap: 4px; padding-top: 8px; }
.sync-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sync-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.sync .btn.sm { padding: 2px 8px; font-size: 11.5px; border-radius: 6px; flex: none; }
body.narrow .sync-row { justify-content: center; }
.sync-foot a { color: var(--accent); }
body.narrow .sync-foot, body.narrow #pdSyncInfo { display: none; }

/* Settings tab */
.set-card { padding: 14px 18px; max-width: 1100px; }
.set-card h3 { margin: 0 0 6px; font-size: 15px; }
.set-default { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.set-default label { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.set-h { width: 64px; text-align: right; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.set-t { border-collapse: collapse; width: 100%; font-size: 13px; }
.set-t th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.set-t td { border-bottom: 1px solid var(--line); padding: 5px 8px; }
.set-t .num { text-align: right; white-space: nowrap; }
.set-t tr.own td:first-child { font-weight: 600; }
.set-t td.set-off { color: var(--warn); font-weight: 600; }

/* Sign-in page */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; box-sizing: border-box; }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; box-shadow: var(--shadow); }
.login-card .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 18px; padding: 0; }
.login-logo { height: 34px; width: auto; }
.login-sub { font-size: 10.5px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.login-card h2 { font-size: 17px; margin: 6px 0 12px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.login-card .btn { margin-top: 4px; }
.login-qr svg { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 8px; }
.login-msg { color: #b42318; min-height: 1.2em; font-size: 13px; margin: 10px 0 0; }
.who { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 6px 4px; border-top: 1px solid var(--line); margin-top: auto; }
body.narrow .who { display: none; }
.who[hidden] { display: none; }
.who:not([hidden]) + .sync { margin-top: 0; }
.set-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0 4px; }
.set-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.set-form label.check { flex-direction: row; align-items: center; color: var(--text); }
.set-form input:not([type=checkbox]) { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.set-acts { white-space: nowrap; }
.set-acts .danger { color: #b42318; }
.set-newpw { background: var(--warn-soft); border: 1px solid #e6c37a; border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }

/* Admin: API keys & connections */
.adm-h { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.adm-key { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line2); }
.adm-key .set-form { margin: 0; }
.adm-key input:not([type=checkbox]), .adm-key select, .adm-key .msel { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); min-width: 260px; }

/* Hours & utilization tab (the pivot in mode "hours") */
/* the Values box: one setting per line (the box itself wraps its items), readable dropdowns - the list that opens
   takes the select's font size */
.hv-pick { display: flex; align-items: center; gap: 8px; margin: 2px 0; font-size: 13px; width: 100%; }
.hv-pick label { width: 82px; flex: none; color: var(--muted); }
.hv-pick select, .hv-pick input[type=month], .hv-pick .msel { font-size: 13.5px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); min-height: 32px; }
.hv-pick > select, .hv-pick > .msel { flex: 1; min-width: 0; max-width: 340px; }
.hv-pick select:disabled, .hv-pick input:disabled, .hv-pick .msel:disabled { opacity: .55; }
.field > .bands { width: 100%; margin-top: 4px; }
table.pv-blocks tr.pv-bt td { background: var(--total); font-weight: 650; font-size: 13px; padding: 8px 10px; border-top: 2px solid var(--line); }
table.pv-blocks tr.pv-bt td span { position: sticky; left: 10px; }
table.pv-blocks tr.pv-btot td { font-weight: 600; border-top: 1px solid var(--line); }
table.pv-blocks tr.pv-btot td.rk { background: var(--total); }
.bands { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.bands input { width: 54px; padding: 4px 6px; font-size: 13px; text-align: right; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.bands i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; box-shadow: inset 0 0 0 1px var(--line); }

/* Tagging tab */
.tg-subtabs { margin: 0 2px 10px; }
.tg-sum { padding: 10px 14px; }
.tg-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tg-groups .chip.metric .muted { font-size: 11.5px; }
.tg-groups .chip.metric.on .muted { color: #fff; opacity: .8; }
table.tg-t tbody tr { cursor: default; }
table.tg-t td.tg-type { max-width: 240px; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
table.tg-t td.tg-txt { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.tg-t tr.tg-untagged td { background: #fffbeb; }
.tg-pick { max-width: 220px; }
.tg-new { width: 220px; }
.tg-bulk { display: inline-flex; align-items: center; gap: 8px; }
.tg-more { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }

/* Pivot: collapsible row levels */
table.pv td.rk.grp .tw { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px 0 0; font-size: 11px; width: 14px; }
table.pv td.rk.grp .tw:hover { color: var(--accent); }
table.pv tr.sub td { font-weight: 600; }
table.pv tr.sub td.rk { background: var(--total); }
table.pv th.rd .lvl { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
table.pv th.rd .lvl button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 5px; width: 18px; height: 18px; line-height: 14px; padding: 0; cursor: pointer; font-size: 12px; }
table.pv th.rd .lvl button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
table.pv th.rd .lvl button:disabled { opacity: .35; cursor: default; }

/* Pivot: booked periods (Hours & utilization): the same colours as history, a line where history ends */
table.pv .bk1 { box-shadow: inset 2px 0 0 #d97706; }
table.pv tr.bk1 td { box-shadow: inset 0 2px 0 #d97706; }
table.pv .bk-tag { display: inline-block; font-size: 10.5px; font-weight: 600; color: #b45309; margin-right: 6px; }
.note .bk-note b { color: #b45309; }
.hv-pick.hv-booked { flex-wrap: wrap; }
.hv-pick.hv-booked label.check, .hv-pick label.check { width: auto; color: var(--text); }
.hv-pick.hv-booked { row-gap: 6px; margin-top: 4px; }
.hv-pick.hv-booked > select, .hv-pick.hv-booked > .msel { flex: none; }

/* Soft backlog deal page: months typed in on the time distribution */
table.bd-t input.month-in { width: 76px; text-align: right; border: 1px solid transparent; border-radius: 5px; padding: 1px 4px;
  background: transparent; font: inherit; color: inherit; }
table.bd-t input.month-in:hover { border-color: var(--line); }
table.bd-t input.month-in:focus { border-color: var(--accent); background: var(--panel); outline: none; }
table.bd-t td.typed { background: var(--accent-soft); }
table.bd-t td.typed input.month-in { font-weight: 600; color: var(--accent); }
.rr-note.ok-note { background: var(--chip); color: var(--muted); border-color: var(--line); }
.rr-note .btn.sm { padding: 2px 10px; font-size: 12px; }
table.bd-t td.month-ro { cursor: pointer; }
table.bd-t td.month-ro:hover { background: var(--accent-soft); }
table.bd-t input.month-in { border-bottom: 1px dashed var(--line); cursor: text; }

/* BD → Pipeline pivot: Kanban view */
.kb { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; max-height: calc(100vh - 300px); }
.kb-col { width: 260px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 310px);
  background: var(--chip); border: 1px solid var(--line); border-radius: 10px; }
.kb-head { padding: 7px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.kb-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-sum { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-cards { padding: 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.kb-card { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kb-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.kb-title { font-size: 11.5px; font-weight: 600; color: inherit; text-decoration: none; display: block; line-height: 1.3; }
a.kb-title:hover { color: var(--accent); text-decoration: underline; }
.kb-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.kb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.kb-prob { font-size: 9.5px; padding: 1px 5px; border-radius: 4px; }
.kb-empty { font-size: 10.5px; color: var(--muted); text-align: center; padding: 12px 0; }
.wp-cols { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* BD → Pipeline pivot: click a value to see its deals */
table.pv td.v.click { cursor: pointer; }
table.pv td.v.click:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
.drill-bg { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .28); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; }
.drill { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); width: min(1150px, 100%);
  max-height: 84vh; display: flex; flex-direction: column; }
.drill-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drill-head h3 { margin: 0 0 2px; font-size: 15px; }
.drill-body { overflow: auto; padding: 4px 12px 12px; }
.drill-t td a { color: var(--accent); text-decoration: none; }
.drill-t td a:hover { text-decoration: underline; }

/* BD → Data quality */
.dq-card h3 { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
table.dq-t td.dq-cell { cursor: pointer; }
table.dq-t td.dq-cell:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
table.dq-t tr.dq-off td { color: var(--muted); }
table.dq-t tr.dq-sub th { font-weight: 500; }
table.dq-t th, table.dq-t td { white-space: nowrap; }
.dq-issues { font-size: 11px; color: var(--warn); white-space: normal; min-width: 220px; }
svg.dq-trend { display: block; max-width: 900px; margin-top: 8px; }
svg.dq-trend text { font-size: 10.5px; fill: var(--muted); }
svg.dq-trend text.all { font-weight: 700; fill: var(--text, #111); }
svg.dq-trend line.grid { stroke: var(--line2, #eee); }

/* BD → Activities: the companies behind a cell, each opening into its activities */
/* Pivot / Hours & utilization: the work orders behind a value, a work order opens to its lines */
.drill.drill-wide { width: min(1400px, 100%); }
table.hd-t tr.click { cursor: pointer; }
table.hd-t tr.click:hover td { background: var(--hover, rgba(99, 102, 241, .05)); }
table.hd-t .tw { color: var(--muted); font-size: 10px; }
table.hd-t td.nowrap, table.drill-t td.nowrap { white-space: nowrap; }
table.hd-t tr.hd-lines > td { background: var(--bg); padding: 4px 8px 10px 24px; }
table.hd-t tr.hd-lines table { width: 100%; font-size: 12px; }
table.hd-t tr.hd-lines tr.muted td { color: var(--muted); }
.drill-body h4.hd-sub { margin: 14px 0 4px; font-size: 13px; }
table.drill-t tr.act-co { cursor: pointer; }
table.drill-t tr.act-co:hover td { background: var(--hover, rgba(99, 102, 241, .05)); }
tr.act-sub > td { padding: 0 0 8px 22px; background: var(--bg, #f8fafc); }
table.act-list { width: 100%; border-collapse: collapse; font-size: 12px; }
table.act-list td { padding: 3px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.act-list td:first-child { white-space: nowrap; color: var(--muted); }
table.act-list .badge { margin-left: 6px; }

.dq-filters { display: flex; flex-direction: column; gap: 6px; }
.dq-frow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dq-flab { width: 120px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.dq-filters .pill, .fin-bar .pill { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; }
.dq-filters .pill.on, .fin-bar .pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dq-detail { margin-left: 6px; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* BD → Backlog history: zombie / won / lost rows, the value range, the change-log warning */
table.bh-t tr.bh-sub td { color: var(--muted); font-size: 12px; }
table.bh-t tr.bh-zombie td { background: var(--warn-soft); color: var(--warn); }
table.bh-t tr.bh-won td { background: rgba(16, 150, 90, .08); color: #0d7a4a; }
table.bh-t tr.bh-lost td { background: rgba(200, 40, 40, .07); color: #b42323; }
table.bh-t tr.bh-won td:first-child, table.bh-t tr.bh-lost td:first-child { border-top: 1px solid var(--line); }
table.bh-t tr.se-new td { background: rgba(60, 110, 220, .07); color: #2b55b8; border-top: 1px solid var(--line); }
table.bh-t td.se-sum, table.bh-t th.se-sum { background: var(--total); font-weight: 600; border-left: 1px solid var(--line); }
.badge.bh-zombie { background: var(--warn-soft); color: var(--warn); }
.badge.bh-st-won { background: rgba(16, 150, 90, .12); color: #0d7a4a; }
.badge.bh-st-lost { background: rgba(200, 40, 40, .1); color: #b42323; }
.badge.bh-st-open { background: var(--chip); color: var(--muted); }
.fchip.bh-range { display: inline-flex; align-items: center; gap: 4px; cursor: default; }
.fchip.bh-range input { width: 76px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.warn-box { margin: 8px 0; padding: 8px 12px; border: 1px solid #e6c37a; background: var(--warn-soft); color: var(--warn); border-radius: 8px; font-size: 13px; }

.srcs { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* Menu: favourite stars (shown on hover, always when set) and the version box under the logo (1.11.2026) */
.tabrow { position: relative; display: flex; }
.tabrow > button { padding-right: 24px; }
.tabrow .fav { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); text-decoration: none; color: var(--muted); font-size: 13px; padding: 2px 4px; opacity: 0; }
.tabrow:hover .fav, .tabrow .fav:focus { opacity: .7; }
.tabrow .fav.is { color: #d99a00; opacity: 1; }
.tabrow .fav:hover { color: #d99a00; opacity: 1; }
.navh .favh { color: #d99a00; }
body.narrow .tabrow .fav, body.narrow .verbox { display: none; }
.verbox { position: relative; padding: 0 4px; margin-top: -8px; font-size: 11px; }
.verbox .ver { display: flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0 0 0 36px; cursor: pointer; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 10px; white-space: nowrap; }
.verbox .ver:hover { color: var(--accent); }
.verbox .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; align-self: center; }
.ver-new { margin-top: 4px; padding: 4px 6px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.ver-new a { color: inherit; font-weight: 600; margin-left: 4px; }
.ver-list { position: absolute; left: 4px; top: 18px; z-index: 30; width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 380px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--panel); }
.ver-h { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 4px; }
.ver-h a { text-decoration: none; color: var(--muted); }
.ver-row { padding: 4px 0; border-top: 1px solid var(--line2); line-height: 1.3; }
.ver-row.here { border-left: 3px solid var(--accent); padding-left: 5px; }
@media (max-width: 760px) { .tabrow > button { padding-right: 8px; } .tabrow .fav { display: none; } }

/* Ask the app (1.11.2026): the menu button and the panel on the right */
.ask-btn { display: flex; align-items: center; gap: 9px; margin: 2px 0 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--accent); cursor: pointer; font-weight: 600; text-align: left; }
.ask-btn i { font-style: normal; width: 20px; text-align: center; }
.ask-btn:hover, .ask-btn.on { background: var(--accent-soft); border-color: var(--accent); }
body.narrow .ask-btn span { display: none; } body.narrow .ask-btn { justify-content: center; }
.ask { position: fixed; top: 0; right: 0; height: 100vh; width: 430px; max-width: 94vw; z-index: 60; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 28px rgba(0,0,0,.12); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .25s ease; }
.ask.open { transform: none; }
.ask-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line2); color: var(--accent); }
.ask-beta { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 1px 5px; }
.ask-x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.ask-x:hover { color: var(--text); }
.ask-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.45; }
.ask-intro p { margin: 0 0 10px; }
.ask-ex { display: block; width: 100%; text-align: left; margin-bottom: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--text); cursor: pointer; font-size: 12.5px; }
.ask-ex:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ask-me { align-self: flex-end; max-width: 85%; background: var(--accent); color: #fff; border-radius: 14px 14px 3px 14px; padding: 7px 11px; white-space: pre-wrap; }
.ask-me img { display: block; max-height: 120px; border-radius: 8px; margin-bottom: 6px; }
.ask-it { background: var(--chip); border-radius: 14px 14px 14px 3px; padding: 8px 11px; }
.ask-it.err { background: #fdecec; color: #a32020; }
.ask-open { margin-top: 8px; }
.ask-res { margin-top: 6px; font-size: 11.5px; display: flex; flex-direction: column; gap: 2px; }
.ask-res .ok { color: #1b7a43; } .ask-res .warn { color: var(--warn); }
.ask-rate { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 11px; }
.ask-rate button { border: 0; background: none; cursor: pointer; opacity: .45; padding: 0 2px; font-size: 13px; }
.ask-rate button:hover, .ask-rate button.on { opacity: 1; }
.ask-cost { margin-left: auto; }
.ask-note { display: flex; gap: 6px; margin-top: 6px; } .ask-note input { flex: 1; }
.ask-busy { font-size: 12px; }
.ask-warn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.ask-foot { border-top: 1px solid var(--line2); padding: 10px 14px; }
.ask-imgs { display: flex; gap: 8px; margin-bottom: 8px; } .ask-imgs span { position: relative; }
.ask-imgs img { height: 52px; border-radius: 6px; border: 1px solid var(--line); }
.ask-imgs button { position: absolute; top: -6px; right: -6px; border: 1px solid var(--line); background: var(--panel); border-radius: 50%; width: 18px; height: 18px; line-height: 14px; cursor: pointer; padding: 0; }
.ask-input { display: flex; gap: 8px; align-items: flex-end; }
.ask-input textarea { flex: 1; resize: none; font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.ask-btns { display: flex; flex-direction: column; gap: 4px; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.ask-small { font-size: 10.5px; margin: 8px 0 0; line-height: 1.35; }
.ask-log { margin-top: 8px; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--line2); }
.ask-log details { border-bottom: 1px solid var(--line2); padding: 5px 0; font-size: 12.5px; }
.ask-log summary { cursor: pointer; }

/* Requests & what's new (1.11.2026) */
.req-new { display: flex; flex-direction: column; gap: 8px; }
.req-new textarea, .req-title { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.req-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.req-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; } .req-imgs span { position: relative; }
.req-imgs img { height: 70px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.req-imgs button { position: absolute; top: -6px; right: -6px; border: 1px solid var(--line); background: var(--panel); border-radius: 50%; width: 18px; height: 18px; line-height: 14px; cursor: pointer; padding: 0; }
.req-card { border-top: 1px solid var(--line2); padding: 10px 0; }
.req-card.st-done, .req-card.st-declined { opacity: .65; }
.req-top { display: flex; align-items: center; gap: 8px; }
.req-t { cursor: pointer; }
.req-prio { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--muted); }
.req-prio.pA { background: #c0392b; } .req-prio.pB { background: var(--accent); } .req-prio.pC { background: #8a93a6; }
.req-tab { font-size: 11px; background: var(--chip); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.req-desc { white-space: pre-wrap; margin: 6px 0; }
.req-comment { font-size: 13px; padding: 3px 0 3px 10px; border-left: 2px solid var(--line); margin: 4px 0; }
.news-day { margin-top: 12px; }
.news-date { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.news-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line2); }
.news-item > div { flex: 1; }
.news-cat { flex: none; font-size: 10.5px; border-radius: 999px; padding: 1px 8px; margin-top: 2px; min-width: 62px; text-align: center; }
.news-cat.c-new { background: var(--accent-soft); color: var(--accent); }
.news-cat.c-improved { background: #e8eefc; color: #2f55b5; }
.news-cat.c-fixed { background: var(--warn-soft); color: var(--warn); }
.news-new { margin-left: 6px; font-size: 10px; color: #fff; background: var(--accent); border-radius: 4px; padding: 0 5px; }
.tabrow .navdot { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); display: flex; gap: 4px; align-items: center; pointer-events: none; }
.navdot .d { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.navdot .n { font-size: 10px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 6px; font-weight: 600; }
body.narrow .navdot { right: 4px; top: 6px; transform: none; } body.narrow .navdot .n { display: none; }

/* Users: tab access popover (1.11.2026) */
.tab-access { position: relative; }
.tab-access-pop { position: absolute; z-index: 30; top: 20px; left: 0; display: flex; flex-direction: column; gap: 3px; min-width: 210px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); white-space: nowrap; }

/* Find a tab (1.11.2026) */
.tsearch { position: relative; margin-top: 4px; }
.tsearch input { width: 100%; box-sizing: border-box; font: inherit; font-size: 12.5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.tsearch input:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.tsearch-list { position: absolute; left: 0; top: 34px; z-index: 40; width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.15); padding: 4px; display: flex; flex-direction: column; }
.tsearch-list button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: var(--text); text-align: left; font-size: 13px; }
.tsearch-list button i { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
.tsearch-list button small { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.tsearch-list button.on, .tsearch-list button:hover { background: var(--accent-soft); }
.tsearch-list button.ask { color: var(--accent); border-top: 1px solid var(--line2); border-radius: 0 0 7px 7px; }
body.narrow .tsearch { display: none; }

/* Ask the app: include the figures, confidence (1.11.2026) */
.ask-fig { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 6px; cursor: pointer; }
.ask-fig .warn { color: var(--warn); }
.ask-help-only { border: 1px solid var(--line, #d9dee5); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 12px; }
.ask-conf { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 7px; margin-bottom: 5px; background: var(--warn-soft); color: var(--warn); }
.ask-conf.low { background: #fdecec; color: #a32020; }
.ask-sent { margin-top: 6px; font-size: 11px; opacity: .9; }
.ask-sent summary { cursor: pointer; }
.ask-sent pre { max-height: 220px; overflow: auto; white-space: pre; background: rgba(255,255,255,.15); padding: 6px; border-radius: 6px; font-size: 10.5px; }
.ask-btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .ask-btnrow .ask-open { margin-top: 0; }
.ask-me.auto { background: var(--accent-soft); color: var(--accent); font-size: 12px; }

/* Tagging -> Maintenance time (pages/tagging/Maintenance.tsx): temporary times, assumptions first */
.mt-banner { margin: 8px 0 10px; padding: 10px 14px; border: 1px solid #e6c37a; background: var(--warn-soft); border-radius: 8px; font-size: 13.5px; color: var(--warn); }
.mt-assume h3, .mt-head h3 { margin: 0 0 6px; font-size: 14px; }
.mt-assume ol { margin: 0 0 8px; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.mt-assume ol li { margin-bottom: 4px; }
.mt-assume ul { margin: 2px 0; padding-left: 18px; }
.mt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 10px 0; }
.mt-kpis .sb-card { margin: 0; }
.mt-big { font-size: 22px; font-weight: 650; margin: 2px 0; }
.mt-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 8px 10px 0; }
.mt-t td, .mt-t th { white-space: nowrap; }
.mt-t td:first-child { white-space: normal; min-width: 180px; }
.mt-in { width: 64px; text-align: right; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); border-color: #e6c37a; }
.mt-yours td { background: rgba(37, 99, 235, .05); }
.mt-chip { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.mt-good { background: rgba(16, 150, 90, .12); color: #0d7a4a; }
.mt-some { background: #fff1c2; color: #8a6100; }
.mt-weak { background: rgba(220, 110, 40, .15); color: #a1460f; }
.mt-none { background: var(--chip); color: var(--muted); }

/* Maintenance run-rate (pages/maintrr) */
.mrr-chart { width: 100%; height: 260px; display: block; }
.mrr-chart .grid { stroke: var(--line2); }
.mrr-chart .ax { font-size: 10.5px; fill: var(--muted); }
.mrr-chart .b-inc, .mrr-dot-inc { fill: var(--accent); background: var(--accent); }
.mrr-chart .b-nr, .mrr-dot-nr { fill: var(--accent); opacity: .28; background: var(--accent); }
.mrr-settings { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line2); font-size: 12.5px; }
.mrr-settings label { display: inline-flex; align-items: center; gap: 6px; }
.mrr-kpi { cursor: pointer; }
.mrr-k-not_reviewed .mt-big { opacity: .55; }
.mrr-k-excluded .mt-big { color: var(--muted); }
.mrr-seg button { padding: 2px 8px; font-size: 11.5px; }
.mrr-seg button.on.off { background: #8a8f9c; }
.mrr-seg button.on.nr { background: var(--chip); color: var(--text); }
.mrr-from { margin-left: 6px; align-self: center; }
.mrr-t tr.mrr-out td { color: var(--muted); }
.mrr-t td.warn, .mrr-plans td.warn { color: #b45309; font-weight: 600; }
.mrr-sub > td { background: var(--line2); padding: 6px 10px 10px 28px; }
.mrr-plans { background: var(--panel); border-radius: 8px; }
.mrr-plans tbody tr { cursor: default; }
.mrr-groups { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.mrr-st { font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.mrr-included { background: rgba(16, 150, 90, .12); color: #0d7a4a; }
.mrr-excluded { background: var(--chip); color: var(--muted); }
.mrr-not_reviewed { background: #fff1c2; color: #8a6100; }
.mrr-foot { padding: 6px 10px; }
.mt-type td { background: var(--line2); font-size: 12.5px; }
.mt-visits > td { background: var(--line2); padding: 8px 12px 12px 22px; }
.mt-vt { background: var(--panel); border-radius: 8px; margin-top: 6px; font-size: 12px; }
.mt-vt tr.muted td { color: var(--muted); }
.mrr-basis { padding: 2px 2px 8px; }
.mrr-dev > td { background: var(--line2); padding: 6px 10px 10px 22px; }
.mrr-check { margin-top: 8px; }
.mrr-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(460px, 1fr); gap: 10px; align-items: start; }
.mrr-top .sb-card { margin-bottom: 10px; }
@media (max-width: 1100px) { .mrr-top { grid-template-columns: minmax(0, 1fr); } }
.mrr-pad { padding: 10px 14px; }
.mrr-nopad { padding: 0 0 4px; }
.mrr-warn { color: var(--warn); }
.mrr-kpi.on { outline: 2px solid var(--accent); }
.mrr-assume h3 { margin: 0 0 6px; font-size: 14px; }
.mrr-assume table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.mrr-assume th { text-align: left; vertical-align: top; padding: 5px 10px 5px 0; white-space: nowrap; color: var(--muted); font-weight: 600; }
.mrr-assume td { vertical-align: top; padding: 5px 6px 5px 0; border-top: 1px solid var(--line2); line-height: 1.4; }
.mrr-assume tr:first-child td, .mrr-assume tr:first-child th { border-top: 0; }
.mrr-assume th { border-top: 1px solid var(--line2); }
.mrr-assume td:last-child { white-space: nowrap; text-align: right; }
.mrr-assume select, .mrr-assume .mt-in, .mrr-assume .msel { font-size: 12px; }
.mrr-top.closed { grid-template-columns: minmax(0, 1fr); }
.mrr-assume-bar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 14px; margin-bottom: 10px; cursor: pointer;
  background: var(--warn-soft); border: 1px solid #e6c37a; border-radius: 12px; font-size: 12.5px; }
.mrr-assume-bar b { color: var(--warn); }
.mrr-assume-bar span { color: var(--text); }
.mrr-assume-bar span + span::before { content: '·'; margin-right: 14px; color: var(--muted); }
.mrr-assume-bar:hover { border-color: var(--warn); }
.mrr-hide { float: right; }
.mrr-calc { font-size: 12.5px; padding: 6px 10px; margin: 4px 0 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.mrr-own { color: var(--accent); }
.mrr-section { margin: 18px 0 6px; font-size: 15px; }

/* Tagging -> Revenue tagging */
.rt-cover { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.rt-bar { width: 220px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; flex: none; }
.rt-bar i { display: block; height: 100%; background: var(--good, #2e9d5b); }
.rt-t th.rt-sf, .rt-t td.rt-sf { background: #f6f7fb; color: #4b5563; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-t th.rt-sf span { margin-left: 4px; font-size: 9.5px; font-weight: 600; color: #fff; background: #00a1e0; border-radius: 3px; padding: 0 3px; vertical-align: 1px; }
.rt-t td.rt-sf.warn { color: var(--warn); font-weight: 600; }
.rt-t .rt-prod { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-t .rt-prod .tag { margin-left: 6px; }
.rt-pick { font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); max-width: 170px; }
.rt-pick.own { color: var(--accent); border-color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.rt-t tr.rt-done td:first-child { box-shadow: inset 3px 0 0 #2e9d5b; }
.rt-bulk { background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; }
.rt-log { max-height: 320px; overflow: auto; }
.set-h.own { border-color: var(--accent); background: var(--accent-soft); }
.rt-cover .warn { color: var(--warn); font-weight: 600; }

/* Hours & utilization "Combined": the utilization in the colour of its limit, under it a thin bar and the hours.
   Empty cells stay blank (no dashes, no empty bars) */
table.pv-hu td.v { padding-top: 4px; padding-bottom: 4px; }
table.pv-hu tbody td, table.pv-hu tfoot td { height: 38px; }   /* same height whether a row has bars or not */
table.pv .hu { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 64px; }
table.pv .hu-p { align-self: flex-end; line-height: 1.25; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0 7px; border-radius: 9px; }
/* the number keeps the text colour; the fill carries the level (text on a coloured fill reads worse) */
table.pv .hu-p.b0 { background: var(--u0-bg); color: var(--text); font-weight: 700; }
table.pv .hu-p.b1 { background: var(--u1-bg); color: var(--text); }
table.pv .hu-p.b2 { background: var(--u2-bg); color: var(--text); }
table.pv .hu-p.b3 { background: var(--u3-bg); color: var(--text); }
table.pv .hu-q { display: flex; align-items: center; gap: 5px; }
table.pv .hu-bar { flex: 1; height: 3px; min-width: 20px; }
table.pv .hu-bar i { display: block; height: 100%; border-radius: 2px; background: var(--muted); opacity: .35; }
table.pv .hu-n { font-size: 10.5px; color: var(--muted); line-height: 1.1; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
table.pv .hu.bkd .hu-p { color: var(--muted); font-weight: 500; }
/* Shade cells on: the whole cell carries the colour, so the label is plain coloured text */
table.pv td.hu-tint .hu-p { background: none; padding: 0; }
table.pv td.hu-tint .hu.bkd .hu-p { color: var(--text); }
table.pv .hu.bkd .hu-bar i { background: var(--warn); opacity: .55; }
/* the % / h sort choice sits in the period header, shown on hover or when that column is sorted */
table.pv thead .hu-sorts { display: inline-flex; gap: 1px; margin-left: 4px; font-size: 10.5px; font-weight: 500; color: var(--muted); opacity: 0; transition: opacity .1s; }
table.pv thead th:hover .hu-sorts, table.pv thead .hu-sorts.on { opacity: 1; }
table.pv thead .hu-sorts span { padding: 0 3px; border-radius: 4px; cursor: pointer; }
table.pv thead .hu-sorts span:hover, table.pv thead .hu-sorts span.on { color: var(--accent); background: var(--line2); }
table.pv-hu thead th.hu-h { cursor: pointer; }
/* Utilization / revenue limits: a diverging scale around the target. Under the target = coral (darker = further below,
   incl. 0), in the target = neutral (no fill), over it = light blue. Not red vs green (the pair colour-blind readers
   cannot tell apart). Booked periods: slate, stronger the more is booked (--bk-rgb). Text on all fills >= 10:1. */
:root { --u0: #b4382c; --u0-bg: #f4cfc9; --u1: #b4382c; --u1-bg: #fbe7e2; --u2: var(--text); --u2-bg: transparent; --u3: #2f5f9e; --u3-bg: #d8e5f6; --bk-rgb: 100, 116, 139; }
@media (prefers-color-scheme: dark) {
  :root { --u0: #f2a097; --u0-bg: #5c2e2b; --u1: #f2a097; --u1-bg: #3e2b29; --u2: var(--text); --u2-bg: transparent; --u3: #9cc0ee; --u3-bg: #24384f; --bk-rgb: 148, 163, 184; }
}
table.pv thead th.mh .hu-sort { margin-left: 6px; padding: 0 4px; border-radius: 4px; cursor: pointer; }
table.pv thead th.mh .hu-sort:hover, table.pv thead th.mh .hu-sort.on { color: var(--accent); background: var(--line2); }
table.pv thead th.tot .tot-sub { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }

/* ‹ › beside the period dates: step one period back / on */
.topbar button.step { min-width: 30px; height: 30px; padding: 0 8px; font-size: 17px; line-height: 1; font-weight: 600; }


/* The app's dropdown (components/Select.tsx): a button like the inputs, and a list drawn like the filter lists */
.msel { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); padding: 4px 8px; cursor: pointer; text-align: left; line-height: 1.3; vertical-align: middle; }
.msel:hover:not(:disabled) { border-color: var(--muted); }
.msel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.msel.open { border-color: var(--accent); }
.msel:disabled { opacity: .55; cursor: default; }
.msel .msel-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msel .msel-c { width: 12px; height: 12px; flex: none; color: var(--muted); }
.msel-pop { position: fixed; z-index: 80; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-width: min(460px, calc(100vw - 16px)); display: flex; flex-direction: column; overflow: hidden; font-size: 13px; }
.msel-pop .msel-q { margin: 8px 8px 4px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--bg); font-size: 13px; }
.msel-pop .msel-list { overflow: auto; padding: 4px; outline: none; }
.msel-pop .msel-o { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.msel-pop .msel-o.in-g { padding-left: 18px; }
.msel-pop .msel-o.act { background: var(--chip); }
.msel-pop .msel-o.on { font-weight: 600; }
.msel-pop .msel-o.dis { color: var(--muted); cursor: default; background: none; }
.msel-pop .msel-tick { margin-left: auto; color: var(--accent); }
.msel-pop .msel-g { padding: 8px 10px 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.msel-pop .msel-empty { padding: 8px 10px; color: var(--muted); }

/* Settings: colour limits for revenue per country */
.set-t input.num-in { width: 76px; text-align: right; margin-right: 4px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-variant-numeric: tabular-nums; }

/* Hours & utilization: the colour scale above the table */
.hu-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 2px 2px 8px; color: var(--text); }
.hu-legend i { display: inline-block; width: 14px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; box-shadow: inset 0 0 0 1px var(--line); }

/* Pivot: Sort by under Rows */
.field .sort-by { width: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.field .sort-by .msel { max-width: 220px; }

/* Group P&L (pages/finance) */
.fin-bar { margin-bottom: 8px; }
.fin-card h3 { margin: 0 0 8px; }
.set-card.fin-card { max-width: none; }   /* By month has 13 columns: use the whole width, not the settings cards' 1100 px */
table.fin-t td.lab, table.fin-t th.lab { position: sticky; left: 0; z-index: 1; background: var(--panel); }   /* line names stay when the table scrolls */
table.fin-t tr.r-total td.lab { background: var(--total); }
table.fin-t th.k-split, table.fin-t td.k-split { border-left: 2px solid var(--accent); }   /* actual | budget or scenario */
.fin-scroll { overflow-x: auto; }
table.fin-t { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 60%; }
table.fin-t th, table.fin-t td { padding: 5px 12px; white-space: nowrap; border-bottom: 1px solid var(--line2); }
table.fin-t th { font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
table.fin-t .num { text-align: right; }
table.fin-t td.lab { min-width: 200px; text-align: left; }
table.fin-t tr.r-total td { font-weight: 650; border-top: 1px solid var(--line); background: var(--total); }
table.fin-t tr.r-margin td { font-style: italic; color: var(--muted); font-size: 12px; }
table.fin-t .k-bud, table.fin-t .k-ly { color: var(--muted); }
table.fin-t tr.r-total .k-bud, table.fin-t tr.r-total .k-ly { color: var(--text); }
table.fin-t th.k-delta, table.fin-t td.k-delta { border-left: 1px solid var(--line); }
table.fin-t th.k-ly, table.fin-t td.k-ly { border-left: 2px solid var(--line); }
table.fin-t th.k-total, table.fin-t td.k-total { border-left: 2px solid var(--line); font-weight: 600; }
table.fin-t td.up { color: #2e7d4f; }
table.fin-t td.down { color: #b4382c; }
.fin-imp { width: min(1050px, 100%); }
.fin-drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; margin: 8px 0; }
.fin-drop:hover { border-color: var(--accent); color: var(--accent); }
.fin-drop.busy { cursor: progress; }
.fin-drop input { display: none; }
.hc-t td { vertical-align: middle; }
.hc-t tr:not(.hc-detail) td:nth-child(2) { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-t tr.hc-detail td { background: var(--panel2, transparent); padding-top: 2px; }
.hc-t tr.hc-detail .fin-warn { margin: 4px 0 6px; }
.fin-err { color: #b4382c; font-weight: 600; margin: 6px 0; }
.fin-checks { display: flex; flex-direction: column; gap: 4px; }
.fin-check { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.fin-check-h { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.fin-check-h span:nth-child(2) { flex: 1; }
.fin-check .mark { font-weight: 700; width: 14px; }
.fin-check.ok .mark { color: #2e7d4f; }
.fin-check.bad { border-color: #e2a59d; background: #fdf1ef; }
.fin-check.bad .mark { color: #b4382c; }
.fin-check.info .mark { color: var(--muted); }
.fin-check ul { margin: 6px 0 2px 24px; padding: 0; }
.fin-warn li { color: var(--warn); }
.fin-badge { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.fin-badge.ok { background: var(--accent-soft); color: var(--accent); }
.fin-badge.bad { background: #fbe7e2; color: #b4382c; }
.fin-bad-t { color: #b4382c; }
.fin-actions { display: flex; gap: 10px; align-items: center; margin: 12px 0 4px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) {
  .fin-check.bad { background: #3a1f1c; border-color: #6b3a33; }
  table.fin-t td.up { color: #6fcf97; }
  table.fin-t td.down { color: #f08a7e; }
}
.fin-page { position: relative; min-height: 70vh; }
.fin-dropall { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; border: 3px dashed var(--accent);
  border-radius: 14px; background: rgba(var(--heat), .08); color: var(--accent); font-size: 18px; font-weight: 600; pointer-events: none; }
table.fin-t tr.r-section td { padding-top: 16px; font-weight: 650; border-bottom: 1px solid var(--line); text-transform: none; }
table.fin-t tr.r-metric td { color: var(--text); }
.fin-share { margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fin-share-in { width: 60px; text-align: right; }
.fin-mnote { margin: 8px 0 0; }
.fin-form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.fin-form-row label { display: flex; gap: 6px; align-items: center; }
table.fin-grid td.fin-edit { background: rgba(240, 180, 0, 0.09); }   /* a scenario cell you can change (the grid: components/sheet.tsx) */
table.fin-grid td.sh-cell { text-align: right; }
table.fin-grid tr.r-ref td { color: var(--muted); font-size: 12px; font-style: italic; border-bottom-color: transparent; }   /* actual under each line */
table.fin-grid tr.r-ref td .sh-val { padding-top: 2px; padding-bottom: 2px; }
table.fin-grid tr.r-ref td.sh-cell { height: 22px; }
table.fin-grid tr.r-ref td.lab { padding-left: 24px; font-weight: 400; }
.fin-ref-pick { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-weight: 400; text-transform: none; }
/* driver-based scenario (pages/finance/Drivers.tsx): actual grey, suggestion blue italic, your value yellow, calculated plain */
.fin-drv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 4px 0 10px; }
.fin-drv-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
table.fin-drv td.drv-actual { color: var(--muted); background: var(--total); }
table.fin-drv td.drv-suggested { color: #2563a8; font-style: italic; background: rgba(37, 99, 168, 0.07); }
table.fin-drv td.drv-typed { color: #8a5a00; font-weight: 600; background: rgba(240, 180, 0, 0.18); }
table.fin-drv tr.drv-calc td.lab { padding-left: 24px; color: var(--muted); }
table.fin-drv td.drv-last-act, table.fin-drv th.drv-last-act { border-right: 2px solid var(--accent); }
table.fin-drv .drv-basis { font-size: 12px; font-weight: 400; color: var(--muted); white-space: normal; min-width: 220px; max-width: 320px; text-align: left; }
.drv-reset { margin-left: 6px; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0 2px; }
.drv-mode { display: flex; align-items: center; gap: 2px; margin-top: 3px; font-size: 11px; font-weight: 400; }
.drv-mode button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 1px 6px; cursor: pointer; font-size: 11px; }
.drv-mode button:first-child { border-radius: 6px 0 0 6px; }
.drv-mode button:nth-child(2) { border-radius: 0 6px 6px 0; border-left: 0; }
.drv-mode button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.drv-mode .muted { margin-left: 6px; font-style: italic; }
.fin-drv-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 2px; color: var(--muted); }
.fin-drv-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid var(--line); }
.fin-drv-legend i.drv-actual { background: var(--total); }
.fin-drv-legend i.drv-suggested { background: rgba(37, 99, 168, 0.15); }
.fin-drv-legend i.drv-typed { background: rgba(240, 180, 0, 0.35); }
@media (prefers-color-scheme: dark) { table.fin-drv td.drv-suggested { color: #8ab8ef; } table.fin-drv td.drv-typed { color: #f0c860; } }
.fin-kind { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 10px; }
.fin-kind-opt { flex: 1 1 260px; display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.fin-kind-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fin-kind-opt > span { display: flex; flex-direction: column; gap: 2px; }
.fclear.danger { color: #b4382c; font-weight: 600; }
