/* ==========================================================================
   CS102 · enrolment — IDE workspace theme
   Dark (default) and light, toggled with [data-theme] on <html>.
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #1e1f22;
  --bg-2: #2b2d30;
  --bg-3: #25272a;
  --hover: #33353a;
  --line: #393b40;
  --line-2: #4a4d53;
  --text: #dfe1e5;
  --muted: #a8abb2;
  --dim: #6f737a;
  --accent: #f89820;
  --accent-2: #ffb454;
  --accent-ink: #1d1002;
  --accent-soft: rgba(248, 152, 32, 0.12);
  --blue: #548af7;
  --sel: rgba(84, 138, 247, 0.2);
  --ok: #5fb865;
  --ok-soft: rgba(95, 184, 101, 0.14);
  --warn: #e0a23a;
  --warn-soft: rgba(224, 162, 58, 0.14);
  --bad: #f75464;
  --bad-soft: rgba(247, 84, 100, 0.13);
  --violet: #b189f5;
  --violet-soft: rgba(177, 137, 245, 0.14);
  --term-bg: #141517;
  --term-text: #cfd2d8;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --t-kw: #cf8e6d;
  --t-str: #6aab73;
  --t-num: #2aacb8;
  --t-com: #7a7e85;
  --t-fn: #56a8f5;
  --t-ty: #c7c9cf;
  --t-ann: #b3ae60;
  --c0: #f89820; --c1: #56a8f5; --c2: #6aab73; --c3: #c77dbb; --c4: #2aacb8;
  --c5: #e0a23a; --c6: #f75464; --c7: #b189f5; --c8: #9da0a8;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --bg-3: #f2f3f5;
  --hover: #ebecf0;
  --line: #e3e5e9;
  --line-2: #cfd2d8;
  --text: #1e1f22;
  --muted: #55585e;
  --dim: #8a8d94;
  --accent: #c25600;
  --accent-2: #9c4500;
  --accent-ink: #ffffff;
  --accent-soft: rgba(194, 86, 0, 0.09);
  --blue: #3574f0;
  --sel: rgba(53, 116, 240, 0.13);
  --ok: #1f7a3a;
  --ok-soft: rgba(31, 122, 58, 0.1);
  --warn: #946000;
  --warn-soft: rgba(176, 116, 0, 0.11);
  --bad: #c62f3f;
  --bad-soft: rgba(198, 47, 63, 0.09);
  --violet: #6f4fd1;
  --violet-soft: rgba(111, 79, 209, 0.1);
  --term-bg: #1e1f22;
  --term-text: #dfe1e5;
  --shadow: 0 18px 50px -24px rgba(30, 31, 34, 0.35);
  --t-kw: #0033b3;
  --t-str: #067d17;
  --t-num: #1750eb;
  --t-com: #8c8c8c;
  --t-fn: #00627a;
  --t-ty: #1e1f22;
  --t-ann: #9e880d;
  --c0: #c25600; --c1: #2a64d6; --c2: #1f7a3a; --c3: #9c3f8f; --c4: #0e7f8c;
  --c5: #8f5d00; --c6: #c62f3f; --c7: #6f4fd1; --c8: #5a5d63;
  color-scheme: light;
}

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", "Inter", ui-sans-serif, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --tb: 46px;
  --sb: 24px;
  --tree-w: 258px;
  --struct-w: 236px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--tb) + 80px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-bottom: var(--sb);
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-2);
}

code,
kbd,
pre {
  font-family: var(--mono);
}

code {
  font-size: 0.86em;
}

:not(pre) > code:not(.sig):not(.out) {
  padding: 0.08em 0.36em;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
}

::selection {
  background: var(--sel);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.fill {
  fill: currentColor;
  stroke: none;
}

.sr-only,
.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip:focus {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 6px;
}

.dim {
  color: var(--dim);
}

/* ---------- File-type icons (IntelliJ-style) ----------------------------- */

.fi {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font: 700 9px/1 var(--mono);
  color: #fff;
  vertical-align: -3px;
}

