/* System Prompts Archive — paper/ink + blueprint. No external assets. */

@font-face {
  font-family: Ubuntu;
  src: url("../fonts/ubuntu-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Ubuntu;
  src: url("../fonts/ubuntu-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Ubuntu;
  src: url("../fonts/ubuntu-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("../fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("../fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("../fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: Ubuntu, "Segoe UI", sans-serif;
  --font-body: Ubuntu, "Segoe UI", "Avenir Next", sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", "IBM Plex Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  --bg: #faf7f5;
  --bg-ink: #f3eee8;
  --surface: #fffdfb;
  --surface-elevated: #fff9f4;
  --surface-recessed: #f4efe9;
  --border: rgba(41, 32, 23, 0.08);
  --border-bright: rgba(41, 32, 23, 0.16);
  --text: #292017;
  --text-dim: #8a7e72;
  --text-faint: #b0a59a;
  --accent: #c2410c;
  --accent-dim: rgba(194, 65, 12, 0.08);
  --sage: #4d7c0f;
  --sage-dim: rgba(77, 124, 15, 0.1);
  --teal: #0f766e;
  --teal-dim: rgba(15, 118, 110, 0.1);
  --amber: #b45309;
  --amber-dim: rgba(180, 83, 9, 0.1);
  --rose: #9f1239;
  --rose-dim: rgba(159, 18, 57, 0.1);
  --slate: #1e3a5f;
  --slate-dim: rgba(30, 58, 95, 0.1);
  --ink: #292017;
  --ink-dim: rgba(41, 32, 23, 0.08);
  --muted: #6b625a;
  --muted-dim: rgba(107, 98, 90, 0.1);
  --cyan: #0e7490;
  --cyan-dim: rgba(14, 116, 144, 0.1);
  --shadow: 0 8px 28px rgba(41, 32, 23, 0.06);
  --grid: rgba(41, 32, 23, 0.045);
  --read-bg: #fffdfb;
  --sidebar-w: 292px;
  --radius: 10px;
}

html[data-theme="dark"] {
  --bg: #161210;
  --bg-ink: #1c1714;
  --surface: #221c18;
  --surface-elevated: #2b241f;
  --surface-recessed: #1a1512;
  --border: rgba(237, 229, 221, 0.08);
  --border-bright: rgba(237, 229, 221, 0.14);
  --text: #ede5dd;
  --text-dim: #a69889;
  --text-faint: #6e645b;
  --accent: #fb923c;
  --accent-dim: rgba(251, 146, 60, 0.12);
  --sage: #bef264;
  --sage-dim: rgba(190, 242, 100, 0.1);
  --teal: #5eead4;
  --teal-dim: rgba(94, 234, 212, 0.1);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.1);
  --rose: #fda4af;
  --rose-dim: rgba(253, 164, 175, 0.1);
  --slate: #93c5fd;
  --slate-dim: rgba(147, 197, 253, 0.1);
  --ink: #ede5dd;
  --ink-dim: rgba(237, 229, 221, 0.08);
  --muted: #a69889;
  --muted-dim: rgba(166, 152, 137, 0.1);
  --cyan: #67e8f9;
  --cyan-dim: rgba(103, 232, 249, 0.1);
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  --grid: rgba(237, 229, 221, 0.04);
  --read-bg: #161210;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #161210;
    --bg-ink: #1c1714;
    --surface: #221c18;
    --surface-elevated: #2b241f;
    --surface-recessed: #1a1512;
    --border: rgba(237, 229, 221, 0.08);
    --border-bright: rgba(237, 229, 221, 0.14);
    --text: #ede5dd;
    --text-dim: #a69889;
    --text-faint: #6e645b;
    --accent: #fb923c;
    --accent-dim: rgba(251, 146, 60, 0.12);
    --sage: #bef264;
    --sage-dim: rgba(190, 242, 100, 0.1);
    --teal: #5eead4;
    --teal-dim: rgba(94, 234, 212, 0.1);
    --amber: #fbbf24;
    --amber-dim: rgba(251, 191, 36, 0.1);
    --rose: #fda4af;
    --rose-dim: rgba(253, 164, 175, 0.1);
    --slate: #93c5fd;
    --slate-dim: rgba(147, 197, 253, 0.1);
    --ink: #ede5dd;
    --ink-dim: rgba(237, 229, 221, 0.08);
    --muted: #a69889;
    --muted-dim: rgba(166, 152, 137, 0.1);
    --cyan: #67e8f9;
    --cyan-dim: rgba(103, 232, 249, 0.1);
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    --grid: rgba(237, 229, 221, 0.04);
    --read-bg: #161210;
  }
}

/* Cyan / black / white — additional theme; paper/ink tokens above are unchanged. */
html[data-theme="cyan"] {
  --bg: #050505;
  --bg-ink: #000000;
  --surface: #0a0a0a;
  --surface-elevated: #111111;
  --surface-recessed: #000000;
  --border: rgba(255, 255, 255, 0.12);
  --border-bright: rgba(255, 255, 255, 0.22);
  --text: #ffffff;
  --text-dim: #b3b3b3;
  --text-faint: #6a6a6a;
  --accent: #00d4e8;
  --accent-dim: rgba(0, 212, 232, 0.14);
  --sage: #00d4e8;
  --sage-dim: rgba(0, 212, 232, 0.12);
  --teal: #00d4e8;
  --teal-dim: rgba(0, 212, 232, 0.12);
  --amber: #ffffff;
  --amber-dim: rgba(255, 255, 255, 0.08);
  --rose: #00d4e8;
  --rose-dim: rgba(0, 212, 232, 0.12);
  --slate: #ffffff;
  --slate-dim: rgba(255, 255, 255, 0.08);
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.08);
  --muted: #8a8a8a;
  --muted-dim: rgba(255, 255, 255, 0.08);
  --cyan: #00d4e8;
  --cyan-dim: rgba(0, 212, 232, 0.12);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  --grid: rgba(0, 212, 232, 0.09);
  --read-bg: #000000;
}

html { height: 100%; }
html, body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 12% -10%, var(--accent-dim) 0%, transparent 46%),
    radial-gradient(ellipse at 92% 110%, var(--sage-dim) 0%, transparent 42%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
  color: var(--text);
  line-height: 1.55;
  min-height: 100%;
  overflow: hidden;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
code, kbd { font-family: var(--font-mono); font-size: 0.86em; }
button { font-family: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  min-width: 0;
}
.app > * { min-width: 0; }

/* —— Sidebar —— */
.sidebar {
  background: color-mix(in srgb, var(--bg-ink) 88%, var(--surface) 12%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.brand {
  padding: 1.15rem 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: center;
}
.brand-mark {
  width: 38px; height: 38px;
  border: 1px solid var(--border-bright);
  background: var(--surface);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.brand p {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.search-wrap { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border); }
.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.84rem;
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-hint {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.4rem 0 1.2rem; }
.nav-vendor { margin-bottom: 0.1rem; }
.nav-vendor-btn {
  width: 100%;
  background: none;
  border: 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.95rem;
  cursor: pointer;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-vendor-btn:hover { color: var(--text); background: var(--accent-dim); }
.nav-vendor.is-open > .nav-vendor-btn { color: var(--text); }
.chev {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform 0.15s;
}
.nav-vendor:not(.is-open) .chev { transform: rotate(-90deg); }
.nav-vendor:not(.is-open) .nav-body { display: none; }
.nav-count { margin-left: auto; font-family: var(--font-mono); font-weight: 500; font-size: 10px; color: var(--text-faint); letter-spacing: 0; text-transform: none; }

.hue-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--hue, var(--muted));
}

.nav-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  padding: 0.45rem 0.95rem 0.2rem 1.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-file {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  padding: 0.32rem 0.9rem 0.32rem 1.7rem;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-file:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.nav-file.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

/* —— Main —— */
.main {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: transparent;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 1.25rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.hub-link {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.38rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.hub-link:hover { color: var(--text); border-color: var(--border-bright); }
.menu-btn, .tool-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.38rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.menu-btn { display: none; }
.tool-btn:hover { color: var(--text); border-color: var(--border-bright); }
.tool-btn[hidden] { display: none; }
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-faint);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb button {
  background: none; border: 0; color: var(--accent); cursor: pointer; font-size: inherit;
}
.breadcrumb .here { color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; gap: 0.4rem; flex-shrink: 0; }

.chrome {
  flex-shrink: 0;
  z-index: 5;
}
.reader-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 1.25rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.reader-bar[hidden] { display: none; }
.reader-field {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}
.reader-field span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.reader-field select {
  appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a7e72'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.38rem 1.5rem 0.38rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-body);
  cursor: pointer;
  min-width: 7.5rem;
}
.reader-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.tool-btn.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.content.is-reading {
  background: var(--read-bg);
  background-image: none;
  color: var(--text);
}

.content.is-reading .md {
  font-family: var(--read-font, var(--font-body));
  font-size: var(--read-size, 16px);
  line-height: var(--read-leading, 1.7);
  max-width: var(--read-measure, none);
  margin-inline: auto;
  padding: var(--read-pad-y, 1.6rem) var(--read-pad-x, 2rem) 4rem;
  width: 100%;
}
.content.is-reading .md h1,
.content.is-reading .md h2,
.content.is-reading .md h3,
.content.is-reading .md h4 {
  font-family: var(--read-font, var(--font-display));
  line-height: 1.25;
}
.content.is-reading .md p {
  margin-block: var(--read-para, 0.7em);
  line-height: var(--read-leading, 1.7);
}
.content.is-reading .md li {
  margin-block: var(--read-li, 0.22em);
  line-height: var(--read-leading, 1.7);
}
.content.is-reading .md ul,
.content.is-reading .md ol {
  margin-block: var(--read-para, 0.7em);
}
.content.is-reading .md pre,
.content.is-reading .raw-view,
.content.is-reading .md :not(pre) > code {
  font-size: calc(var(--read-size, 16px) * 0.9);
  line-height: var(--read-leading, 1.7);
}

html[data-paper="cream"] .content.is-reading {
  --read-bg: #f7f1e3;
  --text: #2c2416;
  --text-dim: #6a5d48;
  --text-faint: #94856d;
  --border: rgba(44, 36, 22, 0.12);
}
html[data-paper="sepia"] .content.is-reading {
  --read-bg: #edd9b0;
  --text: #3a2714;
  --text-dim: #6d4e2e;
  --text-faint: #8d6a42;
  --border: rgba(58, 39, 20, 0.16);
}
html[data-paper="mist"] .content.is-reading {
  --read-bg: #e8eef2;
  --text: #1b242c;
  --text-dim: #5a6873;
  --text-faint: #7d8b96;
  --border: rgba(27, 36, 44, 0.12);
}
html[data-paper="night"] .content.is-reading {
  --read-bg: #141414;
  --text: #ece6dc;
  --text-dim: #a79e90;
  --text-faint: #6f685e;
  --border: rgba(236, 230, 220, 0.1);
}
html[data-paper="ink"] .content.is-reading {
  --read-bg: #000000;
  --text: #ffffff;
  --text-dim: #b5b5b5;
  --text-faint: #7a7a7a;
  --border: rgba(255, 255, 255, 0.14);
}

html.is-contrast .content.is-reading {
  --text: #000000;
  --text-dim: #161616;
  --text-faint: #333333;
}
html.is-contrast-dark .content.is-reading {
  --text: #ffffff;
  --text-dim: #f0f0f0;
  --text-faint: #d2d2d2;
}
html.is-contrast .content.is-reading .md td { color: var(--text); }

html.is-focus .sidebar,
html.is-focus .footer { display: none; }
html.is-focus .app { grid-template-columns: 1fr; }
html.is-focus .topbar { border-bottom-color: transparent; }
html.is-focus .hub-link { display: none; }

@media (display-mode: standalone) {
  .hub-link { display: none; }
  body { user-select: none; }
  .content.is-reading, .content.is-reading .md { user-select: text; }
}

/* —— Hero —— */
.hero {
  padding: 2.6rem 2rem 2rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 2rem;
  align-items: end;
  animation: fadeUp 0.5s ease both;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.kicker::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.hero h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 0.7rem;
}
.lead {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 38rem;
  line-height: 1.55;
}
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.kpi:first-child {
  background: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
  border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%);
}
.kpi-num {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.section {
  padding: 1.4rem 2rem 2rem;
  animation: fadeUp 0.55s ease both;
  animation-delay: 0.06s;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.section-label::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.7rem;
}
.vendor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.9rem 0.9rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.vendor-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
  box-shadow: var(--shadow);
}
.vendor-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vendor-card .mark {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--hue, var(--accent));
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.vendor-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.vendor-card .count { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }

.featured {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-top: 0.2rem;
}
.feat {
  display: block;
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.feat:hover { border-color: var(--border-bright); background: var(--surface); }
.feat small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}
.feat span { font-size: 0.9rem; }

.file-list { padding: 0 2rem 2rem; }
.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 0.2rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.file-row:hover { background: var(--accent-dim); }
.file-row .name { font-size: 0.92rem; }
.file-row .path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 0.15rem;
}
.file-row .grp {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  align-self: center;
}

/* —— Markdown —— */
.md {
  padding: 1.5rem 2rem 3rem;
  max-width: none;
  width: 100%;
}
.md-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}
.md h1 { font-size: 1.85rem; margin: 1.4rem 0 0.7rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--border); }
.md h2 { font-size: 1.35rem; margin: 1.3rem 0 0.5rem; }
.md h3 { font-size: 1.08rem; margin: 1rem 0 0.4rem; }
.md p { margin: 0.65rem 0; color: var(--text); line-height: 1.7; }
.md ul, .md ol { margin: 0.5rem 0 0.5rem 1.35rem; }
.md li { margin: 0.22rem 0; line-height: 1.6; }
.md blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.9rem 0;
  padding: 0.45rem 0.9rem;
  background: none;
  color: var(--text-dim);
}
.md table { width: 100%; border-collapse: collapse; margin: 0.9rem 0; font-size: 0.85rem; display: table; overflow-x: auto; }
.md th, .md td { padding: 0.45rem 0.65rem; border: 1px solid var(--border); text-align: left; background: none; }
.md th { font-weight: 600; }
.md td { color: var(--text-dim); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.3rem 0; }
.md img { max-width: 100%; border-radius: 8px; }
.md pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0.4rem 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  margin: 0.8rem 0;
  box-shadow: none;
}
.md :not(pre) > code {
  background: none;
  border: 0;
  padding: 0;
}
.md a[href^="#"] { color: var(--accent); }

