/* =========================================================
   THE LEDGER — Modern stylesheet
   Clean. Readable. Hand-rolled (no Tailwind).
   ========================================================= */

:root {
  /* Surfaces */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;

  /* Ink */
  --fg: #0b0b0a;
  --fg-muted: #5b5b58;
  --fg-subtle: #8f8e89;

  /* Lines */
  --border: #e5e3dd;
  --border-strong: #d1cfc7;

  /* Accent */
  --accent: #ff5a1f;
  --accent-deep: #c2410c;
  --accent-tint: #ffe9dc;

  /* Status */
  --ok: #15803d;
  --err: #b91c1c;

  /* Type */
  --ff-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Scale */
  --fs-xs:   0.8125rem;  /* 13 */
  --fs-sm:   0.9375rem;  /* 15 */
  --fs-base: 1.0625rem;  /* 17 — larger base for readability */
  --fs-lg:   1.1875rem;  /* 19 */
  --fs-xl:   1.5rem;     /* 24 */
  --fs-2xl:  clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
  --fs-3xl:  clamp(2.25rem, 1.4rem + 2.8vw, 3.5rem);
  --fs-hero: clamp(2.75rem, 1.4rem + 5vw, 5.25rem);

  /* Spacing */
  --sp-1: 0.5rem;
  --sp-2: 0.75rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: 2rem;
  --sp-6: 3rem;
  --sp-7: 4.5rem;
  --sp-8: 6.5rem;

  /* Radii */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(11,11,10,0.04);
  --shadow:    0 4px 14px rgba(11,11,10,0.06), 0 1px 2px rgba(11,11,10,0.04);
  --shadow-lg: 0 24px 48px -16px rgba(11,11,10,0.16), 0 2px 6px rgba(11,11,10,0.05);

  /* Layout */
  --container: 1180px;
  --container-narrow: 760px;
}

/* --------- Reset --------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

/* --------- Base --------- */
body {
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02", "cv11";
  text-rendering: optimizeLegibility;
}

::selection { background: var(--fg); color: var(--bg); }

.skip {
  position: absolute; top: -100px; left: 0;
  background: var(--fg); color: var(--bg);
  padding: 0.6rem 1rem; font-size: var(--fs-sm);
  border-radius: 0 0 var(--r-sm) 0;
}
.skip:focus { top: 0; z-index: 100; }

/* --------- Layout --------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

/* =========================================================
   APP SHELL (sidebar layout)
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  align-items: stretch;
}
.app__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app__main > main { flex: 1; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  z-index: 40;
}
.sidebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  padding: 0.25rem 0.4rem;
}
.sidebar__mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.8rem;
  letter-spacing: -0.02em;
  flex: none;
}
.sidebar__nav {
  display: flex; flex-direction: column;
  gap: 0.15rem;
}
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-muted);
  transition: background .2s, color .2s;
}
.sidebar__nav a:hover { background: var(--bg); color: var(--fg); }
.sidebar__nav a[aria-current="page"] {
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
}
.sidebar__nav a::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
  transition: background .2s;
}
.sidebar__nav a[aria-current="page"]::before { background: var(--accent); }

.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.sidebar__group-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.75rem 0.4rem;
}
.sidebar__categories {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sidebar__cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background .2s, color .2s;
}
.sidebar__cat:hover { background: var(--bg); color: var(--fg); }
.sidebar__cat--active {
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-weight: 600;
}
.sidebar__cat--active .sidebar__cat-n {
  background: var(--accent);
  color: var(--bg);
}
.sidebar__cat-n {
  background: var(--bg);
  color: var(--fg-muted);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  padding: 0.1rem 0.5rem;
  border-radius: var(--r-full);
  font-weight: 500;
}

.sidebar__user {
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar__user .user-badge {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  background: var(--bg);
}
.sidebar__user .btn,
.sidebar__user .nav__cta {
  width: 100%;
  justify-content: center;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    height: auto;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .sidebar__brand { padding: 0; }
  .sidebar__nav {
    flex-direction: row;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
  }
  .sidebar__nav a { padding: 0.45rem 0.7rem; white-space: nowrap; }
  .sidebar__nav a::before { display: none; }
  .sidebar__user {
    margin-top: 0;
    flex-direction: row;
    border-top: 0;
    padding-top: 0;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border);
  }
  .sidebar__user .user-badge { width: auto; }
  .sidebar__user .btn, .sidebar__user .nav__cta { width: auto; }
}

/* Legacy .nav-header / .nav kept below so the knowledge sticky sidebar offset still works. */
.nav-header { display: none; }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  gap: var(--sp-4);
}
.nav__brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.nav__mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem;
  letter-spacing: -0.02em;
}
.nav__links {
  display: flex; gap: var(--sp-1);
}
.nav__links a {
  padding: 0.5rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  font-weight: 500;
  transition: color .2s, background .2s;
}
.nav__links a:hover { color: var(--fg); background: var(--surface-2); }
.nav__links a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }

