/* Offshore Creative Finance — stylesheet
   Light-first, clean accounting-app look; dark mode via prefers-color-scheme or data-theme. */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f1f1ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hair: #e4e3dc;
  --hair-2: #d3d2ca;
  --accent: #0b0b0b;
  --accent-ink: #ffffff;
  --link: #1c5cab;
  --focus: #2a78d6;
  /* chart series (validated palette, light) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --grid: #e1e0d9; --axis: #c3c2b7;
  /* status (fixed) */
  --good: #0ca30c; --good-ink: #006300; --good-bg: #e6f6e6;
  --warn: #fab219; --warn-ink: #7a5200; --warn-bg: #fff4d6;
  --serious: #ec835a; --serious-ink: #8a3a1a; --serious-bg: #fdeae2;
  --crit: #d03b3b; --crit-ink: #9b1f1f; --crit-bg: #fbe5e5;
  --info-ink: #1c5cab; --info-bg: #e4eefb;
  --neutral-ink: #52514e; --neutral-bg: #ecebe6;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 6px 20px -12px rgba(11,11,11,.18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 232px;
  --sidebar-collapsed: 60px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e; --surface: #1a1a19; --surface-2: #242423; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --hair: #2c2c2a; --hair-2: #383835; --accent: #ffffff; --accent-ink: #0b0b0b; --link: #86b6ef; --focus: #3987e5;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #2c2c2a; --axis: #383835;
    --good-ink: #5fd35f; --good-bg: #123512; --warn-ink: #ffd27a; --warn-bg: #3a2c05; --serious-ink: #ffb391; --serious-bg: #3d1d10;
    --crit-ink: #ff8f8f; --crit-bg: #3c1414; --info-ink: #9ec5f4; --info-bg: #142a47; --neutral-ink: #c3c2b7; --neutral-bg: #2a2a28;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #242423; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --hair: #2c2c2a; --hair-2: #383835; --accent: #ffffff; --accent-ink: #0b0b0b; --link: #86b6ef; --focus: #3987e5;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --grid: #2c2c2a; --axis: #383835;
  --good-ink: #5fd35f; --good-bg: #123512; --warn-ink: #ffd27a; --warn-bg: #3a2c05; --serious-ink: #ffb391; --serious-bg: #3d1d10;
  --crit-ink: #ff8f8f; --crit-bg: #3c1414; --info-ink: #9ec5f4; --info-bg: #142a47; --neutral-ink: #c3c2b7; --neutral-bg: #2a2a28;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hidden, [hidden] { display: none !important; }
.pos { color: var(--good-ink); }
.neg { color: var(--crit-ink); }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.gap-lg { gap: 16px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.app { display: block; min-height: 100vh; }
/* icon-only by default; hovering floats the full labelled nav over the page so nothing reflows */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 40; height: 100vh; width: var(--sidebar-collapsed);
  background: var(--surface); border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; padding: 18px 10px; overflow: hidden;
  transition: width .16s ease, box-shadow .16s ease;
}
.sidebar:hover, .sidebar:focus-within { width: var(--sidebar-w); padding: 18px 14px; box-shadow: 8px 0 24px -14px rgba(11,11,11,.35); }
.sidebar .nav a span, .sidebar .brand img, .sidebar .user-pill .who, .sidebar .sidebar-foot .flex,
.sidebar .nav-section { opacity: 0; transition: opacity .12s ease; white-space: nowrap; }
.sidebar:hover .nav a span, .sidebar:hover .brand img, .sidebar:hover .user-pill .who,
.sidebar:hover .sidebar-foot .flex, .sidebar:hover .nav-section,
.sidebar:focus-within .nav a span, .sidebar:focus-within .brand img, .sidebar:focus-within .user-pill .who,
.sidebar:focus-within .sidebar-foot .flex, .sidebar:focus-within .nav-section { opacity: 1; }
.sidebar .nav a { gap: 12px; }
.sidebar .brand { justify-content: flex-start; min-height: 22px; }
.sidebar .user-pill { padding: 6px; }
.sidebar .user-pill #logout-btn { opacity: 0; transition: opacity .12s; }
.sidebar:hover .user-pill #logout-btn, .sidebar:focus-within .user-pill #logout-btn { opacity: 1; }
/* the collapsed strip shows a mark where the logo sits, so the top isn't empty */
.sidebar .brand::before {
  content: ""; width: 22px; height: 22px; flex: none; border-radius: 6px; background: var(--accent);
  margin-left: 2px; transition: opacity .12s, width .16s, margin .16s;
}
.sidebar:hover .brand::before, .sidebar:focus-within .brand::before { opacity: 0; width: 0; margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { height: 22px; width: auto; display: block; }
:root[data-theme="dark"] .brand img.light, :root:not([data-theme="light"]) .brand img.light { }
.brand .tag { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2);
  font-weight: 500; font-size: 13.5px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.nav-section { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 14px 10px 6px; }
.sidebar-foot { margin-top: auto; padding: 10px 8px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.claude-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--hair); border-radius: 999px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); }
.claude-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }

.main { min-width: 0; margin-left: var(--sidebar-collapsed); }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--hair); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border-radius: 999px; border: 1px solid var(--hair); background: var(--page); }
.topbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 30; }
.search-results .grp { padding: 8px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.search-results a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; color: var(--ink); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.content { padding: 24px 28px 80px; max-width: none; width: 100%; }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-p { padding: 18px 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--hair); }
.card-h h2 { font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* stat tiles */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .label { font-size: 12.5px; color: var(--ink-2); }
.stat .value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; word-break: break-word; }
.stat .value.hero { font-size: 34px; }
.stat .delta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .spark { height: 28px; margin-top: 4px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.paid { background: var(--good-bg); color: var(--good-ink); }
.badge.deposit { background: var(--warn-bg); color: var(--warn-ink); }
.badge.unpaid { background: var(--info-bg); color: var(--info-ink); }
.badge.overdue { background: var(--crit-bg); color: var(--crit-ink); }
.badge.draft, .badge.void, .badge.neutral, .badge.upcoming { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge.due { background: var(--serious-bg); color: var(--serious-ink); }
.badge.in { background: var(--good-bg); color: var(--good-ink); }
.badge.out { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge.plain::before { display: none; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; background: var(--accent); }
.btn.danger { color: var(--crit-ink); border-color: var(--crit-bg); background: var(--crit-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.field input, .field select, .field textarea, .input {
  padding: 8px 10px; border: 1px solid var(--hair-2); border-radius: var(--radius-sm); background: var(--surface); width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.field textarea { min-height: 70px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; }
.segmented { display: inline-flex; border: 1px solid var(--hair-2); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button { padding: 6px 12px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.segmented button + button { border-left: 1px solid var(--hair-2); }
.segmented button.on { background: var(--accent); color: var(--accent-ink); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input, .filters select { width: auto; }
.filters input[type="search"] { min-width: 220px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.row-link { cursor: pointer; }
.tbl tbody tr.row-link:hover { background: var(--surface-2); }
.tbl td.actions { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--hair-2); background: var(--surface-2); }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; }

/* list rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--hair); }
.row:last-child { border-bottom: 0; }
.row.link { cursor: pointer; }
.row.link:hover { background: var(--surface-2); }
.row .title { font-weight: 500; }
.row .meta { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; }

/* meter */
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }
.meter.good > i { background: var(--good); }
.meter.warn > i { background: var(--warn); }

/* chart */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { rx: 0; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hover-line { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .ln { width: 14px; height: 2px; display: inline-block; border-radius: 1px; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--hair-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); z-index: 5; min-width: 150px; }
.tooltip .t-title { color: var(--muted); margin-bottom: 4px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }
.tooltip .k { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; border-radius: 1px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .track { height: 14px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.hbar .track > i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hbar.s2 .track > i { background: var(--s2); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); border: 1px solid var(--hair); }
.modal.wide { max-width: 920px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--hair); }
.modal-b { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--hair); display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal-f .left { margin-right: auto; }
.error-box { background: var(--crit-bg); color: var(--crit-ink); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.note-box { background: var(--info-bg); color: var(--info-ink); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.warn-box { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 8px; font-size: 13px; }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; transition: .2s; z-index: 200; pointer-events: none; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--crit); color: #fff; }

/* invoice editor lines */
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.4fr) minmax(0, 1.2fr) 32px; gap: 8px; align-items: center; }
.line .input { padding: 7px 9px; }
.line-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.totals { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; font-size: 13.5px; }
.totals .tot { font-size: 18px; font-weight: 600; }

/* invoice detail */
.inv-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.inv-head .amount { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { display: flex; flex-direction: column; }
.timeline .t { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); align-items: center; }
.timeline .t:last-child { border-bottom: 0; }

/* page header */
.page-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h .sub { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hair); margin-bottom: 16px; }
.tabs button { padding: 8px 12px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { margin-left: 6px; color: var(--muted); font-weight: 400; }

/* bottom nav (mobile) */
.bottom-nav { display: none; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 16px; }
  .topbar .search { max-width: none; }
  .content { padding: 16px 16px 90px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr 1fr; }
  .line .input.desc { grid-column: 1 / -1; }
  .stat .value { font-size: 20px; } .stat .value.hero { font-size: 28px; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--hair); z-index: 50; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); padding: 4px 0; }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .hide-m { display: none !important; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 96vh; overflow: auto; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media print { .sidebar, .topbar, .bottom-nav, .btn, .filters { display: none !important; } .app { display: block; } .main { margin-left: 0; } .content { padding: 0; max-width: none; } }

/* import */
.drop { border: 2px dashed var(--hair-2); border-radius: 12px; padding: 26px; text-align: center; color: var(--muted); margin-top: 14px; transition: .15s; }
.drop.over { border-color: var(--focus); background: var(--surface-2); color: var(--ink); }
.draft.excluded { opacity: .55; }
.chip.kind-retainer { background: var(--info-bg); color: var(--info-ink); }
.chip.kind-project { background: var(--neutral-bg); color: var(--neutral-ink); }
a.chip:hover { text-decoration: none; filter: brightness(.95); }
a.chip svg { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--page); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 26px; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .field { margin-top: 12px; }
.auth-card .btn.primary { width: 100%; margin-top: 16px; padding: 10px; }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); }
.user-pill .avatar { width: 28px; height: 28px; font-size: 11px; }
.user-pill .who { line-height: 1.2; min-width: 0; }
.user-pill .who b { display: block; font-size: 12.5px; }
.user-pill .who span { font-size: 11px; color: var(--muted); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }

/* my day / camera */
.cam-wrap { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; max-width: 520px; }
.cam-wrap video, .cam-wrap canvas, .cam-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-wrap .cam-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ddd; text-align: center; padding: 20px; font-size: 13px; }
.cam-wrap .cam-badge { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 11.5px; }
.big-btn { padding: 14px 18px; font-size: 15px; border-radius: 12px; }
.status-tile { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.status-tile .avatar { width: 44px; height: 44px; font-size: 15px; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: inline-block; vertical-align: middle; cursor: zoom-in; }
.photo-view img { max-width: 100%; border-radius: 10px; }
.pay-break { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13.5px; }
.pay-break .sub { color: var(--muted); font-size: 12px; }
.pay-break .total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--hair-2); padding-top: 8px; margin-top: 4px; }
.pay-break .minus { color: var(--crit-ink); }
.pay-break .plus { color: var(--good-ink); }
.locate { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 820px) { .cam-wrap { max-width: none; } }

/* ---------------------------------------------------------------- tasks
   Folders → lists → board / table. Uses the tokens above; status colours come from the list. */
.tk-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 16px; align-items: start; }
.tk-tree { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; padding: 6px; }
.tk-tree .tk-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
.tk-tree .tk-item:hover { background: var(--surface-2); color: var(--ink); }
.tk-tree .tk-item.on { background: var(--accent); color: var(--accent-ink); }
.tk-tree .tk-item.on .muted, .tk-tree .tk-item.on .tk-n { color: inherit; opacity: .7; }
.tk-tree .tk-folder { font-weight: 600; color: var(--ink); }
.tk-tree .tk-list { padding-left: 26px; }
.tk-tree .tk-n { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tk-tree .tk-sec { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 12px 9px 4px; }
.folder-ico { width: 18px; height: 18px; flex: none; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; }
.folder-ico svg { width: 12px; height: 12px; color: #fff; }
.tk-caret { width: 18px; height: 18px; flex: none; color: var(--muted); transition: transform .15s; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.tk-caret:hover { background: var(--hair); color: var(--ink); }
.tk-caret svg { width: 13px; height: 13px; }
.tk-caret.open { transform: rotate(90deg); }

.tk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; min-height: 44px; }
/* view-specific controls (Gantt zoom, calendar month) live here and nowhere else,
   so the shared filter row underneath keeps its position when the view changes */
.tk-viewslot { display: flex; align-items: center; gap: 8px; min-height: 34px; min-width: 168px; justify-content: flex-end; }
.tk-filters { min-height: 38px; }
.tk-head .tk-crumb { font-size: 12.5px; color: var(--muted); }
.tk-head h2 { font-size: 17px; }

/* let the strip run to the window edge so a column is never clipped mid-card:
   it is pulled out to the page padding and given the same padding back inside */
.tk-board-wrap { margin-right: -28px; padding-right: 28px; overflow-x: auto; overscroll-behavior-x: contain; scroll-padding-left: 2px; }
.tk-board { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 10px; width: max-content; min-width: 100%; }
.tk-col { flex: 0 0 292px; max-width: 292px; background: var(--surface-2); border-radius: 12px; padding: 8px; border: 1px solid transparent; }
.tk-col.over { border-color: var(--focus); background: var(--info-bg); }
.tk-col-h { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.tk-col-h .icon-btn { width: 24px; height: 24px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.count-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hair-2); color: var(--ink-2); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.tk-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 24px; }
.tk-card { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 10px 11px; cursor: pointer; box-shadow: 0 1px 2px rgba(11,11,11,.04); }
.tk-card:hover { border-color: var(--hair-2); }
.tk-card.dragging { opacity: .4; }
.tk-card .tk-title { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.tk-card .tk-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tk-card .tk-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.tk-card .tk-meta .spacer { flex: 1; }
.tk-thumb { width: 100%; height: 118px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; display: block; background: var(--surface-2); }
.tk-add { width: 100%; justify-content: flex-start; border: 0; background: transparent; color: var(--muted); padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.tk-add:hover { background: var(--hair); color: var(--ink); }
.tk-add svg { width: 13px; height: 13px; }
.tk-col-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 14px 6px; border: 1px dashed var(--hair-2); border-radius: 8px; }

.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.unassigned { background: transparent; border: 1px dashed var(--hair-2); color: var(--muted); }
.due-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.due-chip svg { width: 11px; height: 11px; }
.due-chip.over { background: var(--crit-bg); color: var(--crit-ink); }
.due-chip.soon { background: var(--warn-bg); color: var(--warn-ink); }
.pri { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; }
.pri svg { width: 12px; height: 12px; }
.pri.urgent { color: var(--crit-ink); } .pri.high { color: var(--serious-ink); }
.pri.normal { color: var(--info-ink); } .pri.low { color: var(--muted); }
.tk-count { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); }
.tk-count svg { width: 12px; height: 12px; }

/* task detail */
.tk-detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tk-title-input { font-size: 19px; font-weight: 600; border: 1px solid transparent; background: transparent; width: 100%; padding: 4px 6px; border-radius: 8px; letter-spacing: -.01em; }
.tk-title-input:hover { border-color: var(--hair); }
.tk-title-input:focus { outline: 2px solid var(--focus); outline-offset: -1px; background: var(--surface); }
.tk-props { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 10px 12px; align-items: center; font-size: 13px; }
.tk-props .k { color: var(--muted); }
.tk-props select, .tk-props input { padding: 6px 9px; border: 1px solid var(--hair-2); border-radius: 8px; background: var(--surface); width: 100%; }
.rich { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.rich a { word-break: break-all; }
.drive-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--hair-2); border-radius: 10px; padding: 9px 11px; margin: 8px 0; background: var(--surface-2); max-width: 440px; }
.drive-card .g-ico { width: 30px; height: 30px; border-radius: 7px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11px; }
.drive-card .g-meta { min-width: 0; line-height: 1.3; }
.drive-card .g-meta b { display: block; font-size: 13px; }
.drive-card .g-meta span { font-size: 11.5px; color: var(--muted); }
.drive-card .btn { margin-left: auto; }

.cmt-list { display: flex; flex-direction: column; gap: 14px; }
.cmt { display: flex; gap: 10px; }
.cmt .body { min-width: 0; flex: 1; }
.cmt .who { font-size: 13px; font-weight: 600; }
.cmt .when { font-size: 11.5px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.cmt .text { font-size: 13.5px; margin-top: 2px; }
.cmt .acts { margin-top: 4px; display: flex; gap: 10px; }
.cmt .acts button { border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.cmt .acts button:hover { color: var(--ink); text-decoration: underline; }
.cmt .replies { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--hair); display: flex; flex-direction: column; gap: 12px; }
.cmt-box { display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; }
.cmt-box textarea { flex: 1; min-height: 40px; padding: 9px 11px; border: 1px solid var(--hair-2); border-radius: 10px; background: var(--surface); resize: vertical; }
.act-feed { display: flex; flex-direction: column; }
.act-feed .a { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 12.5px; align-items: flex-start; }
.act-feed .a:last-child { border-bottom: 0; }
.act-feed .a .when { color: var(--muted); font-size: 11.5px; white-space: nowrap; margin-left: auto; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hair-2); margin-top: 6px; flex: none; }
.act-dot.status { background: var(--s1); } .act-dot.assigned { background: var(--s3); }
.act-dot.commented { background: var(--s4); } .act-dot.created { background: var(--s7); }
.att-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.att-row:last-child { border-bottom: 0; }
.att-row img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; }
.att-row .f-ico { width: 40px; height: 40px; border-radius: 6px; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex: none; }

.status-editor { display: flex; flex-direction: column; gap: 8px; }
.status-editor .se-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 44px 62px 30px; gap: 8px; align-items: center; }
.status-editor .se-row input[type="color"] { padding: 0; height: 30px; border: 1px solid var(--hair-2); border-radius: 6px; background: none; cursor: pointer; }
.status-editor .se-grip { color: var(--muted); text-align: center; cursor: grab; user-select: none; }
.status-editor .se-row.dragging { opacity: .45; }