.fi-cls { background: #3574f0; }
.fi-cls:is(:empty) { background: #3574f0; }
.fi-run { background: transparent; color: var(--ok); font-size: 11px; border-radius: 0; }
.fi-txt,
.fi-md,
.fi-pdf,
.fi-dir,
.fi-proj { border-radius: 3px; }
.fi-txt { background: transparent; border: 1.5px solid var(--muted); width: 13px; height: 15px; border-radius: 2px 5px 2px 2px; }
.fi-md { background: transparent; border: 1.5px solid var(--blue); width: 13px; height: 15px; border-radius: 2px 5px 2px 2px; }
.fi-pdf { background: transparent; border: 1.5px solid var(--bad); width: 13px; height: 15px; border-radius: 2px 5px 2px 2px; }
.fi-dir { background: #a7b2c3; width: 16px; height: 12px; border-radius: 2px; position: relative; }
.fi-dir::before { content: ""; position: absolute; left: 0; top: -2px; width: 7px; height: 3px; border-radius: 2px 2px 0 0; background: inherit; }
.fi-proj { background: var(--accent); width: 14px; height: 14px; }
.fi-x { background: var(--bad); }
.fi-m { background: #db7a2c; border-radius: 50%; }
.fi-f { background: #b48ead; border-radius: 50%; }
.fi-c { background: #3574f0; }
.fi-e { background: #c7a03e; }
.fi-h { background: transparent; color: var(--dim); font-size: 11px; }
.fi-s { background: transparent; color: var(--ok); font-size: 10px; }
.fi.v-private { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25); opacity: 0.75; }
.fi.v-package { opacity: 0.85; }

/* ---------- Title bar ---------------------------------------------------- */

.titlebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--tb);
  padding: 0 10px 0 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font: 500 13px var(--mono);
}

.brand:hover {
  color: var(--text);
  background: var(--hover);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #e76f00);
  box-shadow: 0 6px 16px -8px var(--accent);
}

.brand-mark svg {
  width: 17px;
  height: 17px;
  fill: #fff;
  stroke: none;
}

.brand-mark .stroke {
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
}

.brand-text b {
  font-weight: 700;
}

.brand-sep {
  margin: 0 6px;
  color: var(--dim);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font: 13px var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-sep {
  color: var(--dim);
}

.tb-spacer {
  flex: 1;
}

.tb-btn,
.tb-search,
.tb-run,
.tb-report {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 500 13px var(--font);
  text-decoration: none;
  cursor: pointer;
}

.tb-btn {
  width: 30px;
}

.tb-btn:hover,
.tb-search:hover {
  background: var(--hover);
  color: var(--text);
}

.tb-menu {
  display: none;
}

.tb-search {
  min-width: 190px;
  padding: 0 8px 0 10px;
  justify-content: flex-start;
  background: var(--bg);
  border-color: var(--line);
}

.tb-search kbd {
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  color: var(--dim);
}

.tb-run {
  padding: 0 12px 0 9px;
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
  background: var(--ok-soft);
}

.tb-run svg {
  fill: currentColor;
  stroke: none;
}

.tb-run:hover {
  background: color-mix(in srgb, var(--ok) 22%, transparent);
  color: var(--ok);
}

.tb-report {
  padding: 0 12px 0 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.tb-report:hover {
  background: var(--accent-2);
  color: var(--accent-ink);
}

[data-theme="dark"] .i-moon,
[data-theme="light"] .i-sun {
  display: none;
}

/* ---------- Workspace ---------------------------------------------------- */

.workspace {
  display: grid;
  grid-template-columns: var(--tree-w) minmax(0, 1fr) var(--struct-w);
  min-height: calc(100vh - var(--tb) - var(--sb));
}

body:not(:has(.pane-structure)) .workspace {
  grid-template-columns: var(--tree-w) minmax(0, 1fr);
}

.pane {
  position: sticky;
  top: var(--tb);
  height: calc(100vh - var(--tb) - var(--sb));
  overflow: auto;
  background: var(--bg-2);
  scrollbar-width: thin;
  font-size: 13px;
}

.pane-project {
  border-right: 1px solid var(--line);
}

.pane-structure {
  border-left: 1px solid var(--line);
}

.pane-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-2);
  color: var(--text);
  font-weight: 600;
  font-size: 12.5px;
}

.pane-x {
  display: none;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

/* Project tree */
.tree {
  padding: 2px 6px 24px;
}

.tree a,
.tree summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tree a span,
.tree summary span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree a:hover,
.tree summary:hover {
  background: var(--hover);
  color: var(--text);
}

.tree a[aria-current],
.tree-root.is-active {
  background: var(--sel);
}

.tree-dim {
  margin-left: auto;
  color: var(--dim);
  font-size: 11.5px;
}

.tree summary {
  list-style: none;
}

.tree summary::-webkit-details-marker {
  display: none;
}

.tree summary::before {
  content: "";
  width: 6px;
  height: 6px;
  margin: 0 1px 0 -2px;
  border-right: 1.5px solid var(--dim);
  border-bottom: 1.5px solid var(--dim);
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.tree details[open] > summary::before {
  transform: rotate(45deg);
}

.tree ul {
  margin: 0;
  padding: 0 0 0 18px;
  list-style: none;
}

/* Structure */
.structure {
  margin: 0;
  padding: 2px 6px 24px;
  list-style: none;
}

.structure a {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 1px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.structure a span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.structure .lv1 a {
  padding-left: 26px;
  font-family: var(--mono);
  font-size: 12px;
}

.structure a:hover {
  background: var(--hover);
  color: var(--text);
}

.structure a.is-current {
  background: var(--sel);
  color: var(--text);
}

/* Editor */
.editor {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.tabs {
  position: sticky;
  top: var(--tb);
  z-index: 20;
  display: flex;
  height: 36px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  max-width: 230px;
  padding: 0 10px 0 12px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.tab span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab:hover {
  background: var(--hover);
  color: var(--text);
}

.tab.is-active {
  background: var(--bg);
  color: var(--text);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
}

.tab-x {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.tab:hover .tab-x,
.tab.is-active .tab-x {
  opacity: 1;
}

.tab-x:hover {
  background: var(--line);
  color: var(--text);
}

.pathbar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font: 12px var(--font);
  white-space: nowrap;
  overflow: hidden;
}

.doc {
  flex: 1;
  width: 100%;
  max-width: 1060px;
  padding: 34px 48px 56px;
}

.is-wide .doc {
  max-width: 1280px;
}

/* ---------- Typography --------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.mono-title {
  font-family: var(--mono);
  letter-spacing: -0.03em;
}

h2 {
  position: relative;
  margin: 0 0 16px;
  font-size: 25px;
  line-height: 1.2;
}

h3 {
  margin: 0;
  font-size: 17px;
}

.anchor {
  margin-left: 10px;
  color: var(--dim);
  font: 400 0.7em var(--mono);
  text-decoration: none;
  opacity: 0;
}

h2:hover .anchor {
  opacity: 1;
}

.lede {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font: 500 12.5px var(--mono);
}

.kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font: 500 12px var(--mono);
}

.note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mini-title {
  margin: 0 0 10px;
  color: var(--dim);
  font: 500 11.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.doc-head {
  padding-bottom: 26px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.sec {
  padding: 34px 0 4px;
}

.sec-blurb {
  margin: -6px 0 16px;
  color: var(--muted);
}

.prose h2 {
  margin-top: 34px;
  font-size: 21px;
}

.prose p,
.prose li {
  color: var(--text);
}

/* ---------- Atoms -------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 500 11px var(--mono);
  white-space: nowrap;
}

.badge.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge.warn,
.badge.quirk { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.bug { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.badge.design,
.badge.violet { background: var(--violet-soft); border-color: transparent; color: var(--violet); }
.badge.dim { color: var(--dim); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-2);
  color: var(--text);
  font: 500 12.5px var(--mono);
  text-decoration: none;
}

a.chip:hover {
  border-color: var(--line-2);
  background: var(--hover);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font: 600 14px var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}

.btn:hover {
  color: var(--text);
  border-color: var(--muted);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
}

.btn-run {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-run svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: none;
}

.btn-run:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--accent-ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.mini-btn {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font: 500 12px var(--font);
  cursor: pointer;
}

.mini-btn:hover {
  color: var(--text);
}

.ln-link {
  margin-left: auto;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--dim);
  font: 500 11.5px var(--mono);
  text-decoration: none;
  white-space: nowrap;
}

.ln-link:hover {
  background: var(--sel);
  color: var(--blue);
}

/* Syntax colours */
.t-kw { color: var(--t-kw); }
.t-str { color: var(--t-str); }
.t-num { color: var(--t-num); }
.t-com { color: var(--t-com); font-style: italic; }
.t-fn { color: var(--t-fn); }
.t-ty { color: var(--t-ty); }
.t-ann { color: var(--t-ann); }

code.sig {
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------- Class page --------------------------------------------------- */

.decl {
  margin: 20px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-2);
  overflow-x: auto;
  font-size: 14px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
  overflow: hidden;
}

.fact {
  padding: 12px 14px;
  background: var(--bg);
}

.fact dt {
  color: var(--dim);
  font: 500 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fact dd {
  margin: 3px 0 0;
  font-size: 14px;
  font-weight: 500;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  margin-top: 22px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-2);
}

.view-switch button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--font);
  cursor: pointer;
}

.view-switch button[aria-selected="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 0 var(--line-2), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
}

.js .view[hidden] {
  display: none;
}

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checks li {
  position: relative;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  font-size: 14px;
}

.checks li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 16px;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}

.checks.muted li::before {
  border-color: var(--dim);
}

.members {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.mem {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  transition: background 0.15s;
}

.mem:first-child {
  border-top: 0;
}

.mem:hover,
.mem:target {
  background: var(--bg-2);
}

.mem:target {
  box-shadow: inset 3px 0 0 var(--accent);
}

.mem-sig {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mem-desc {
  margin: 6px 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.mem-det {
  margin: 6px 0 0 24px;
  padding: 0 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.mem-det li::marker {
  color: var(--dim);
}

.enum {
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}

.enum-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.enum-vals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.enum-vals code {
  padding: 3px 9px !important;
  border-radius: 5px;
  color: var(--t-num) !important;
}

.fold summary {
  cursor: pointer;
  color: var(--muted);
  font: 500 13px var(--mono);
}

.acc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.acc li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

/* Source view */
.code-view {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}

.code-head {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font: 500 13px var(--mono);
}

.code-head .grow {
  flex: 1;
}

.code-body {
  overflow-x: auto;
  padding: 8px 0;
  font: 13px/1.6 var(--mono);
}

.l {
  display: grid;
  grid-template-columns: 56px max-content;
  min-width: 100%;
}

.l .n {
  position: sticky;
  left: 0;
  padding-right: 14px;
  background: var(--bg);
  color: var(--dim);
  text-align: right;
  text-decoration: none;
  user-select: none;
  border-right: 1px solid var(--line);
}

.l .c {
  padding: 0 24px 0 16px;
  white-space: pre;
}

.l.is-decl .n {
  color: var(--muted);
}

.l:target,
.l.is-hit {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.l:target .n,
.l.is-hit .n {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
  color: var(--accent);
}

/* ---------- Tables ------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.grid th {
  padding: 9px 14px;
  background: var(--bg-2);
  color: var(--dim);
  font: 600 11px var(--mono);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

table.grid td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

table.grid tbody tr:hover {
  background: var(--bg-2);
}

table.grid td .fi {
  margin-right: 6px;
}

.num {
  text-align: right !important;
  white-space: nowrap;
}

code.out {
  color: var(--t-str);
  font-size: 12.5px;
}

.pass,
.fail {
  font: 500 12.5px var(--mono);
  padding: 2px 7px;
  border-radius: 4px;
}

.pass { background: var(--ok-soft); color: var(--ok); }
.fail { background: var(--bad-soft); color: var(--bad); }

/* ---------- Cards, callouts, terminal ------------------------------------ */

.cards {
  display: grid;
  gap: 12px;
}

.cards.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}

.card h3 {
  margin-bottom: 8px;
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.card.link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}

.card.link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card.ok { border-top: 3px solid var(--ok); }
.card.no,
.card.warn { border-top: 3px solid var(--warn); }
.card.no { border-top-color: var(--bad); }

.callout {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: var(--bg-2);
  font-size: 14px;
}

.callout.warn { border-left-color: var(--warn); }
.callout p { margin: 4px 0 0; color: var(--muted); }
.callout .callout-t { margin: 0; color: var(--text); font-weight: 600; }

.term {
  position: relative;
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--term-bg);
  color: var(--term-text);
  font: 12.5px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.term-label {
  display: block;
  margin: -2px 0 8px;
  color: #7a7e85;
  font-size: 11px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.figure {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(var(--line) 1px, transparent 1.2px) 0 0 / 18px 18px,
    var(--bg-2);
  overflow-x: auto;
}

/* ---------- Diagrams ----------------------------------------------------- */

.uml,
.erd {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
  stroke: none;
  font-family: var(--mono);
}

.uml-box rect {
  fill: var(--bg);
  stroke: var(--line-2);
  stroke-width: 1.2;
  transition: stroke 0.2s;
}

.uml-box .uml-head {
  fill: var(--bg-3);
  stroke: none;
}

.uml-box line {
  stroke: var(--line-2);
}

.uml-box:hover rect:first-child {
  stroke: var(--accent);
  stroke-width: 2;
}

.uml-box.is-abstract .uml-name {
  font-style: italic;
  fill: var(--accent);
}

.uml-name {
  fill: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.uml-stereo {
  fill: var(--dim);
  font-size: 11px;
}

.uml-mem {
  fill: var(--muted);
  font-size: 12px;
}

.uml-lbl {
  fill: var(--dim);
  font-size: 11px;
}

.uml-inh,
.uml-assoc,
.uml-dep {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.5;
}

.uml-assoc {
  stroke: var(--muted);
  stroke-dasharray: 0;
}

.uml-dep {
  stroke-dasharray: 4 4;
}

.uml-tri {
  fill: var(--bg);
  stroke: var(--line-2);
  stroke-width: 1.2;
}

.uml-arr {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

/* Bars */
.bars {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bars li > a,
.bars.cap li {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.bars li > a {
  padding: 5px 8px;
  border-radius: 6px;
}

.bars li > a:hover {
  background: var(--bg-2);
  color: inherit;
}

.bars.cap li {
  grid-template-columns: 180px minmax(0, 1fr) 110px;
  padding: 5px 0;
}

.bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 13px var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 12px;
  border-radius: 3px;
  background: var(--bg-3);
  overflow: hidden;
}

.bar {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}

.bar.layer-support { background: var(--accent); }
.bar.layer-app { background: var(--ok); }
.bar.is-full { background: var(--bad); }

.bar-val {
  font: 500 13px var(--mono);
  white-space: nowrap;
}

/* ---------- Home --------------------------------------------------------- */

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 40px;
  align-items: center;
  padding: 10px 0 30px;
  border-bottom: 1px solid var(--line);
}

.hero-title {
  font-size: clamp(36px, 4.6vw, 58px);
  line-height: 1.02;
  margin: 0 0 18px;
}

.hero-title span {
  color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 4px 30px;
  margin: 30px 0 0;
  padding-top: 18px;
  border-top: 1px dashed var(--line-2);
}

.stats dt {
  color: var(--dim);
  font: 500 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats dd {
  margin: 2px 0 0;
  font: 600 26px var(--display);
}

.console-hint {
  margin: 8px 2px 0;
  color: var(--dim);
  font-size: 12.5px;
}

.role-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.role-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}

.role-tile:hover {
  color: inherit;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.role-ic {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 15px var(--mono);
}

.role-name {
  font: 600 17px var(--display);
}

.role-meta {
  color: var(--dim);
  font: 500 12px var(--mono);
}

.role-tile ol {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--term-bg);
  color: var(--term-text);
  font: 12px/1.7 var(--mono);
  list-style: decimal inside;
}

.role-tile ol li::marker {
  color: #6897bb;
}

.role-tile ol .more {
  list-style: none;
  color: #7a7e85;
}

.doc-rows {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.doc-row {
  display: grid;
  grid-template-columns: auto 200px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.doc-row:first-child {
  border-top: 0;
}

.doc-row:hover {
  background: var(--bg-2);
  color: var(--text);
}

.doc-row code {
  color: var(--text);
}

/* ---------- Architecture ------------------------------------------------- */

.layers {
  display: grid;
  gap: 10px;
}

.layer {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  background: var(--bg-2);
}

.layer-support { border-left-color: var(--accent); }
.layer-app { border-left-color: var(--ok); }

.layer-head strong {
  display: block;
  font: 600 16px var(--display);
}

.layer-head span {
  color: var(--muted);
  font-size: 13.5px;
}

.layer-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layer-items a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: 500 13px var(--mono);
  text-decoration: none;
}

.layer-items a:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- Workflows ---------------------------------------------------- */

.segs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--muted);
  font: 500 13px var(--font);
  text-decoration: none;
  cursor: pointer;
}

.seg:hover {
  color: var(--text);
}

.seg.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.run-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  font-size: 13.5px;
}

.session {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.session li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0 7px 4px;
  font-size: 13px;
}

.session li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 38px;
  top: 30px;
  height: 14px;
  border-left: 1.5px solid var(--line-2);
}

.session .loop span:last-child {
  color: var(--muted);
}

.node {
  display: inline-grid;
  place-items: center;
  min-width: 70px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font: 600 10.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.node.in { background: var(--sel); color: var(--blue); }
.node.do { background: var(--bg-3); color: var(--muted); border: 1px solid var(--line); }
.node.check { background: var(--warn-soft); color: var(--warn); }
.node.out { background: var(--ok-soft); color: var(--ok); }
.node.save { background: var(--accent-soft); color: var(--accent); }

.matrix td:nth-child(3) {
  max-width: 420px;
}

.opt {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}

.opt:target {
  border-color: var(--accent);
}

.opt-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.opt-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.opt-head h3 {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: -0.01em;
}

.opt-n {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--term-bg);
  color: #6897bb;
  font: 700 15px var(--mono);
}

.opt-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.opt-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 20px;
  padding: 16px;
}

.flow {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  align-items: start;
  padding: 6px 0;
  font-size: 13.5px;
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 39px;
  top: 28px;
  bottom: -6px;
  border-left: 1.5px dotted var(--line-2);
}

.step .node {
  min-width: 80px;
}

.outcomes {
  display: grid;
  gap: 8px;
  margin: 0;
}

.outcome dt {
  margin-bottom: 4px;
  color: var(--dim);
  font: 500 11.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.outcome dd {
  margin: 0;
}

/* Run page */
.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
}

.tl-dot {
  position: relative;
  width: 12px;
  height: 12px;
  margin: 6px 0 0 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline li:not(:last-child) .tl-dot::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  height: calc(100% + 64px);
  border-left: 1.5px solid var(--line-2);
}

.tl-body {
  padding-bottom: 20px;
}

.tl-body p {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.timeline li {
  overflow: hidden;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.role-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.role-card strong {
  color: var(--text);
  font: 600 16px var(--mono);
}

a.role-card:hover {
  border-color: var(--accent);
  color: var(--muted);
}

/* ---------- Data files --------------------------------------------------- */

.file-view {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.records {
  margin: 0;
  padding: 12px 14px;
  background: var(--term-bg);
  color: var(--term-text);
  font: 12.5px/1.75 var(--mono);
  overflow-x: auto;
}

.records .pipe {
  color: #5a5d63;
}

.seg.c0, .col-i.c0 { --cc: var(--c0); }
.seg.c1, .col-i.c1 { --cc: var(--c1); }
.seg.c2, .col-i.c2 { --cc: var(--c2); }
.seg.c3, .col-i.c3 { --cc: var(--c3); }
.seg.c4, .col-i.c4 { --cc: var(--c4); }
.seg.c5, .col-i.c5 { --cc: var(--c5); }
.seg.c6, .col-i.c6 { --cc: var(--c6); }
.seg.c7, .col-i.c7 { --cc: var(--c7); }
.seg.c8, .col-i.c8 { --cc: var(--c8); }

.records .seg {
  display: inline;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cc);
  font: inherit;
  cursor: help;
}

[data-theme="light"] .records .seg {
  filter: brightness(1.55) saturate(0.9);
}

.col-i {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--cc) 18%, transparent);
  color: var(--cc);
  font: 700 12px var(--mono);
}

.refs {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.datafile h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.datafile h2 code {
  font-size: 0.85em;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
}

/* ---------- Issues ------------------------------------------------------- */

.issues {
  display: grid;
  gap: 12px;
  padding-top: 26px;
}

.issue {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  background: var(--bg-2);
}

.issue.bug { border-left-color: var(--bad); }
.issue.design { border-left-color: var(--violet); }
.issue[hidden] { display: none; }

.issue header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.issue h3 {
  font-size: 16.5px;
}

.issue .src {
  margin-left: auto;
  font: 500 11.5px var(--mono);
}

.issue p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.issue .fix span {
  margin-right: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ok-soft);
  color: var(--ok);
  font: 600 11px var(--mono);
  text-transform: uppercase;
}

.issue-where {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.issue-where .ln-link {
  margin-left: 0;
}

.issue-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.issue-mini a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.issue-mini a:hover {
  border-color: var(--line-2);
  color: var(--text);
}

/* ---------- Validator lab ------------------------------------------------ */

.validator-lab {
  margin-top: 16px;
}

.lab {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
}

.lab label {
  font: 600 13px var(--mono);
}

.lab-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lab select,
.lab input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: 13px var(--mono);
}

.lab input {
  flex: 1;
  min-width: 0;
}

.lab-out {
  min-width: 80px;
  text-align: center;
}

/* ---------- Pager & footer ----------------------------------------------- */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  color: inherit;
  text-decoration: none;
}

.pager-link:hover {
  border-color: var(--accent);
  color: inherit;
}

.pager-link.next {
  grid-column: 2;
  text-align: right;
}

.pager-link span {
  color: var(--dim);
  font: 500 11.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pager-link strong {
  font: 600 15px var(--mono);
}

.site-foot {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13.5px;
}

.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 28px;
  max-width: 1280px;
  padding: 34px 48px 26px;
}

.foot-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.foot-grid a {
  width: fit-content;
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.foot-grid a:hover {
  color: var(--accent);
}

.foot-title {
  margin: 0;
  font: 600 20px var(--display);
}

.foot-text {
  margin: 0;
  color: var(--muted);
}

.foot-head {
  margin: 0 0 4px;
  color: var(--dim);
  font: 600 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.foot-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 48px 18px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font: 12px var(--mono);
}

.foot-bar code {
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--accent) !important;
}

/* Status bar */
.statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: var(--sb);
  padding: 0 8px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 12px var(--font);
}

.sb-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  white-space: nowrap;
}

.sb-item svg {
  width: 13px;
  height: 13px;
}

.sb-grow {
  flex: 1;
}

/* ---------- Report ------------------------------------------------------- */

.pdf-frame {
  height: min(85vh, 1000px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-2);
}

.pdf-frame object {
  width: 100%;
  height: 100%;
}

.pdf-frame p {
  padding: 20px;
}

.nf {
  max-width: 680px;
  padding: 40px 0;
}

.nf .term {
  margin-bottom: 30px;
  color: #f75464;
}

/* ---------- Console (inline + dock) -------------------------------------- */

.console {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #2e3034;
  border-radius: 12px;
  background: var(--term-bg);
  color: var(--term-text);
  overflow: hidden;
  box-shadow: var(--shadow);
  font: 13px/1.6 var(--mono);
}

.con-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 6px 0 10px;
  background: #1b1c1f;
  border-bottom: 1px solid #2e3034;
  color: #a8abb2;
  font: 500 12.5px var(--font);
}

.con-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 6px;
  color: #dfe1e5;
  white-space: nowrap;
}

.con-title svg {
  width: 14px;
  height: 14px;
  fill: #5fb865;
  stroke: none;
}

.con-tab,
.con-btn {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a8abb2;
  font: 500 12.5px var(--font);
  cursor: pointer;
  white-space: nowrap;
}

.con-tab:hover,
.con-btn:hover {
  background: #2b2d30;
  color: #dfe1e5;
}

.con-tab[aria-selected="true"] {
  background: #2b2d30;
  color: #dfe1e5;
  box-shadow: inset 0 -2px 0 #548af7;
}

.con-grow {
  flex: 1;
}

.con-out {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 12px 14px 4px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.con-out .u {
  color: #f89820;
}

.con-out .sys {
  color: #6f737a;
}

.con-out .err {
  color: #f75464;
}

.con-out .hdr {
  color: #ffc66d;
}

.con-in {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 10px;
}

.con-in label {
  color: #f89820;
}

.con-in input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  caret-color: #f89820;
}

.con-in input:disabled {
  opacity: 0.4;
}

.con-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.con-chip {
  height: 24px;
  padding: 0 9px;
  border: 1px solid #393b40;
  border-radius: 999px;
  background: #1e1f22;
  color: #a8abb2;
  font: 500 11.5px var(--mono);
  cursor: pointer;
}

.con-chip:hover {
  border-color: #f89820;
  color: #fff;
}

.con-files {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.con-files[hidden] {
  display: none;
}

.con-files-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid #2e3034;
  font: 12px var(--font);
  color: #a8abb2;
}

.con-files-bar button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid #393b40;
  border-radius: 6px;
  background: #1e1f22;
  color: #a8abb2;
  font: 500 12px var(--mono);
  cursor: pointer;
}

.con-files-bar button[aria-pressed="true"] {
  border-color: #548af7;
  color: #fff;
}

.con-files-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
}

.con-files-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid #2e3034;
}

.con-files-col:last-child {
  border-right: 0;
}

.con-files-col h4 {
  margin: 0;
  padding: 8px 14px;
  color: #6f737a;
  font: 600 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.con-files-col pre {
  flex: 1;
  margin: 0;
  padding: 0 14px 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.7;
}

.con-files-col .chg {
  display: block;
  margin: 0 -14px;
  padding: 0 14px;
  background: rgba(248, 152, 32, 0.14);
  box-shadow: inset 2px 0 0 #f89820;
}

.inline-console .console {
  height: 470px;
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--sb);
  z-index: 25;
  height: min(46vh, 460px);
  padding: 0;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.6);
}