.nav__cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: transform .15s, background .2s;
}
.nav__cta:hover { background: var(--accent-deep); transform: translateY(-1px); }

@media (max-width: 640px) {
  .nav__links { display: none; }
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform .15s, background .2s, border-color .2s, color .2s, box-shadow .2s;
  white-space: nowrap;
  cursor: pointer;
}
.btn--primary {
  background: var(--fg);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface); border-color: var(--fg); }
.btn--lg { padding: 0.95rem 1.6rem; font-size: var(--fs-base); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: var(--sp-8) 0 var(--sp-7);
  text-align: center;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 50% -10%, rgba(255,90,31,0.08), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-muted);
  box-shadow: var(--shadow-sm);
}
.tag__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.hero__title {
  font-size: var(--fs-hero);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 16ch;
  margin: var(--sp-4) auto var(--sp-4);
}
.hero__title em {
  font-style: normal;
  color: var(--accent);
}
.hero__lead {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  line-height: 1.55;
  max-width: 58ch;
  margin: 0 auto var(--sp-5);
}
.hero__actions {
  display: flex; justify-content: center; gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-7);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-1);
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-1);
  box-shadow: var(--shadow-sm);
}
.stat {
  padding: var(--sp-4);
  border-radius: var(--r);
  text-align: left;
}
.stat__v {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--fg);
}
.stat__l {
  margin-top: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
}

/* =========================================================
   SECTION HEADERS
   ========================================================= */
.section {
  padding: var(--sp-8) 0;
}
.section__kicker {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}
.section__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 22ch;
  margin-bottom: var(--sp-3);
}
.section__lead {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  max-width: 52ch;
  line-height: 1.55;
}
.section__head { margin-bottom: var(--sp-6); }

/* =========================================================
   FEATURES
   ========================================================= */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.feature:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.feature__icon {
  width: 40px; height: 40px;
  border-radius: var(--r);
  background: var(--accent-tint);
  color: var(--accent-deep);
  display: grid; place-items: center;
  margin-bottom: var(--sp-3);
}
.feature h3 {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-2);
}
.feature p {
  color: var(--fg-muted);
  font-size: var(--fs-base);
  line-height: 1.55;
  margin-bottom: var(--sp-3);
}
.feature__tag {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
@media (max-width: 860px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   STEPS
   ========================================================= */
.steps {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.step-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
  counter-reset: step;
}
.step {
  counter-increment: step;
  position: relative;
  padding-top: var(--sp-5);
}
.step::before {
  content: "0" counter(step);
  position: absolute;
  top: 0; left: 0;
  font-family: var(--ff-mono);
  font-size: var(--fs-sm);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.05em;
}
.step::after {
  content: "";
  position: absolute;
  top: 0.4rem; left: 2.5rem; right: -1.25rem;
  height: 1px;
  background: var(--border);
}
.step:last-child::after { display: none; }
.step h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.step p {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
@media (max-width: 900px) {
  .step-list { grid-template-columns: 1fr 1fr; }
  .step::after { display: none; }
}
@media (max-width: 520px) {
  .step-list { grid-template-columns: 1fr; }
}

/* =========================================================
   QUOTE
   ========================================================= */
.quote {
  padding: var(--sp-8) 0;
  text-align: center;
}
.quote blockquote { margin: 0; }
.quote p {
  font-size: var(--fs-3xl);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
  max-width: 22ch;
  margin: 0 auto var(--sp-4);
  color: var(--fg);
}
.quote footer {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
}
.quote__author { font-weight: 600; color: var(--fg); }

/* =========================================================
   CTA
   ========================================================= */
.cta {
  padding: var(--sp-8) 0;
}
.cta__card {
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta__card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 80% 0%, rgba(255,90,31,0.25), transparent 60%),
              radial-gradient(400px 200px at 10% 100%, rgba(255,90,31,0.15), transparent 60%);
  pointer-events: none;
}
.cta__card > * { position: relative; }
.cta__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 20ch;
  margin: 0 auto var(--sp-4);
}
.cta__lead {
  color: rgba(246,245,242,0.7);
  font-size: var(--fs-lg);
  max-width: 48ch;
  margin: 0 auto var(--sp-5);
}
.cta__card .btn--primary {
  background: var(--bg);
  color: var(--fg);
}
.cta__card .btn--primary:hover {
  background: var(--accent);
  color: var(--bg);
}
.cta__fine {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  color: rgba(246,245,242,0.55);
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-6) 0 var(--sp-5);
  margin-top: var(--sp-5);
}
.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-5);
  align-items: start;
}
.footer__brand p {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  max-width: 36ch;
  margin-top: 0.6rem;
}
.footer__col h4 {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.footer__col ul li { margin-bottom: 0.35rem; font-size: var(--fs-sm); }
.footer__col a { color: var(--fg-muted); transition: color .2s; }
.footer__col a:hover { color: var(--fg); }
.footer__bottom {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}
@media (max-width: 760px) {
  .footer__inner { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   ARCHIVE PAGE
   ========================================================= */
.archive__head {
  padding: var(--sp-8) 0 var(--sp-5);
  text-align: center;
  max-width: var(--container-narrow);
  margin-inline: auto;
}
.archive__actions {
  display: flex; justify-content: center; gap: var(--sp-2);
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}
.archive__status {
  margin-top: var(--sp-3);
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  min-height: 1.2em;
}
.archive__status[data-tone="err"] { color: var(--err); }

/* =========================================================
   KNOWLEDGE Q&A CARDS (pulled from Google Sheet)
   ========================================================= */
.kb-wrap {
  padding-bottom: var(--sp-7);
  max-width: 760px;
}

.kb-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 0.75rem 1.25rem;
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.kb-search:focus-within {
  border-color: var(--fg);
  box-shadow: 0 0 0 4px rgba(11, 11, 10, 0.08);
}
.kb-search .search__icon { color: var(--fg-subtle); flex: none; }
.kb-search__input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--fs-base);
  color: var(--fg);
}
.kb-search__input::placeholder { color: var(--fg-subtle); }

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.qa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.qa:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.kb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: var(--sp-4);
}
.kb-chips .chip { padding: 0.4rem 0.85rem; }

