/* Gradient — ML Intranet */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --panel-3: #f1f3f6;
  --ink: #0f1729;
  --ink-2: #4b5567;
  --ink-3: #8a93a3;
  --line: #e6e8ee;
  --line-2: #d9dde5;
  --accent: #5b5bd6;
  --accent-2: #3b82f6;
  --accent-ink: #ffffff;
  --accent-soft: #eeeefc;
  --accent-line: #c9c9f3;
  --ok: #16a34a;   --ok-soft: #e8f6ee;
  --warn: #c2700a; --warn-soft: #fdf3e3;
  --bad: #dc2626;  --bad-soft: #fdecec;
  --info: #0b7cc2; --info-soft: #e6f3fb;
  --theory: #0ea5a4; --theory-soft: #e3f6f5;
  --code-bg: #f3f4f7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, .04);
  --shadow: 0 1px 2px rgba(15, 23, 41, .04), 0 4px 16px -6px rgba(15, 23, 41, .08);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 41, .25);
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12; --panel: #12151c; --panel-2: #161a23; --panel-3: #1c212c; --ink: #e8ebf1; --ink-2: #aab3c2; --ink-3: #737d8e;
    --line: #222734; --line-2: #2c3241; --accent: #8b8cf8; --accent-2: #60a5fa; --accent-ink: #0b0d12; --accent-soft: #1d1e3a; --accent-line: #3a3b7a;
    --ok: #4ade80; --ok-soft: #10261a; --warn: #f5b04c; --warn-soft: #2b2010; --bad: #f87171; --bad-soft: #2e1515; --info: #5ab7f0; --info-soft: #102331;
    --theory: #2dd4bf; --theory-soft: #0f2826; --code-bg: #1a1f29;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d12; --panel: #12151c; --panel-2: #161a23; --panel-3: #1c212c; --ink: #e8ebf1; --ink-2: #aab3c2; --ink-3: #737d8e;
  --line: #222734; --line-2: #2c3241; --accent: #8b8cf8; --accent-2: #60a5fa; --accent-ink: #0b0d12; --accent-soft: #1d1e3a; --accent-line: #3a3b7a;
  --ok: #4ade80; --ok-soft: #10261a; --warn: #f5b04c; --warn-soft: #2b2010; --bad: #f87171; --bad-soft: #2e1515; --info: #5ab7f0; --info-soft: #102331;
  --theory: #2dd4bf; --theory-soft: #0f2826; --code-bg: #1a1f29;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14.5px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
code { background: var(--code-bg); padding: .12em .4em; border-radius: 5px; border: 1px solid var(--line); }
pre { background: var(--code-bg); padding: 14px 16px; border-radius: 10px; overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); }
pre code { background: none; padding: 0; border: 0; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-family: "Inter Tight", Inter, sans-serif; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: .98rem; font-weight: 700; }
svg { flex: none; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px;
}
.brand { display: flex; gap: 11px; align-items: center; color: var(--ink); padding: 2px 6px 22px; }
.brand:hover { text-decoration: none; }
.logo { width: 36px; height: 36px; border-radius: 11px; color: #fff; display: grid; place-items: center; background: linear-gradient(135deg, #6e6ef0, #3b82f6); box-shadow: 0 6px 16px -6px rgba(91, 91, 214, .7); }
.logo svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: "Inter Tight", Inter, sans-serif; font-size: 1.08rem; letter-spacing: -.02em; }
.brand-text small { color: var(--ink-3); font-size: .75rem; }
#nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; padding: 14px 10px 6px; }
#nav a { color: var(--ink-2); padding: 8px 10px; border-radius: 9px; display: flex; gap: 11px; align-items: center; font-weight: 500; transition: background .12s, color .12s; }
#nav a:hover { background: var(--panel-3); text-decoration: none; color: var(--ink); }
#nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#nav a .count { margin-left: auto; font-size: .72rem; background: var(--panel-3); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; font-weight: 600; }
#nav a.active .count { background: var(--panel); color: var(--accent); }
.side-foot { margin-top: auto; }
.me { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.me img { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-3); }
.me .who { min-width: 0; line-height: 1.3; }
.me .who b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: .75rem; color: var(--ink-3); }
.me-prog { margin-top: 10px; font-size: .75rem; color: var(--ink-3); }
.theme-switch { display: flex; gap: 2px; background: var(--panel-3); border-radius: 9px; padding: 3px; margin-top: 10px; }
.theme-switch button { flex: 1; border: 0; background: none; color: var(--ink-3); padding: 5px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.theme-switch button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; }
.menu-btn { display: none; }
.crumbs { color: var(--ink-3); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--ink-2); }
.crumbs b { color: var(--ink); font-weight: 600; }
.search-btn { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-3); font: inherit; font-size: .85rem; cursor: pointer; min-width: 220px; }
.search-btn kbd { margin-left: auto; font-family: inherit; font-size: .72rem; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--ink-3); background: var(--panel-2); }
.top-right { display: flex; gap: 8px; align-items: center; }
.view { padding: 28px; max-width: 1240px; width: 100%; margin: 0 auto; outline: none; }
.scrim { display: none; }

