/* FIAE-Quiz – Gestaltung angelehnt an den Prüfungsbogen: Formularweiß, Tinte, Kugelschreiber-Kreuz */

@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url("/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #f2f4f6;
  --sheet: #ffffff;
  --ink: #18202b;
  --ink-2: #4b5664;
  --ink-3: #6b7684;
  --rule: #cdd4dc;
  --rule-2: #e3e8ed;
  --pen: #2340b8;
  --pen-soft: #e6eafb;
  --ok: #1d7a4b;
  --ok-soft: #e3f3ea;
  --bad: #b42318;
  --bad-soft: #fbe9e7;
  --flag: #9a6206;
  --flag-soft: #fbf0d9;
  --radius: 6px;
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --nav-h: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161c;
    --sheet: #1a2029;
    --ink: #e7ebf0;
    --ink-2: #b0bac6;
    --ink-3: #8994a2;
    --rule: #333d4a;
    --rule-2: #252d38;
    --pen: #93a6ff;
    --pen-soft: #222c52;
    --ok: #55c993;
    --ok-soft: #173326;
    --bad: #ff8173;
    --bad-soft: #3a1d1a;
    --flag: #f0b44c;
    --flag-soft: #3a2c12;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
main { max-width: 680px; margin: 0 auto; padding: 20px 18px 48px; outline: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--pen); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Kopf und Navigation ---------- */
.topbar {
  position: relative; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: center; gap: 8px; padding: 12px 18px;
  font-weight: 700; color: var(--ink); text-decoration: none; max-width: 680px; margin: 0 auto;
}
.brand-mark { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.6; }
.brand-mark path { stroke: var(--pen); stroke-width: 2.4; stroke-linecap: round; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--sheet); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  height: var(--nav-h); justify-content: center;
  color: var(--ink-3); text-decoration: none; font-size: 0.75rem;
}
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.nav a[aria-current="page"] { color: var(--pen); font-weight: 700; }
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center;
}
@media (min-width: 820px) {
  body { padding-bottom: 0; }
  .topbar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
    background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); }
  .brand { margin: 0; padding: 14px 0; }
  .nav { position: static; background: none; border: 0; gap: 4px; padding: 0; }
  .nav a { flex-direction: row; height: auto; padding: 8px 12px; font-size: 0.95rem; gap: 6px; border-radius: var(--radius); }
  .nav a:hover { background: var(--rule-2); color: var(--ink); }
  .nav svg { width: 20px; height: 20px; }
  .badge { position: static; margin-left: 2px; }
  :root { --top-offset: 57px; }
}

/* ---------- Bausteine ---------- */
.sheet {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: var(--radius);
  border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--rule-2); }
.btn-primary { background: var(--pen); border-color: var(--pen); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--pen) 88%, #000); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0e1530; } }
.btn-quiet { border-color: var(--rule); font-weight: 400; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  border: 1px solid currentColor;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }

.bar { height: 8px; background: var(--rule-2); border-radius: 4px; overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .b-ok { background: var(--ok); }
.bar .b-seen { background: color-mix(in srgb, var(--ok) 35%, var(--rule-2)); }
.bar .b-bad { background: var(--bad); }

.field { display: block; }
.field span { display: block; font-weight: 700; margin-bottom: 4px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--radius);
  border: 1.5px solid var(--rule); background: var(--sheet);
}
.field input:focus { border-color: var(--pen); outline: none; }
.error-msg { color: var(--bad); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 820px) { .toast { bottom: 24px; } }

