/* BrightHarbour app and portal. Extends the demo's navy and gold world for task screens (DESIGN.md). */
@font-face { font-family: "Inter"; src: url(/assets/Inter.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url(/assets/SourceSerif4.woff2) format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  --navy: #0C1B35; --navy2: #13264A; --gold: #F0B429;
  --bg: #EEF1F6; --side: #E6EAF1; --paper: #FFFFFF; --soft: #E3E8F0; --line: #CBD3E0; --line2: #DDE3EC;
  --ink: #0C1B35; --muted: #4E5A70; --faint: #636E82;
  --ok: #1C7A43; --okbg: #E1F3E8; --warn: #8F4F00; --warnbg: #FCEBD5; --bad: #B42318; --badbg: #FDE4E1;
  --info: #2563A8; --infobg: #E3EDF9; --person: #6B3FA0; --personbg: #EEE6F8;
  --shadow: 0 1px 2px rgba(12,27,53,.05), 0 2px 6px -3px rgba(12,27,53,.10);
  --display: "Source Serif 4", Georgia, serif; --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 8px; --R: 12px; --ease: cubic-bezier(0.23, 1, 0.32, 1); --drawer: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #07101E; --side: #0A1527; --paper: #0F1C33; --soft: #18294A; --line: #2A3B58; --line2: #1F2F4B;
  --ink: #E7ECF3; --muted: #9AA7BB; --faint: #8794A9; --navy2: #1A3260;
  --ok: #72D39A; --okbg: #0F3320; --warn: #F3B66A; --warnbg: #3A2508; --bad: #F59A90; --badbg: #3D1411;
  --info: #8DB8F0; --infobg: #132B4D; --person: #C7A6F0; --personbg: #2C1C45;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #07101E; --side: #0A1527; --paper: #0F1C33; --soft: #18294A; --line: #2A3B58; --line2: #1F2F4B;
  --ink: #E7ECF3; --muted: #9AA7BB; --faint: #8794A9; --navy2: #1A3260;
  --ok: #72D39A; --okbg: #0F3320; --warn: #F3B66A; --warnbg: #3A2508; --bad: #F59A90; --badbg: #3D1411;
  --info: #8DB8F0; --infobg: #132B4D; --person: #C7A6F0; --personbg: #2C1C45;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
a { color: var(--info); text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3, p { margin: 0; }
h1 { font: 600 26px/1.2 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
h2 { font: 600 16px/1.3 var(--body); letter-spacing: -0.005em; text-wrap: balance; }
h3 { font: 600 14px/1.35 var(--body); }
.num, td.num, .amt { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line2); margin: 16px 0; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- icons ---------- */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i.sm { width: 15px; height: 15px; vertical-align: -3px; }

/* ---------- controls ---------- */
button, .btn { font: 500 14px/1 var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s var(--ease); }
@media (hover: hover) and (pointer: fine) { button:hover, .btn:hover { border-color: var(--muted); } }
button:active, .btn:active { transform: scale(0.97); }
button.primary, .btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] button.primary, :root[data-theme="dark"] .btn.primary { background: var(--gold); border-color: var(--gold); color: #0C1B35; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primary, :root:not([data-theme="light"]) .btn.primary { background: var(--gold); border-color: var(--gold); color: #0C1B35; } }
button.primary:hover, .btn.primary:hover { background: var(--navy2); border-color: var(--navy2); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { button.ghost:hover, .btn.ghost:hover { background: var(--soft); color: var(--ink); } }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
button.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
button.small, .btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .8s linear infinite; }
button.primary.busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

label.f { display: grid; gap: 6px; font-weight: 500; font-size: 13px; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input, select, textarea { font: 14px/1.4 var(--body); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); min-height: 38px; padding: 8px 11px; width: 100%; transition: border-color .16s, box-shadow .16s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 22%, transparent); }
input[aria-invalid="true"] { border-color: var(--bad); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--navy); margin: 0; flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 14px; } .stack.tight { gap: 8px; }
.err { color: var(--bad); font-size: 13px; } .err:empty { display: none; }

/* ---------- pills and chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font: 500 12px/1 var(--body); padding: 4px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--okbg); color: var(--ok); } .pill.warn { background: var(--warnbg); color: var(--warn); } .pill.bad { background: var(--badbg); color: var(--bad); }
.pill.info { background: var(--infobg); color: var(--info); } .pill.person { background: var(--personbg); color: var(--person); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 12.5px/1.2 var(--body); padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg); color: var(--ink); cursor: pointer; max-width: 100%; text-align: left; min-height: 0; white-space: normal; }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--info); color: var(--info); } }
.chip b { font-weight: 600; }

/* ---------- panels and tables ---------- */
.panel { background: var(--paper); border: 1px solid var(--line2); border-radius: var(--R); box-shadow: var(--shadow); }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line2); }
.panel > header h2 { flex: 1; }
.panel > .body { padding: 18px; }
.panel + .panel { margin-top: 16px; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font: 500 12px/1.3 var(--body); color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; transition: background .12s; }
@media (hover: hover) and (pointer: fine) { tbody tr.link:hover { background: color-mix(in srgb, var(--soft) 55%, transparent); } }
.tw { overflow-x: auto; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h3 { color: var(--ink); font-size: 15px; }
.skel { background: linear-gradient(90deg, var(--soft), color-mix(in srgb, var(--soft) 40%, var(--paper)), var(--soft)); background-size: 200% 100%; animation: sh 1.2s linear infinite; border-radius: 6px; height: 14px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- toast and dialog ---------- */
#toasts { position: fixed; z-index: 50; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 8px 24px -8px rgba(7,16,30,.45); font-size: 13.5px; display: flex; gap: 10px; align-items: center; pointer-events: auto; transition: opacity .24s var(--ease), transform .24s var(--ease); }
@starting-style { .toast { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast.out { opacity: 0; transform: translateY(6px); transition-duration: .14s; }
.toast.bad { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
dialog { transition: opacity .2s var(--ease), transform .2s var(--ease), overlay .2s allow-discrete, display .2s allow-discrete; border: 0; border-radius: 14px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); width: min(94vw, 480px); }
dialog::backdrop { background: rgba(7,16,30,.45); backdrop-filter: blur(2px); transition: opacity .2s ease; }
@starting-style { dialog[open] { opacity: 0; transform: scale(.96); } dialog[open]::backdrop { opacity: 0; } }
dialog .d-body { padding: 22px; display: grid; gap: 14px; }
dialog .d-foot { padding: 14px 22px; border-top: 1px solid var(--line2); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- firm app shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100dvh; background: linear-gradient(to right, var(--navy) 236px, transparent 236px); }
.side { background: var(--navy); color: #C9D2E1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand b { font: 600 17px/1 var(--display); letter-spacing: -0.01em; }
.brand small { display: block; font: 500 11.5px/1.3 var(--body); color: #9FB0C9; margin-top: 3px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #C9D2E1; text-decoration: none; font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.1); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav .count { margin-left: auto; font: 600 11.5px/1 var(--body); background: var(--gold); color: #0C1B35; border-radius: 99px; padding: 3px 7px; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 4px; }
.side .me { margin-top: auto; padding: 10px; border-radius: 10px; display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; }
.side .me:hover { background: rgba(255,255,255,.06); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--ink); display: grid; place-items: center; font: 600 12px/1 var(--body); flex: none; }
.side .avatar { background: var(--gold); color: #0C1B35; }
.side .me span { font-size: 13px; line-height: 1.25; overflow: hidden; } .side .me small { color: #9FB0C9; display: block; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 22px 32px 0; }
.top .grow h1 { margin-top: 2px; }
.crumb { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.crumb a { color: var(--muted); text-decoration: none; } .crumb a:hover { color: var(--ink); }
.content { padding: 20px 32px 48px; max-width: 1320px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; background: var(--infobg); color: var(--ink); font-size: 13.5px; margin-bottom: 16px; }
.banner .i { color: var(--info); margin-top: 1px; }
.banner.warn { background: var(--warnbg); } .banner.warn .i { color: var(--warn); }
.banner.person { background: var(--personbg); } .banner.person .i { color: var(--person); }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .22s var(--ease); }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(7,16,30,.45); }
  .menu-btn { display: inline-flex; }
  .top { padding: 16px 16px 0; } .content { padding: 16px 16px 40px; }
}

/* ---------- board ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line2); border-radius: var(--R); background: var(--paper); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.stats a { padding: 14px 16px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--line2); display: grid; gap: 2px; }
.stats a:last-child { border-right: 0; }
@media (hover: hover) and (pointer: fine) { .stats a:hover { background: color-mix(in srgb, var(--soft) 50%, transparent); } }
.stats b { font: 600 22px/1.1 var(--body); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats a:nth-child(3) { border-right: 0; } .stats a:nth-child(-n+3) { border-bottom: 1px solid var(--line2); } }
.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
.att li { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 12px 18px; border-bottom: 1px solid var(--line2); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .att li:hover { background: color-mix(in srgb, var(--soft) 50%, transparent); } }
.att li:last-child { border-bottom: 0; }
.att ul { margin: 0; padding: 0; }
.att .why { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
.feed { margin: 0; padding: 6px 0; list-style: none; }
.feed li { display: grid; grid-template-columns: 8px 1fr; gap: 12px; padding: 8px 18px; font-size: 13px; }
.feed li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line); margin-top: 6px; }
.feed time { color: var(--muted); font-size: 12px; display: block; }

/* ---------- client workspace ---------- */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1150px) { .ws { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .pill { padding: 2px 6px; }
.fig td { padding-top: 13px; padding-bottom: 13px; }
.fig .line { font: 600 13px/1.2 var(--body); font-variant-numeric: tabular-nums; }
.fig .what { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fig .amt { font: 600 15px/1.2 var(--body); font-variant-numeric: tabular-nums; }
.fig .amt s { color: var(--muted); font-weight: 400; font-size: 12.5px; display: block; }
.fig .srcs { display: flex; flex-wrap: wrap; gap: 6px; }
.fig .acts { display: flex; gap: 6px; justify-content: flex-end; }
.fig tr.done td { background: color-mix(in srgb, var(--okbg) 35%, transparent); }
.fig tr.done.set td { background: color-mix(in srgb, var(--soft) 50%, transparent); }
.fig tr.settle td { animation: settle .5s var(--ease); }
@keyframes settle { from { background: color-mix(in srgb, var(--okbg) 100%, transparent); } }
.fig .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.fig .confirm { font-size: 12.5px; color: var(--warn); margin-top: 6px; display: flex; gap: 6px; }
.fig .editor { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; margin-top: 10px; }
@media (max-width: 700px) { .fig .editor { grid-template-columns: 1fr; } .fig .acts { justify-content: flex-start; } }
.cl li { list-style: none; display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid var(--line2); }
.cl li:last-child { border-bottom: 0; } .cl ul { margin: 0; padding: 0; }
.mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.mark.ok { background: var(--okbg); color: var(--ok); } .mark.wait { border: 1.5px dashed var(--line); } .mark.warn { background: var(--warnbg); color: var(--warn); } .mark.bad { background: var(--badbg); color: var(--bad); } .mark.info { background: var(--infobg); color: var(--info); }
.mark .i { width: 14px; height: 14px; stroke-width: 2.25; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--R); padding: 22px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--muted); transition: border-color .16s, background .16s; }
.drop.over { border-color: var(--info); background: var(--infobg); color: var(--ink); }
.files li { list-style: none; display: flex; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line2); }
.files ul { margin: 0; padding: 0; } .files li:last-child { border-bottom: 0; }
.ficon { width: 34px; height: 40px; border-radius: 6px; background: var(--soft); display: grid; place-items: center; color: var(--muted); flex: none; font: 600 10px/1 var(--body); }
.viewer { position: fixed; inset: 0 0 0 auto; width: min(720px, 100vw); background: var(--paper); z-index: 45; box-shadow: -20px 0 60px -20px rgba(0,0,0,.4); display: grid; grid-template-rows: auto 1fr; animation: vin .24s var(--drawer); }
@keyframes vin { from { transform: translateX(4%); opacity: 0; } }
.viewer header { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.viewer iframe, .viewer img { width: 100%; height: 100%; border: 0; object-fit: contain; background: var(--soft); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.thread { display: grid; gap: 12px; padding: 16px 18px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 12px; background: var(--soft); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.firm { justify-self: end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg.client { border-bottom-left-radius: 4px; }
.msg.draft { justify-self: end; background: var(--personbg); color: var(--ink); border: 1px dashed var(--person); max-width: 92%; width: 92%; }
.msg time { display: block; font-size: 11.5px; opacity: .7; margin-top: 5px; }
.compose { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line2); align-items: flex-end; }
.compose textarea { min-height: 42px; }
.bt-score { display: flex; align-items: baseline; gap: 10px; }
.bt-score b { font: 600 34px/1 var(--display); font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

/* ---------- setup wizard and auth ---------- */
.solo { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--navy) 10%, transparent), transparent 60%), var(--bg); }
.card { width: min(100%, 440px); background: var(--paper); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: grid; gap: 18px; }
.card.wide { width: min(100%, 720px); }
.card .brandline { display: flex; align-items: center; gap: 10px; }
.card .brandline img { width: 34px; height: 34px; border-radius: 8px; }
.card .brandline b { font: 600 19px/1 var(--display); }
.card .lede { color: var(--muted); }
.card .foot { font-size: 13px; color: var(--muted); text-align: center; }
.steps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps li { flex: 1; height: 4px; border-radius: 4px; background: var(--soft); }
.steps li.done { background: var(--navy); } .steps li.now { background: var(--gold); }
:root[data-theme="dark"] .steps li.done { background: var(--muted); }
.choices { display: grid; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; transition: border-color .16s, background .16s; }
.choice:hover { border-color: var(--muted); }
.choice:has(input:checked) { border-color: var(--navy); background: color-mix(in srgb, var(--infobg) 60%, transparent); }
.choice b { display: block; font-weight: 600; margin-bottom: 2px; }
.choice input { margin-top: 2px; }
.secret { font: 600 17px/1.3 var(--body); letter-spacing: .06em; padding: 12px; background: var(--soft); border-radius: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.qr { width: 168px; height: 168px; margin: 0 auto; background: #fff; padding: 8px; border-radius: 8px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font: 500 14px/1.5 var(--body); font-variant-numeric: tabular-nums; background: var(--soft); padding: 12px; border-radius: 8px; }

/* ---------- client portal ---------- */
.portal { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }
.pbar { background: var(--navy); color: #fff; margin: 0 -16px 18px; padding: 16px 18px 15px; border-bottom: 3px solid var(--gold); display: flex; gap: 12px; align-items: center; }
.pbar b { font: 600 18px/1.2 var(--display); display: block; } .pbar small { color: #C9D2E1; font-size: 12.5px; }
.pbar .grow { min-width: 0; }
.portal h1 { font-size: 24px; margin-bottom: 6px; }
.portal .lead { color: var(--muted); font-size: 15px; }
.portal button, .portal .btn { min-height: 46px; font-size: 15px; border-radius: 10px; }
.portal input { min-height: 46px; font-size: 16px; }
.portal .panel { margin-top: 16px; }
.portal .cl li { padding: 14px 16px; font-size: 15px; }
.bigdrop { display: grid; gap: 10px; }
.bigdrop label.btn { justify-content: center; width: 100%; }
.privacy { display: flex; gap: 10px; font-size: 13px; color: var(--muted); padding: 14px 4px; align-items: flex-start; }
.portal .msg { font-size: 15px; }
.upl { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line2); font-size: 14px; }
.upl .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; } .upl .bar i { display: block; height: 100%; width: 100%; background: var(--info); transform: scaleX(var(--p, 0)); transform-origin: left; transition: transform .2s var(--ease); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { .side, .top button, .tabs, .compose, .acts { display: none !important; } .shell { display: block; } .panel { box-shadow: none; } }
.shell[data-solo] { display: block; } .shell[data-solo] .side { display: none; }
.msg.draft { white-space: normal; }
@media (max-width: 700px) {
  .top { flex-wrap: wrap; } .top > .row { width: 100%; } .top > .row > * { flex: 1; justify-content: center; }
  .fig table, .fig tbody { display: block; } .fig thead { display: none; }
  .fig tr[data-key] { display: grid; grid-template-columns: 1fr auto; padding: 12px 14px; border-bottom: 1px solid var(--line2); gap: 8px 12px; }
  .fig tr[data-key] td { display: block; padding: 0; border: 0; width: auto !important; }
  .fig tr[data-key] td:nth-child(3) { grid-column: 1 / -1; }
  .fig tr[data-key] td:nth-child(4) { grid-column: 1 / -1; }
  .fig .acts { justify-content: stretch; } .fig .acts button.primary { flex: 1; justify-content: center; }
  .fig .acts button { min-height: 40px; }
}
/* Portal: phone details (apple-design pass) */
.portal { padding-bottom: calc(48px + env(safe-area-inset-bottom)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.pbar { padding-top: calc(16px + env(safe-area-inset-top)); }
.portal button, .portal .btn, .portal label.btn, .portal input, .portal select { touch-action: manipulation; }
.portal .pbar button { min-height: 44px; }
@supports (font: -apple-system-body) { .portal { font: -apple-system-body; font-family: var(--body); } }
.upl img.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.upl.done .bar i { background: var(--ok); }
/* Sign in with Google or Microsoft: a quiet divider, then full-width buttons */
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn.sso { justify-content: center; min-height: 42px; width: 100%; font-weight: 600; }
.firm-switch { display: grid; gap: 6px; }
.firm-switch select { width: 100%; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.plain li { min-height: 30px; }
.firm-switch { padding: 0 12px; color: rgba(255,255,255,.6); }
.firm-switch select { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: var(--r); min-height: 34px; padding: 0 8px; font: 500 13px var(--body); }
.firm-switch select option { color: #0C1B35; background: #fff; }
[hidden] { display: none !important; }
/* Refer a firm */
.side .nav a.refer .count { background: var(--gold); color: var(--navy); }
.refer-hero h2 { font: 600 22px/1.2 var(--display); margin: 2px 0 6px; }
.eyebrow { font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: var(--gold-ink, #8A5A00); margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.content.banners { padding-top: 0; padding-bottom: 0; display: grid; gap: 8px; }
@media print { .side, .top .row, .menu-btn, .banners { display: none !important; } .shell { display: block; } .invoice { border: 0; box-shadow: none; } }
/* Admin console */
body.admin .stats { grid-template-columns: repeat(4, 1fr); }
.stat { padding: 14px 16px; border-right: 1px solid var(--line2); display: grid; gap: 2px; align-content: start; min-width: 0; }
.stat:last-child { border-right: 0; }
.stat b { font: 600 22px/1.2 var(--display); overflow-wrap: anywhere; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.funnel { display: grid; grid-template-columns: 170px 1fr 40px; gap: 10px; align-items: center; }
.funnel b { text-align: right; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; height: 120px; align-items: end; }
.bar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; }
.bar i { align-self: end; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar span { font-size: 10px; color: var(--muted); text-align: center; }
tr.go { cursor: pointer; }
@media (max-width: 760px) { body.admin .stats, .grid3 { grid-template-columns: 1fr 1fr; } .funnel { grid-template-columns: 120px 1fr 32px; } }
.grid2 > .panel, .grid3 > .panel { margin-top: 0; align-self: start; }
body.admin .side .row button.ghost { color: rgba(255,255,255,.72); }
body.admin .side .row button.ghost:hover { color: #fff; background: rgba(255,255,255,.08); }
.grid2 + .panel, .grid2 + .grid2, .panel + .grid2, .stats + .grid2 { margin-top: 16px; }
label.f .row input { flex: 1; min-width: 0; }
/* Phone: file rows wrap their actions under the name; plan table and big stats fit */
@media (max-width: 600px) {
  .files li { flex-wrap: wrap; }
  .files li .grow { flex-basis: calc(100% - 60px); min-width: 0; overflow-wrap: anywhere; }
  .files li select { flex: 1; min-width: 0; }
  .stat b { font-size: 18px; }
  body.admin [data-settings] table { table-layout: fixed; width: 100%; }
  body.admin [data-settings] table input { width: 100%; min-width: 0; }
  body.admin [data-settings] table th, body.admin [data-settings] table td { padding-left: 6px; padding-right: 6px; }
}
form.stack + .panel { margin-top: 16px; }
.ferr { margin: -4px 0 0; font-size: 13px; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
/* iPhone (Safari and Chrome both use WebKit) zooms in on any text box under 16px when it is tapped, and
   stays zoomed: the page then looks shifted with its right edge cut off (Trevor, 21 Oct). 16px on phones
   and touch screens stops that. Pinch-zoom stays allowed for anyone who needs it. */
@media (max-width: 900px), (pointer: coarse) {
  input, select, textarea, input.small, select.small, .small input, .small select { font-size: 16px !important; }
}
/* Needs a person: the status sits with the name (it describes the client), the arrow says the row opens */
.att li { align-items: center; }
.att .who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.att .who .pill { font-size: 12px; padding: 2px 8px; }
.att .go { color: var(--faint); display: grid; place-items: center; }
.att .why { grid-column: 1 / 2; }
.svc-name { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
/* Connections hub */
.hub { width: 100%; height: auto; display: block; }
.hub .spoke { stroke: var(--line); stroke-width: 2; } .hub .spoke.on { stroke: color-mix(in srgb, var(--ok) 55%, transparent); } .hub .spoke.soon { stroke: color-mix(in srgb, var(--gold) 60%, transparent); stroke-dasharray: 6 6; } .hub .spoke.gap { stroke: var(--faint); stroke-dasharray: 2 6; }
.hub .core circle { fill: var(--navy); stroke: var(--gold); stroke-width: 3; }
.hub .core-t { fill: #fff; font: 600 15px var(--display); }
.hub .node rect { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; transition: stroke .16s; }
.hub .node.on rect { stroke: var(--ok); } .hub .node.soon rect { stroke: var(--gold); } .hub .node.gap rect { stroke: var(--faint); stroke-dasharray: 4 4; }
.hub .node:hover rect { stroke-width: 2.5; }
.hub .node-t { fill: var(--ink); font: 600 14px var(--body); } .hub .node-s { fill: var(--muted); font: 500 11.5px var(--body); }
.hub-key { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.hub-key .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.on { background: var(--ok); } .dot.soon { background: var(--gold); } .dot.gap { border: 2px solid var(--faint); background: transparent; width: 6px; height: 6px; }
.cx-use { align-items: flex-end; flex-wrap: wrap; } .cx-use input[name=other] { max-width: 220px; }
.cx-tools li { gap: 8px; padding: 6px 0; border-top: 1px solid var(--line2); }
.panel.cx { scroll-margin-top: 16px; }
@media (max-width: 600px) { .cx-tools li { flex-wrap: wrap; } .hub .node-s { display: none; } .hub .node-t { font-size: 17px; transform: translateY(9px); transform-box: fill-box; } }
ol.signoff { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13.5px; }
ol.signoff li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); }
ol.signoff li.done { color: var(--ink); }
ol.signoff .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; }
ol.signoff li.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
/* Season board: eight statuses, four across (two on phones), lines between them only inside */
nav.stats { grid-template-columns: repeat(4, 1fr); }
nav.stats a { border-bottom: 1px solid var(--line2); }
nav.stats a:nth-child(4n) { border-right: 0; }
nav.stats a:nth-last-child(-n+4) { border-bottom: 0; }
@media (max-width: 900px) {
  nav.stats { grid-template-columns: repeat(2, 1fr); }
  nav.stats a { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
  nav.stats a:nth-child(2n) { border-right: 0; }
  nav.stats a:nth-last-child(-n+2) { border-bottom: 0; }
}
.ws > * { min-width: 0; } /* a wide table scrolls inside its box instead of widening the page */
.grid2 > *, .grid3 > *, .stack > * { min-width: 0; } textarea { max-width: 100%; }