@media (max-width: 1100px) { .tk-detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  /* board first, folder tree below it — the tree is tall and mostly used to switch lists */
  .tk-layout { display: flex; flex-direction: column; }
  .tk-layout > * { min-width: 0; max-width: 100%; }   /* flex items default to min-width:auto — the board would widen the page */
  .tk-tree { order: 2; position: static; max-height: 340px; }
  .tk-col { flex-basis: 82vw; max-width: 82vw; }
  .tk-head { align-items: flex-start; }
  .tk-viewslot { min-width: 0; flex: 1 0 100%; justify-content: flex-start; }   /* keeps its own row even when empty, so the filters never shift */
  .tk-board-wrap { margin-right: -16px; padding-right: 16px; }
  .tk-head > .grow { flex: 1 0 100%; }   /* title on its own line, view switcher wraps under it */
}
.tk-tree .tk-item .ellipsis { flex: 1; }
.tk-tree .tk-item > svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.tk-caret svg { display: block; }
.tk-tree .tk-act { width: 22px; height: 22px; flex: none; opacity: 0; }
.tk-tree .tk-item:hover .tk-act { opacity: 1; }
.tk-tree .tk-item.on .tk-act { opacity: .85; color: inherit; }
@media (hover: none) { .tk-tree .tk-act { opacity: 1; } }
.segmented button { display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 14px; height: 14px; flex: none; }
.tbl td.tk-t { max-width: 380px; }
.tbl td.tk-t b, .tbl td.tk-t .sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- gantt / workload / calendar
   Same tokens as the board — only the geometry is new. */