.qa__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.qa__tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  background: var(--accent-tint);
  color: var(--accent-deep);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.qa__src {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}

.qa__q {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
.qa__a {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  line-height: 1.55;
  margin: 0 0 var(--sp-3);
}
.qa__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kb-count {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  text-align: center;
  font-family: var(--ff-mono);
}

.cell-link {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.cell-link:hover { color: var(--fg); }
.archive__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}
.archive__lead {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  max-width: 56ch;
  margin-inline: auto;
  line-height: 1.55;
}

/* Console (workbook binder) */
.console {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.console__grid {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: var(--sp-3);
  align-items: end;
}
@media (max-width: 800px) {
  .console__grid { grid-template-columns: 1fr; }
}

.field-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
  margin-bottom: 0.4rem;
}
.field-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.7rem 0.9rem;
  font-size: var(--fs-sm);
  color: var(--fg);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field-input:focus {
  border-color: var(--fg);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(11,11,10,0.08);
}
.field-hint {
  display: block;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  margin-top: 0.35rem;
}
.console__actions {
  display: flex;
  gap: 0.5rem;
}
.console__msg {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  min-height: 1.5em;
  padding: var(--sp-3) 0 0;
}
.console__msg[data-tone="err"] { color: var(--err); }
.console__msg[data-tone="ok"] { color: var(--ok); }

/* Archive body */
.archive__body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--sp-5);
  padding-bottom: var(--sp-7);
}
@media (max-width: 900px) {
  .archive__body { grid-template-columns: 1fr; }
}

.filters {
  position: sticky;
  top: 1rem;
  align-self: start;
}
.filters__title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}
.search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.55rem 0.75rem;
  margin-bottom: var(--sp-4);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within {
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(11,11,10,0.08);
}
.search__icon { color: var(--fg-subtle); flex: none; }
.search__input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: var(--fs-sm);
}
.search__input::placeholder { color: var(--fg-subtle); }

.filter-group__label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.filter-list {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.chip {
  padding: 0.4rem 0.8rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-muted);
  transition: all .2s;
}
.chip:hover { border-color: var(--fg); color: var(--fg); }
.chip--active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.filter-meta {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}

/* Empty */
.empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
}
.empty__icon {
  width: 48px; height: 48px;
  border-radius: var(--r);
  background: var(--accent-tint);
  color: var(--accent-deep);
  margin: 0 auto var(--sp-3);
  display: grid; place-items: center;
}
.empty__title {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-2);
}
.empty p {
  max-width: 48ch;
  margin: 0 auto var(--sp-4);
  color: var(--fg-muted);
  font-size: var(--fs-base);
  line-height: 1.55;
}
.empty__actions { display: flex; justify-content: center; gap: var(--sp-2); flex-wrap: wrap; }

