@font-face {
  font-family: "Recursive Variable";
  font-style: oblique 0deg 15deg;
  font-display: swap;
  font-weight: 300 1000;
  src: url("./fonts/recursive/5.3.0/recursive-cyrillic-ext-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Recursive Variable";
  font-style: oblique 0deg 15deg;
  font-display: swap;
  font-weight: 300 1000;
  src: url("./fonts/recursive/5.3.0/recursive-vietnamese-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: "Recursive Variable";
  font-style: oblique 0deg 15deg;
  font-display: swap;
  font-weight: 300 1000;
  src: url("./fonts/recursive/5.3.0/recursive-latin-ext-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, 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: "Recursive Variable";
  font-style: oblique 0deg 15deg;
  font-display: swap;
  font-weight: 300 1000;
  src: url("./fonts/recursive/5.3.0/recursive-latin-full-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Work — a small, dense triage UI. Tokens first; everything else uses them. */

:root {
  --font: "Recursive Variable", ui-sans-serif, system-ui, sans-serif;
  --mono: "Recursive Variable", ui-monospace, monospace;
  --bg: #fbfbfa;
  --surface: #ffffff;
  --sunken: #f3f3f1;
  --hover: #efefec;
  --selected: #e8eefc;
  --border: #e4e4e0;
  --border-strong: #cfcfca;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --faint: #9a9a94;
  --accent: #3b5bdb;
  --accent-text: #ffffff;
  --accent-soft: #e8eefc;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --ok: #2b8a3e;
  --ok-soft: #e6f4ea;
  --must: #c92a2a;
  --should: #b45309;
  --later: #6b6b66;
  --kind-feedback: #c2410c;
  --kind-idea: #a16207;
  --kind-agent: #6d28d9;
  --kind-alert: #c92a2a;
  --kind-manual: #475569;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.08);
  --nav-w: 236px;
  --panel-w: min(580px, 40vw);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1b1b1a;
    --sunken: #111110;
    --hover: #242422;
    --selected: #1f2a47;
    --border: #2c2c2a;
    --border-strong: #3d3d3a;
    --text: #ececea;
    --muted: #a1a19b;
    --faint: #73736e;
    --accent: #7c95f2;
    --accent-text: #0f1220;
    --accent-soft: #1f2a47;
    --warn: #f0a24b;
    --warn-soft: #34260f;
    --danger: #f27272;
    --danger-soft: #3a1c1c;
    --ok: #6cc489;
    --ok-soft: #173222;
    --must: #f27272;
    --should: #f0a24b;
    --later: #a1a19b;
    --kind-feedback: #fb923c;
    --kind-idea: #facc15;
    --kind-agent: #a78bfa;
    --kind-alert: #f27272;
    --kind-manual: #94a3b8;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  font-variation-settings: "CASL" 0, "MONO" 0;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); font-variation-settings: "MONO" 1, "CASL" 0; font-size: 0.92em; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 0.35em; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; font-size: 11px; line-height: 1.5; text-align: center; color: var(--muted); background: var(--surface);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.icon { width: 16px; height: 16px; flex: none; }

/* Controls ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.small { height: 26px; padding: 0 9px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.small { width: 22px; height: 22px; }
.icon-btn.small .icon { width: 14px; height: 14px; }
.input, select {
  width: 100%; min-height: 32px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
select { width: auto; padding-right: 28px; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus, select:focus, .btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, summary:focus-visible, .title-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px;
}
.field { display: grid; gap: 4px; font-weight: 550; font-size: 13px; }
.stack { display: grid; gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline, .inline-form { display: inline-flex; flex-wrap: wrap; align-items: end; gap: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 180px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--sunken); color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip .icon { width: 12px; height: 12px; }
.prio { font-weight: 600; background: transparent; }
.prio-must { color: var(--must); border-color: color-mix(in srgb, var(--must) 40%, transparent); }
.prio-should { color: var(--should); border-color: color-mix(in srgb, var(--should) 40%, transparent); }
.prio-later { color: var(--later); }
.status { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sunken); color: var(--muted); }
.status-new { background: var(--accent-soft); color: var(--accent); }
.status-investigating { background: var(--warn-soft); color: var(--warn); }
.status-resolved, .status-ok { background: var(--ok-soft); color: var(--ok); }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius); }
.callout > div { display: flex; gap: 8px; align-items: baseline; }
.callout .icon { align-self: center; }
.callout.is-warn { background: var(--warn-soft); color: var(--warn); }
.callout.is-warn strong { margin-right: 4px; }
.callout.is-error { background: var(--danger-soft); color: var(--danger); }

/* App shell ---------------------------------------------------------------- */

.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--panel-w); height: 100dvh; }
.app:not(.has-panel-slot) { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; container-type: inline-size; }

.nav {
  display: flex; flex-direction: column; gap: 14px; padding: 12px 10px; overflow-y: auto;
  background: var(--sunken); border-right: 1px solid var(--border);
}
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 0 8px; }
.wordmark { font-weight: 800; font-size: 17px; letter-spacing: 0.02em; text-decoration: none; text-transform: uppercase; }
.wordmark span { color: var(--accent); }
.nav-section { display: grid; gap: 1px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 8px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-link {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 5px 8px;
  border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-weight: 520;
}
.nav-link span:nth-of-type(1) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link[aria-current] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.nav-link.is-warn .nav-count { color: var(--warn); font-weight: 700; }
.nav-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.nav-goal { grid-template-rows: auto auto; row-gap: 4px; }
.nav-goal meter { grid-column: 2 / 4; width: 100%; height: 4px; }
.nav-empty { margin: 0; padding: 2px 8px; color: var(--faint); font-size: 13px; }
.nav-foot { margin-top: auto; }
.account summary { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; list-style: none; font-weight: 550; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--hover); }
.account-menu { display: grid; gap: 1px; padding: 4px; margin-bottom: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.account-menu a, .account-menu button { padding: 6px 8px; border: 0; border-radius: 4px; background: none; text-align: left; text-decoration: none; cursor: pointer; }
.account-menu a:hover, .account-menu button:hover { background: var(--hover); }
.account-menu form { display: contents; }
.account[open] { display: flex; flex-direction: column-reverse; }
.avatar { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.toolbar {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.view-title { margin-right: auto; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-toggle { display: none; }
.search { position: relative; display: flex; align-items: center; width: min(260px, 32vw); }
.search .icon { position: absolute; left: 9px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 32px; padding: 0 30px 0 30px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.search input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.search kbd { position: absolute; right: 7px; pointer-events: none; }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.group-form label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.group-form select { height: 32px; min-height: 0; padding-top: 0; padding-bottom: 0; }

@container (max-width: 640px) {
  .toolbar { gap: 6px; }
  .search { width: 150px; }
  .group-form .muted, .toolbar .btn.primary kbd { display: none; }
}
@container (max-width: 520px) {
  .toolbar .btn.primary span { display: none; }
  .row-meta .chip:not(.prio) { display: none; }
}

/* List ----------------------------------------------------------------------- */

.list { flex: 1; overflow-y: auto; padding: 4px 0 48px; }
.group { margin-top: 6px; }
.group-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 16px 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); cursor: default;
}
summary.group-head { cursor: pointer; list-style: none; }
summary.group-head::-webkit-details-marker { display: none; }
summary.group-head::before { content: "▸"; font-size: 10px; transition: transform 120ms; }
details[open] > summary.group-head::before { transform: rotate(90deg); }
.group-count { color: var(--faint); font-weight: 600; }
.rows { margin: 0; padding: 0 8px; list-style: none; }
.row { position: relative; border-radius: var(--radius); }
.row + .row { margin-top: 1px; }
.row:hover { background: var(--hover); }
.row[aria-current] { background: var(--selected); }
.row.is-cursor { box-shadow: inset 2px 0 0 var(--accent); }
.row-main {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 9px 10px; text-decoration: none; color: inherit;
}
.kind { display: inline-grid; place-items: center; padding-top: 1px; color: var(--muted); }
.kind-feedback { color: var(--kind-feedback); }
.kind-idea { color: var(--kind-idea); }
.kind-agent { color: var(--kind-agent); }
.kind-alert { color: var(--kind-alert); }
.kind-manual { color: var(--kind-manual); }
.row-text { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row[data-state="done"] .row-title, .row[data-state="dropped"] .row-title { color: var(--muted); }
.row[data-state="dropped"] .row-title { text-decoration: line-through; text-decoration-color: var(--faint); }
.row-snippet { color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-context { color: var(--text); opacity: 0.75; margin-right: 6px; }
.row-context::after { content: " —"; color: var(--faint); }
.row-blocked { display: flex; gap: 5px; align-items: center; color: var(--warn); font-size: 13px; font-weight: 550; }
.row-blocked .icon { width: 13px; height: 13px; }
.row-meta { display: flex; align-items: center; gap: 6px; padding-top: 1px; color: var(--faint); font-size: 12px; }
.meta-count { display: inline-flex; align-items: center; gap: 3px; }
.meta-count .icon { width: 13px; height: 13px; }
.age { min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.row-actions {
  position: absolute; top: 6px; right: 8px; display: none; gap: 4px; padding: 2px; border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow);
}
.row:hover .row-actions, .row.is-cursor .row-actions, .row:focus-within .row-actions { display: flex; }
.empty { display: grid; gap: 4px; justify-items: center; margin: 15vh auto 0; color: var(--muted); text-align: center; }
.empty strong { color: var(--text); font-size: 15px; }

.goal-head { display: grid; gap: 10px; margin: 8px 16px 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.goal-head > .btn { justify-self: start; }
.goal-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.goal-figure { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.goal-figure small { color: var(--faint); font-size: 15px; font-weight: 600; }
.goal-progress meter { flex: 1 1 180px; height: 8px; }
.fact { padding: 1px 8px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 600; }
.fact.is-must { background: var(--danger-soft); color: var(--danger); }
.fact.is-warn { background: var(--warn-soft); color: var(--warn); }
.goal-description { color: var(--muted); }

meter { appearance: none; border: 0; border-radius: 999px; background: var(--border); overflow: hidden; }
meter::-webkit-meter-bar { border: 0; border-radius: 999px; background: var(--border); height: 100%; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { border-radius: 999px; background: var(--ok); }
meter::-moz-meter-bar { border-radius: 999px; background: var(--ok); }

/* Panel ---------------------------------------------------------------------- */

.panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-left: 1px solid var(--border); background: var(--surface); }
.panel-empty { display: grid; gap: 18px; place-content: center; height: 100%; padding: 24px; color: var(--muted); text-align: center; }
.panel-empty p { margin: 0; }
.keys { display: grid; gap: 6px; margin: 0; text-align: left; }
.keys div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; }
.keys.wide div { grid-template-columns: 150px 1fr; }
.keys dt { text-align: right; }
.keys dd { margin: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); }
.crumbs { flex: 1; color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.panel-body { display: grid; align-content: start; gap: 16px; padding: 16px 18px 40px; overflow-y: auto; }
.title-input {
  width: 100%; margin: 0; padding: 4px 6px; margin-left: -6px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; font-size: 19px; font-weight: 680; line-height: 1.3; resize: none; overflow: hidden;
}
.title-input:hover { border-color: var(--border); }
.dialog .title-input { margin-left: 0; border-color: var(--border-strong); font-size: 16px; padding: 8px 10px; }
.segmented { display: flex; flex-wrap: wrap; gap: 0; width: fit-content; padding: 2px; border-radius: var(--radius); background: var(--sunken); border: 1px solid var(--border); }
.seg { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-weight: 560; cursor: pointer; }
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), 0 1px 2px rgb(0 0 0 / 0.06); }
.seg-done[aria-pressed="true"] { color: var(--ok); }
.seg-dropped[aria-pressed="true"] { color: var(--danger); }
.seg-open[aria-pressed="true"] { color: var(--accent); }
.props { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.props label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 600; }
.props select { min-width: 140px; color: var(--text); font-weight: 450; font-size: 14px; }
.inline-details summary { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; list-style: none; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details summary:hover { color: var(--warn); }
.inline-details .inline-form { display: flex; margin-top: 8px; }
.inline-details .input { flex: 1; }
.panel-section { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.panel-section h4 { font-size: 13px; color: var(--muted); }
.desc-edit { display: none; gap: 8px; }
.panel.is-editing .desc-edit { display: grid; }
.panel.is-editing .desc-view { display: none; }

.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote { margin: 0 0 0.7em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose h3, .prose h4, .prose h5, .prose h6 { margin: 1em 0 0.4em; font-size: 14px; }
.prose code { padding: 0.05em 0.3em; border-radius: 4px; background: var(--sunken); }
.prose pre { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--sunken); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { padding-left: 10px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.prose a { color: var(--accent); }
.quote { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--sunken); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts a { color: var(--accent); }
.evidence { display: grid; gap: 8px; justify-items: start; }
.artifacts { display: grid; gap: 4px; width: 100%; margin: 0; padding: 0; list-style: none; }
.artifacts li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 4px; background: var(--sunken); font-size: 13px; }

.updates { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.update { display: grid; gap: 4px; }
.update-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13px; }
.update-head time { color: var(--faint); }
.transition { padding: 0 6px; border-radius: 4px; background: var(--sunken); color: var(--muted); font-size: 12px; }
.update.is-internal .transition { background: var(--warn-soft); color: var(--warn); }
.update.is-reporter .transition { background: var(--accent-soft); color: var(--accent); }
.comment-form { display: grid; gap: 8px; }
.audit summary { color: var(--faint); font-size: 12px; cursor: pointer; }
.events { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; }
.events li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.events small { color: var(--faint); text-align: right; }

/* Dialogs & toast -------------------------------------------------------------- */

.dialog {
  width: min(560px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.35); backdrop-filter: blur(2px); }
.dialog h2 { margin-bottom: 14px; font-size: 16px; }
.dialog-form { display: grid; gap: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 50; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px;
  border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  transform: translate(-50%, 140%); opacity: 0; transition: transform 180ms ease, opacity 180ms ease; pointer-events: none;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: var(--danger); color: #fff; }

/* Settings & simple pages ------------------------------------------------------ */

.settings { display: grid; align-content: start; gap: 16px; padding: 16px; overflow-y: auto; max-width: 1000px; }
.settings > p { margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 8px 12px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: left; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; vertical-align: top; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table td small { display: block; margin-top: 2px; color: var(--muted); }
.table tr.is-muted td { color: var(--muted); }
.card { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.settings .card { display: flex; }

.simple-main { display: grid; gap: 24px; width: min(640px, calc(100vw - 32px)); margin: 0 auto; padding: 32px 0 64px; }
.simple-main h1 { font-size: 24px; margin-bottom: 8px; }
.simple-main h2 { font-size: 16px; margin: 20px 0 10px; }
.landing { display: grid; gap: 14px; justify-items: start; margin-top: 10vh; }
.landing h1 { font-size: clamp(28px, 6vw, 44px); letter-spacing: -0.02em; }
.landing p { margin: 0; }
.lede { font-size: 17px; }
.login { display: grid; gap: 8px; }
.login p { margin: 0; }
.login form { margin-top: 10px; }
.login form > .btn { justify-self: start; }
.report-public { display: grid; gap: 10px; }
.report-public > p { margin: 0; }

/* Responsive ------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .app { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .panel:not(.is-open) { display: none; }
  .panel.is-open {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 20; width: min(620px, 100vw); box-shadow: var(--shadow);
  }
}

@media (max-width: 820px) {
  .app, .app:not(.has-panel-slot) { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(300px, 86vw); transform: translateX(-100%);
    transition: transform 160ms ease; box-shadow: var(--shadow);
  }
  body.nav-open .nav { transform: none; }
  .nav-toggle { display: inline-grid; margin-left: -6px; }
  .toolbar { flex-wrap: wrap; padding: 8px 12px; }
  .view-title { flex: 1; }
  .search { order: 5; width: 100%; }
  .group-form .muted, .btn.primary kbd, .btn.primary span { display: none; }
  .row-meta .chip:not(.prio) { display: none; }
  .row-actions { display: none !important; }
  .rows { padding: 0 4px; }
  .panel.is-open { width: 100vw; }
  .panel-body { padding: 14px 14px 40px; }
}
