/* Brandt Advice office app.
   Colours and type come from brand/tokens/tokens.css.
   Assumed, since the CVI doesn't define them yet: an 8px spacing grid and
   6px UI corner radius. Status is shown with weight and ink fill, not colour. */

:root { --space: 8px; --radius: 6px; --side-w: 232px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-size: 15px; line-height: 22px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; line-height: 18px; }
.mono, .num { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.num { text-align: right; white-space: nowrap; }

/* layout */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--brand-ink); color: var(--brand-white); padding: 28px 20px; display: flex; flex-direction: column; gap: 32px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--hairline); }
.side-logo img { width: 156px; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-weight: 300; color: #ffffffcc; }
.nav a:hover { background: #ffffff14; color: #fff; }
.nav a.active { background: #ffffff1f; color: #fff; font-weight: 700; }
.side { overflow-y: auto; gap: 24px; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-head { display: flex; justify-content: space-between; align-items: center; padding: 0 12px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #ffffff99; }
.nav-head a { text-decoration: none; color: inherit; }
.nav-head a.active, .nav-head a:hover { color: #fff; }
.nav-head .link { color: #ffffffcc; text-decoration: none; font-size: 20px; line-height: 20px; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nav.sub a { padding-left: 20px; }
.nav .badge { font-family: var(--font-mono); font-size: 11px; line-height: 16px; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px; border: 1px solid #ffffff66; }
.nav .badge.strong { background: #fff; color: var(--brand-ink); border-color: #fff; }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin: -12px 0 28px; }
.subtabs a { text-decoration: none; padding: 10px 14px; font-weight: 300; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a.on { font-weight: 700; border-bottom-color: var(--text); }
.toggle-list { display: grid; gap: 4px; }
.toggle-list label { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hairline); }
.toggle-list label:first-child { border-top: 0; }
.toggle-list input { width: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.side-foot .link { color: #ffffffcc; }
.side-foot .muted { color: #ffffff99; }
.main { padding: 40px 48px 80px; max-width: 1280px; width: 100%; outline: none; }

/* headings: Bold + Light, like the wordmark */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.title { font-size: 40px; line-height: 44px; margin: 0; letter-spacing: -0.01em; }
.title b { font-weight: 700; }
.title span { font-weight: 300; }
h2 { font-size: 20px; line-height: 26px; font-weight: 700; margin: 0 0 12px; }
h2 span { font-weight: 300; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }

/* surfaces */
.grid { display: grid; gap: 24px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 20px 24px; background: var(--surface); }
.card.subtle { background: var(--surface-subtle); border-color: transparent; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.section { margin-top: 32px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.kpi { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 16px 20px; text-decoration: none; display: block; }
a.kpi:hover { background: var(--surface-subtle); }
.kpi .label { font-size: 13px; color: var(--text-muted); }
.kpi .value { font-family: var(--font-mono); font-size: 28px; line-height: 36px; margin-top: 4px; }
.kpi.strong { background: var(--brand-ink); color: var(--brand-white); border-color: var(--brand-ink); }
[data-theme="dark"] .kpi.strong { background: var(--brand-white); color: var(--brand-ink); }
.kpi.strong .label { color: inherit; opacity: .75; }

/* lists */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hairline); }
.row:first-child { border-top: 0; }
.row .what { min-width: 0; }
.row .what .t { overflow-wrap: anywhere; }
.row .what .s { font-size: 13px; color: var(--text-muted); }
.row.done .t { text-decoration: line-through; color: var(--text-muted); }
.row .end { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--text-muted); padding: 12px 0; font-weight: 300; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; font-size: 13px; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-subtle); }
tr.inactive td { color: var(--text-muted); }
th.num, td.num { text-align: right; }

/* status pills: no colour, weight and fill do the work */
.pill { display: inline-block; font-size: 12px; line-height: 18px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--hairline); white-space: nowrap; font-family: var(--font-mono); }
.pill.overdue { background: var(--text); color: var(--surface); border-color: var(--text); }
.pill.soon { border-color: var(--text); font-weight: 700; }
.pill.later { color: var(--text-muted); }
.pill.done { color: var(--text-muted); text-decoration: line-through; }
.tag { display: inline-block; font-size: 12px; line-height: 18px; padding: 1px 8px; border-radius: var(--radius); background: var(--surface-subtle); margin: 2px 4px 2px 0; }
.tag.strong { background: var(--text); color: var(--surface); }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--text); background: var(--text); color: var(--surface); border-radius: var(--radius); padding: 8px 16px; cursor: pointer; font-weight: 500; text-decoration: none; }
.btn:hover { opacity: .9; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--hairline); }
.btn.ghost:hover { border-color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--text); background: transparent; cursor: pointer; padding: 0; display: grid; place-items: center; }
.check:hover { background: var(--surface-subtle); }
.check.on { background: var(--text); }
.check.on::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--surface); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 14px; cursor: pointer; font-weight: 300; }
.seg button.on { background: var(--text); color: var(--surface); font-weight: 500; }

form.stack { display: grid; gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--text-muted); }
label.f.wide { grid-column: 1 / -1; }
input, select, textarea { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 8px 10px; color: var(--text); font-size: 15px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
textarea { min-height: 120px; resize: vertical; }
label.inline { display: flex; gap: 8px; align-items: center; font-size: 14px; }
label.inline input { width: auto; }
.hint { font-size: 13px; color: var(--text-muted); font-weight: 300; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }

dialog { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 28px; width: min(680px, 92vw); background: var(--surface); color: var(--text); }
dialog::backdrop { background: #32374466; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: var(--radius); opacity: 0; transition: .2s; pointer-events: none; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* key/value */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
dl.kv dt { color: var(--text-muted); font-size: 13px; }
dl.kv dd { margin: 0; }

/* bar chart */
.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 200px; padding-top: 8px; border-bottom: 1px solid var(--hairline); }
.chart .m { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; position: relative; }
.chart .bar { width: 40%; max-width: 18px; border-radius: 2px 2px 0 0; min-height: 1px; }
.chart .bar.inc { background: var(--text); }
.chart .bar.cost { background: transparent; border: 1.5px solid var(--text); border-bottom: 0; }
.chart-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 6px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }
.legend i.inc { background: var(--text); }
.legend i.cost { border: 1.5px solid var(--text); }

.callout { border-left: 3px solid var(--text); padding: 12px 16px; background: var(--surface-subtle); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 24px; }
.welcome { padding: 48px; text-align: left; }
.welcome img { width: 56px; margin-bottom: 24px; }

@media (max-width: 1180px) {
  .cols-2 { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0; flex-direction: row; }
  .main { padding: 24px 20px 60px; }
  .cols-2, .cols-3, .fields { grid-template-columns: 1fr; }
}
label.inline.wide { grid-column: 1 / -1; }

[hidden] { display: none !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--text); }

/* timer */
.clock { font-family: var(--font-mono); font-size: 56px; line-height: 64px; letter-spacing: -0.02em; }
.timer-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.timer-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 4px; }
.day-head h3 { margin: 0; }
.entity-logo { height: 30px; display: block; margin-bottom: 8px; }
[data-theme="dark"] .entity-logo { filter: brightness(0) invert(1); }
.inline-add { display: grid; grid-template-columns: 1fr 220px 170px auto; gap: 12px; align-items: end; margin-bottom: 24px; }
@media (max-width: 960px) { .timer-form, .inline-add, .timer-card { grid-template-columns: 1fr; } }
.link.plain { text-decoration: none; text-align: left; font: inherit; color: inherit; }
.link.plain:hover { text-decoration: underline; }