/* Doc list */
.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.doc-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.doc-card__cat {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.doc-card__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--fg);
}
.doc-card__meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem;
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}
.doc-card__meta span::before { content: "·"; margin-right: 0.5rem; color: var(--border-strong); }
.doc-card__meta span:first-child::before { content: ""; margin: 0; }
.doc-card__footer {
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.doc-card__link {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg);
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: color .2s;
}
.doc-card__link:hover { color: var(--accent-deep); }
.doc-card__copy {
  padding: 0.35rem 0.7rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--fg-muted);
  transition: all .2s;
}
.doc-card__copy:hover { border-color: var(--fg); color: var(--fg); }
.doc-card__copy[data-copied="true"] {
  background: var(--ok); color: #fff; border-color: var(--ok);
}

.note {
  padding: var(--sp-6) 0;
  max-width: var(--container-narrow);
  border-top: 1px solid var(--border);
}
.note p {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  max-width: 60ch;
}
.note code {
  font-family: var(--ff-mono);
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: var(--r-sm);
}

/* =========================================================
   ABOUT PAGE
   ========================================================= */
.article {
  max-width: var(--container-narrow);
  padding: var(--sp-8) 0 var(--sp-7);
}
.article__head { margin-bottom: var(--sp-7); text-align: center; }
.article__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 22ch;
  margin: var(--sp-3) auto var(--sp-4);
}
.article__lead {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  max-width: 55ch;
  margin: 0 auto;
  line-height: 1.55;
}
.article__byline {
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  display: flex; justify-content: center; gap: 0.6rem;
}
.article__byline span::after { content: "·"; margin-left: 0.6rem; color: var(--border-strong); }
.article__byline span:last-child::after { display: none; }

.article__body p {
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--fg);
  margin-bottom: var(--sp-4);
}
.article__h2 {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: var(--sp-6) 0 var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.pull {
  padding: var(--sp-5) 0;
  margin: var(--sp-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pull__text {
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  max-width: 28ch;
  color: var(--fg);
}
.pull__text::before {
  content: "";
  display: block;
  width: 32px; height: 3px;
  background: var(--accent);
  margin-bottom: var(--sp-2);
  border-radius: 2px;
}

.spec-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: var(--sp-3);
}
.spec-list li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.spec-list li:last-child { border-bottom: 0; }
.spec-list__k {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.spec-list__v { font-size: var(--fs-base); color: var(--fg); }

/* =========================================================
   REVEAL ANIMATIONS (staggered page load)
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal .7s cubic-bezier(.2,.65,0,1) forwards;
  animation-delay: calc(var(--i, 0) * 80ms + 80ms);
}
@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; animation: none; }
}

/* Auth dot */
.auth-dot {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}
.auth-dot::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--fg-subtle);
}
.auth-dot[data-bound="true"]::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21,128,61,0.18);
}

@media print {
  .nav-header, .footer, .btn, .nav__cta { display: none; }
  body { background: #fff; }
}

/* =========================================================
   AUTH PAGE
   ========================================================= */
.body-centered { min-height: 100vh; display: flex; flex-direction: column; }
.auth {
  flex: 1;
  display: grid;
  place-items: center;
  padding: var(--sp-7) var(--sp-3);
}
.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6) var(--sp-5);
  box-shadow: var(--shadow);
}
.auth__head { text-align: center; margin-bottom: var(--sp-5); }
.auth__title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}
.auth__lead { color: var(--fg-muted); font-size: var(--fs-sm); }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg);
  border-radius: var(--r);
  margin-bottom: var(--sp-4);
}
.tab {
  padding: 0.55rem 0.75rem;
  border-radius: calc(var(--r) - 2px);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-muted);
  transition: all .2s;
}
.tab:hover { color: var(--fg); }
.tab--active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.field { display: flex; flex-direction: column; }
.field-optional { font-weight: 400; color: var(--fg-subtle); font-size: var(--fs-xs); }
.auth-form__submit { margin-top: var(--sp-2); width: 100%; justify-content: center; }

.auth__msg {
  margin-top: var(--sp-3);
  min-height: 1.4em;
  font-size: var(--fs-sm);
  text-align: center;
  color: var(--fg-muted);
}
.auth__msg[data-tone="err"] { color: var(--err); }
.auth__msg[data-tone="ok"] { color: var(--ok); }

