/* ===== Tokens ===== */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #0f1729;
  --text-2: #3b4456;
  --muted: #6b7486;
  --shadow: 0 1px 2px rgba(15, 23, 41, .05), 0 4px 16px rgba(15, 23, 41, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 41, .18);

  --cto: #5b5bd6;
  --cto-soft: #eceefe;
  --eng: #0d9488;
  --eng-soft: #e3f6f3;
  --plan: #c2620a;
  --plan-soft: #fdf0e1;
  --review: #9142d6;
  --review-soft: #f4ebfd;

  --p0: #dc2626;
  --p1: #ea580c;
  --p2: #2563eb;
  --p3: #64748b;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --ok: #15803d;
  --ok-soft: #e6f6eb;
  --warn: #b45309;
  --warn-soft: #fdf3e2;

  --on-accent: #ffffff;
  --accent: var(--cto);
  --accent-soft: var(--cto-soft);

  --radius: 14px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 248px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d12;
    --surface: #12151c;
    --surface-2: #181c25;
    --surface-3: #212633;
    --border: #232835;
    --border-strong: #323949;
    --text: #e8ebf1;
    --text-2: #c3c9d4;
    --muted: #8b94a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
    --cto: #8b8cf5; --cto-soft: #1d1f3d;
    --eng: #2dd4bf; --eng-soft: #0f2d2a;
    --plan: #f59e0b; --plan-soft: #33240c;
    --review: #c084fc; --review-soft: #2a1a3d;
    --p0: #f87171; --p1: #fb923c; --p2: #60a5fa; --p3: #94a3b8;
    --danger: #f87171; --danger-soft: #3a1515;
    --ok: #4ade80; --ok-soft: #12301d;
    --warn: #fbbf24; --warn-soft: #33270c;
    --on-accent: #0b0d12;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-2: #181c25;
  --surface-3: #212633;
  --border: #232835;
  --border-strong: #323949;
  --text: #e8ebf1;
  --text-2: #c3c9d4;
  --muted: #8b94a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  --cto: #8b8cf5; --cto-soft: #1d1f3d;
  --eng: #2dd4bf; --eng-soft: #0f2d2a;
  --plan: #f59e0b; --plan-soft: #33240c;
  --review: #c084fc; --review-soft: #2a1a3d;
  --p0: #f87171; --p1: #fb923c; --p2: #60a5fa; --p3: #94a3b8;
  --danger: #f87171; --danger-soft: #3a1515;
  --ok: #4ade80; --ok-soft: #12301d;
  --warn: #fbbf24; --warn-soft: #33270c;
  --on-accent: #0b0d12;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #0d9488); color: #fff; font-weight: 800; font-size: 18px;
}

/* ===== Layout ===== */
.shell { min-height: 100vh; }
.main {
  max-width: 980px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom));
}
.sidebar { display: none; }
.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 550; position: relative;
}
.nav-item[aria-current="page"] { color: var(--text); }
.nav-item[aria-current="page"] .icon { color: var(--nav-color, var(--accent)); }
.nav-item .dot {
  position: absolute; top: 9px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 2px var(--surface);
}

.fab {
  position: fixed; z-index: 21; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  height: 52px; padding: 0 18px 0 16px; border-radius: 26px; border: 0;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-lg);
}
.fab:active { transform: scale(.97); }

@media (min-width: 960px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 20px 14px;
    background: var(--surface); border-right: 1px solid var(--border);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 700; font-size: 17px; }
  .side-link {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
    color: var(--text-2); text-decoration: none; font-weight: 550;
  }
  .side-link:hover { background: var(--surface-2); }
  .side-link[aria-current="page"] { background: var(--surface-2); color: var(--text); }
  .side-link[aria-current="page"] .icon { color: var(--nav-color, var(--accent)); }
  .side-link .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
  .side-foot { margin-top: auto; display: grid; gap: 8px; }
  .bottom-nav { display: none; }
  .shell { padding-left: var(--sidebar); }
  .main { padding: 32px 32px 64px; }
  .fab { bottom: 28px; right: 28px; }
  .hide-desktop { display: none !important; }
}
@media (max-width: 959px) { .hide-mobile { display: none !important; } }

/* ===== Page header ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* ===== Cards & sections ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.grid-2 { display: grid; gap: 12px; }
.grid-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 680px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Mode theming */
[data-mode="CTO"] { --accent: var(--cto); --accent-soft: var(--cto-soft); }
[data-mode="ENGINEER"] { --accent: var(--eng); --accent-soft: var(--eng-soft); }
[data-mode="PLAN"] { --accent: var(--plan); --accent-soft: var(--plan-soft); }
[data-mode="REVIEW"] { --accent: var(--review); --accent-soft: var(--review-soft); }

