/* Tonimus Projects. Colours follow the data-viz reference palette:
   chart ink/surfaces from its chrome table; status, priority and project
   colours validated with validate_palette.js (light + dark). */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --sunken: #ebeae5;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.05);
  --shadow-lg: 0 12px 48px rgba(11, 11, 11, 0.18);
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #e4effc;
  --danger: #b42323;
  --danger-soft: #fbe9e9;
  --ok-text: #006300;

  /* item status (validated set: blue / yellow / magenta / green) */
  --st-open: #2a78d6;
  --st-in_progress: #eda100;
  --st-blocked: #e87ba4;
  --st-done: #008300;
  /* priority: ordinal blue ramp, steps 600 / 400 / 250 */
  --pr-high: #184f95;
  --pr-medium: #3987e5;
  --pr-low: #86b6ef;
  /* project identity: categorical slots in fixed order */
  --slot-0: #2a78d6; --slot-1: #eb6834; --slot-2: #1baf7a; --slot-3: #eda100;
  --slot-4: #e87ba4; --slot-5: #008300; --slot-6: #4a3aa7; --slot-7: #e34948;

  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --sunken: #121211;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
    --border: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
    --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: #16273d;
    --danger: #e66767; --danger-soft: #3a1c1c; --ok-text: #0ca30c;
    --st-open: #3987e5; --st-in_progress: #c98500; --st-blocked: #d55181; --st-done: #008300;
    --pr-high: #9ec5f4; --pr-medium: #5598e7; --pr-low: #1c5cab;
    --slot-0: #3987e5; --slot-1: #d95926; --slot-2: #199e70; --slot-3: #c98500;
    --slot-4: #d55181; --slot-5: #008300; --slot-6: #9085e9; --slot-7: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #222220; --sunken: #121211;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #898781; --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: #16273d;
  --danger: #e66767; --danger-soft: #3a1c1c; --ok-text: #0ca30c;
  --st-open: #3987e5; --st-in_progress: #c98500; --st-blocked: #d55181; --st-done: #008300;
  --pr-high: #9ec5f4; --pr-medium: #5598e7; --pr-low: #1c5cab;
  --slot-0: #3987e5; --slot-1: #d95926; --slot-2: #199e70; --slot-3: #c98500;
  --slot-4: #d55181; --slot-5: #008300; --slot-6: #9085e9; --slot-7: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text-2); font-weight: 600; }
.muted { color: var(--muted); }
.secondary { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- boot / auth ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.boot-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.92); } }
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--page);
}
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 36px 32px; text-align: center;
}
.auth-card .logo { margin: 0 auto 18px; width: 56px; height: 56px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card p { color: var(--text-2); margin: 0 0 24px; }
.auth-card .btn { width: 100%; justify-content: center; height: 44px; font-size: 15px; }
.auth-card .error { color: var(--danger); margin-top: 14px; min-height: 20px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 15px; }
.brand img { width: 28px; height: 28px; }
.nav-label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-link .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-icon { width: 16px; height: 16px; flex: none; opacity: 0.8; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 12px;
}
.avatar.agent { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-strong); }
.sidebar-foot .who { line-height: 1.2; min-width: 0; }
.sidebar-foot .who div:first-child { font-weight: 600; }
.sidebar-foot .who div:last-child { font-size: 12px; color: var(--muted); }
.sidebar-foot .icon-btn:first-of-type { margin-left: auto; }

.main { min-width: 0; padding: 28px 36px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 760px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
input[type="text"], input[type="search"], input[type="date"], select, textarea {
  height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; min-width: 0;
}
textarea { height: auto; padding: 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label.field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- cards & KPIs ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--border-strong); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 220px; }
.chart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.chart-table th, .chart-table td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: right; font-variant-numeric: tabular-nums; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.empty-chart { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; }

/* ---------- project cards ---------- */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.project-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.project-card:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.project-card .title { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.project-card .title .key { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; }
.project-card .stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.project-card .stats b { color: var(--text); font-size: 16px; display: block; font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 4px; background: var(--st-done); }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pill-color, var(--muted)); }
.pill.st-open { --pill-color: var(--st-open); }
.pill.st-in_progress { --pill-color: var(--st-in_progress); }
.pill.st-blocked { --pill-color: var(--st-blocked); }
.pill.st-done { --pill-color: var(--st-done); }
.pill.pr-high { --pill-color: var(--pr-high); color: var(--text); }
.pill.pr-medium { --pill-color: var(--pr-medium); }
.pill.pr-low { --pill-color: var(--pr-low); }
.pill.overdue { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pill.overdue::before { background: var(--danger); }
.pill.agent-tag::before { display: none; }
/* pick-up state: icon-free text pills, colour is secondary to the words */
.pill.pickup-wait { color: var(--text); border-color: color-mix(in srgb, var(--st-in_progress) 55%, transparent); }
.pill.pickup-wait::before { background: var(--st-in_progress); }
.pill.pickup-ok { color: var(--ok-text); }
.pill.pickup-ok::before { background: var(--st-done); }
.owner-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.pickup-line { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.pickup-line.wait { background: color-mix(in srgb, var(--st-in_progress) 14%, var(--surface)); }
.pickup-line.ok { background: color-mix(in srgb, var(--st-done) 12%, var(--surface)); color: var(--ok-text); }
.pickup-line .btn { margin-left: auto; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input[type="search"] { width: 240px; }
.seg { display: inline-flex; background: var(--sunken); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 6px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 10px; border-radius: 15px; border: 1px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; cursor: pointer; color: var(--text-2);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- item table ---------- */
.table-card { padding: 0; overflow: hidden; }
table.items { width: 100%; border-collapse: collapse; }
table.items th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  font-weight: 650; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
table.items td { padding: 11px 14px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.items tr:last-child td { border-bottom: 0; }
table.items tbody tr { cursor: pointer; }
table.items tbody tr:hover { background: var(--surface-2); }
table.items .ref { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.items .title-cell { font-weight: 600; }
table.items .title-cell .sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
table.items tr.done .title-cell { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--axis); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; }
.column { background: var(--sunken); border-radius: var(--radius); padding: 10px; min-height: 160px; border: 2px solid transparent; }
.column.drop { border-color: var(--accent); background: var(--accent-soft); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 650; font-size: 13px; }
.column-head .count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.bcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: grab; display: grid; gap: 8px;
}
.bcard:hover { border-color: var(--border-strong); }
.bcard.dragging { opacity: 0.4; }
.bcard .t { font-weight: 600; }
.bcard .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.bcard .meta .grow { flex: 1; }

/* ---------- drawer (item detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.32); z-index: 40; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); z-index: 41; background: var(--surface);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide 0.18s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-head .ref { font-weight: 650; color: var(--text-2); }
.drawer-head .grow { flex: 1; }
.drawer-body { overflow-y: auto; padding: 20px 24px 32px; display: grid; gap: 20px; }
.title-input { font-size: 20px; font-weight: 650; border: 1px solid transparent !important; padding: 4px 8px !important; margin-left: -8px; height: auto !important; width: calc(100% + 8px); background: transparent !important; }
.title-input:hover { border-color: var(--border-strong) !important; }
.props { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.props select, .props input { width: 100%; }
.desc-view { white-space: pre-wrap; word-wrap: break-word; color: var(--text); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 44px; cursor: text; }
.desc-view.placeholder { color: var(--muted); }
.section-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.comment { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; }
.comment + .comment { border-top: 1px solid var(--grid); }
.comment .head { display: flex; gap: 8px; align-items: baseline; }
.comment .head b { font-weight: 650; }
.comment .head span { font-size: 12px; color: var(--muted); }
.comment .body { white-space: pre-wrap; word-wrap: break-word; margin-top: 2px; }
.composer { display: grid; gap: 8px; margin-top: 8px; }
.composer .row { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.composer .row .muted { margin-right: auto; font-size: 12px; }
.history { display: grid; gap: 6px; font-size: 12px; color: var(--text-2); }
.history .when { color: var(--muted); }

/* ---------- activity feed ---------- */
.feed { display: grid; gap: 0; }
.feed-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 9px 0; align-items: start; border-bottom: 1px solid var(--grid); cursor: pointer; }
.feed-row:last-child { border-bottom: 0; }
.feed-row .what { color: var(--text-2); }
.feed-row .what b { color: var(--text); font-weight: 600; }
.feed-row .excerpt { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.feed-row .when { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- modal ---------- */
.modal {
  position: fixed; z-index: 41; top: 10vh; left: 50%; transform: translateX(-50%); width: min(620px, calc(100vw - 32px));
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px 24px; animation: fade 0.15s;
  max-height: 80vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.secret-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--sunken); padding: 10px 12px;
  border-radius: var(--radius-sm); word-break: break-all; margin: 8px 0;
}

/* ---------- admin tables ---------- */
table.plain { width: 100%; border-collapse: collapse; }
table.plain th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.plain td { padding: 10px; border-bottom: 1px solid var(--grid); }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--page); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 60;
  transition: opacity 0.2s, transform 0.2s; box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #fff; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 20px 16px 48px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .props, .form-grid { grid-template-columns: 1fr 1fr; }
  table.items .hide-sm { display: none; }
}
@media (forced-colors: active) {
  .pill::before, .dot { forced-color-adjust: none; }
}

.grid-2 > *, .grid-3 > *, .kpis > * { min-width: 0; }

/* ---------- needs your attention (TONI-1) ---------- */
:root { --attn: #d03b3b; --attn-soft: rgba(208, 59, 59, 0.08); }
:root[data-theme="dark"] { --attn-soft: rgba(208, 59, 59, 0.16); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --attn-soft: rgba(208, 59, 59, 0.16); } }
.attn-card { border: 1px solid color-mix(in srgb, var(--attn) 45%, transparent); background: linear-gradient(0deg, var(--attn-soft), var(--attn-soft)), var(--surface); margin-bottom: 18px; animation: attn-glow 2.4s ease-in-out infinite; }
@keyframes attn-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(208, 59, 59, 0); } 50% { box-shadow: 0 0 0 6px rgba(208, 59, 59, 0.18); } }
.attn-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.attn-head h2 { color: var(--attn); font-size: 16px; }
.attn-head .btn { margin-left: auto; }
.attn-beacon { width: 12px; height: 12px; border-radius: 50%; background: var(--attn); animation: attn-blink 1.2s ease-in-out infinite; flex: none; }
@keyframes attn-blink { 50% { opacity: 0.25; transform: scale(0.8); } }
.attn-list { display: grid; gap: 8px; }
.attn-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.attn-row:hover { border-color: color-mix(in srgb, var(--attn) 50%, transparent); }
.attn-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.attn-title { font-weight: 650; }
.attn-title .ref { color: var(--muted); font-size: 12px; margin-right: 4px; }
.attn-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.attn-comment { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-go { color: var(--muted); font-size: 22px; line-height: 1; }
.pill.attn-blocked { --pill-color: var(--attn); color: var(--attn); border-color: color-mix(in srgb, var(--attn) 40%, transparent); }
.pill.attn-yours { --pill-color: var(--accent); color: var(--text); }
.attn-clear { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 12px 18px; }
.attn-ok-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st-done); }
/* the menu item lights up and pulses while anything is waiting */
.nav-link.attn-live { color: var(--attn); font-weight: 650; background: var(--attn-soft); animation: attn-nav 1.6s ease-in-out infinite; }
.nav-link.attn-live .count { background: var(--attn); color: #fff; border-radius: 9px; padding: 0 7px; font-weight: 700; }
@keyframes attn-nav { 50% { background: color-mix(in srgb, var(--attn) 22%, transparent); } }
@media (prefers-reduced-motion: reduce) { .attn-card, .attn-beacon, .nav-link.attn-live { animation: none; } }

.swatches { display: flex; gap: 8px; margin-top: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px var(--surface); }
.swatch.on { border-color: var(--text); }

/* avatars (TONI-3): initials sit underneath, the image covers them once loaded */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.has-img { background: var(--surface-2); color: transparent; border-color: transparent; }
.owner-line { display: inline-flex; align-items: center; gap: 6px; }

/* resources (TONI-5) */
.res-list { display: grid; gap: 6px; margin-bottom: 10px; }
.res-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.res-icon { font-size: 16px; width: 22px; text-align: center; }
.res-main { flex: 1; min-width: 0; }
.res-title { font-weight: 600; color: var(--accent); word-break: break-word; }
.res-title:hover { text-decoration: underline; }
.res-meta { font-size: 12px; color: var(--muted); }
.res-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.res-add input[type="text"] { flex: 1; min-width: 180px; }
.res-note { font-size: 12px; margin-top: 6px; }
/* profile (TONI-6) */
.avatar-btn { border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }

/* ---------- my actions (TONI-9) ---------- */
.kpi-actions .label svg { width: 14px; height: 14px; }
.kpi-actions.has { border-color: color-mix(in srgb, var(--accent, var(--slot-0)) 55%, transparent); }
.kpi-actions.has .value { color: var(--accent, var(--slot-0)); }
.actions-list { padding: 6px; }
.walk-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, var(--surface)); }