.nav__user { display: flex; align-items: center; gap: 0.6rem; }
.user-badge {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border);
}
.nav__cta--ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border-strong);
}
.nav__cta--ghost:hover { background: var(--surface-2); color: var(--fg); }

/* =========================================================
   KNOWLEDGE BASE
   ========================================================= */
.kb {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
}
@media (max-width: 900px) {
  .kb { grid-template-columns: 1fr; }
}

.kb__sidebar {
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-3);
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  background: var(--bg);
}
@media (max-width: 900px) {
  .kb__sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
}

.kb__sidebar .search { margin-bottom: var(--sp-4); }

.kb__nav { display: flex; flex-direction: column; gap: var(--sp-4); }
.kb__group-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  padding-inline: 0.25rem;
}
.kb__nav ul { display: flex; flex-direction: column; gap: 0.15rem; }
.kb__link {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  transition: background .15s, color .15s;
  border: 1px solid transparent;
}
.kb__link:hover { background: var(--surface); color: var(--fg); }
.kb__link[data-active="true"] {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}
.kb__link-title {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: inherit;
  line-height: 1.3;
}
.kb__link-summary {
  display: block;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
  margin-top: 0.15rem;
  line-height: 1.4;
}
.kb__empty {
  padding: 0.75rem;
  font-size: var(--fs-sm);
  color: var(--fg-subtle);
  font-style: italic;
}

.kb__article {
  padding: var(--sp-6) var(--sp-5);
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}
.kb__head {
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
}
.kb__kicker {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--sp-2);
}
.kb__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}
.kb__lead {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  line-height: 1.55;
  max-width: 60ch;
}
.kb__meta {
  margin-top: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}

.kb__body { display: flex; flex-direction: column; gap: var(--sp-5); }
.kb__section {
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.kb__h2 {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.kb__body p {
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--fg);
  max-width: 70ch;
}
.kb__list {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  font-size: var(--fs-lg);
  line-height: 1.6;
  max-width: 70ch;
}
.kb__list li::marker { color: var(--accent); }

.kb__placeholder {
  padding: var(--sp-7) var(--sp-3);
  text-align: center;
  color: var(--fg-muted);
}
.kb__placeholder h2 {
  font-size: var(--fs-xl);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.auth__fine {
  margin-top: var(--sp-3);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--fg-subtle);
}

.btn--sm { padding: 0.45rem 0.8rem; font-size: var(--fs-xs); }
.password-field { display: flex; gap: 0.5rem; align-items: stretch; }
.password-field .field-input { flex: 1; font-family: var(--ff-mono); letter-spacing: 0.02em; }
.password-field .btn { white-space: nowrap; }

.radio-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.radio {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: all .2s;
}
.radio:has(input:checked) { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.radio input { accent-color: var(--accent); }

/* =========================================================
   ADMIN PAGE
   ========================================================= */
.admin { padding: var(--sp-7) 0 var(--sp-7); }
.admin__head { text-align: center; max-width: 60ch; margin: 0 auto var(--sp-6); }
.admin__title {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}
.admin__lead { color: var(--fg-muted); font-size: var(--fs-lg); line-height: 1.5; }

.admin__grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--sp-5);
}
@media (max-width: 900px) { .admin__grid { grid-template-columns: 1fr; } }

.admin__pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.admin__pane-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
}
.admin__pane-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.user-table { display: flex; flex-direction: column; }
.user-table__head,
.user-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  padding: 0.75rem 0.25rem;
  font-size: var(--fs-sm);
}
.user-table__head {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.user-row {
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: 0; }
.user-row__name { font-weight: 500; color: var(--fg); }
.user-row__sub { color: var(--fg-muted); font-size: var(--fs-xs); margin-top: 0.15rem; }
.user-row__you {
  display: inline-block;
  font-size: var(--fs-xs);
  color: var(--accent);
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--accent-tint);
  background: var(--accent-tint);
  border-radius: var(--r-full);
}
.user-row__del {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--err);
  padding: 0.35rem 0.7rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: transparent;
  transition: all .2s;
}
.user-row__del:hover { background: var(--err); color: #fff; border-color: var(--err); }

.user-table__empty {
  padding: var(--sp-4);
  color: var(--fg-subtle);
  font-size: var(--fs-sm);
  font-style: italic;
  text-align: center;
}

.role-pill {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  text-transform: capitalize;
}
.role-pill--admin {
  background: var(--accent-tint);
  border-color: transparent;
  color: var(--accent-deep);
}