.mode-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; }
.mode-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.mode-card .task-title { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.mode-card .actions { margin-top: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip-mode { background: var(--accent-soft); color: var(--accent); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.prio { font-family: var(--mono); font-weight: 700; color: var(--on-accent); }
.prio-P0 { background: var(--p0); } .prio-P1 { background: var(--p1); }
.prio-P2 { background: var(--p2); } .prio-P3 { background: var(--p3); }

.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }

/* ===== Forms ===== */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 16px;
}
@media (min-width: 960px) { .input, .textarea, .select { font-size: 15px; } }
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 600px) { .form-grid { grid-template-columns: 1fr 1fr; } }

.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: 11px; border: 1px solid var(--border); max-width: 100%;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented.wide { display: grid; width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  white-space: nowrap; flex: none;
  height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 14px; font-weight: 600; color: var(--text-2);
}
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* ===== Task list ===== */
.task-list { display: grid; gap: 8px; }
.task-row {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%;
  padding: 12px 14px 12px 0; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
}
.task-row:hover { border-color: var(--border-strong); }
.task-row .bar { align-self: stretch; border-radius: 0 4px 4px 0; background: var(--p3); }
.task-row .bar.P0 { background: var(--p0); } .task-row .bar.P1 { background: var(--p1); }
.task-row .bar.P2 { background: var(--p2); }
.task-row .t { font-weight: 600; overflow-wrap: anywhere; }
.task-row .badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 200px; }
.task-row.done .t { text-decoration: line-through; color: var(--muted); }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 8px; }
.group-head h2 { font-size: 14px; }

.toolbar { display: grid; gap: 10px; margin-bottom: 8px; }
@media (min-width: 720px) { .toolbar { grid-template-columns: auto 1fr; align-items: center; } }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }
.scroll-x { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ===== Distribution bar ===== */
.dist { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.dist > i { display: block; height: 100%; }
.dist .cto { background: var(--cto); } .dist .eng { background: var(--eng); }
.dist .plan { background: var(--plan); } .dist .review { background: var(--review); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--text-2); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* ===== Stats ===== */
.stat { padding: 14px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }

/* ===== Focus ===== */
.focus-hero { text-align: center; padding: 28px 16px; position: relative; overflow: hidden; }
.focus-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 70%); pointer-events: none; }
.focus-hero > * { position: relative; }
.timer { font-size: clamp(48px, 14vw, 76px); font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; margin: 12px 0 8px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; max-width: 360px; margin: 12px auto 0; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 1s linear; }
.progress.over > i { background: var(--warn); }
.kv { display: grid; gap: 14px; }
.kv > div { display: grid; gap: 2px; }
.kv dt, .kv .k { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv dd { margin: 0; }
.first-action { border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--accent-soft); border-radius: 0 10px 10px 0; font-weight: 600; }
.proposal { display: grid; gap: 16px; }
.proposal-table { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.proposal-table dt { color: var(--muted); font-weight: 600; }
.proposal-table dd { margin: 0; font-weight: 600; }
.focus-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.focus-actions .btn-primary { grid-column: 1 / -1; }
@media (min-width: 680px) { .focus-actions { grid-template-columns: auto auto 1fr; } .focus-actions .btn-primary { grid-column: auto; justify-self: end; } }

.steps { display: grid; gap: 2px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; border-radius: 8px; cursor: pointer; }
.step:hover { background: var(--surface-2); }
.step input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.step.done span { text-decoration: line-through; color: var(--muted); }

.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger); font-weight: 550; margin-bottom: 12px;
}
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.banner a, .banner button.link { color: inherit; font-weight: 700; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; margin-bottom: 10px; opacity: .6; }
.empty p { max-width: 380px; margin: 0 auto 14px; }

/* Outcome radio cards */
.options { display: grid; gap: 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin-top: 3px; accent-color: var(--accent); }
.option b { display: block; }