.gantt-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); }
.g-row { display: flex; height: 38px; border-bottom: 1px solid var(--hair); }
.g-row:last-child { border-bottom: 0; }
.g-row:hover .g-name { background: var(--surface-2); }
.g-name { position: sticky; left: 0; z-index: 3; width: 232px; min-width: 232px; background: var(--surface); border-right: 1px solid var(--hair); display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 12.5px; }
.g-name .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.g-track { position: relative; flex: none; }
.g-head-row { position: sticky; top: 0; z-index: 4; background: var(--surface-2); height: 44px; border-bottom: 1px solid var(--hair-2); }
.g-head-row .g-name { z-index: 5; background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
.g-head-cell { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--hair); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.g-head-cell b { color: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.g-head-cell.off { background: var(--hair); }
.g-body { position: relative; }
.g-off { position: absolute; top: 0; bottom: 0; background: var(--surface-2); pointer-events: none; z-index: 0; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); opacity: .55; pointer-events: none; z-index: 1; }
.g-links { position: absolute; top: 0; pointer-events: none; z-index: 1; overflow: visible; }
.g-links path { fill: none; stroke: var(--axis); stroke-width: 1.5; }
.g-links path.clash { stroke: var(--crit); stroke-dasharray: 4 3; }
.g-links circle { fill: var(--axis); }
.g-links circle.clash { fill: var(--crit); }
.g-bar { position: absolute; top: 7px; height: 24px; border-radius: 6px; display: flex; align-items: center; gap: 6px; padding: 0 9px; color: #fff; font-size: 11.5px; font-weight: 500; cursor: grab; user-select: none; white-space: nowrap; overflow: hidden; z-index: 2; box-shadow: 0 1px 2px rgba(11,11,11,.18); }
.g-bar:active { cursor: grabbing; }
.g-bar.dragging { opacity: .85; box-shadow: 0 6px 18px -6px rgba(11,11,11,.5); z-index: 6; }
.g-bar .g-grip { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.g-bar .g-grip.l { left: 0; } .g-bar .g-grip.r { right: 0; }
.g-bar .g-av { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,.28); display: inline-flex; align-items: center; justify-content: center; font-size: 8.5px; font-weight: 700; flex: none; }
.g-bar.clash { outline: 2px solid var(--crit); outline-offset: 1px; }
.g-empty { padding: 26px; text-align: center; color: var(--muted); }
.g-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; }
.g-unscheduled { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.wl-row td { vertical-align: middle; }
.wl-strip { display: flex; gap: 2px; }
.wl-day { width: 13px; height: 26px; border-radius: 3px; background: var(--surface-2); position: relative; }
.wl-day.off { background: repeating-linear-gradient(45deg, var(--surface-2) 0 3px, var(--hair) 3px 6px); }
.wl-day > i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px; display: block; background: var(--s3); }
.wl-day.warn > i { background: var(--warn); }
.wl-day.over > i { background: var(--crit); }
.wl-util { min-width: 120px; }
.wl-util .meter { height: 8px; }
.wl-util .meter > i { background: var(--s3); }
.wl-util.warn .meter > i { background: var(--warn); }
.wl-util.over .meter > i { background: var(--crit); }
.wl-detail td { background: var(--surface-2); }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--hair); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 7px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--hair); text-align: center; font-weight: 600; }
.cal-cell { min-height: 108px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.off .cal-num { color: var(--crit-ink); }
.cal-num { font-size: 11.5px; color: var(--muted); width: 21px; height: 21px; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-weight: 700; }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 5px; border-radius: 5px; background: var(--surface-2); cursor: pointer; min-width: 0; }
.cal-chip:hover { background: var(--hair); }
.cal-chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.cal-chip .cal-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip svg { width: 10px; height: 10px; flex: none; opacity: .8; }
.cal-more { font-size: 10.5px; color: var(--muted); padding-left: 5px; cursor: pointer; }