.raw-view {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: none;
  border: 0;
  padding: 0;
  max-width: none;
  margin: 0.4rem 0 0;
}

/* —— Guide —— */
.guide { padding: 2rem; max-width: 720px; }
.guide h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}
.guide .lead { margin-bottom: 1.4rem; }
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 0 0.85rem 2.8rem;
  border-bottom: 1px solid var(--border);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0.85rem;
  width: 1.7rem; height: 1.7rem;
  border: 1px solid var(--border-bright);
  background: var(--surface);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.guide pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-recessed);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  white-space: pre-wrap;
  margin: 0.8rem 0 1.2rem;
}

.footer {
  margin-top: auto;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.loading {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 2.5rem 2rem; color: var(--text-dim);
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.empty {
  padding: 3rem 2rem;
  color: var(--text-dim);
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 1.4rem; right: 1.4rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border-bright);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  z-index: 80;
  animation: fadeUp 0.2s ease;
}

.overlay { display: none; }

[data-hue="terracotta"] { --hue: var(--accent); }
[data-hue="teal"] { --hue: var(--teal); }
[data-hue="sage"] { --hue: var(--sage); }
[data-hue="ink"] { --hue: var(--ink); }
[data-hue="cyan"] { --hue: var(--cyan); }
[data-hue="slate"] { --hue: var(--slate); }
[data-hue="rose"] { --hue: var(--rose); }
[data-hue="amber"] { --hue: var(--amber); }
[data-hue="muted"] { --hue: var(--muted); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: min(86vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: inline-flex; }
  .hero { grid-template-columns: 1fr; padding: 1.6rem 1.1rem 1.3rem; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .section, .file-list, .md, .guide, .raw-view { padding-left: 1.1rem; padding-right: 1.1rem; }
  .reader-bar { padding-left: 1rem; padding-right: 1rem; }
  .reader-field select { min-width: 6.4rem; }
  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20, 14, 10, 0.45);
    z-index: 15;
  }
  .overlay.is-on { display: block; }
}
