/* AI Legal Institute CRM
   Layout: dark HUD workspace — pill nav on top, numbered dot-matrix tiles on the Panel,
   cream "paper" work surface with a list on the left and a black detail card on the right.
   Dark-first; light theme = cream ground with white cards. Black ink cards and lime stay in both. */
:root {
  /* Palette: Rich Black · Dark Green · Pine · Basil · Bangladesh Green · Mountain Meadow · Caribbean Green · Anti-Flash White · Stone · Pistachio */
  --bg: #021b1a;
  --grid: rgba(0, 223, 129, .05);
  --surface: #032221;
  --raised: #06302b;
  --line: #0b453a;
  --fg: #f1f7f6;
  --muted: #86a8a0;
  --paper: #f1f7f6;
  --paper-2: #e2eeeb;
  --paper-fg: #021b1a;
  --paper-muted: #707d7d;
  --paper-line: #cddfdb;
  --ink: #032221;          /* dark detail cards, both themes */
  --ink-2: #06302b;
  --ink-line: #0b453a;
  --ink-fg: #f1f7f6;
  --ink-muted: #aacbc4;
  --lime: #00df81;         /* Caribbean Green: primary accent */
  --lime-ink: #021b1a;
  --accent-text: #00df81;
  --green: #2cc295;        /* Mountain Meadow: second series */
  --hot: #ff6b4a;
  --warn: #f2b33d;
  --dot-off: rgba(241, 247, 246, .10);
  --shadow: 0 1px 0 rgba(241,247,246,.03) inset, 0 20px 40px rgba(0,0,0,.35);
  --f-display: "Lexend", system-ui, sans-serif;
  --f-body: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --f-dot: "Doto", "Geist Mono", ui-monospace, monospace;
  --r-lg: 24px; --r-md: 16px; --r-sm: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) {
  --bg: #f1f7f6; --grid: rgba(3,98,76,.07); --surface: #ffffff; --raised: #e8f2ef; --line: #cddfdb;
  --fg: #021b1a; --muted: #4f6863; --paper: #ffffff; --paper-2: #eaf3f0; --paper-line: #d8e7e3;
  --accent-text: #03624c; --dot-off: rgba(2,27,26,.10); --hot: #d9472a; --warn: #a86b00;
  --shadow: 0 1px 2px rgba(2,27,26,.05), 0 14px 30px rgba(2,27,26,.08);
  color-scheme: light;
} }
:root[data-theme="light"] {
  --bg: #f1f7f6; --grid: rgba(3,98,76,.07); --surface: #ffffff; --raised: #e8f2ef; --line: #cddfdb;
  --fg: #021b1a; --muted: #4f6863; --paper: #ffffff; --paper-2: #eaf3f0; --paper-line: #d8e7e3;
  --accent-text: #03624c; --dot-off: rgba(2,27,26,.10); --hot: #d9472a; --warn: #a86b00;
  --shadow: 0 1px 2px rgba(2,27,26,.05), 0 14px 30px rgba(2,27,26,.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0; background-color: var(--bg); color: var(--fg); font: 14px/1.45 var(--f-body);
  background-image: radial-gradient(var(--grid) 1px, transparent 1.2px); background-size: 22px 22px;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.muted { color: var(--muted); margin: 0; }
code { font-family: var(--f-mono); font-size: .92em; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 16px; letter-spacing: -.02em; white-space: nowrap; }
.logo { width: 32px; height: auto; flex: none; }
.logo .frame { fill: var(--lime); stroke: var(--lime); }
.logo .hole { fill: #04201a; }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.lime { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); font-weight: 600; }
.btn.lime:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: inherit; }
.btn.danger { color: var(--hot); background: transparent; border-color: currentColor; }
.btn.danger.armed { background: var(--hot); color: #fff; border-color: var(--hot); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 15px; }
.icon-btn:hover { border-color: var(--muted); }
.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--fg); }
.input, select.input, textarea.input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 9px 12px; }
.input:focus { border-color: var(--lime); outline: none; }
.input.sm { width: auto; padding: 4px 8px; border-radius: 8px; }
textarea.input { resize: vertical; min-height: 80px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.eyebrow { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.status { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--muted); font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px rgba(0,223,129,.2); flex: none; }
.live.off { background: var(--hot); box-shadow: 0 0 0 3px rgba(255,90,54,.18); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: var(--ink); color: var(--ink-fg); padding: 32px 40px; display: flex; flex-direction: column; gap: 28px; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 50% at 85% 20%, rgba(3,98,76,.55), transparent 70%), radial-gradient(50% 40% at 10% 100%, rgba(0,223,129,.14), transparent 70%); pointer-events: none; }
.auth-hero { position: relative; z-index: 1; margin-top: auto; }
.dot-title { font-family: var(--f-dot); font-weight: 800; font-size: clamp(48px, 7vw, 92px); line-height: .95; letter-spacing: .02em; color: var(--lime); }
.auth-art .status { color: var(--ink-muted); }
.auth-globe { position: absolute; z-index: 0; top: 50%; right: -22%; width: min(110%, 860px); aspect-ratio: 1; transform: translateY(-52%); cursor: grab; touch-action: none; }
.auth-globe:active { cursor: grabbing; }
.auth-globe canvas { width: 100%; height: 100%; display: block; }
.auth-art > .brand { position: relative; z-index: 1; }
.auth-hero, .auth-tiles { pointer-events: none; }
.auth-tiles { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini { border: 1px solid var(--ink-line); background: rgba(255,255,255,.03); border-radius: var(--r-md); padding: 14px; display: grid; gap: 4px; }
.mini .eyebrow { color: var(--ink-muted); }
.mini b { font-family: var(--f-display); font-size: 18px; font-weight: 600; }
.mini small { color: var(--ink-muted); }
.auth-side { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-family: var(--f-display); font-weight: 600; font-size: 30px; letter-spacing: -.03em; margin: 0; }
.auth-card .muted { margin-bottom: 8px; }
.auth-card label { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.auth-card .btn.block { margin-top: 12px; padding: 12px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
.notice { background: rgba(242,179,61,.12); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.form-error { color: var(--hot); font-size: 13px; margin: 4px 0 0; }
.form-error.ok { color: var(--green); }

/* ---------- Top bar ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); flex-wrap: wrap; }
.navpill { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--ink); border: 1px solid var(--ink-line); margin-inline: auto; overflow-x: auto; max-width: 100%; }
.navpill button { border: 0; background: transparent; color: var(--ink-muted); padding: 8px 16px; border-radius: 999px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.navpill button:hover { color: var(--ink-fg); }
.navpill button[aria-current="page"] { background: var(--lime); color: var(--lime-ink); font-weight: 600; }
.navpill button[aria-current="page"]::before { content: "+"; font-weight: 700; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--hot); color: #fff; font: 600 11px/18px var(--f-mono); }
.top-right { display: flex; align-items: center; gap: 8px; }
.me { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.me b { font-weight: 600; font-size: 13px; display: block; line-height: 1.1; }
.me small { color: var(--muted); font-size: 11px; display: block; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--f-body); flex: none; color: var(--lime-ink); }

main { padding: 8px 24px 48px; max-width: 1480px; margin: 0 auto; }
.demo-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--lime); color: var(--lime-ink); border-radius: 999px; padding: 6px 8px 6px 16px; margin-bottom: 16px; font-weight: 500; }
.demo-bar select { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.page-head h1 { font-family: var(--f-display); font-weight: 600; letter-spacing: -.03em; font-size: clamp(34px, 4.4vw, 52px); letter-spacing: -.035em; line-height: 1; margin: 0; }
.page-head .muted { margin-top: 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools .input { width: 260px; max-width: 100%; border-radius: 999px; }

/* ---------- Panel tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.tile { position: relative; grid-column: span 4; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-shadow: var(--shadow); }
.tile.w8 { grid-column: span 8; } .tile.w6 { grid-column: span 6; } .tile.w12 { grid-column: span 12; }
.tile.ink { background: var(--ink); border-color: var(--ink-line); color: var(--ink-fg); }
.tile.ink .eyebrow, .tile.ink .muted, .tile.ink .kv span { color: var(--ink-muted); }
.tile::before, .tile::after { content: ""; position: absolute; width: 10px; height: 10px; border-color: var(--muted); opacity: .45; }
.tile::before { top: 10px; left: 10px; border-top: 1px solid; border-left: 1px solid; }
.tile::after { bottom: 10px; right: 10px; border-bottom: 1px solid; border-right: 1px solid; }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-head .eyebrow b { color: var(--fg); font-weight: 500; margin-right: 8px; }
.tile.ink .tile-head .eyebrow b { color: var(--ink-fg); }
.big { font-family: var(--f-dot); font-weight: 800; font-size: clamp(34px, 3.6vw, 50px); line-height: 1; letter-spacing: .01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big .cur { font-family: var(--f-mono); font-size: 13px; font-weight: 500; color: var(--muted); margin-right: 6px; vertical-align: top; letter-spacing: .06em; }
.big.lime { color: var(--lime); } .big.hot { color: var(--hot); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.kv div { display: grid; gap: 2px; }
.kv span { font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kv b { font-family: var(--f-mono); font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--f-mono); font-size: 9px; fill: var(--muted); letter-spacing: .06em; }
.tile.ink .chart text { fill: var(--ink-muted); }
.d-off { fill: var(--dot-off); } .tile.ink .d-off { fill: rgba(238,242,236,.12); }
.d-a { fill: var(--lime); } .d-b { fill: var(--green); } .d-hot { fill: var(--hot); }
.ln { stroke: var(--muted); stroke-width: 1; fill: none; stroke-dasharray: 2 4; opacity: .6; }
.ring-wrap { position: relative; width: 170px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; }
.ring-wrap svg { width: 100%; height: 100%; }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; align-content: center; gap: 2px; }
.ring-center .big { font-size: 40px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.tlist { display: grid; gap: 2px; }
.trow { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.tile.ink .trow { border-color: var(--ink-line); }
.trow:last-child { border-bottom: 0; }
.trow span:first-child { min-width: 0; overflow-wrap: anywhere; }
.trow .mono { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.trow .mono.hot { color: var(--hot); }
.track { display: flex; align-items: flex-start; }
.track .st { flex: 1; display: grid; justify-items: center; gap: 6px; position: relative; text-align: center; font-size: 11.5px; color: var(--muted); }
.track .st::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; border-top: 1px dashed var(--line); z-index: 0; }
.track .st:first-child::before { display: none; }
.track .st b { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 500 12px var(--f-mono); border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
.track .st.on b { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.track .st.won b { background: var(--green); border-color: var(--green); color: #04201a; }
.track .st.lost b { border-color: var(--hot); color: var(--hot); }
.empty-note { color: var(--muted); font-size: 13px; }

/* ---------- Filters ---------- */
.filters { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--ink); border: 1px solid var(--ink-line); margin-bottom: 14px; max-width: 100%; }
.fbtn { border: 0; background: transparent; color: var(--ink-muted); border-radius: 999px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.fbtn b { min-width: 20px; height: 20px; border-radius: 999px; background: var(--ink-2); color: var(--ink-fg); font: 500 11px/20px var(--f-mono); padding: 0 5px; }
.fbtn[aria-pressed="true"] { background: var(--lime); color: var(--lime-ink); }
.fbtn[aria-pressed="true"] b { background: var(--lime-ink); color: var(--lime); }

/* ---------- Paper workspace (list + detail) ---------- */
.paper { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; background: var(--paper); color: var(--paper-fg); border-radius: 28px; padding: 16px; min-height: 60vh; box-shadow: var(--shadow); }
.plist { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-height: 78vh; overflow-y: auto; padding: 4px; }
.plist-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 8px 10px; font-weight: 600; }
.plist-head span { font: 12px var(--f-mono); color: var(--paper-muted); }
.prow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 18px; border: 0; background: transparent; text-align: left; color: var(--paper-fg); width: 100%; }
.prow:hover { background: var(--paper-2); }
.prow[aria-current="true"] { background: var(--ink); color: var(--ink-fg); }
.prow .t { font-weight: 600; overflow-wrap: anywhere; line-height: 1.2; }
.prow .s { font-size: 12px; color: var(--paper-muted); }
.prow[aria-current="true"] .s { color: var(--ink-muted); }
.prow .v { font-family: var(--f-mono); font-size: 13px; text-align: right; display: grid; gap: 4px; justify-items: end; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--paper-line); border-radius: 999px; padding: 1px 9px; font: 500 11px var(--f-body); color: var(--paper-muted); white-space: nowrap; }
.prow[aria-current="true"] .tag { border-color: var(--ink-fg); background: var(--ink-fg); color: var(--ink); }
.tag.won { border-color: var(--green); color: #03624c; } .tag.lost { border-color: var(--hot); color: var(--hot); }
.tag.late { border-color: var(--hot); background: var(--hot); color: #fff; }
.plist .empty-note { padding: 20px 12px; color: var(--paper-muted); }

/* Black detail card */
.detail { background: var(--ink); color: var(--ink-fg); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail .muted, .detail .eyebrow { color: var(--ink-muted); }
.d-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: start; }
.d-top h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(24px, 2.6vw, 34px); letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 2px; overflow-wrap: anywhere; }
.d-owner { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.d-owner small { display: block; color: var(--ink-muted); font-size: 11.5px; }
.pill { display: inline-flex; align-items: center; border: 1px solid var(--ink-line); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.won { border-color: var(--green); color: var(--green); } .pill.lost { border-color: var(--hot); color: var(--hot); }
.d-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.d-card { border: 1px solid var(--ink-line); background: rgba(255,255,255,.02); border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 14px; min-width: 0; }
.d-card b { font-family: var(--f-mono); font-weight: 500; font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.d-card b .cur { font-size: 11px; color: var(--ink-muted); margin-right: 4px; }
.d-card span { font-size: 12px; color: var(--ink-muted); display: flex; justify-content: space-between; gap: 6px; }
.d-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; background: var(--ink-2); border-radius: 20px; padding: 12px 12px 12px 18px; }
.d-bar .kv span { color: var(--ink-muted); }
.d-bar .kv b { font-size: 17px; }
.d-bar .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.d-bar .btn:not(.lime) { background: transparent; border-color: var(--ink-line); color: var(--ink-fg); }
.stages { display: flex; gap: 3px; flex-wrap: wrap; }
.stages button { flex: 1 1 80px; border: 0; border-radius: 8px; padding: 7px 4px; background: var(--ink-2); color: var(--ink-muted); font-size: 11.5px; }
.stages button.past { color: var(--lime); }
.stages button.cur { background: var(--lime); color: var(--lime-ink); font-weight: 600; }
.stages button.cur.won { background: var(--green); color: var(--lime-ink); }
.stages button.cur.lost { background: var(--hot); color: #fff; }
.stages button:disabled { cursor: default; }
.d-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ink-line); }
.d-tabs button { border: 0; background: none; color: var(--ink-muted); padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.d-tabs button[aria-selected="true"] { color: var(--ink-fg); border-color: var(--lime); }
.detail .input, .detail select.input, .detail textarea.input { background: var(--ink-2); border-color: var(--ink-line); color: var(--ink-fg); }
.detail .input:disabled { opacity: .75; }
.form-sec h4 { margin: 0 0 10px; font: 500 11px var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--lime); }
.form-sec + .form-sec { margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-muted); }
textarea.tall { min-height: 160px; }
.calc { margin-top: 10px; font-size: 13px; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.calc b { color: var(--lime); font-family: var(--f-mono); font-weight: 500; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.row-actions .spacer { flex: 1; }
.logform { display: grid; gap: 8px; border: 1px solid var(--ink-line); border-radius: var(--r-md); padding: 12px; }
.logrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.timeline { display: grid; margin-top: 14px; }
.tl { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.tl::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; border-left: 1px dashed var(--ink-line); }
.tl:last-child::before { display: none; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ink-line); display: grid; place-items: center; font: 11px var(--f-mono); color: var(--ink-muted); }
.tl.pending .tl-dot { border-color: var(--lime); color: var(--lime); }
.tl.stage .tl-dot { background: var(--ink-2); color: var(--green); border-color: var(--green); }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--ink-muted); }
.tl-head b { color: var(--ink-fg); font-weight: 600; }
.tl-head .tools { margin-left: auto; }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.chip { border-radius: 999px; padding: 1px 8px; font-size: 11px; border: 1px solid var(--lime); color: var(--lime); }
.chip.late { border-color: var(--hot); color: var(--hot); }
.tpl-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tpl-tabs .btn { background: transparent; border-color: var(--ink-line); color: var(--ink-fg); }
.tpl-tabs .btn[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.tpl { border: 1px solid var(--ink-line); border-radius: var(--r-md); padding: 14px; }
.tpl-subj { font-weight: 600; margin-bottom: 8px; overflow-wrap: anywhere; }
.tpl-body { white-space: pre-wrap; font-size: 13.5px; overflow-wrap: anywhere; color: var(--ink-fg); }
.detail-empty { margin: auto; text-align: center; color: var(--ink-muted); display: grid; gap: 10px; justify-items: center; padding: 40px 10px; }
.detail-empty .big { color: var(--lime); font-size: 44px; }

/* ---------- Board ---------- */
.board-wrap { overflow-x: auto; margin-inline: -24px; padding: 0 24px 12px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; min-height: 60vh; }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; min-width: 0; }
.col.drop { outline: 2px dashed var(--lime); outline-offset: -3px; }
.col-head { padding: 14px 14px 10px; display: grid; gap: 2px; }
.col-head b { display: flex; justify-content: space-between; font-weight: 600; }
.col-head b span { font: 12px var(--f-mono); color: var(--muted); }
.col-head small { font: 12px var(--f-mono); color: var(--muted); }
.col-body { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kcard { background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; cursor: grab; text-align: left; }
.kcard:hover { border-color: var(--muted); }
.kcard .t { font-weight: 600; overflow-wrap: anywhere; }
.kcard .s { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.kcard .r { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; font: 12px var(--f-mono); }
.kcard .promo { color: var(--accent-text); }
.kcard .late { color: var(--hot); }

/* ---------- Agenda + users ---------- */
.agenda { display: grid; gap: 20px; max-width: 900px; }
.agenda h2 { margin: 0 0 8px; font: 500 11px var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); display: flex; gap: 8px; }
.agenda h2.hot { color: var(--hot); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.task:last-child { border-bottom: 0; }
.task input { width: 18px; height: 18px; accent-color: var(--lime); margin-top: 2px; }
.task .meta { font-size: 12.5px; color: var(--muted); }
.task .meta a { color: inherit; text-decoration: underline; cursor: pointer; }
.task .when { font: 12px var(--f-mono); color: var(--muted); white-space: nowrap; }
.task .when.hot { color: var(--hot); }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }
.empty strong { display: block; color: var(--fg); font-family: var(--f-display); font-size: 20px; margin-bottom: 4px; }
.users { display: grid; gap: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 500 11px var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td .who { display: flex; gap: 10px; align-items: center; }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; }
.yes { color: var(--green); font-weight: 600; } .no { color: var(--muted); }
.help { padding: 16px 18px; display: grid; gap: 6px; }
.help ol { margin: 0; padding-left: 20px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 90; background: var(--lime); color: var(--lime-ink); font-weight: 600; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
#toast.err { background: var(--hot); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tile, .tile.w6 { grid-column: span 6; } .tile.w8, .tile.w12 { grid-column: span 12; }
  .paper { grid-template-columns: 1fr; }
  .plist { max-height: 46vh; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 24px 16px; }
  .auth-globe { width: 120%; right: -45%; }
  .top { padding: 10px 16px; }
  .navpill { order: 3; margin: 0; width: 100%; }
  .top-right { margin-left: auto; }
  .me div { display: none; }
  main { padding: 4px 16px 40px; }
  .tile, .tile.w6, .tile.w8 { grid-column: span 12; }
  .tools .input { width: 100%; }
  .paper { padding: 10px; border-radius: 22px; }
  .detail { padding: 16px; }
  .grid2, .logrow { grid-template-columns: 1fr; }
  .board-wrap { margin-inline: -16px; padding-inline: 16px; }
}