/* ---------- Startseite ---------- */
.hello { margin-bottom: 20px; }
.daily {
  border: 2px solid var(--ink); border-radius: var(--radius); background: var(--sheet);
  padding: 20px; display: grid; gap: 14px;
}
.daily-dots { display: flex; gap: 6px; }
.daily-dots i { flex: 1; height: 10px; border-radius: 2px; background: var(--rule-2); border: 1px solid var(--rule); }
.daily-dots i.ok { background: var(--ok); border-color: var(--ok); }
.daily-dots i.bad { background: var(--bad); border-color: var(--bad); }
.streak { font-weight: 700; }
.modes { display: grid; gap: 10px; margin-top: 20px; }
.mode {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.mode:hover { border-color: var(--ink-3); }
.mode svg { width: 44px; height: 44px; padding: 9px; border-radius: var(--radius); background: var(--paper); fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mode .count { font-weight: 700; font-variant-numeric: tabular-nums; }
.subjects { display: grid; gap: 14px; margin-top: 28px; }
.subject-line .row { margin-bottom: 6px; }

/* ---------- Frage ---------- */
.qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.qhead .pos { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 700; }
.progress-line { height: 4px; background: var(--rule-2); border-radius: 2px; margin-bottom: 18px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--pen); transition: width .25s; }
.question-text { font-size: 1.2rem; font-weight: 700; line-height: 1.4; }
.code {
  font: 400 0.9rem/1.55 var(--mono); background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0 0; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.hint { margin: 14px 0 10px; color: var(--ink-2); font-size: 0.95rem; }
.hint b { color: var(--ink); }
.options { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start;
  width: 100%; text-align: left; padding: 14px 14px; min-height: 56px;
  background: var(--sheet); border: 1.5px solid var(--rule); border-radius: var(--radius);
  cursor: pointer; line-height: 1.4;
}
.opt:hover:not(:disabled) { border-color: var(--ink-3); }
.opt:disabled { cursor: default; }
.opt[aria-checked="true"] { border-color: var(--pen); background: var(--pen-soft); }
.box {
  width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 3px; background: var(--sheet);
  display: grid; place-items: center; margin-top: -2px;
}
.box svg { width: 26px; height: 26px; overflow: visible; }
.box path {
  fill: none; stroke: var(--pen); stroke-width: 3.2; stroke-linecap: round;
  stroke-dasharray: 20; stroke-dashoffset: 20;
}
.opt[aria-checked="true"] .box path { stroke-dashoffset: 0; transition: stroke-dashoffset .14s ease-out; }
.opt[aria-checked="true"] .box path + path { transition-delay: .1s; }
.opt-text { padding-top: 1px; }
.opt-note { display: block; font-size: 0.8rem; font-weight: 700; margin-top: 4px; }
.opt.is-right { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-right .opt-note { color: var(--ok); }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .opt-note { color: var(--bad); }
.opt.is-wrong .box path { stroke: var(--bad); }
.opt.is-right .box { border-color: var(--ok); }

.explain { margin-top: 18px; border-left: 4px solid var(--ok); padding: 4px 0 4px 16px; }
.explain.wrong { border-color: var(--bad); }
.explain.part { border-color: var(--flag); }
.explain.part h3 { color: var(--flag); }
.explain h3 { margin-bottom: 6px; }
.explain.right h3 { color: var(--ok); }
.explain.wrong h3 { color: var(--bad); }
.explain .catalog-note { margin-top: 8px; font-size: 0.9rem; color: var(--ink-2); }

.actionbar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 10;
  margin: 20px -18px 0; padding: 12px 18px;
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid var(--rule);
  display: flex; gap: 10px;
}
.actionbar .btn { flex: 1; }
@media (min-width: 820px) { .actionbar { bottom: 0; } }

/* ---------- Katalog ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 16px 0; }
.tab {
  flex: none; padding: 8px 14px; border-radius: var(--radius); border: 1.5px solid var(--rule);
  background: var(--sheet); cursor: pointer; font-weight: 700; min-height: 44px;
}
.tab[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.seg { display: flex; border: 1.5px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--sheet); padding: 10px 6px; cursor: pointer; min-height: 44px; font-size: 0.9rem; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--pen-soft); color: var(--pen); font-weight: 700; }
.topic-list { display: grid; gap: 8px; }
.topic {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  cursor: pointer; text-align: left; width: 100%;
}
.topic:hover { border-color: var(--ink-3); }
.topic .bar { grid-column: 1 / -1; }
.topic .num { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- Prüfung ---------- */
.exam-top {
  position: sticky; top: var(--top-offset, 0px); z-index: 15; margin: -20px -18px 16px; padding: 10px 18px;
  background: var(--sheet); border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 12px;
}
.timer { font: 700 1.25rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--bad); }
.grid-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 4px 0 16px; }
.grid-nav button {
  height: 44px; border: 1.5px solid var(--rule); border-radius: 4px; background: var(--sheet);
  font-variant-numeric: tabular-nums; cursor: pointer; position: relative;
}
.grid-nav button.answered { background: var(--pen-soft); border-color: var(--pen); color: var(--pen); font-weight: 700; }
.grid-nav button.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--flag); }
.grid-nav button.current { outline: 2px solid var(--ink); outline-offset: 1px; }
.flag-btn[aria-pressed="true"] { border-color: var(--flag); color: var(--flag); background: var(--flag-soft); }
.legend { display: flex; gap: 14px; font-size: 0.85rem; color: var(--ink-2); flex-wrap: wrap; }