/* ---------- primitives ---------- */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-hero { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-top { align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.section { margin-top: 18px; }
.stack > * + * { margin-top: 18px; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: .84rem; }
.xs { font-size: .76rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; }

.tile { display: flex; flex-direction: column; gap: 6px; }
.tile .k { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: .78rem; font-weight: 600; }
.tile .v { font-family: "Inter Tight", Inter, sans-serif; font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .v small { font-size: .9rem; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.tile .s { color: var(--ink-2); font-size: .8rem; }
.tile .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .ic.ok { background: var(--ok-soft); color: var(--ok); }
.tile .ic.warn { background: var(--warn-soft); color: var(--warn); }
.tile .ic.bad { background: var(--bad-soft); color: var(--bad); }
.tile .ic.info { background: var(--info-soft); color: var(--info); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1.6; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-ok { background: var(--ok-soft); color: var(--ok); }
.p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-info { background: var(--info-soft); color: var(--info); }
.p-mute { background: var(--panel-3); color: var(--ink-2); }
.p-accent { background: var(--accent-soft); color: var(--accent); }
.p-theory { background: var(--theory-soft); color: var(--theory); }
.p-outline { border-color: var(--line-2); color: var(--ink-2); background: var(--panel); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; padding: 8px 14px; height: 36px;
  font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); transition: background .12s, border-color .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.sm { height: 30px; padding: 4px 10px; font-size: .8rem; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 11px; width: 100%; min-height: 36px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 96px; resize: vertical; }
label { font-weight: 600; font-size: .82rem; display: block; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.hint { color: var(--ink-3); font-size: .78rem; margin-top: 5px; }
.check-label { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; color: var(--ink); }
.check-label input { width: 16px; height: 16px; min-height: 0; margin-top: 3px; accent-color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.bar { height: 6px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; }
.bar.ok > span { background: var(--ok); }

.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; border: 1px solid; font-size: .9rem; }
.banner .i { margin-top: 2px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner a { color: inherit; text-decoration: underline; }
.banner > div { color: var(--ink); }
.banner b { color: inherit; }

.empty { text-align: center; padding: 26px 12px; color: var(--ink-3); font-size: .9rem; }

/* ---------- rings & zone bar ---------- */
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .lbl { position: absolute; text-align: center; line-height: 1.1; }
.ring .lbl b { font-family: "Inter Tight", Inter, sans-serif; font-size: 1.6rem; letter-spacing: -.03em; display: block; }
.ring .lbl span { font-size: .72rem; color: var(--ink-3); }
.ring.sm .lbl b { font-size: .78rem; letter-spacing: 0; }

.zone { margin-top: 14px; }
.zone-track { position: relative; display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel-3); }
.zone-track span { height: 100%; }
.z1 { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.z2 { background: color-mix(in srgb, var(--warn) 55%, transparent); }
.z3 { background: color-mix(in srgb, var(--bad) 35%, transparent); }
.zone-now { position: absolute; top: -4px; width: 4px; height: 18px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px var(--panel); transform: translateX(-2px); }
.zone-labels { display: flex; justify-content: space-between; font-size: .74rem; color: var(--ink-3); margin-top: 7px; gap: 8px; }
.zone-labels b { color: var(--ink-2); font-weight: 600; }

/* ---------- dashboard ---------- */
.hero { position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 220px at 100% 0%, var(--accent-soft), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero h1 { font-size: 1.6rem; margin-bottom: 4px; }
.focus { margin-top: 18px; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.focus-title { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.countdown { font-family: "Inter Tight", Inter, sans-serif; font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.avg-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.plist { display: flex; flex-direction: column; }
.pitem { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.pitem:last-child { border-bottom: 0; }
.pitem:hover { text-decoration: none; background: var(--panel-2); border-radius: 10px; }
.pitem .pid { font-family: "JetBrains Mono", monospace; font-size: .75rem; font-weight: 500; color: var(--ink-3); width: 34px; flex: none; }
.pitem .pt { min-width: 0; flex: 1; }
.pitem .pt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem .pt span { font-size: .78rem; color: var(--ink-3); }
.pitem .pr { text-align: right; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.trackdot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.trackdot.theory { background: var(--theory); }
.months { padding-top: 22px; }
.months .plot { position: relative; height: 120px; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--line); }
.months .m { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; position: relative; }
.months .val { font-size: .72rem; color: var(--ink-2); margin-bottom: 4px; }
.months .col { width: 100%; max-width: 44px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); min-height: 3px; }
.months .col.below { background: var(--bad); opacity: .8; }
.months .col.none { background: var(--panel-3); }
.months .thr { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--ink-3); opacity: .7; z-index: 1; pointer-events: none; }
.months .thr span { position: absolute; right: 0; top: -17px; font-size: .68rem; color: var(--ink-3); background: var(--panel); padding: 0 4px; }
.mlabels { display: flex; gap: 10px; margin-top: 6px; }
.mlabels span { flex: 1; text-align: center; font-size: .72rem; color: var(--ink-3); }
.log-item { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .88rem; display: flex; gap: 12px; }
.log-item:last-child { border-bottom: 0; }
.log-item time { color: var(--ink-3); font-size: .76rem; white-space: nowrap; width: 92px; flex: none; padding-top: 2px; }

/* ---------- projects list ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--panel-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 600; color: var(--ink-2); padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.toolbar input { max-width: 260px; }
.phase { margin-top: 26px; }
.phase-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.phase-head h2 { margin: 0; }
.prow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 150px 120px 64px; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--panel-2); text-decoration: none; }
.prow .pt b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .pt span { font-size: .78rem; color: var(--ink-3); }
.prow .dates { font-size: .8rem; color: var(--ink-2); }
.list-card { padding: 4px 0; overflow: hidden; }

/* ---------- project page ---------- */
.proj-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.proj-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }
.proj-title { margin: 10px 0 6px; font-size: 1.9rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .84rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.calc { font-family: "JetBrains Mono", monospace; font-size: .76rem; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 12px; text-align: center; }
.split { display: flex; gap: 10px; margin-top: 12px; }
.split > div { flex: 1; background: var(--panel-2); border-radius: 10px; padding: 9px 10px; border: 1px solid var(--line); }
.split .eyebrow { font-size: .66rem; }
.split b { font-family: "Inter Tight", Inter, sans-serif; font-size: 1.1rem; }
.md { overflow-wrap: break-word; }
.md p { margin: .55em 0; }
.md p:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 1.35em; margin: .5em 0; }
.md li { margin: .2em 0; }
.md table { margin: .7em 0; font-size: .88rem; }
.md h3, .md h4 { margin-top: 1.1em; }
.md blockquote { margin: .7em 0; padding: 4px 14px; border-left: 3px solid var(--accent-line); color: var(--ink-2); }
.list { margin: 0; padding-left: 1.2em; }
.list li { margin: 5px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.res { display: flex; flex-direction: column; gap: 4px; }
.res a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); border: 1px solid transparent; }
.res a:hover { background: var(--panel-2); border-color: var(--line); text-decoration: none; }
.res a .i { color: var(--ink-3); }
.res a { align-items: flex-start; }
.res a .i { margin-top: 3px; }
.res a span { min-width: 0; line-height: 1.45; }
details.fold { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
details.fold > summary { cursor: pointer; font-weight: 600; font-size: .9rem; list-style: none; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "›"; font-size: 1.1rem; transition: transform .15s; display: inline-block; width: 10px; }
details.fold[open] > summary::before { transform: rotate(90deg); }

.tasks-head { display: flex; align-items: center; gap: 12px; margin: 28px 0 4px; }
.tasks-head h2 { margin: 0; font-size: 1.2rem; }
.task { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); margin-top: 12px; overflow: hidden; }
.task > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.task > summary::-webkit-details-marker { display: none; }
.task > summary:hover { background: var(--panel-2); }
.task[open] > summary { border-bottom: 1px solid var(--line); }
.tstate { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .78rem; font-weight: 700; border: 1.5px solid var(--line-2); color: var(--ink-3); font-family: "JetBrains Mono", monospace; }
.task.done .tstate { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.partial .tstate { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.task.pending .tstate { border-color: var(--info); color: var(--info); background: var(--info-soft); }
.ttitle { font-weight: 650; font-size: .98rem; flex: 1; min-width: 180px; }
.tpts { font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.task-body { padding: 16px 18px 18px; }
.deliver { display: flex; flex-wrap: wrap; gap: 8px 22px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 14px; font-size: .82rem; }
.deliver div { display: flex; gap: 7px; align-items: center; color: var(--ink-3); }
.deliver code { color: var(--ink); }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.checks { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; font-size: .84rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.check:last-child { border-bottom: 0; }
.check .ck { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; margin-top: 1px; }
.check.ok .ck { background: var(--ok); }
.check.ko .ck { background: var(--bad); }
.check.ko { background: color-mix(in srgb, var(--bad-soft) 55%, var(--panel)); }
.check.run .ck { background: var(--panel-3); border: 2px solid var(--line-2); border-right-color: var(--accent); animation: spin .8s linear infinite; }
.check .ck svg { width: 11px; height: 11px; stroke-width: 3; }
.check pre { margin: 6px 0 0; font-size: .72rem; max-height: 180px; background: var(--panel-2); white-space: pre-wrap; }
.checks-sum { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--panel-2); font-size: .78rem; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.lock-note { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: 11px 14px; color: var(--ink-2); font-size: .86rem; margin-top: 14px; }

.rubric { display: grid; gap: 10px; margin-top: 12px; }
.rubric .crit { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel); }
.levels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.levels label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; margin: 0; color: var(--ink-2); font-size: .82rem; }
.levels label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.levels input { width: auto; min-height: 0; accent-color: var(--accent); }
.must { display: grid; gap: 6px; }
.review { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 14px; background: var(--panel-2); }
.review-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.review-score { font-family: "Inter Tight", Inter, sans-serif; font-weight: 700; font-size: 1.15rem; }
.crit-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mustlist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 5px; font-size: .84rem; }
.mustlist li { display: flex; gap: 8px; }
.mustlist .y { color: var(--ok); } .mustlist .n { color: var(--bad); }
.subpanel { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 14px; background: var(--panel-2); }

.quiz .qitem { padding: 14px 0; border-bottom: 1px solid var(--line); }
.quiz .qitem:last-of-type { border-bottom: 0; }
.quiz .qtext { font-weight: 600; margin-bottom: 8px; }
.quiz .opt { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 4px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; color: var(--ink); }
.quiz .opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.quiz .opt input { width: auto; min-height: 0; margin-top: 4px; accent-color: var(--accent); }

/* ---------- planning ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 760px; font-size: .78rem; }
.g-row { display: grid; grid-template-columns: 230px 1fr; align-items: center; min-height: 26px; }
.g-row:hover .g-label a { color: var(--accent); }
.g-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; color: var(--ink-2); }
.g-label a { color: var(--ink); font-weight: 500; }
.g-label .mono { color: var(--ink-3); margin-right: 6px; }
.g-track { position: relative; height: 26px; border-left: 1px solid var(--line); }
.g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.g-bar { position: absolute; top: 7px; height: 12px; border-radius: 6px; background: var(--accent); }
.g-bar.theory { background: var(--theory); }
.g-bar.second { opacity: .3; }
.g-bar.done { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ok) 90%, white); }
.g-break { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, var(--warn-soft), var(--warn-soft) 4px, transparent 4px, transparent 8px); }
.g-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); }
.g-months { position: relative; height: 22px; }
.g-months span { position: absolute; font-size: .72rem; color: var(--ink-3); font-weight: 600; transform: translateX(4px); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-bottom: 14px; }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }

/* ---------- onboarding ---------- */
.onb { max-width: 860px; margin: 20px auto; }
.onb-hero { text-align: center; margin-bottom: 26px; }
.onb-hero .logo { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 16px; }
.onb-hero .logo svg { width: 34px; height: 34px; }
.onb-hero h1 { font-size: 2.1rem; }
.onb-hero p { color: var(--ink-2); max-width: 600px; margin: 0 auto; }
.rules-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 6px; }
.rules-strip div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: .8rem; color: var(--ink-2); }
.rules-strip b { display: block; font-family: "Inter Tight", Inter, sans-serif; font-size: 1.2rem; color: var(--ink); }
.program-pick { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.program-pick label { border: 1.5px solid var(--line-2); border-radius: 14px; padding: 16px; cursor: pointer; font-weight: 400; color: var(--ink); margin: 0; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s, background .12s; position: relative; }
.program-pick label:hover { border-color: var(--accent-line); }
.program-pick input { position: absolute; opacity: 0; }
.program-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.program-pick .pp-title { font-weight: 700; font-family: "Inter Tight", Inter, sans-serif; font-size: 1.02rem; }
.program-pick .pp-big { font-family: "Inter Tight", Inter, sans-serif; font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--accent); }

/* ---------- palette & toast ---------- */
.palette { position: fixed; inset: 0; background: rgba(10, 12, 18, .45); backdrop-filter: blur(3px); z-index: 60; display: flex; justify-content: center; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-box { width: 100%; max-width: 600px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start; }
.palette-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 1rem; box-shadow: none; }
.palette-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-list a { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 9px; color: var(--ink); }
.palette-list a.sel, .palette-list a:hover { background: var(--accent-soft); text-decoration: none; }
.palette-list .mono { color: var(--ink-3); width: 34px; }
.palette-list small { margin-left: auto; color: var(--ink-3); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 10px); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); opacity: 0; transition: .2s; pointer-events: none; max-width: min(440px, calc(100vw - 32px)); font-size: .88rem; z-index: 70; font-weight: 500; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .proj-grid { grid-template-columns: 1fr; }
  .proj-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr 1fr; }
  .g-hero { grid-template-columns: 1fr; }
  .prow { grid-template-columns: 34px minmax(0, 1fr) 110px 64px; }
  .prow .dates { display: none; }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: grid; }
  .view { padding: 18px 16px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .top-right .pill:not(.keep) { display: none; }
  .g4, .g3, .g2, .program-pick, .rules-strip, .proj-side { grid-template-columns: 1fr; }
  .g-row { grid-template-columns: 130px 1fr; }
  .prow { grid-template-columns: 30px minmax(0, 1fr) 60px; padding: 12px; }
  .prow .st { display: none; }
  h1, .proj-title { font-size: 1.45rem; }
  .tile .v { font-size: 1.5rem; }
}

/* overflow guards */
.proj-grid > *, .grid > * { min-width: 0; }
.chips .pill { white-space: normal; line-height: 1.4; padding-top: 3px; padding-bottom: 3px; }
.proj-title, h1 { overflow-wrap: anywhere; }
.md pre, .md table { max-width: 100%; }
.md table { display: block; overflow-x: auto; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
@media (max-width: 760px) {
  .zone-labels { font-size: .68rem; }
  .task > summary { padding: 12px 14px; }
  .task-body { padding: 14px; }
  .ttitle { min-width: 0; flex-basis: calc(100% - 44px); }
}
.md, .katex-display { overflow-x: auto; overflow-y: hidden; position: relative; }
.btn.pn { white-space: normal; height: auto; min-height: 36px; text-align: left; max-width: 100%; }
.deliver div { flex-wrap: wrap; min-width: 0; }
.deliver code { overflow-wrap: anywhere; }

/* textbooks */
.books { display: flex; flex-direction: column; gap: 4px; }
.bookref { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-radius: 9px; color: var(--ink); border: 1px solid transparent; font-size: .9rem; }
.bookref:hover { background: var(--panel-2); border-color: var(--line); text-decoration: none; }
.bookref .pill { flex: none; min-width: 52px; justify-content: center; }
.book-card { display: flex; flex-direction: column; }
.book-card p { flex: 1; }
.book-spine { height: 92px; border-radius: 10px; display: flex; align-items: flex-end; padding: 12px 14px; color: #fff; font-family: "Inter Tight", Inter, sans-serif; font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; position: relative; overflow: hidden; }
.book-spine::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, transparent 2px 14px); }
.book-spine.esl { background: linear-gradient(135deg, #5b5bd6, #3b82f6); }
.book-spine.foml { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.book-spine.ssbd { background: linear-gradient(135deg, #0369a1, #0ea5e9); }
.prow.lib { grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) 110px 64px; }
.prow.lib .dates { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) { .prow.lib { grid-template-columns: 34px minmax(0, 1fr) 64px; } .prow.lib .dates, .prow.lib .st { display: none; } }