/* ---------- full-page item (TONI-10) ---------- */
.item-page { padding: 0; overflow: visible; max-width: 1100px; margin: 0 auto; }
.item-page.drop { outline: 3px dashed var(--accent); outline-offset: 4px; }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 5; border-radius: var(--radius, 14px) var(--radius, 14px) 0 0; }
.item-head .ref { font-weight: 650; color: var(--text-2); }
.item-head .grow { flex: 1; }
.item-body { padding: 22px 28px 36px; display: grid; gap: 24px; }
.item-body .title-input { font-size: 22px; }

.action-box { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-radius: 12px; padding: 14px 18px; display: grid; gap: 8px; }
.action-box.mine { border-color: var(--attn, #c62828); background: color-mix(in srgb, var(--attn, #c62828) 7%, var(--surface)); }
.action-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.action-box.mine .action-label { color: var(--attn, #c62828); }
.action-text { font-size: 17px; font-weight: 600; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.action-box .row { display: flex; gap: 8px; justify-content: flex-end; }
.action-box textarea { width: 100%; }
.action-add { justify-self: start; color: var(--muted); }
.attn-action { margin-top: 6px; font-weight: 600; }

.item-page .comment { grid-template-columns: 36px 1fr; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-top: 12px; }
.item-page .comment + .comment { border-top: 1px solid var(--border); }
.item-page .comment .head { flex-wrap: wrap; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--grid); }
.item-page .comment .body { font-size: 15px; line-height: 1.55; margin-top: 4px; }
.comment .body a, .action-text a { color: var(--accent); text-decoration: underline; word-break: break-all; }

.res-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.res-add .btn.primary { order: -1; }
.viewer { width: min(980px, calc(100vw - 32px)); top: 5vh; max-height: 90vh; }
.viewer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.viewer-head h2 { margin: 0; font-size: 17px; word-break: break-word; }
.viewer-head .grow { flex: 1; }
.viewer-img { max-width: 100%; height: auto; display: block; margin: 0 auto; border-radius: 8px; }
.viewer-pre { white-space: pre-wrap; word-wrap: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--sunken, var(--surface-2)); padding: 12px 14px; border-radius: 8px; }
.viewer-md { font-size: 15px; line-height: 1.6; }
.viewer-md h2, .viewer-md h3, .viewer-md h4, .viewer-md h5 { margin: 18px 0 6px; }
.viewer-md p, .viewer-md ul, .viewer-md blockquote { margin: 0 0 10px; }
.viewer-md ul { padding-left: 22px; }
.viewer-md blockquote { border-left: 3px solid var(--border-strong, var(--border)); padding-left: 12px; color: var(--text-2); }
.viewer-md code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.viewer-md .md-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
@media (max-width: 760px) {
  .item-body { padding: 16px 14px 28px; }
  .item-head { padding: 10px 12px; }
  .viewer-md .md-row { grid-auto-flow: row; }
}
.btn.ghost { background: transparent; border: 1px dashed var(--border-strong, var(--border)); }
/* On a phone an item page is the whole screen; ‹ Back gets you out. */
@media (max-width: 760px) { .shell.route-i .sidebar { display: none; } .shell.route-i .main { padding-top: 12px; } }
/* PDF viewer (TONI-10) */
.pdf-viewer { width: min(1000px, calc(100vw - 32px)); }
.pdf-pages { display: grid; gap: 12px; justify-items: center; background: var(--sunken); padding: 12px; border-radius: 8px; }
.pdf-page { width: 100%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); display: flex; justify-content: center; }
.pdf-page canvas { display: block; max-width: 100%; height: auto; }
@media (max-width: 760px) {
  .modal.viewer { top: 0; left: 0; transform: none; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; padding: 12px; }
  .pdf-pages { padding: 6px; gap: 8px; }
  .viewer-head { flex-wrap: wrap; }
}
/* ---------- voting (TONI-11) ---------- */
.vote-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vote-buttons.compact { margin-top: 8px; gap: 6px; }
.vote-buttons .btn { min-width: 84px; font-weight: 700; }
.vote-buttons.compact .btn { min-width: 64px; }
.btn.vote-yes { background: var(--st-done); color: #fff; border-color: transparent; }
.btn.vote-no { background: var(--danger, #c62828); color: #fff; border-color: transparent; }
.btn.vote-later { background: var(--surface-2); }
.vote-bar { border: 2px solid var(--accent); border-radius: 12px; padding: 14px 18px; display: grid; gap: 10px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.vote-result { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; font-size: 15px; }
.vote-result .grow { flex: 1; }
.vote-result.vote-yes { background: color-mix(in srgb, var(--st-done) 14%, var(--surface)); color: var(--ok-text, inherit); }
.vote-result.vote-no { background: color-mix(in srgb, var(--danger, #c62828) 12%, var(--surface)); }
.vote-pill.vote-yes { background: color-mix(in srgb, var(--st-done) 18%, var(--surface)); }
.vote-pill.vote-no { background: color-mix(in srgb, var(--danger, #c62828) 16%, var(--surface)); }
.follow-lines { display: grid; gap: 2px; font-size: 13px; } .follow-line b { color: var(--text-2); } .vote-buttons input[type="date"] { height: 30px; }

/* Comment pages + jump to latest (2026-10-14) */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 4px; }
.pager .pager-info { margin-left: auto; font-size: 12px; }
.jump-latest { position: fixed; right: 24px; bottom: 24px; z-index: 50; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.jump-latest[hidden] { display: none; }
@media (max-width: 700px) { .jump-latest { right: 12px; bottom: 12px; } .pager .pager-info { margin-left: 0; width: 100%; } }

/* TONI-14: "What you need to do" box + markers */
.action-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-tags { display: inline-flex; gap: 6px; margin-left: auto; }
.pill.req { background: color-mix(in srgb, var(--attn, #c62828) 14%, var(--surface)); color: var(--attn, #c62828); border-color: transparent; font-weight: 650; }
.pill.opt { background: color-mix(in srgb, var(--muted) 14%, var(--surface)); color: var(--muted); border-color: transparent; font-weight: 650; }
.action-box .action-text { font-size: 17px; line-height: 1.45; font-weight: 550; }
.action-box .action-line { font-size: 14px; }
.action-box .action-where-text { font-weight: 600; }
.action-box .vote-buttons { margin: 4px 0; }
.action-box.missing { border-color: #b26a00; background: color-mix(in srgb, #f0a020 12%, var(--surface)); }
.action-box.missing .action-label { color: #8a5200; }
.action-box.editing .field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.action-box.editing input[type=text] { width: 100%; }
.action-box .check { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.attn-action .action-tags { margin-left: 0; margin-right: 4px; vertical-align: middle; }
.attn-missing { margin-top: 6px; font-weight: 600; color: #8a5200; background: color-mix(in srgb, #f0a020 12%, var(--surface)); border-radius: 8px; padding: 6px 10px; display: inline-block; }
.attn-fyi { margin-top: 18px; border-top: 1px solid var(--grid); padding-top: 12px; opacity: 0.85; }
.attn-fyi h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 4px; }
.attn-fyi-link { display: inline-block; margin-top: 10px; font-size: 13px; }