/* ===== Notes ===== */
.notes-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.note-card { text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.note-card:hover { border-color: var(--border-strong); }
.note-card .body { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.note-card .foot { margin-top: auto; }

/* ===== Timeline ===== */
.timeline { display: grid; gap: 10px; border-left: 2px solid var(--border); padding-left: 14px; margin-left: 4px; }
.timeline .ev { position: relative; font-size: 13px; }
.timeline .ev::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }

/* ===== Dialogs ===== */
dialog.sheet {
  border: 0; padding: 0; color: var(--text); background: var(--surface);
  width: 100%; max-width: 100%; max-height: 94vh; margin: auto 0 0 0;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
}
dialog.sheet[open] { animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
dialog.sheet::backdrop { background: rgba(10, 12, 18, .45); backdrop-filter: blur(3px); }
.sheet-inner { display: flex; flex-direction: column; max-height: 94vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.sheet-body { padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.grabber { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; max-width: 640px; border-radius: 18px; max-height: 88vh; }
  dialog.sheet-sm { max-width: 440px; }
  .sheet-inner { max-height: 88vh; }
  .grabber { display: none; }
  dialog.sheet[open] { animation: pop .18s ease-out; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text-2); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 18px; line-height: 1; }
details.disclosure[open] > summary::before { transform: rotate(90deg); }

.dep-list { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.dep-list label { padding: 6px; border-radius: 6px; }
.dep-list label:hover { background: var(--surface-2); }

/* ===== Toasts ===== */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 32px; left: calc(50% + var(--sidebar) / 2); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 550; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; }

/* ===== Login ===== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 28px 24px; display: grid; gap: 18px; }
.login h1 { font-size: 22px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.divider { height: 1px; background: var(--border); margin: 4px 0; }
.list-plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.list-plain li { display: flex; gap: 8px; align-items: baseline; }

/* ===== Carga ===== */
.loadbar { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
.loadbar.on { opacity: 1; }
.loadbar::before { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: loadbar 1s ease-in-out infinite; }
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.skeleton { height: 140px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .loadbar::before { animation: none; } }

/* ===== Proyectos ===== */
/* Paleta categórica validada (claro/oscuro, CVD). El color nunca va solo: siempre con el nombre. */
[data-pc="blue"] { --pc: #2a78d6; } [data-pc="orange"] { --pc: #eb6834; } [data-pc="aqua"] { --pc: #1baf7a; }
[data-pc="yellow"] { --pc: #eda100; } [data-pc="magenta"] { --pc: #e87ba4; } [data-pc="green"] { --pc: #008300; }
[data-pc="violet"] { --pc: #6250d6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-pc="blue"] { --pc: #3987e5; } :root:not([data-theme="light"]) [data-pc="orange"] { --pc: #d95926; }
  :root:not([data-theme="light"]) [data-pc="aqua"] { --pc: #199e70; } :root:not([data-theme="light"]) [data-pc="yellow"] { --pc: #c98500; }
  :root:not([data-theme="light"]) [data-pc="magenta"] { --pc: #d55181; } :root:not([data-theme="light"]) [data-pc="violet"] { --pc: #9085e9; }
}
:root[data-theme="dark"] [data-pc="blue"] { --pc: #3987e5; } :root[data-theme="dark"] [data-pc="orange"] { --pc: #d95926; }
:root[data-theme="dark"] [data-pc="aqua"] { --pc: #199e70; } :root[data-theme="dark"] [data-pc="yellow"] { --pc: #c98500; }
:root[data-theme="dark"] [data-pc="magenta"] { --pc: #d55181; } :root[data-theme="dark"] [data-pc="violet"] { --pc: #9085e9; }

.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pc, var(--muted)); flex: none; }
.ptag { display: inline-flex; align-items: center; gap: 6px; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; margin-bottom: -1px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); }

.project-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.project-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; position: relative; overflow: hidden; }
.project-card:hover { border-color: var(--border-strong); }
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pc); }
.project-card h3 { font-size: 16px; }

.pbar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; gap: 2px; }
.pbar > i { display: block; height: 100%; background: var(--pc, var(--accent)); border-radius: 999px; min-width: 0; }
.pbar.thin { height: 5px; }
.pct { font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }

/* Barras semanales: una serie, extremos redondeados de 4px anclados a la base, 2px de separación */
.bars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; align-items: end; height: 140px; padding-top: 18px; border-bottom: 1px solid var(--border-strong); }
.bar-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; cursor: default; }
.bar-col i { display: block; width: min(28px, 70%); background: var(--pc, var(--accent)); border-radius: 4px 4px 0 0; min-height: 0; }
.bar-col:hover i, .bar-col:focus-visible i { filter: brightness(1.12); }
.bar-col .val { position: absolute; font-size: 11px; font-weight: 600; color: var(--text-2); transform: translateY(-16px); }
.bar-col[data-tip]:hover::after, .bar-col[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 5;
  white-space: nowrap; padding: 6px 9px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 550; box-shadow: var(--shadow-lg);
}
.bar-col:first-child[data-tip]:hover::after, .bar-col:first-child[data-tip]:focus-visible::after { left: 0; transform: none; }
.bar-col:last-child[data-tip]:hover::after, .bar-col:last-child[data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }
.bar-labels { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--pc); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }
