/* Brimz Hub — light, calm palette with gold for main actions (agreed in the prototype). */
:root {
  --bg: #FAFAF8; --surface: #FFFFFF; --sunk: #F1F1EE; --ink: #2A2C30; --muted: #686B71; --line: #E6E6E2;
  --gold: #C9A84C; --gold-hover: #B99837; --gold-ink: #7A6427; --gold-soft: #F8F3E5;
  --tile: #2A2D31; --btn-line: #BDBFC3;
  --ok: #2F7A55; --ok-soft: #E7F2EC; --warn: #91611B; --warn-soft: #FBF2E0; --crit: #B0463D; --crit-soft: #FAEAE7;
  --info: #3D6890; --info-soft: #E9F0F7;
  --display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --r: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 600; }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
p { margin: 0; }
a { color: var(--gold-ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* loading */
.loading { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sign-in screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.auth-brand { display: flex; gap: 12px; align-items: center; }
.auth-brand b { font: 600 18px var(--display); display: block; }
.auth-brand small, .brand small { color: var(--muted); font-size: 12px; display: block; }
.qr { width: 200px; height: 200px; align-self: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.demo-pick { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.error { color: var(--crit); }
code { background: var(--sunk); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.sel { user-select: all; }

/* header */
.bar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; flex: none; }
.brand b { font: 600 16px/1.15 var(--display); display: block; }
.mark { width: 36px; height: 36px; padding: 7px 8px; border-radius: 9px; background: var(--tile); color: #fff; flex: none; display: block; }
.mark svg { width: 100%; height: 100%; display: block; }
.topnav { display: flex; gap: 2px; flex: 1; }
.topnav a, .tabbar a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 7px; white-space: nowrap; }
.topnav a:hover { color: var(--ink); background: var(--sunk); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--gold); }
.user { display: flex; align-items: center; gap: 10px; flex: none; }
.who b { display: block; font-size: 14px; line-height: 1.2; }
.who small { color: var(--muted); font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-ink); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.demo-bar { background: var(--gold-soft); color: var(--gold-ink); text-align: center; font-size: 14px; padding: 6px 16px; }
.tabbar { display: none; }

.main { max-width: 1280px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) 72px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 18px; }
.main:focus { outline: none; }
.head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.sub { color: var(--muted); max-width: 70ch; margin-top: 4px; }
.crumb { font-size: 14px; color: var(--muted); }

/* layout pieces */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border-radius: var(--r); padding: 20px; box-shadow: 0 1px 3px rgba(30, 32, 35, 0.06); min-width: 0; }
.card.flush { padding: 0; }
.card.flush > h2 { padding: 16px 18px 0; }
.pad { padding: 16px 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font: 600 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi.crit .v { color: var(--crit); }
.split-kpi { display: flex; gap: 32px; margin-bottom: 10px; }
.meter { height: 10px; background: var(--sunk); border-radius: 99px; overflow: hidden; margin-bottom: 12px; }
.meter i { display: block; height: 100%; background: var(--gold); }
.tot { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.card > .row:first-of-type, h2 + .row { border-top: 0; }
.grow { flex: 1; min-width: 0; }
.meta { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; }
.notes { white-space: pre-wrap; margin-top: 8px; }
.banner { background: var(--gold-soft); padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.nowrap { white-space: nowrap; }
.narrow { max-width: 380px; }

/* pills, chips, buttons */
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill-btn { border: 0; font: 600 12px var(--body); padding: 2px 9px; border-radius: 99px; cursor: pointer; background: var(--sunk); color: var(--muted); }
.pill-btn.warn { background: var(--warn-soft); color: var(--warn); }
.pill-btn.info { background: var(--info-soft); color: var(--info); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--btn-line); background: var(--surface); border-radius: 99px; padding: 5px 14px; font: 600 14px var(--body); cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1E1F22; }
.chip-check { display: inline-flex; gap: 6px; align-items: center; border: 1.5px solid var(--btn-line); border-radius: 99px; padding: 5px 12px; font-size: 14px; cursor: pointer; }
.chip-check:has(input:checked) { background: var(--gold-soft); border-color: var(--gold); }
.btn { font: 700 15px var(--body); padding: 9px 18px; border-radius: 8px; border: 1.5px solid var(--btn-line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.btn:hover { border-color: var(--ink); background: var(--sunk); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1E1F22; box-shadow: 0 2px 6px rgba(150, 120, 40, 0.25); }
.btn.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { background: var(--gold-soft); border: 1px solid transparent; border-radius: 6px; padding: 4px 10px; color: var(--gold-ink); font: 700 13.5px var(--body); cursor: pointer; align-self: flex-start; }
.link:hover { border-color: var(--gold); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
input, select, textarea { font: 400 16px var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--btn-line); border-radius: 7px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; flex: none; accent-color: var(--gold); }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; margin-top: 12px; cursor: pointer; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.dl-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.toolbar input { max-width: 420px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td a { color: var(--ink); text-decoration: none; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sunk); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; width: 42%; border-bottom: 1px solid var(--line); white-space: normal; padding-left: 0; }
.kv td { padding-left: 0; }

/* jobs board */
.kanban-wrap { overflow-x: auto; padding-bottom: 6px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 12px; min-width: 1200px; }
.col { background: var(--sunk); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); display: flex; justify-content: space-between; margin: 2px 4px 2px; }
.jcard { background: var(--surface); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; box-shadow: 0 1px 2px rgba(30, 32, 35, 0.08); }
.jcard.late { box-shadow: inset 3px 0 0 var(--crit), 0 1px 2px rgba(30, 32, 35, 0.08); }
.jcard .foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jcard a.jtitle { color: inherit; text-decoration: none; }
.jcard a.jtitle:hover b, .jcard a.jtitle:focus-visible b { text-decoration: underline; }

/* accounts production */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
.tick { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--btn-line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.paper-list { display: flex; flex-direction: column; gap: 2px; }
.paper-list button { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; font: 15px var(--body); color: var(--muted); cursor: pointer; }
.paper-list button[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); }
tr.subtotal td { background: var(--sunk); }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; opacity: 0; width: 1px; height: 1px; inset: 0; }
.filebtn:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.paper { background: var(--surface); border-radius: 4px; box-shadow: 0 2px 12px rgba(30, 32, 35, 0.1); padding: clamp(20px, 5vw, 52px); max-width: 820px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; font-size: 14.5px; }
.paper h2 { font-size: 24px; font-weight: 600; margin: 4px 0; }
.paper h3 { font-size: 16px; margin: 0 0 8px; }
.paper-head { border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.fine { font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; max-width: 72ch; margin-top: 10px; }
.fs { font-variant-numeric: tabular-nums; }
.fs th { text-align: right; text-transform: none; letter-spacing: 0; font-size: 12px; border: 0; padding: 4px 8px; line-height: 1.3; }
.fs th:first-child { text-align: left; }
.fs td { padding: 5px 8px; border: 0; }
.fs td.n { text-align: right; width: 120px; white-space: nowrap; }
.fs tr.h td { font-weight: 700; padding-top: 14px; }
.fs tr.fs-sub td.n { border-top: 1px solid var(--ink); font-weight: 700; }
.fs tr.fs-sub td:first-child, .fs tr.fs-tot td { font-weight: 700; }
.fs tr.fs-tot td.n { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
@media (max-width: 760px) { .split { grid-template-columns: minmax(0, 1fr); } .paper-list { flex-direction: row; overflow-x: auto; } .paper-list button { white-space: nowrap; } }
/* Management packs */
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tot.big { font-weight: 700; border-top: 1px solid var(--ink); margin-top: 4px; }
.pack .commentary { white-space: pre-line; font-size: 15px; }
.pack .aged .tot { border: 0; padding: 4px 0 3px; }
.pack .aged .meter { height: 6px; margin-bottom: 6px; }
.meter.over i { background: var(--crit); }
.pack-chart { width: 100%; height: auto; display: block; font: 11px var(--body); }
.pack-chart .grid { stroke: var(--line); }
.pack-chart text { fill: var(--muted); }
.pack-chart .rev, .legend i.rev { fill: var(--gold); background: var(--gold); }
.pack-chart .costs, .legend i.costs { fill: var(--tile); background: var(--tile); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
@media print { .pack-chart .rev, .pack-chart .costs, .legend i, .meter i { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

@media print {
  body { background: #fff; }
  .bar, .tabbar, .demo-bar, .tabs, .no-print, .toast { display: none !important; }
  .main { padding: 0; max-width: none; }
  .paper { box-shadow: none; max-width: none; padding: 0; }
  .paper section { break-inside: avoid; }
}

/* compliance and proposals */
.ok-banner { background: var(--ok-soft); }
.crit-banner { background: var(--crit-soft); }
.warn-banner { background: var(--warn-soft); }
.link-card { text-decoration: none; color: inherit; }
.link-card:hover { box-shadow: 0 0 0 1.5px var(--gold); }
tr.faded td { opacity: 0.55; }
.letter p, .letter li { font-size: 14.5px; max-width: 72ch; }
.letter ul { margin: 6px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.letter section > p + p { margin-top: 8px; }
.sign-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-top: 8px; }
.sigline { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 24px; border-bottom: 1px solid var(--muted); min-height: 40px; padding: 4px 2px; margin: 6px 0 4px; }
.letter { gap: 22px; }
.letter h4 { font-size: 14.5px; margin: 14px 0 4px; }
.letter section + section { border-top: 1px solid var(--ink); padding-top: 18px; }
.lh-band { display: flex; align-items: center; gap: 16px; background: #111; color: #fff; padding: 18px 22px; margin: calc(-1 * clamp(20px, 5vw, 52px)) calc(-1 * clamp(20px, 5vw, 52px)) 0; border-radius: 4px 4px 0 0; flex-wrap: wrap; }
.lh-band b { font-size: 18px; letter-spacing: 0.02em; display: block; }
.lh-band small { color: #A9ABAF; font-size: 12px; }
.lh-mark { width: 44px; height: 44px; background: #000; border-radius: 6px; display: grid; place-items: center; }
.lh-mark svg { width: 24px; height: 24px; }
.lh-contact { font-size: 12px; color: #D6D7D9; text-align: right; line-height: 1.6; }
.lh-title { border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
.lh-title h2 { text-transform: uppercase; font-size: 22px; font-weight: 700; margin: 0; }
.lh-title p { font-style: italic; color: var(--muted); font-size: 13.5px; }
.lh-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); font-size: 14px; }
.lh-boxes > div { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.lh-details { background: var(--sunk); border-left: 1px solid var(--ink); }
.lh-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: block; }
.sign-row .lh-label { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.fee-table { width: 100%; margin: 6px 0 4px; }
.fee-table th { text-align: left; }
.fee-table th.num { text-align: right; }
.fee-table tr.total td { border-top: 1.5px solid var(--ink); }
.lh-foot { border-top: 1px solid var(--line); padding-top: 10px; text-align: center; font-size: 12px; font-style: italic; color: var(--muted); }
@media (max-width: 560px) { .lh-band { padding: 14px 16px; gap: 12px; } .lh-band b { font-size: 15px; } .lh-mark { width: 36px; height: 36px; }
  .lh-contact { flex-basis: 100%; text-align: left; } .lh-details { border-left: 0; border-top: 1px solid var(--ink); } .lh-title h2 { font-size: 19px; } }
@media print { .lh-band, .lh-details { print-color-adjust: exact; -webkit-print-color-adjust: exact; } .lh-band { margin: 0; } }

/* portal and messages */
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: var(--gold); color: #1E1F22; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.entity-pick { width: auto; max-width: 260px; font-weight: 600; padding: 7px 10px; }
.step { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.row.todo { padding: 14px 0; }
.datebox { flex: none; width: 46px; text-align: center; border: 1px solid var(--line); border-radius: 7px; padding: 4px 0; line-height: 1.1; }
.datebox b { display: block; font: 600 18px/1.1 var(--display); }
.datebox span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow-y: auto; padding: 4px 2px 12px; }
.bubble { max-width: min(78%, 560px); padding: 10px 14px; border-radius: 12px; font-size: 15px; background: var(--sunk); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--gold-soft); border-bottom-right-radius: 4px; }
.bubble.them { border-bottom-left-radius: 4px; }
.bubble .meta { font-size: 12px; margin-bottom: 2px; white-space: normal; }
.composer { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.composer textarea { flex: 1; resize: vertical; min-height: 46px; }
@media (max-width: 520px) { .row.todo { flex-wrap: wrap; } .row.todo .btn { margin-left: 40px; } .entity-pick { max-width: 170px; } }

/* dialogs and toasts */
dialog.ask-dialog { border: 0; max-width: 440px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(30, 32, 35, 0.45); }
.ask-msg { font-size: 16px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); background: var(--tile); color: #fff; padding: 11px 18px; border-radius: 9px; z-index: 30; max-width: calc(100% - 32px); font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: opacity 0.4s; }
.toast-error { background: var(--crit); }
.toast-out { opacity: 0; }

/* phones */
@media (max-width: 860px) {
  .topnav, .who { display: none; }
  .bar-in { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; }
  .user { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); gap: 2px; }
  .tabbar a { flex: 1; text-align: center; font-size: 13px; padding: 10px 2px; overflow: hidden; text-overflow: ellipsis; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Email settings */
.checks { display: grid; gap: 2px; }
.email-preview summary { cursor: pointer; font-weight: 600; }
.email-preview pre { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--sunk); border-radius: 8px; padding: 10px 12px; margin: 8px 0 0; max-width: 46ch; }
.ev-n { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

/* Team levels and CPD */
.levels { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.levels legend { font-weight: 700; font-size: 14px; margin-bottom: 4px; padding: 0; }
.levels .check { margin-top: 4px; align-items: flex-start; }
.levels .check input { margin-top: 4px; }
.meter.behind i { background: var(--warn); }

/* Menus: account menu on wider screens; "More" on phones (ui.js menus()). */
.topnav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.acct { position: relative; }
.acct summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 9px; }
.acct summary::-webkit-details-marker { display: none; }
.acct summary:hover, .acct[open] summary { background: var(--sunk); }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(30, 32, 35, 0.14); padding: 6px; min-width: 210px; display: flex; flex-direction: column; z-index: 20; }
.acct-menu a, .acct-menu button, .more-sheet a, .more-sheet button { text-align: left; padding: 10px 12px; border-radius: 7px; color: var(--ink); text-decoration: none;
  font: 600 15px var(--body); background: none; border: 0; cursor: pointer; }
.acct-menu a:hover, .acct-menu button:hover, .more-sheet a:hover, .more-sheet button:hover { background: var(--sunk); }
.more-sheet a[aria-current="page"] { background: var(--gold-soft); }
.more-sheet hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.tab-more, .more-sheet { display: none; }
@media (max-width: 1240px) {
  .topnav a { padding: 8px 8px; }
  .acct .who, .who.ent { display: none; }
  .bar-in { gap: 12px; }
}
@media (max-width: 860px) {
  .acct { display: none; }
  .tabbar a, .tab-more { flex: 1; }
  .tab-more { display: block; border: 0; background: none; font: 600 13px var(--body); color: var(--muted); padding: 10px 2px; border-radius: 7px; cursor: pointer; }
  .tab-more[aria-current="page"], .tab-more[aria-expanded="true"] { color: var(--ink); background: var(--sunk); }
  .more-sheet:not([hidden]) { display: flex; flex-direction: column; position: fixed; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 7;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -8px 24px rgba(30, 32, 35, 0.14); padding: 8px; max-height: 70vh; overflow: auto; }
}