.dock .console {
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.dock-open {
  padding-bottom: calc(var(--sb) + min(46vh, 460px));
}

/* ---------- Search palette ----------------------------------------------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.palette[hidden] {
  display: none;
}

.pal {
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.pal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.pal-head input {
  flex: 1;
  height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 15px var(--font);
}

.pal-scope {
  color: var(--dim);
  font: 500 11.5px var(--mono);
}

.pal-list {
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.pal-list a {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.pal-list a[aria-selected="true"],
.pal-list a:hover {
  background: var(--sel);
  color: var(--text);
}

.pal-list .pal-x {
  display: block;
  color: var(--dim);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pal-list .pal-k {
  color: var(--dim);
  font: 500 11.5px var(--mono);
}

.pal-list mark {
  background: none;
  color: var(--accent);
  font-weight: 600;
}

.pal-empty {
  padding: 18px;
  color: var(--dim);
  text-align: center;
}

.pal-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font: 11.5px var(--mono);
}

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

@media (max-width: 1280px) {
  .workspace,
  body:not(:has(.pane-structure)) .workspace {
    grid-template-columns: var(--tree-w) minmax(0, 1fr);
  }

  .pane-structure {
    display: none;
  }
}

@media (max-width: 1100px) {
  .welcome {
    grid-template-columns: minmax(0, 1fr);
  }

  .role-tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .opt-body,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .workspace,
  body:not(:has(.pane-structure)) .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .tb-menu {
    display: inline-flex;
  }

  .pane-project {
    position: fixed;
    top: var(--tb);
    left: 0;
    bottom: var(--sb);
    z-index: 40;
    width: min(320px, 86vw);
    height: auto;
    transform: translateX(-102%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow);
  }

  body.tree-open .pane-project {
    transform: none;
  }

  .pane-x {
    display: block;
  }

  .crumbs {
    display: none;
  }

  .tb-search {
    min-width: 0;
    width: 30px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }

  .tb-search span,
  .tb-search kbd {
    display: none;
  }

  .doc {
    padding: 26px 24px 48px;
  }

  .foot-grid {
    grid-template-columns: 1fr 1fr;
    padding: 28px 24px 20px;
  }

  .foot-brand {
    grid-column: 1 / -1;
  }

  .foot-bar {
    padding: 14px 24px 18px;
  }

  .layer {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .bars li > a,
  .bars.cap li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .doc-row {
    grid-template-columns: auto 1fr;
  }

  .doc-row span {
    grid-column: 2;
  }

  .con-files-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .con-files-col {
    border-right: 0;
    border-bottom: 1px solid #2e3034;
  }

  .lab {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  body {
    font-size: 14.5px;
  }

  .titlebar {
    gap: 2px;
    padding: 0 6px;
  }

  .brand-text {
    display: none;
  }

  .tb-run span {
    display: none;
  }

  .tb-run {
    width: 30px;
    padding: 0;
  }

  .tb-report span {
    display: none;
  }

  .tb-report {
    width: 30px;
    padding: 0;
  }

  .pathbar {
    padding: 0 16px;
  }

  .doc {
    padding: 22px 16px 40px;
  }

  .stats {
    grid-template-columns: repeat(2, auto);
  }

  .role-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .opt-head {
    grid-template-columns: auto 1fr;
  }

  .opt-meta {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-link.next {
    grid-column: 1;
  }

  .foot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sb-hide {
    display: none;
  }

  .inline-console .console {
    height: 420px;
  }

  .step {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .step::after {
    display: none;
  }

  .con-title span {
    display: none;
  }
}

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

.mem-sig code.sig {
  flex: 1 1 320px;
  min-width: 0;
}

/* Show operators exactly as typed (no != → ≠ ligatures) */
code,
pre,
kbd,
.code-body,
.console {
  font-variant-ligatures: none;
}

/* Console parts toggled with the hidden attribute */
.con-out[hidden],
.con-in[hidden],
.con-chips[hidden] {
  display: none;
}