.dep-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.dep-row:last-child { border-bottom: 0; }
.dep-row .clash { color: var(--crit-ink); font-size: 11.5px; }
.conn-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); }
.conn-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.conn-pill.on .dot { background: var(--good); }
.step-list { counter-reset: s; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.step-list > li { margin-left: 16px; }

@media (max-width: 820px) {
  .g-name { width: 150px; min-width: 150px; }
  .cal-cell { min-height: 74px; }
  .gantt-wrap { max-height: 60vh; }
}

/* ---------------------------------------------------------------- notifications, to-dos, automations, radar */
.bell { position: relative; }
.bell .count-badge { position: absolute; top: -3px; right: -4px; background: var(--crit); color: #fff; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.notif-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 380px; max-width: 92vw; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 60; max-height: 70vh; display: flex; flex-direction: column; }
.notif-panel .nh { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--hair); }
.notif-panel .nb { overflow: auto; }
.notif-row { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--hair); cursor: pointer; align-items: flex-start; }
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: var(--info-bg); }
.notif-row.unread:hover { filter: brightness(.98); }
.notif-row .nt { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-row .nbody { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.notif-row .nwhen { font-size: 11px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--hair-2); }
.notif-dot.assigned { background: var(--s3); } .notif-dot.mention { background: var(--s7); }
.notif-dot.comment { background: var(--s4); } .notif-dot.status { background: var(--s1); }
.notif-dot.due { background: var(--crit); } .notif-dot.automation { background: var(--s2); }
.notif-dot.todo { background: var(--s5); }

.todo-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--hair); }
.todo-row:last-child { border-bottom: 0; }
.todo-row.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-check { width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--hair-2); background: transparent; cursor: pointer; flex: none; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.todo-check:hover { border-color: var(--ink-2); }
.todo-check.on { background: var(--good); border-color: var(--good); color: #fff; }
.todo-check svg { width: 11px; height: 11px; }
.todo-text { font-size: 14px; line-height: 1.4; word-break: break-word; }
.todo-text[contenteditable="true"]:focus { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.todo-when { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: inline-flex; align-items: center; gap: 5px; }
.todo-when svg { width: 11px; height: 11px; }
.todo-when.over { color: var(--crit-ink); } .todo-when.soon { color: var(--warn-ink); }
.todo-add { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.todo-add input[type="text"] { flex: 1; border: 0; background: transparent; font-size: 14px; padding: 4px 0; }
.todo-add input[type="text"]:focus { outline: none; }

.rule-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--hair); }
.rule-row:last-child { border-bottom: 0; }
.rule-row.off { opacity: .55; }
.switch { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--hair-2); border: 0; cursor: pointer; flex: none; padding: 0; transition: background .15s; }
.switch > i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; display: block; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch.on { background: var(--good); }
.switch.on > i { transform: translateX(14px); }
.rule-when { font-size: 13px; }
.rule-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.radar-wrap { position: relative; }
.radar-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.radar-q { opacity: .5; }
.radar-q-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.radar-pt { cursor: pointer; stroke: var(--surface); stroke-width: 2; }
.radar-pt:hover { stroke: var(--ink); }
.radar-axis { font-size: 11px; fill: var(--muted); }
.scale-pick { display: flex; gap: 4px; }
.scale-pick button { width: 30px; height: 28px; border: 1px solid var(--hair-2); background: var(--surface); border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); padding: 0; }
.scale-pick button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.equip-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 13.5px; }
.equip-row:last-child { border-bottom: 0; }
.equip-row.on .equip-name { color: var(--muted); text-decoration: line-through; }
@media (max-width: 820px) {
  .notif-panel { width: 96vw; right: -8px; }
  .todo-add { flex-wrap: wrap; }
  .todo-add input[type="text"] { flex: 1 0 100%; }          /* date, time and Add drop to their own row */
  .todo-add .input { flex: 1; }
}
.act-feed { max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.act-feed .cmt { padding: 10px 0; border-top: 1px solid var(--hair); margin-top: 4px; }
.act-feed .cmt:first-child { border-top: 0; margin-top: 0; }
.tk-feed-card { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 100px); }
.tk-feed-card .act-feed { flex: 1; }
.feed-compose { border-top: 1px solid var(--hair); padding-top: 12px; padding-bottom: 12px; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.thread-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px; padding: 3px 8px 3px 4px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.thread-toggle:hover { background: var(--hair); color: var(--ink); }
.thread-toggle svg { width: 12px; height: 12px; transition: transform .15s; flex: none; }
.thread-toggle.open svg { transform: rotate(90deg); }
.thread-toggle b { font-weight: 600; }
.thread-toggle .muted { font-weight: 400; }
/* the logo asset carries the OFFSHORE mark; the wordmark completes it */
.brand .wordmark { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--ink); white-space: nowrap; }
.auth-card .brand .wordmark { font-size: 14px; }
/* money is opt-in: make the switch read as deliberate, not a stray click */
.dash-toggle { border-color: var(--hair-2); }
.dash-toggle button { padding: 6px 14px; font-weight: 500; }
.dash-toggle button svg { width: 14px; height: 14px; }
.dash-toggle button[data-m="finance"].on { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------------------------------------------------------------- gantt: subtasks, float, fill, milestones, critical path */
.g-name.sub { font-size: 12px; color: var(--ink-2); }
.g-indent { width: 16px; flex: none; border-left: 1px solid var(--hair-2); height: 100%; margin-right: 2px; }
.g-name.crit { box-shadow: inset 3px 0 0 var(--ink); font-weight: 600; }
.g-pc { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.g-msflag { color: var(--s7); font-size: 11px; }

/* the bar is a light track with the completed share filled solid on top */
.g-bar { background: transparent !important; box-shadow: inset 0 0 0 1px var(--hair-2); overflow: visible; }
.g-shade { position: absolute; inset: 0; border-radius: 6px; opacity: .45; }
.g-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px 0 0 6px; max-width: 100%; }
.g-bar[style*="width"] .g-fill[style*="width: 100%"] { border-radius: 6px; }
.g-inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; padding-left: 7px; }
.g-bar.crit { box-shadow: inset 0 0 0 2px var(--ink); }
.g-bar.crit .g-shade { opacity: .55; }
.g-bar.clash { outline: 2px solid var(--crit); outline-offset: 1px; }

/* float: spare time before the next task needs it */
.g-float { position: absolute; top: 11px; height: 16px; border-radius: 4px; z-index: 1;
  background: repeating-linear-gradient(45deg, var(--hair-2) 0 3px, transparent 3px 7px);
  border: 1px dashed var(--hair-2); }
.g-float.crit { border-color: var(--axis); }

/* a milestone has no duration — it is a point in time */
.g-ms { position: absolute; top: 10px; width: 16px; height: 16px; margin-left: -8px; transform: rotate(45deg);
  border-radius: 3px; z-index: 3; cursor: grab; box-shadow: 0 1px 3px rgba(11,11,11,.3); }
.g-ms.crit { box-shadow: 0 0 0 2px var(--ink), 0 1px 3px rgba(11,11,11,.3); }
.g-links path.crit { stroke: var(--ink); stroke-width: 2; }
.g-links circle.crit { fill: var(--ink); }
.g-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.g-legend i { display: inline-block; width: 16px; height: 10px; border-radius: 3px; flex: none; }
.g-legend .lg-crit { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--ink); }
.g-legend .lg-float { background: repeating-linear-gradient(45deg, var(--hair-2) 0 3px, transparent 3px 7px); border: 1px dashed var(--hair-2); }
.g-legend .lg-fill { background: var(--s1); }

/* subtasks elsewhere in the app */
.sub-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.sub-row:last-child { border-bottom: 0; }
.sub-row.done .sub-name { text-decoration: line-through; color: var(--muted); }
.tk-card .tk-sub-count { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.tk-card .tk-sub-count svg { width: 11px; height: 11px; }
