@import url('/vendor/geist/index.css');
@import url('/vendor/geist-mono/index.css');
@import url('/vendor/phosphor/style.css');
@import url('/vendor/phosphor-fill/style.css');

/*
  Design system
  - Type: Geist (UI), Geist Mono (every number: counts, dates, sizes).
  - Palette: cool neutral greys, ONE accent per surface (Command Center = teal, client report = client brand),
    plus semantic state only: red = overdue/urgent, amber = due soon / high / waiting on someone.
  - Shape lock: panels 10px, everything interactive or chip-sized 6px. Nothing is pill-shaped.
  - Motion: transform/opacity only, 180-260ms, all collapsed under prefers-reduced-motion.
  - Z scale: header 10, drawer backdrop 40, drawer 41, lightbox 50, toast 60.
*/
:root {
  --bg: #f3f4f6;
  --surface: #fbfbfc;
  --surface-2: #eef0f2;
  --ink: #17191c;
  --muted: #5b616a;
  --line: #dfe2e6;
  --accent: #0d6b61;
  --accent-ink: #f6fbfa;
  --accent-soft: #e0eeeb;
  --red: #b3372a;
  --red-soft: #f6e4e1;
  --amber: #8d600b;
  --amber-soft: #f4ead6;
  --ok: #2b7247;
  --ok-soft: #e1efe6;
  --shadow: 0 1px 2px rgba(23, 30, 40, .06), 0 8px 24px -12px rgba(23, 30, 40, .18);
  --r-panel: 10px;
  --r-ctl: 6px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sans: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono Variable', ui-monospace, 'SFMono-Regular', monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #171a1e; --surface-2: #1e2227; --ink: #e5e7ea; --muted: #9ca2ab; --line: #2a2f35;
    --accent: #52b5a7; --accent-ink: #0d1614; --accent-soft: #19302c;
    --red: #e3735f; --red-soft: #3a211d; --amber: #d9a443; --amber-soft: #33291a; --ok: #6dbf8b; --ok-soft: #1c2f24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317; --surface: #171a1e; --surface-2: #1e2227; --ink: #e5e7ea; --muted: #9ca2ab; --line: #2a2f35;
  --accent: #52b5a7; --accent-ink: #0d1614; --accent-soft: #19302c;
  --red: #e3735f; --red-soft: #3a211d; --amber: #d9a443; --amber-soft: #33291a; --ok: #6dbf8b; --ok-soft: #1c2f24;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 14.5px; line-height: 1.5; font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.015em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ph, .ph-fill { line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 64px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 32px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 500; font-size: 13.5px; cursor: pointer;
  transition: transform .12s var(--ease), background-color .15s, border-color .15s;
}
a.btn { text-decoration: none; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn .ph { font-size: 16px; }
.btn.spin .ph-arrows-clockwise { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 28px; height: 28px; border-radius: var(--r-ctl); background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -.02em;
}
/* The emblem is drawn with a mask so it takes the mark's text colour in light, dark and inverted (login) variants. */
.brand .mark::before {
  content: ""; width: 58%; height: 76%; background: currentColor;
  -webkit-mask: url('/assets/logo.svg') center / contain no-repeat; mask: url('/assets/logo.svg') center / contain no-repeat;
}
.brand h1 { font-size: 19px; }
.topbar .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stamp { color: var(--muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.stamp .live { color: var(--ok); }
.stamp.warn, .stamp.warn .live { color: var(--amber); }

/* ---------- segmented owner filter ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 0 16px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-ctl); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button:hover { color: var(--ink); }

/* ---------- KPI strip: one panel, divided cells ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-panel); margin-bottom: 22px; overflow: hidden;
}
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 14px 16px 12px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .n { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.kpi.red .n { color: var(--red); } .kpi.amber .n { color: var(--amber); } .kpi.accent .n { color: var(--accent); } .kpi.ok .n { color: var(--ok); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.rail { display: grid; gap: 22px; position: sticky; top: 16px; }
section > header.sh { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; }
section > header.sh h2 { font-size: 15.5px; display: inline-flex; align-items: center; gap: 7px; }
section > header.sh h2 .ph, section > header.sh h2 .ph-fill { font-size: 18px; }
section > header.sh .count { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
section + section { margin-top: 26px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel.list { padding: 2px 14px; }
.panel.flag-red { box-shadow: inset 3px 0 0 var(--red); }
.panel.flag-amber { box-shadow: inset 3px 0 0 var(--amber); }
.panel.flag-ok { box-shadow: inset 3px 0 0 var(--ok); }
.panel.flag-accent { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- task rows ---------- */
.trow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  padding: 8px 0; border-top: 1px solid var(--line); min-width: 0;
}
.trow:first-child { border-top: 0; }
.trow .main { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.trow .grp { flex: none; width: 108px; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tname {
  appearance: none; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--ink);
  min-width: 0; overflow-wrap: anywhere; line-height: 1.4;
}
.tname:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.trow .meta { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.trow.stack { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 9px 0; }
.trow.stack .main { flex-direction: column; gap: 1px; }
.trow.stack .grp { width: auto; font-size: 12px; }
.trow.stack .meta { justify-content: flex-start; }
.trow.stack .meta > .chip.due { margin-left: auto; }
.trow.pending { opacity: .6; }
.trow.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: var(--r-ctl);
  font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.chip .ph, .chip .ph-fill { font-size: 13px; }
.chip.due { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.solid-red { background: var(--red); color: #fff7f5; }

.who { display: inline-flex; }
.av {
  width: 22px; height: 22px; border-radius: var(--r-ctl); display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
}
.who .av + .av { margin-left: -5px; }
.av.none { color: var(--muted); }

/* status select, coloured by bucket */
.st {
  appearance: none; height: 24px; padding: 0 22px 0 8px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 7px center;
  font-size: 12px; font-weight: 500; cursor: pointer; max-width: 150px; text-transform: capitalize;
}
.st:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.st.b-prog { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.st.b-wait { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
.st.b-done { color: var(--ok); }

details.more > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 12.5px; padding: 8px 0; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 6px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ph { transition: transform .2s var(--ease); }
details.more[open] > summary .ph { transform: rotate(90deg); }
details.more > summary:hover { color: var(--ink); }

.empty { color: var(--muted); padding: 14px 0; display: flex; align-items: center; gap: 8px; }
.empty .ph { font-size: 18px; }

/* ---------- client board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.group { padding: 12px 14px 4px; min-width: 0; }
.group > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 6px; }
.group h3 { font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.group h3 a { color: var(--muted); font-size: 14px; display: inline-flex; }
.group h3 a:hover { color: var(--accent); }
.group .gmeta { color: var(--muted); font-size: 12px; font-family: var(--mono); white-space: nowrap; }
.group .gmeta .over { color: var(--red); }

/* ---------- team load: no track, bar + number ---------- */
.load { padding: 10px 14px; display: grid; gap: 2px; }
.lrow { display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 5px 0; }
.lrow .nm { font-size: 13.5px; }
.lrow .bar { height: 8px; border-radius: 2px; background: var(--accent); transform-origin: left; transition: width .4s var(--ease); }
.lrow .bar.muted { background: var(--muted); opacity: .45; }
.lrow .v { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-align: right; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--r-panel); background: var(--amber-soft); color: var(--ink); font-size: 13.5px; }
.notice .ph { color: var(--amber); font-size: 18px; margin-top: 1px; }

.admin { padding: 6px 14px; }
.admin .arow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.admin .arow:first-child { border-top: 0; }
.admin .arow .tags { color: var(--muted); font-size: 12px; }
.admin .acts { display: flex; gap: 4px; }
.admin .acts .btn { height: 28px; padding: 0 8px; font-size: 12.5px; }
.linkbox { grid-column: 1 / -1; display: flex; gap: 6px; }
.linkbox input { flex: 1; min-width: 0; height: 28px; font-family: var(--mono); font-size: 11.5px; padding: 0 8px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface-2); }

/* ---------- skeleton ---------- */
.sk { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 50%, var(--line)), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skrow { display: grid; grid-template-columns: 1fr 64px; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.skrow:first-child { border-top: 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- drawer ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(12, 14, 17, .38); z-index: 40; opacity: 0; transition: opacity .22s var(--ease); }
.backdrop.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 41; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s var(--ease);
}
.drawer.open { transform: none; }
.drawer .dh { padding: 16px 20px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.drawer .crumb { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.drawer .dh h2 { font-size: 19px; line-height: 1.3; grid-column: 1; overflow-wrap: anywhere; }
.drawer .close { grid-row: 1 / span 2; grid-column: 2; align-self: start; }
.drawer .db { overflow-y: auto; padding: 16px 20px 28px; flex: 1; overscroll-behavior: contain; }
.drawer .df { border-top: 1px solid var(--line); padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0 0 20px; font-size: 13.5px; }
.facts dt { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.facts dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.facts .ph { font-size: 15px; }
.dsec { margin-top: 22px; }
.dsec > h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.prose { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; } .prose > :last-child { margin-bottom: 0; }
.prose img { max-width: 100%; border-radius: var(--r-ctl); }
.prose pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-ctl); overflow-x: auto; font-size: 12.5px; }
.prose code { font-family: var(--mono); font-size: .9em; }
.prose table { border-collapse: collapse; width: 100%; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.prose blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 15px; margin: 16px 0 6px; }
.muted { color: var(--muted); }

.checklist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.checklist li .ph, .checklist li .ph-fill { font-size: 16px; margin-top: 2px; color: var(--muted); }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li.done .ph-fill { color: var(--ok); }
.cl-name { font-size: 13px; font-weight: 600; margin: 8px 0 6px; display: flex; justify-content: space-between; }

.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.att { border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; min-width: 0; text-decoration: none; color: var(--ink); }
.att .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border: 0; padding: 0; cursor: zoom-in; width: 100%; }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att .thumb .ph { font-size: 30px; color: var(--muted); }
.att .cap { padding: 6px 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 12px; }
.att .cap .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .cap .s { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.att .cap a { color: var(--muted); display: inline-flex; }
.att .cap a:hover { color: var(--accent); }
a.att:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }

.thread { display: grid; gap: 14px; }
.cmt { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
.cmt .av { width: 26px; height: 26px; }
.cmt .hd { font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cmt .hd b { font-weight: 600; }
.cmt .hd time { color: var(--muted); font-size: 12px; }
.cmt .bd { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; margin-top: 2px; }
.cmt.client .av { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.cmt .atts { margin-top: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

.field { display: grid; gap: 6px; margin-top: 14px; }
.field label { font-size: 13px; font-weight: 500; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--red); }
textarea, input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
  width: 100%; border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line)); background: var(--surface);
  border-radius: var(--r-ctl); padding: 8px 10px; font-size: 14px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
textarea::placeholder, input::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

.dskel { display: grid; gap: 12px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(8, 10, 12, .86); display: grid; place-items: center; padding: 24px; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 96px); border-radius: var(--r-ctl); }
.lightbox .bar { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; }
.lightbox .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #f1f2f4; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: var(--bg); border-radius: var(--r-ctl); padding: 10px 14px; font-size: 13.5px; box-shadow: var(--shadow);
  display: flex; gap: 8px; align-items: center; animation: toastIn .24s var(--ease);
}
.toast.err { background: var(--red); color: #fff7f5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.foot { color: var(--muted); font-size: 12.5px; margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); max-width: 90ch; }

/* ---------- client report ---------- */
body.client { --accent: var(--brand, #1d3a6b); --accent-ink: #ffffff; --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.client { --accent: var(--brand-dark, #8fb0e8); --accent-ink: #111317; } }
:root[data-theme="dark"] body.client { --accent: var(--brand-dark, #8fb0e8); --accent-ink: #111317; }
body.client .wrap { max-width: 1040px; }
.rhead { padding: 26px 0 20px; border-bottom: 2px solid var(--accent); margin-bottom: 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: end; }
.rhead .eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.rhead h1 { font-size: 30px; letter-spacing: -.025em; margin-top: 4px; }
.rhead .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-top: 26px; }
.twocol > section + section { margin-top: 0; }
body.client .trow { padding: 10px 0; }
.approve { display: flex; gap: 6px; }
.approve .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }

.pinwrap { max-width: 380px; margin: 12vh 0 0; }
.pinwrap h1 { font-size: 22px; margin-bottom: 6px; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth .side { background: var(--accent); color: var(--accent-ink); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .side h2 { font-size: 30px; line-height: 1.15; max-width: 16ch; letter-spacing: -.03em; }
.auth .side p { opacity: .8; max-width: 40ch; margin: 0; }
.auth .form { padding: 40px; display: flex; flex-direction: column; justify-content: center; max-width: 440px; width: 100%; }
.auth .form h1 { font-size: 22px; margin-bottom: 4px; }


/* ---------- theme toggle ---------- */
.theme-toggle { width: 32px; padding: 0; justify-content: center; }
.theme-toggle .ph { font-size: 17px; }
.corner { position: fixed; top: 12px; right: 12px; z-index: 10; }
.auth .corner .btn { color: var(--muted); }

/* ---------- account menu ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu .mname { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow); padding: 6px; display: grid;
}
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; font-size: 13px; }
.menu-who span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-ctl); border: 0; background: none;
  color: var(--ink); text-decoration: none; font-size: 13.5px; cursor: pointer; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }

/* ---------- dialog ---------- */
.dialog { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); color: var(--ink); padding: 0; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(12, 14, 17, .4); }
.dform { padding: 20px; }
.dform h2 { font-size: 17px; }

/* ---------- preview banner (staff viewing a client report) ---------- */
.banner { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 8px 16px; background: var(--ink); color: var(--bg); font-size: 13px; }
.banner a { color: inherit; font-weight: 600; }

/* ---------- admin ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.ccard { padding: 14px 16px 6px; box-shadow: inset 0 3px 0 var(--sw, var(--accent)); }
.ccard > header { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; }
.ccard > header h3 { font-size: 15.5px; flex: 1; min-width: 0; }
.swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--sw); flex: none; }
.cblock { padding: 12px 0; border-top: 1px solid var(--line); }
.clabel { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.clabel .muted { font-weight: 400; margin-left: auto; font-size: 12.5px; }
.urow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; }
.urow .av { width: 26px; height: 26px; }
.uinfo { display: grid; min-width: 0; font-size: 13.5px; }
.uinfo b { font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.uinfo span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urow .acts .btn { height: 28px; padding: 0 8px; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.addform { margin: 4px 0 10px; padding: 4px 12px 12px; background: var(--surface-2); border-radius: var(--r-panel); }
.addform .field { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.credbox { margin: 8px 0; padding: 10px 12px; border-radius: var(--r-panel); background: var(--accent-soft); }
.credbox pre { margin: 6px 0; white-space: pre-wrap; font-size: 12.5px; }
select.select { width: 100%; height: 36px; border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line)); background: var(--surface); border-radius: var(--r-ctl); padding: 0 10px; }
.linkbox input { height: 32px; width: auto; flex: 1; min-width: 0; }
.linkbox .btn { flex: none; }
@media (max-width: 640px) { .cards { grid-template-columns: minmax(0, 1fr); } .grid2 { grid-template-columns: minmax(0, 1fr); } .menu .mname { display: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(n) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .kpis .kpi:nth-child(-n+3) { border-top: 0; }
  .kpis.four .kpi:nth-child(3) { border-top: 1px solid var(--line); }
  .kpis .kpi:nth-child(3n+1) { border-left: 0; }
  .kpis.four .kpi:nth-child(n) { border-left: 1px solid var(--line); }
  .kpis.four .kpi:nth-child(2n+1) { border-left: 0; }
  .twocol { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth .side { min-height: 180px; padding: 24px; }
}
@media (max-width: 640px) {
  .wrap { padding: 14px 16px 48px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .trow { grid-template-columns: minmax(0, 1fr); }
  .trow .meta { justify-content: flex-start; }
  .trow .main { flex-direction: column; gap: 0; }
  .trow .grp { width: auto; }
  .facts { grid-template-columns: 96px minmax(0, 1fr); }
  .rhead { grid-template-columns: minmax(0, 1fr); }
  .rhead .right { justify-content: flex-start; }
  .rhead h1 { font-size: 24px; }
  .drawer .dh, .drawer .db, .drawer .df { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