.result-hero { text-align: left; padding: 8px 0 4px; }
.result-hero .big { font-size: 4.5rem; line-height: 1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.verdict { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 4px; font-weight: 700; }
.verdict.pass { background: var(--ok-soft); color: var(--ok); }
.verdict.fail { background: var(--bad-soft); color: var(--bad); }

.review { display: grid; gap: 8px; }
.review details { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.review summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.review summary::-webkit-details-marker { display: none; }
.review .mark-ok, .review .mark-bad, .review .mark-part { width: 24px; height: 24px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.9rem; }
.review .mark-ok { background: var(--ok); }
.review .mark-bad { background: var(--bad); }
.review .mark-none { background: var(--ink-3); }
.review .mark-part { background: var(--flag); }
.review .body { padding: 0 14px 14px; }

.list { display: grid; gap: 8px; }
.list-item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  padding: 12px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
}
.list-item .q { grid-column: 1 / -1; font-weight: 700; color: var(--ink); text-decoration: none; }
.list-item .q:hover { text-decoration: underline; }
.icon-btn { border: 1px solid var(--rule); background: var(--sheet); border-radius: 4px; padding: 6px 10px; cursor: pointer; font-size: 0.85rem; color: var(--ink-2); }

.empty { text-align: center; padding: 40px 10px; }
.empty svg { width: 64px; height: 64px; fill: none; stroke: var(--ok); stroke-width: 1.6; margin-bottom: 10px; }

.login { max-width: 420px; margin: 8vh auto 0; }
.login .brand-mark { width: 44px; height: 44px; margin-bottom: 14px; }

table.simple { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.simple th, table.simple td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--rule-2); }
@media (max-width: 480px) { table.simple { font-size: 0.8125rem; } table.simple th, table.simple td { padding: 8px 3px; } }
.table-wrap { overflow-x: auto; }
table.simple th { font-size: 0.85rem; color: var(--ink-2); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Bestätigungsdialog */
dialog.ask {
  width: min(92vw, 420px); padding: 22px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
dialog.ask::backdrop { background: rgba(10, 14, 20, 0.5); }
dialog.ask p { margin: 0; white-space: pre-line; }
dialog.ask .btn-row { justify-content: flex-end; margin-top: 12px; }

/* ---------- Aufgabentypen (tasks.js) ---------- */
main:has(.practice-wide) { max-width: 1220px; }
.figure { margin-top: 14px; }
.task { margin-top: 4px; }
.mono, .sql-input { font-family: var(--mono); }

/* Eingabefelder (Rechnen, IP-Adressen, Befehle) */
.calc-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.calc-field { display: grid; gap: 4px; }
.calc-field.wide { grid-column: 1 / -1; }
.calc-label { font-weight: 700; font-size: 0.9rem; }
.calc-input { display: flex; align-items: center; border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.calc-input:focus-within { border-color: var(--pen); }
.calc-input input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 12px; min-height: 44px; outline: none; font-variant-numeric: tabular-nums; }
.calc-field.wide .calc-input input { font-family: var(--mono); }
.calc-input .suffix { padding: 0 12px 0 4px; color: var(--ink-2); white-space: nowrap; }
.calc-field.is-right .calc-input { border-color: var(--ok); background: var(--ok-soft); }
.calc-field.is-wrong .calc-input { border-color: var(--bad); background: var(--bad-soft); }
.field-sol { font-size: 0.85rem; color: var(--ok); }

/* SQL */
.schema { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; font-size: 0.9rem; }
.schema summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.schema ul { margin: 6px 0; padding-left: 18px; display: grid; gap: 4px; font-family: var(--mono); font-size: 0.82rem; }
.sql-input { width: 100%; font-size: 0.9rem; line-height: 1.5; border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--sheet); color: var(--ink); padding: 10px 12px; resize: vertical; tab-size: 2; }
.sql-input:focus { border-color: var(--pen); outline: none; }
.sql-error { color: var(--bad); font-family: var(--mono); font-size: 0.85rem; margin-top: 8px; white-space: pre-wrap; }
.sql-result { max-height: 360px; overflow: auto; border: 1px solid var(--rule-2); border-radius: var(--radius); }
.sql-result table.simple { font-family: var(--mono); font-size: 0.8rem; }
.sql-result th { position: sticky; top: 0; background: var(--sheet); }
.sql-feedback { margin-top: 12px; }

/* Netzplan */
.np-view { max-width: 260px; margin-bottom: 8px; }
.np-help { margin-bottom: 10px; }
.np-scroll { overflow-x: auto; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; }
.np-canvas { position: relative; }
.np-arrows { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.np-arrows path { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.np-arrows marker path { fill: var(--ink-3); stroke: none; }
.np-node { position: absolute; width: 156px; height: 136px; display: grid; grid-template-rows: 1fr auto 1fr 1fr; background: var(--sheet); border: 1.5px solid var(--ink-2); border-radius: 3px; font-variant-numeric: tabular-nums; }
.np-node.np-crit { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.np-row { display: grid; }
.np-row + .np-row, .np-title + .np-row, .np-row + .np-title { border-top: 1px solid var(--rule); }
.np-2 { grid-template-columns: 1fr 1fr; }
.np-3 { grid-template-columns: 1fr 1fr 1fr; }
.np-cell { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 11px 3px 2px; font-weight: 700; }
.np-cell + .np-cell { border-left: 1px solid var(--rule); }
.np-cell small { position: absolute; top: 1px; left: 3px; font-size: 0.6rem; font-weight: 400; color: var(--ink-3); }
.np-cell input { width: 100%; height: 22px; font-size: 0.95rem; min-width: 0; border: 0; background: var(--pen-soft); text-align: center; font-weight: 700; padding: 2px 0; border-radius: 2px; color: var(--pen); }
.np-cell input:focus { outline: 2px solid var(--pen); }
.np-cell input[readonly] { background: transparent; color: var(--ink); }
.np-given span { color: var(--ink-2); }
.np-off { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--rule-2) 4px 5px); }
.np-right input { background: var(--ok-soft) !important; color: var(--ok) !important; }
.np-wrong { background: var(--bad-soft); }
.np-wrong input { color: var(--bad) !important; text-decoration: line-through; }
.np-fix { position: absolute; right: 2px; bottom: 0; font-style: normal; font-size: 0.7rem; color: var(--ok); font-weight: 700; }
.np-title { display: flex; align-items: center; gap: 6px; padding: 3px 6px; font-size: 0.78rem; line-height: 1.2; min-width: 0; }
.np-title span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.np-critbox { display: flex; align-items: center; gap: 2px; font-size: 0.7rem; color: var(--bad); border-radius: 3px; padding: 0 2px; }
.np-critbox input { width: 14px; height: 14px; accent-color: var(--bad); margin: 0; }
.np-critbox.np-wrong { outline: 2px solid var(--bad); }
.np-table td .np-cell { border: 1px solid var(--rule); border-radius: 3px; min-width: 46px; min-height: 36px; padding-top: 10px; }
.np-table tr.np-crit td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* Gantt */
.gt-scroll { overflow-x: auto; padding-bottom: 6px; }
.gt { display: grid; gap: 2px; min-width: max-content; }
.gt-row { display: grid; grid-template-columns: 150px repeat(var(--days), 26px); gap: 2px; align-items: center; }
.gt-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 6px; }
.gt-day { font-size: 0.7rem; text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.gt-cell { height: 26px; border: 1px solid var(--rule-2); background: var(--sheet); border-radius: 2px; padding: 0; display: block; touch-action: none; }
button.gt-cell { cursor: pointer; }
button.gt-cell:hover { border-color: var(--ink-3); }
button.gt-cell:focus-visible { outline: 2px solid var(--pen); outline-offset: 1px; }
.gt-bar { background: var(--pen); border-color: var(--pen); }
.gt-bar.gt-crit { background: var(--bad); border-color: var(--bad); }
.gt-buf { background: repeating-linear-gradient(135deg, var(--flag-soft) 0 4px, var(--flag) 4px 6px); border-color: var(--flag); }
.gt-swatch { display: inline-block; width: 16px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; border: 1px solid transparent; }
.gt-mark { font-weight: 700; }
.gt-mark.ok { color: var(--ok); }
.gt-mark.bad { color: var(--bad); }
