/* Wayfinder by NorthStar
   Brand: deep navy ("night sky") + star gold. Light theme by default, dark via system or toggle. */

:root {
  --navy-950: #070c1c; --navy-900: #0c1430; --navy-800: #13204a; --navy-700: #1c2d63; --navy-600: #2a3f85;
  --gold-500: #f2b64b; --gold-400: #f6c76e; --gold-600: #d99a2b;

  --bg: #f5f6fa;
  --bg-grad: radial-gradient(1200px 400px at 100% -10%, #e9edfb 0%, transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e8ebf4;
  --border: #e2e5ef;
  --border-strong: #cbd1e1;
  --text: #0e1733;
  --text-2: #4c5675;
  --text-3: #8790aa;
  --primary: var(--navy-800);
  --primary-hover: var(--navy-700);
  --primary-text: #ffffff;
  --accent: #3550d4;
  --accent-soft: #e9edfd;
  --star: var(--gold-600);
  --danger: #d23f45;
  --focus: #4a65e8;
  --shadow-sm: 0 1px 2px rgba(14, 23, 51, .06);
  --shadow: 0 1px 2px rgba(14, 23, 51, .05), 0 6px 20px rgba(14, 23, 51, .06);
  --shadow-lg: 0 12px 48px rgba(7, 12, 28, .18);
  --topbar-bg: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  --topbar-text: #dfe5f8;
  --topbar-muted: #9aa6cc;
  --topbar-hover: rgba(255, 255, 255, .08);
  --radius: 10px;

  --s-todo: #687089;       --s-todo-bg: #eceef4;
  --s-in_progress: #2f53d6; --s-in_progress-bg: #e6ecfd;
  --s-blocked: #c9373d;     --s-blocked-bg: #fce8e9;
  --s-in_review: #7d45bd;   --s-in_review-bg: #f2e9fb;
  --s-done: #1d8155;        --s-done-bg: #e1f4ea;
  --p-critical: #d23f45; --p-high: #e26a17; --p-medium: #c99400; --p-low: #8790aa;
  color-scheme: light;
}

/* dark tokens — applied by system preference (unless forced light) or by the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070c1c;
    --bg-grad: radial-gradient(1000px 420px at 100% -10%, rgba(242, 182, 75, .07) 0%, transparent 60%), radial-gradient(900px 500px at -10% 0%, rgba(53, 80, 212, .12) 0%, transparent 60%);
    --surface: #0f1730; --surface-2: #151f3d; --surface-3: #1c2850;
    --border: #1f2a4c; --border-strong: #2e3c69;
    --text: #e7ebf8; --text-2: #a2acc9; --text-3: #6b7699;
    --primary: var(--gold-500); --primary-hover: var(--gold-400); --primary-text: #1a1205;
    --accent: #8ea3ff; --accent-soft: #1a2552; --star: var(--gold-500); --danger: #f2696f; --focus: #8ea3ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 16px 56px rgba(0,0,0,.6);
    --topbar-bg: linear-gradient(180deg, #060a18, #0a1126); --topbar-text: #e7ebf8; --topbar-muted: #8f9bc2; --topbar-hover: rgba(255,255,255,.06);
    --s-todo: #a2acc9; --s-todo-bg: #1c2645;
    --s-in_progress: #8ea3ff; --s-in_progress-bg: #1a2552;
    --s-blocked: #f48e92; --s-blocked-bg: #3a1a22;
    --s-in_review: #c6a0f2; --s-in_review-bg: #2c1f48;
    --s-done: #5fd19b; --s-done-bg: #11352a;
    --p-critical: #f2696f; --p-high: #f59a55; --p-medium: #e8c04a; --p-low: #6b7699;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070c1c;
  --bg-grad: radial-gradient(1000px 420px at 100% -10%, rgba(242, 182, 75, .07) 0%, transparent 60%), radial-gradient(900px 500px at -10% 0%, rgba(53, 80, 212, .12) 0%, transparent 60%);
  --surface: #0f1730; --surface-2: #151f3d; --surface-3: #1c2850;
  --border: #1f2a4c; --border-strong: #2e3c69;
  --text: #e7ebf8; --text-2: #a2acc9; --text-3: #6b7699;
  --primary: var(--gold-500); --primary-hover: var(--gold-400); --primary-text: #1a1205;
  --accent: #8ea3ff; --accent-soft: #1a2552; --star: var(--gold-500); --danger: #f2696f; --focus: #8ea3ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 16px 56px rgba(0,0,0,.6);
  --topbar-bg: linear-gradient(180deg, #060a18, #0a1126); --topbar-text: #e7ebf8; --topbar-muted: #8f9bc2; --topbar-hover: rgba(255,255,255,.06);
  --s-todo: #a2acc9; --s-todo-bg: #1c2645;
  --s-in_progress: #8ea3ff; --s-in_progress-bg: #1a2552;
  --s-blocked: #f48e92; --s-blocked-bg: #3a1a22;
  --s-in_review: #c6a0f2; --s-in_review-bg: #2c1f48;
  --s-done: #5fd19b; --s-done-bg: #11352a;
  --p-critical: #f2696f; --p-high: #f59a55; --p-medium: #e8c04a; --p-low: #6b7699;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-grad), var(--bg); background-attachment: fixed; color: var(--text);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
::selection { background: color-mix(in srgb, var(--gold-500) 35%, transparent); }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }

/* ---------- logo ---------- */
.logo { display: block; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--topbar-text); }
.brand:hover { text-decoration: none; }
.brand-text { display: grid; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand-sub { font-size: 9.5px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-500); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus, .select:focus, textarea:focus, .seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, .select, textarea.input {
  height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); min-width: 0;
  transition: border-color .12s;
}
.input:hover, .select:hover { border-color: var(--text-3); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; }
textarea.prompt-input { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.select { padding-right: 6px; }
input[type="color"].input { padding: 2px; width: 44px; cursor: pointer; }
label.field, div.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-weight: 400; color: var(--text-3); }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 22px;
  background: var(--topbar-bg); color: var(--topbar-text); border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav { display: flex; gap: 2px; }