/* compliance */
.ctable th.c, .ctable td.c { text-align: center; padding-left: 6px; padding-right: 6px; }
.ctable td { vertical-align: middle; }
.ctable td.c .check { margin: 0 auto; }
.ctable tr.group td { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); padding: 20px 12px 6px; }
.ctable tr.is-done td { color: var(--text-muted); }
.ctable.annual th.phase { font-weight: 700; color: var(--text); border-bottom: 0; padding-bottom: 0; }
.ctable.annual th.step { font-size: 12px; white-space: normal; line-height: 15px; min-width: 56px; vertical-align: bottom; }
.meter { display: inline-block; width: 48px; height: 6px; border: 1px solid var(--text); border-radius: 999px; vertical-align: middle; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--text); }

/* tax accounts: balance typed straight into the table */
.amount-in { width: 150px; text-align: right; border-color: transparent; background: transparent; padding: 4px 8px; font-size: 14px; }
.amount-in:hover { border-color: var(--hairline); }
.amount-in:focus { background: var(--surface); border-color: var(--text); }
.amount-in.neg { font-weight: 700; }

/* annual report planner: weeks across, steps as cards */
.planner { overflow-x: auto; }
.planner table { border-collapse: separate; border-spacing: 0; }
.planner th, .planner td { padding: 6px; }
.planner .co { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 230px; max-width: 260px; padding-left: 16px; border-right: 1px solid var(--hairline); }
.planner tr.group td { position: sticky; left: 0; background: var(--surface); }
.planner .wk { min-width: 92px; width: 92px; vertical-align: top; border-left: 1px solid var(--hairline); position: relative; }
.planner th.wk { font-size: 12px; line-height: 16px; white-space: nowrap; }
.planner .wk.pool { min-width: 108px; background: var(--surface-subtle); }
.planner .wk.now { background: var(--surface-subtle); }
.planner td.wk.due { box-shadow: inset -3px 0 0 var(--text); }
.planner td.wk.over { outline: 2px dashed var(--text); outline-offset: -3px; }
.due-mark { display: block; font-size: 10px; line-height: 14px; font-family: var(--font-mono); text-align: right; margin-bottom: 2px; }
.chip { display: block; width: 100%; text-align: left; font: inherit; font-size: 11px; line-height: 16px; padding: 2px 6px; margin: 0 0 3px; border: 1px solid var(--text); border-radius: 4px;
  background: var(--surface); color: var(--text); cursor: grab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip:hover { background: var(--surface-subtle); }
.chip.late { background: var(--text); color: var(--surface); }
.chip.done { border-color: var(--hairline); color: var(--text-muted); text-decoration: line-through; }
.chip.dragging { opacity: .4; }

/* let wide tables scroll inside their card instead of widening the page */
.main { min-width: 0; }

/* annual report planner, full width: weeks share the space left by the company columns */
.main.wide { max-width: none; }
.planner table { width: 100%; table-layout: fixed; min-width: 1100px; }
.planner col.co { width: 230px; }
.planner col.pool { width: 104px; }
.planner .wk { min-width: 0; width: auto; padding: 4px 3px; }
.planner .co { min-width: 0; max-width: none; }
.planner th.wk { text-align: center; font-size: 12px; }
.planner tr.months th { font-weight: 700; color: var(--text); text-align: left; border-bottom: 0; padding-bottom: 0; }
.planner th.month { border-left: 1px solid var(--text); }
.planner .chip { padding: 2px 4px; font-size: 10.5px; }
.planner .due-mark { text-align: center; }

.econ-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.econ-table td { vertical-align: middle; }
.econ-table tr[data-entity-extra] td { padding-top: 0; }