.nav a { padding: 6px 11px; border-radius: 7px; white-space: nowrap; color: var(--topbar-muted); font-weight: 500; }
.nav a:hover { background: var(--topbar-hover); text-decoration: none; color: var(--topbar-text); }
.nav a.current { color: var(--topbar-text); background: rgba(255,255,255,.1); box-shadow: inset 0 -2px 0 var(--gold-500); }
.who { color: var(--topbar-muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.topbar .btn.ghost { color: var(--topbar-muted); }
.topbar .btn.ghost:hover { background: var(--topbar-hover); color: var(--topbar-text); }
.icon-btn { width: 32px; padding: 0; }
main { padding: 22px; max-width: 1560px; margin: 0 auto; }
.page-narrow { max-width: 880px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.card h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.01em; }
.card > p.muted { margin: 0 0 16px; }
h1 { font-size: 22px; margin: 0 0 18px; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-3); font-size: 13px; padding-bottom: 3px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; overflow: hidden;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 28% 72%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 44% 30%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 63% 84%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 78% 22%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(1px 1px at 88% 58%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 6% 88%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(1.3px 1.3px at 55% 8%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(242,182,75,.16), transparent 70%),
    radial-gradient(900px 600px at 50% -20%, #1c2d63, transparent 70%),
    #070c1c;
}
.login { width: 100%; max-width: 380px; padding: 30px; box-shadow: var(--shadow-lg); border-color: transparent; }
.login-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.login-brand .brand-name { font-size: 22px; color: var(--text); }
.login-brand .brand-sub { color: var(--star); font-size: 10.5px; }
.login form { display: grid; gap: 14px; }
.login .btn.primary { height: 38px; }
.login-foot { text-align: center; margin: 16px 0 0; font-size: 12.5px; }
.login-theme { position: absolute; top: 16px; right: 16px; }
.login-theme .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: #dfe5f8; box-shadow: none; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- toolbar ---------- */
.presets { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.preset { padding: 5px 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2); font-weight: 500; transition: all .12s; }
.preset:hover { color: var(--text); border-color: var(--border-strong); }
.preset.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.search { position: relative; width: 250px; }
.search .input { width: 100%; padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.filter-btn.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
.filter-btn .caret { opacity: .55; font-size: 9px; }
.pop-anchor { position: relative; }
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 210px; max-height: 380px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.popover.right { left: auto; right: 0; }
.popover .opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.popover .opt:hover { background: var(--surface-2); }
.popover .opt input { margin: 0; accent-color: var(--accent); }
.popover .sep { height: 1px; background: var(--border); margin: 6px 0; }
.popover .pad { padding: 6px 8px; display: grid; gap: 8px; }
.popover .title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 4px 8px; font-weight: 600; }
.result-meta { color: var(--text-2); font-size: 13px; margin: 0 0 10px; display: flex; gap: 12px; align-items: center; }

/* ---------- pills ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  color: var(--sc); background: var(--sbg); border: 0; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
select.status { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 11px; }
select.status option { color: var(--text); background: var(--surface); }
.status[data-s="todo"] { --sc: var(--s-todo); --sbg: var(--s-todo-bg); }
.status[data-s="in_progress"] { --sc: var(--s-in_progress); --sbg: var(--s-in_progress-bg); }
.status[data-s="blocked"] { --sc: var(--s-blocked); --sbg: var(--s-blocked-bg); }
.status[data-s="in_review"] { --sc: var(--s-in_review); --sbg: var(--s-in_review-bg); }
.status[data-s="done"] { --sc: var(--s-done); --sbg: var(--s-done-bg); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-transform: capitalize; white-space: nowrap; }
.prio-bars { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 12px; }
.prio-bars i { width: 3px; border-radius: 1px; background: var(--border-strong); }
.prio-bars i:nth-child(1) { height: 5px; } .prio-bars i:nth-child(2) { height: 8px; } .prio-bars i:nth-child(3) { height: 12px; }
.prio[data-p="critical"] { color: var(--p-critical); font-weight: 650; --pc: var(--p-critical); }
.prio[data-p="high"] { --pc: var(--p-high); } .prio[data-p="medium"] { --pc: var(--p-medium); } .prio[data-p="low"] { --pc: var(--p-low); }
.prio[data-p="critical"] i, .prio[data-p="high"] i, .prio[data-p="medium"] i:nth-child(-n+2), .prio[data-p="low"] i:nth-child(1) { background: var(--pc); }
.size { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--border-strong); font-size: 11px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  color: color-mix(in srgb, var(--tag) 85%, var(--text)); background: color-mix(in srgb, var(--tag) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag) 22%, transparent); white-space: nowrap;
}
.tag button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; opacity: .7; font-size: 13px; line-height: 1; }
.tag button:hover { opacity: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tag); flex: none; }
.context-chip { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 650; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.prompt-chip { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 650; color: var(--star); background: color-mix(in srgb, var(--gold-500) 14%, transparent); border: 1px solid color-mix(in srgb, var(--gold-500) 30%, transparent); }
.avatar {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: #fff; background: var(--av, #888); flex: none; box-shadow: 0 0 0 2px var(--surface);
}
.person { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

/* ---------- table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
table.tasks { width: 100%; border-collapse: collapse; }
table.tasks th {
  text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; background: var(--surface-2);
}
table.tasks th.sortable { cursor: pointer; }
table.tasks th.sortable:hover { color: var(--text); }
table.tasks td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tasks tr:last-child td { border-bottom: 0; }
table.tasks tbody tr { cursor: pointer; transition: background .08s; }
table.tasks tbody tr:hover { background: var(--surface-2); }
table.tasks tbody tr.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.task-id { color: var(--text-3); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-title { font-weight: 550; color: var(--text); }
a.task-title:hover { text-decoration: none; color: var(--accent); }
.task-title-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 280px; }
tr.is-done .task-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.date { white-space: nowrap; color: var(--text-2); font-size: 13px; }
.date.overdue { color: var(--danger); font-weight: 600; }
.empty { padding: 56px 16px; text-align: center; color: var(--text-2); }

/* ---------- cards view ---------- */
.lanes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.lane { background: color-mix(in srgb, var(--surface-2) 80%, transparent); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; min-height: 220px; max-height: calc(100vh - 240px); }
.lane.drop { border-color: var(--accent); background: var(--accent-soft); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 600; }
.lane-head .n { color: var(--text-3); font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; }
.lane-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 12px; overflow-y: auto; flex: 1; }
.lane-empty { color: var(--text-3); font-size: 12.5px; text-align: center; padding: 18px 8px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.tcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: pointer; display: grid; gap: 8px;
  box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; position: relative;
}
.tcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.tcard.dragging { opacity: .45; }
.tcard.is-done .task-title { text-decoration: line-through; color: var(--text-2); }
.tcard .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tcard .desc-snippet { color: var(--text-2); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .card-top { display: flex; align-items: flex-start; gap: 8px; }
.tcard .card-top .task-title { flex: 1; line-height: 1.35; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(7, 12, 28, .35); z-index: 40; backdrop-filter: blur(1px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(700px, 100vw); z-index: 41; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { overflow-y: auto; padding: 22px 26px 48px; flex: 1; }
.title-input { width: 100%; border: 1px solid transparent; background: transparent; font-size: 21px; font-weight: 700; letter-spacing: -.015em; padding: 4px 7px; margin-left: -8px; border-radius: 8px; }
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--focus); background: var(--surface); }
.props { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; align-items: center; margin: 16px 0 14px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.props > .k { color: var(--text-2); font-size: 13px; }
.props .select, .props .input { height: 30px; max-width: 280px; }
.tags-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: relative; }
.tags-editor input { height: 26px; width: 150px; }
.desc { width: 100%; min-height: 100px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.prompt-box { border: 1px solid color-mix(in srgb, var(--gold-500) 35%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--gold-500) 5%, var(--surface)); padding: 10px; display: grid; gap: 8px; }
.prompt-box textarea { width: 100%; min-height: 110px; background: var(--surface); }
.prompt-box .row { font-size: 12.5px; }
.context-box { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); padding: 10px; display: grid; gap: 8px; }
.context-box textarea { width: 100%; min-height: 110px; background: var(--surface); }
.context-box .row { font-size: 12.5px; }
.context-box .row b { color: var(--text); font-weight: 600; }

.timeline { display: grid; gap: 0; position: relative; }
.ev { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); position: relative; }
.ev:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 30px; bottom: -6px; width: 2px; background: var(--border); }
.ev b { color: var(--text); font-weight: 600; }
.ev .when { color: var(--text-3); font-size: 12px; margin-left: 6px; }
.via { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: color-mix(in srgb, var(--gold-500) 18%, transparent); color: var(--star); margin-left: 6px; vertical-align: 1px; letter-spacing: .05em; }
.ev-icon { width: 24px; height: 24px; display: grid; place-items: center; position: relative; z-index: 1; }
.comment { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; margin-top: 6px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.comment-box { display: grid; gap: 8px; margin-top: 14px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(7, 12, 28, .45); backdrop-filter: blur(2px); display: grid; place-items: start center; padding: 7vh 16px 16px; overflow: auto; animation: fade .15s; }
.modal { width: 100%; max-width: 660px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .15s ease-out; }
.modal-head { padding: 18px 22px 0; font-weight: 700; font-size: 17px; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 16px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ---------- account / admin / tags ---------- */
.list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.token-reveal { background: var(--s-done-bg); border: 1px solid color-mix(in srgb, var(--s-done) 40%, transparent); border-radius: var(--radius); padding: 12px; margin: 12px 0; display: grid; gap: 8px; }
.token-reveal code { word-break: break-all; font-size: 13px; }
pre.snippet { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 6px 0 14px; white-space: pre; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tag-name-input { height: 28px; width: 180px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; }
.toast { background: var(--navy-900); color: #fff; padding: 9px 15px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; animation: pop .15s ease-out; border: 1px solid rgba(255,255,255,.08); }
.toast::before { content: "✦ "; color: var(--gold-500); }
.toast.err { background: var(--danger); }
.toast.err::before { content: ""; }

@media (max-width: 760px) {
  main { padding: 14px 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-text, .who-name { display: none; }
  .nav a { padding: 6px 8px; }
  .search { width: 100%; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .props { grid-template-columns: 88px 1fr; }
  .drawer-body { padding: 16px; }
  .hide-sm { display: none; }
  .lanes { grid-auto-columns: minmax(250px, 85vw); }
}

/* tag suggestions + selected card */
.tags-editor .popover { top: calc(100% + 4px); min-width: 220px; }
.popover .opt.active { background: var(--accent-soft); color: var(--accent); }
.tcard.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* tasks page header */
.tasks-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tasks-title { display: flex; align-items: baseline; gap: 12px; }
.tasks-title h1 { margin: 0; }
.tasks-title .result-meta { margin: 0; }

/* OAuth consent page */
.login.oauth { max-width: 440px; }
.oauth-title { font-size: 18px; margin: 0 0 8px; text-align: center; font-weight: 600; letter-spacing: -.01em; }
.oauth-title b { font-weight: 750; }
.oauth .muted { text-align: center; margin: 0 0 18px; }
.oauth-form { display: grid; gap: 10px; }
.oauth-choice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.oauth-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.oauth-choice input { margin-top: 3px; accent-color: var(--accent); }
.oauth-form .faint { font-size: 12.5px; margin: 4px 0; }
.oauth-form .btn { height: 38px; }
.oauth-host { text-align: center; }

/* account: advanced section */
details.advanced { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
details.advanced[open] summary { margin-bottom: 8px; }

.prio[data-p="none"] { color: var(--text-3); text-transform: none; }
