/* ==========================================================================
   UTA APC Knowledgebase — design system
   Built for technicians: high contrast, large touch targets, legible at
   arm's length, and readable in a dim garage (dark mode) or a bright yard.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Brand */
  --uta-900: #07203c;
  --uta-800: #0b2d52;
  --uta-700: #0f3a68;
  --uta-600: #16558f;
  --uta-500: #2172b8;
  --uta-400: #4a95d6;
  --uta-300: #8fbde8;
  --uta-100: #dcebf8;
  --uta-50:  #f0f7fd;

  /* Semantic — light theme */
  --bg:            #f6f8fb;
  --bg-raised:     #ffffff;
  --bg-sunken:     #eef2f7;
  --bg-hover:      #e9eff7;
  --surface-nav:   linear-gradient(180deg, #0d3157 0%, #07203c 100%);

  --text:          #14202f;
  --text-soft:     #4b5a6f;
  /* Meets WCAG AA (4.5:1) against both --bg and --bg-raised. Anything
     lighter fails on the breadcrumbs, timestamps and kbd hints. */
  --text-faint:    #626e82;
  --text-onnav:    #cfdcec;
  --text-onnav-dim:#8ba3c0;

  --line:          #dde4ee;
  --line-strong:   #c5d0e0;

  --accent:        var(--uta-600);
  --accent-text:   #ffffff;
  --accent-bright: var(--uta-700);   /* for text on hovered/selected rows */
  --focus:         #2172b8;
  --danger:        #a8322a;
  --danger-text:   #ffffff;

  --ok-bg:   #e7f4ec;  --ok-line:   #b6dcc4;  --ok-text:   #1b6438;
  --warn-bg: #fdf3e2;  --warn-line: #f0d5a4;  --warn-text: #8a5a12;
  --err-bg:  #fdecea;  --err-line:  #f3c6c1;  --err-text:  #96271d;
  --info-bg: var(--uta-50); --info-line: var(--uta-300);

  /* Type */
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
          Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.15vw, 1.03rem);
  --step-1:  clamp(1.09rem, 1.03rem + 0.28vw, 1.25rem);
  --step-2:  clamp(1.30rem, 1.20rem + 0.48vw, 1.60rem);
  --step-3:  clamp(1.58rem, 1.40rem + 0.85vw, 2.10rem);
  --step-4:  clamp(1.90rem, 1.60rem + 1.40vw, 2.75rem);

  /* Space + shape */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(11, 33, 61, .06), 0 1px 3px rgba(11, 33, 61, .04);
  --shadow-md: 0 2px 6px rgba(11, 33, 61, .07), 0 8px 20px rgba(11, 33, 61, .06);
  --shadow-lg: 0 10px 34px rgba(11, 33, 61, .16);

  --sidebar-w: 296px;
  --measure: 74ch;
  --topbar-h: 60px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #0e1620;
  --bg-raised:     #16202d;
  --bg-sunken:     #111a25;
  --bg-hover:      #1e2b3b;
  --surface-nav:   linear-gradient(180deg, #101b28 0%, #0a121b 100%);

  --text:          #e6edf6;
  --text-soft:     #a9b8ca;
  /* Light enough to stay ≥4.5:1 on --bg-hover, not just on the page bg. */
  --text-faint:    #8fa0b6;
  --text-onnav:    #cfdcec;
  --text-onnav-dim:#8397ae;

  --line:          #263445;
  --line-strong:   #35485f;

  --accent:        var(--uta-400);
  --accent-text:   #08192b;
  --accent-bright: #8cc2ee;
  --focus:         #6fb0e8;
  --danger:        #e5837a;
  --danger-text:   #2a0f0c;

  --ok-bg:   #10291b;  --ok-line:   #235f39;  --ok-text:   #7fd3a0;
  --warn-bg: #2a2113;  --warn-line: #6b5220;  --warn-text: #e8bd6a;
  --err-bg:  #2c1614;  --err-line:  #6d2f28;  --err-text:  #f0a49b;
  --info-bg: #14293d;  --info-line: #2c557f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, .45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1620; --bg-raised: #16202d; --bg-sunken: #111a25;
    --bg-hover: #1e2b3b;
    --surface-nav: linear-gradient(180deg, #101b28 0%, #0a121b 100%);
    --text: #e6edf6; --text-soft: #a9b8ca; --text-faint: #8fa0b6;
    --text-onnav: #cfdcec; --text-onnav-dim: #8397ae;
    --line: #263445; --line-strong: #35485f;
    --accent: var(--uta-400); --accent-text: #08192b; --focus: #6fb0e8;
    --accent-bright: #8cc2ee; --danger: #e5837a; --danger-text: #2a0f0c;
    --ok-bg: #10291b; --ok-line: #235f39; --ok-text: #7fd3a0;
    --warn-bg: #2a2113; --warn-line: #6b5220; --warn-text: #e8bd6a;
    --err-bg: #2c1614; --err-line: #6d2f28; --err-text: #f0a49b;
    --info-bg: #14293d; --info-line: #2c557f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 2px 8px rgba(0,0,0,.45);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* The hidden attribute must always win, even over display:flex components. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
svg { display: block; }
/* Inline icons never stretch: they carry width/height attributes, and this
   caps them even if an attribute is ever missing. */
svg.icon { flex-shrink: 0; max-width: 24px; max-height: 24px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
/* The browser default placeholder grey fails contrast on a dark background. */
::placeholder { color: var(--text-faint); opacity: 1; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.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;
}
.skip-link {
  position: absolute; left: var(--sp-3); top: -60px; z-index: 100;
  background: var(--bg-raised); color: var(--text);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); transition: top .15s var(--ease);
}
.skip-link:focus { top: var(--sp-3); }

/* --- Layout -------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content {
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: var(--sp-5) var(--sp-6) var(--sp-8);
}
.content-narrow { max-width: calc(var(--measure) + 4rem); }

/* --- Sidebar ------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface-nav); color: var(--text-onnav);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-head {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none; color: #fff;
}
.brand-badge {
  background: #fff; color: var(--uta-700);
  font-weight: 800; letter-spacing: .08em; font-size: .78rem;
  padding: .38rem .55rem; border-radius: var(--r-sm); line-height: 1;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.brand-text { font-weight: 640; font-size: .96rem; line-height: 1.25; letter-spacing: -.01em; }
.brand-text small {
  display: block; font-weight: 450; font-size: .74rem;
  color: var(--text-onnav-dim); letter-spacing: .02em;
}

.nav-scroll { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-2) var(--sp-4); scrollbar-width: thin; }
.nav-scroll::-webkit-scrollbar { width: 8px; }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: var(--r-full); }
.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-onnav-dim); font-weight: 700;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}

.tree { list-style: none; margin: 0; padding: 0; }
.tree-nested {
  list-style: none; margin: 0; padding: 0 0 0 var(--sp-4);
  border-left: 1px solid rgba(255, 255, 255, .1); margin-left: 1.05rem;
}
.tree-row {
  display: flex; align-items: stretch; gap: 0;
  border-radius: var(--r-md); margin: 1px 0;
}
.tree-row:hover { background: rgba(255, 255, 255, .07); }
.tree-row.active { background: rgba(74, 149, 214, .22); box-shadow: inset 2px 0 0 var(--uta-400); }
.tree-row a {
  color: var(--text-onnav); text-decoration: none;
  font-size: .885rem; line-height: 1.35;
  padding: .46rem var(--sp-2) .46rem 0; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: .45rem;
}
.tree-row.active > a { color: #fff; font-weight: 620; }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-icon { flex-shrink: 0; font-size: .95em; }
.twisty {
  background: none; border: 0; cursor: pointer; flex-shrink: 0;
  color: var(--text-onnav-dim); width: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s var(--ease); border-radius: var(--r-sm);
}
.twisty svg { width: 11px; height: 11px; }
.twisty:hover { color: #fff; }
.twisty-spacer { width: 26px; flex-shrink: 0; }
li.collapsed > .tree-nested { display: none; }
li.collapsed > .tree-row .twisty { transform: rotate(-90deg); }

.sidebar-foot {
  padding: var(--sp-3); border-top: 1px solid rgba(255, 255, 255, .09);
  display: grid; gap: 2px;
}
.nav-action {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--text-onnav); text-decoration: none;
  padding: .5rem var(--sp-3); border-radius: var(--r-md);
  font-size: .865rem; background: none; border: 0; cursor: pointer;
  width: 100%; text-align: left;
}
.nav-action:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav-action svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }

/* --- Topbar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--topbar-h);
  padding: var(--sp-2) var(--sp-5);
  background: color-mix(in srgb, var(--bg-raised) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  background: none; border: 1px solid transparent; border-radius: var(--r-md);
  color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-btn { display: none; }

.search-trigger {
  display: flex; align-items: center; gap: var(--sp-3);
  flex: 1 1 0; min-width: 0; max-width: 460px;
  padding: .52rem var(--sp-3); cursor: pointer;
  background: var(--bg-sunken); color: var(--text-faint);
  border: 1px solid var(--line); border-radius: var(--r-full);
  font-size: .9rem; text-align: left;
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.search-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-trigger > span:first-of-type {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.search-trigger .kbd-hint { margin-left: auto; display: flex; gap: 2px; }
kbd {
  font-family: var(--font); font-size: .72rem; font-weight: 600;
  background: var(--bg-raised); color: var(--text-faint);
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: var(--r-sm); padding: .1rem .32rem; line-height: 1.4;
}
.topbar-right {
  margin-left: auto; display: flex; align-items: center; gap: var(--sp-2);
  flex-shrink: 0;
}
.user-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .85rem; color: var(--text-soft); font-weight: 550;
  padding-left: var(--sp-2);
}
.avatar {
  width: 30px; height: 30px; border-radius: var(--r-full);
  background: var(--uta-600); color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  flex-shrink: 0;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--r-md);
  padding: .55rem .95rem; font-size: .885rem; font-weight: 600;
  text-decoration: none; line-height: 1.25;
  transition: background .12s var(--ease), border-color .12s var(--ease),
              transform .08s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm { padding: .38rem .68rem; font-size: .82rem; }
.btn-lg { padding: .72rem 1.3rem; font-size: .95rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--uta-700); }
[data-theme="dark"] .btn-primary:hover { background: var(--uta-300); }
.btn-secondary {
  background: var(--bg-raised); color: var(--text);
  border-color: var(--line-strong); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--danger-text); }
.btn-danger:hover { filter: brightness(1.08); }

/* --- Cards + badges ------------------------------------------------------ */
.card {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: .18rem .5rem; border-radius: var(--r-full);
  border: 1px solid transparent; white-space: nowrap;
}
.badge-review { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.badge-count  { background: var(--bg-sunken); color: var(--text-faint); border-color: var(--line); }
.badge-photos { background: var(--info-bg); color: var(--accent); border-color: var(--info-line); }

/* --- Home ---------------------------------------------------------------- */
.hero { margin-bottom: var(--sp-5); }
.hero h1 {
  font-size: var(--step-3); line-height: 1.12; letter-spacing: -.022em;
  margin: 0 0 var(--sp-2); font-weight: 720;
}
.hero p { font-size: var(--step-0); color: var(--text-soft); margin: 0; max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-4); }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: var(--sp-3); margin: var(--sp-5) 0;
}
.stat {
  display: flex; align-items: baseline; gap: var(--sp-2);
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
}
.stat-num {
  font-size: var(--step-1); font-weight: 720; letter-spacing: -.02em;
  color: var(--accent); line-height: 1.1;
}
.stat-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 650;
}

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-full);
  padding: .42rem .85rem; font-size: .85rem; font-weight: 600;
  text-decoration: none; transition: border-color .12s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.recent-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.section-title {
  font-size: var(--step-1); font-weight: 680; letter-spacing: -.01em;
  margin: var(--sp-6) 0 var(--sp-4);
  display: flex; align-items: baseline; gap: var(--sp-3);
}
.section-title::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.card-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.nav-card {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-5); text-decoration: none; color: inherit;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease),
              transform .14s var(--ease);
  position: relative; overflow: hidden;
}
.nav-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent); opacity: 0; transition: opacity .14s var(--ease);
}
.nav-card:hover {
  border-color: var(--line-strong); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.nav-card:hover::before { opacity: 1; }
.nav-card-top { display: flex; align-items: center; gap: var(--sp-3); }
.nav-card-icon {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--r-md);
  background: var(--info-bg); display: grid; place-items: center; font-size: 1.2rem;
}
.nav-card-title { font-weight: 660; font-size: 1rem; letter-spacing: -.01em; }
.nav-card-desc {
  font-size: .855rem; color: var(--text-soft); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.nav-card-meta {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  margin-top: auto; padding-top: var(--sp-2);
}

/* --- Page header --------------------------------------------------------- */
.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: .3rem;
  font-size: .82rem; color: var(--text-faint); margin-bottom: var(--sp-3);
}
.crumbs a { color: var(--text-faint); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs svg { width: 13px; height: 13px; opacity: .55; }
.crumbs .here { color: var(--text-soft); font-weight: 600; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-2);
}
.page-title {
  font-size: var(--step-3); font-weight: 700; letter-spacing: -.025em;
  line-height: 1.15; margin: 0; display: flex; align-items: center;
  gap: var(--sp-3); flex-wrap: wrap;
}
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.page-sub {
  color: var(--text-soft); font-size: var(--step-0);
  margin: var(--sp-3) 0 0; max-width: var(--measure);
}
.page-meta-row {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  font-size: .8rem; color: var(--text-faint);
  padding-bottom: var(--sp-4); margin: var(--sp-4) 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.page-meta-row > svg.icon { width: 14px; height: 14px; }
.empty-state svg.icon { width: 38px; height: 38px; max-width: 38px; max-height: 38px;
                        margin: 0 auto var(--sp-3); opacity: .45; }
.review-note svg.icon { width: 18px; height: 18px; margin-top: 1px; }
.nav-card-icon svg.icon { width: 20px; height: 20px; }
.badge svg.icon { width: 12px; height: 12px; }

.review-note {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn-text); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5);
  font-size: .875rem;
}
.review-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.review-note strong { display: block; }

/* --- Page body layout (content + TOC) ------------------------------------ */
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: var(--sp-7); }
.page-layout.no-toc { grid-template-columns: minmax(0, 1fr); }

.toc { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); align-self: start; }
.toc-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; color: var(--text-faint); margin-bottom: var(--sp-3);
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc li a {
  display: block; padding: .28rem 0 .28rem var(--sp-4);
  font-size: .82rem; line-height: 1.4; color: var(--text-soft);
  text-decoration: none; margin-left: -2px;
  border-left: 2px solid transparent;
}
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 620; }
.toc .lvl-3 a { padding-left: calc(var(--sp-4) + var(--sp-3)); font-size: .78rem; }

/* --- Prose --------------------------------------------------------------- */
.prose { max-width: var(--measure); font-size: var(--step-0); line-height: 1.68; }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  font-size: var(--step-2); font-weight: 680; letter-spacing: -.02em;
  line-height: 1.25; margin: var(--sp-7) 0 var(--sp-3);
  padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}
.prose h3 {
  font-size: var(--step-1); font-weight: 660; letter-spacing: -.012em;
  margin: var(--sp-6) 0 var(--sp-2);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}
.prose h4 {
  font-size: var(--step-0); font-weight: 680; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .05em;
  margin: var(--sp-5) 0 var(--sp-2);
}
.prose p { margin: var(--sp-4) 0; }
.prose ul, .prose ol { margin: var(--sp-4) 0; padding-left: 1.4rem; }
.prose li { margin: var(--sp-2) 0; padding-left: .15rem; }
.prose li::marker { color: var(--text-faint); }
.prose ol > li::marker { font-weight: 650; color: var(--accent); }
.prose strong { font-weight: 660; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

.prose blockquote {
  position: relative; margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  background: var(--info-bg); border: 1px solid var(--info-line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.prose blockquote > *:first-child { margin-top: 0; }
.prose blockquote > *:last-child { margin-bottom: 0; }
/* Callout variants (Notion-style colored boxes) */
.prose blockquote.callout-warn {
  background: var(--warn-bg); border-color: var(--warn-line);
  border-left-color: var(--warn-text);
}
.prose blockquote.callout-danger {
  background: var(--err-bg); border-color: var(--err-line);
  border-left-color: var(--err-text);
}
.prose blockquote.callout-ok {
  background: var(--ok-bg); border-color: var(--ok-line);
  border-left-color: var(--ok-text);
}

/* Toggle sections */
.prose details.toggle {
  border: 1px solid var(--line); border-radius: var(--r-md);
  margin: var(--sp-5) 0; background: var(--bg-raised);
}
.prose details.toggle > summary {
  cursor: pointer; font-weight: 650; padding: var(--sp-3) var(--sp-4);
  list-style: none; display: flex; align-items: center; gap: var(--sp-2);
  border-radius: var(--r-md);
}
.prose details.toggle > summary::-webkit-details-marker { display: none; }
.prose details.toggle > summary::before {
  content: "▸"; color: var(--accent); transition: transform .15s var(--ease);
}
.prose details.toggle[open] > summary::before { transform: rotate(90deg); }
.prose details.toggle[open] > summary { border-bottom: 1px solid var(--line); }
.prose details.toggle > :not(summary) {
  margin-left: var(--sp-4); margin-right: var(--sp-4);
}
.prose details.toggle > :nth-child(2) { margin-top: var(--sp-3); }
.prose details.toggle > :last-child { margin-bottom: var(--sp-3); }

.prose code {
  font-family: var(--mono); font-size: .875em;
  background: var(--bg-sunken); border: 1px solid var(--line);
  padding: .1em .35em; border-radius: var(--r-sm);
  word-break: break-word;
}
.prose pre {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-4);
  overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; }

.prose table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: var(--sp-5) 0; font-size: .89rem;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
.prose th, .prose td {
  padding: .6rem .8rem; text-align: left;
  border-bottom: 1px solid var(--line);
}
.prose thead th {
  background: var(--bg-sunken); font-weight: 660; color: var(--text);
  font-size: .82rem; letter-spacing: .01em;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--bg-sunken); }
.table-scroll { overflow-x: auto; margin: var(--sp-5) 0; }
.table-scroll table { margin: 0; }

/* Figures — the install-visual photos are the heart of this wiki */
.prose figure, .prose .fig {
  margin: var(--sp-5) 0; padding: 0;
}
.prose figure img, .prose .fig img {
  width: 100%; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--bg-sunken);
  cursor: zoom-in; transition: border-color .14s var(--ease);
}
.prose figure img:hover { border-color: var(--accent); }
.prose figcaption {
  margin-top: var(--sp-2); font-size: .82rem; color: var(--text-faint);
  line-height: 1.45; text-align: center;
}

/* Compact prose — used inside cards (e.g. the contacts panel on the home page)
   where full editorial spacing would dwarf the surrounding layout. */
.prose-compact { font-size: .9rem; max-width: none; }
.prose-compact h2 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700; color: var(--text-faint);
  border: 0; padding: 0; margin: var(--sp-5) 0 var(--sp-3);
}
.prose-compact h2:first-child { margin-top: 0; }
.prose-compact h3 { font-size: .95rem; margin: var(--sp-4) 0 var(--sp-2); }
.prose-compact p { margin: var(--sp-2) 0; }
.prose-compact blockquote {
  margin: var(--sp-2) 0; padding: .45rem .75rem;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-left: 2px solid var(--accent); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: .9rem;
}
.prose-compact blockquote p { margin: 0; }
.prose-compact hr { display: none; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-5); }

/* --- Child page grid on section pages ------------------------------------ */
.child-grid { margin-top: var(--sp-6); }

/* --- Prev / next --------------------------------------------------------- */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4);
  margin-top: var(--sp-8); padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
}
.pager-link {
  display: flex; flex-direction: column; gap: .15rem;
  padding: var(--sp-4); border: 1px solid var(--line);
  border-radius: var(--r-md); text-decoration: none; color: inherit;
  background: var(--bg-raised); transition: border-color .14s var(--ease);
}
.pager-link:hover { border-color: var(--accent); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-dir { font-size: .74rem; color: var(--text-faint); font-weight: 650;
             text-transform: uppercase; letter-spacing: .06em; }
.pager-title { font-weight: 620; font-size: .92rem; line-height: 1.35; }

/* --- Mobile "on this page" + back-to-top --------------------------------- */
.toc-mobile {
  display: none;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-md); margin-bottom: var(--sp-4);
}
.toc-mobile summary {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
  font-size: .88rem; font-weight: 650; color: var(--text-soft);
  list-style: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile[open] summary { border-bottom: 1px solid var(--line); }
.toc-mobile ul { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-3); }
.toc-mobile li a {
  display: block; padding: .45rem var(--sp-2); border-radius: var(--r-sm);
  font-size: .88rem; color: var(--text-soft); text-decoration: none;
}
.toc-mobile li a:hover { background: var(--bg-hover); color: var(--text); }
.toc-mobile .lvl-3 a { padding-left: var(--sp-5); font-size: .84rem; }
@media (max-width: 1080px) { .toc-mobile { display: block; } }

.back-to-top {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 40;
  width: 44px; height: 44px; border-radius: var(--r-full); border: 1px solid var(--line-strong);
  background: var(--bg-raised); color: var(--text-soft); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* --- Command palette ----------------------------------------------------- */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 20, 34, .5); backdrop-filter: blur(3px);
  display: none; padding: 10vh var(--sp-4) var(--sp-4);
}
.palette-backdrop.open { display: block; }
.palette {
  max-width: 620px; margin: 0 auto;
  background: var(--bg-raised); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .16s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.palette-input-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); border-bottom: 1px solid var(--line);
}
.palette-input-row svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }
.palette input {
  flex: 1; border: 0; background: none; outline: none; font-size: 1.02rem;
}
.palette-results { max-height: 52vh; overflow-y: auto; padding: var(--sp-2); }
.palette-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: .6rem var(--sp-3); border-radius: var(--r-md);
  text-decoration: none; color: inherit; cursor: pointer;
}
.palette-item[aria-selected="true"] { background: var(--bg-hover); }
.palette-item-icon { flex-shrink: 0; width: 22px; text-align: center; }
.palette-item-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.palette-item-title {
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.palette-item-path {
  font-size: .76rem; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.palette-item mark { background: transparent; color: var(--accent-bright); font-weight: 700; }
.palette-empty { padding: var(--sp-6); text-align: center; color: var(--text-faint); font-size: .9rem; }
.palette-foot {
  display: flex; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line); background: var(--bg-sunken);
  font-size: .76rem; color: var(--text-faint);
}

/* --- Lightbox ------------------------------------------------------------ */
.lightbox {
  position: fixed; inset: 0; z-index: 95; display: none;
  background: rgba(6, 14, 24, .93); padding: var(--sp-5);
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 96vw; max-height: 88vh; width: auto; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); object-fit: contain;
}
.lightbox-close {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
  width: 44px; height: 44px; border-radius: var(--r-full);
  background: rgba(255, 255, 255, .14); color: #fff; border: 0;
  cursor: pointer; display: grid; place-items: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); }
.lightbox-cap {
  position: absolute; bottom: var(--sp-5); left: 50%; transform: translateX(-50%);
  color: #dbe6f2; font-size: .86rem; text-align: center; max-width: 70ch;
  padding: 0 var(--sp-4);
}

/* --- Flash / search / editor -------------------------------------------- */
.flash-wrap { max-width: 1180px; margin: 0 auto; padding: var(--sp-4) var(--sp-6) 0; width: 100%; }
.flash {
  border-radius: var(--r-md); padding: .7rem var(--sp-4);
  font-size: .89rem; margin-bottom: var(--sp-2); border: 1px solid transparent;
}
.flash-success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.flash-error   { background: var(--err-bg); color: var(--err-text); border-color: var(--err-line); }

.result-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-5); }
.result {
  display: block; padding: var(--sp-4) var(--sp-5); text-decoration: none; color: inherit;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-md); transition: border-color .14s var(--ease);
}
.result:hover { border-color: var(--accent); }
.result-title { font-weight: 640; font-size: 1rem; margin-bottom: .15rem; }
.result-path { font-size: .78rem; color: var(--text-faint); }
.result-snippet { font-size: .87rem; color: var(--text-soft); margin-top: var(--sp-2); line-height: 1.5; }
.result mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit;
               border-radius: 3px; padding: 0 .12em; font-weight: 620; }

.empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-faint); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: var(--sp-3); opacity: .5; }

.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > span { font-size: .8rem; font-weight: 650; color: var(--text-soft); }
.field input, .field select, .field textarea {
  padding: .55rem .7rem; background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-size: .93rem; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.edit-meta { display: grid; grid-template-columns: 2fr 2fr 84px 84px; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.edit-checks { display: flex; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-4); font-size: .88rem; }
.edit-checks label { display: flex; align-items: center; gap: var(--sp-2); }

.editor-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: var(--sp-2); background: var(--bg-raised);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  position: sticky; top: var(--topbar-h); z-index: 20;
}
.editor-toolbar button {
  min-width: 34px; height: 34px; padding: 0 .5rem;
  background: none; border: 0; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-soft); font-size: .86rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.editor-toolbar button:hover { background: var(--bg-hover); color: var(--text); }
.editor-toolbar button.active {
  background: var(--info-bg); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--info-line);
}
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 var(--sp-2); }

/* Link editor popover */
.link-pop {
  flex-basis: 100%; display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-2) var(--sp-1) var(--sp-1);
  border-top: 1px solid var(--line); margin-top: var(--sp-2);
}
.link-pop input {
  flex: 1; min-width: 0; padding: .45rem .65rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  font-size: .9rem; background: var(--bg-raised);
}

/* Draft banner + note */
.draft-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn-text); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4); margin: var(--sp-3) 0;
  font-size: .89rem;
}
.draft-actions { display: flex; gap: var(--sp-2); }
.draft-note { margin-left: auto; font-size: .78rem; color: var(--text-faint); }
.edit-hint { align-self: center; font-size: .78rem; color: var(--text-faint); }

/* Empty caption placeholder inside the editor */
.editor figcaption:empty::before {
  content: "Add a caption (optional)…";
  color: var(--text-faint); font-style: italic;
}
.editor details.toggle > summary { cursor: text; }

/* --- Editor 2.0 floating UI ---------------------------------------------- */
.bubble-menu, .slash-menu, .block-menu, .table-tools {
  position: fixed; z-index: 80;
  background: var(--bg-raised); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.bubble-menu, .table-tools {
  display: flex; align-items: center; gap: 2px; padding: 4px;
}
.bubble-menu button, .table-tools button {
  min-width: 30px; height: 30px; padding: 0 .5rem;
  background: none; border: 0; border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-soft); font-size: .84rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.bubble-menu button:hover, .table-tools button:hover {
  background: var(--bg-hover); color: var(--text);
}
.bubble-menu button.active {
  background: var(--info-bg); color: var(--accent);
}
.table-tools button.danger:hover { background: var(--err-bg); color: var(--err-text); }
.bm-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

.slash-menu {
  width: 286px; max-height: 322px; overflow-y: auto; padding: 5px;
}
.slash-item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left; padding: .45rem .6rem;
  background: none; border: 0; border-radius: var(--r-sm); cursor: pointer;
  color: var(--text);
}
.slash-item:hover, .slash-item.sel { background: var(--bg-hover); }
.slash-ic {
  width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: .82rem; font-weight: 700;
  color: var(--text-soft);
}
.slash-label { display: block; font-weight: 620; font-size: .88rem; }
.slash-hint { display: block; font-size: .74rem; color: var(--text-faint); }
.slash-empty { padding: var(--sp-4); text-align: center; color: var(--text-faint); font-size: .85rem; }

.block-handle {
  position: fixed; z-index: 70; display: flex; gap: 1px;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-sm); padding: 1px;
}
.block-handle button {
  width: 22px; height: 24px; border: 0; background: none; cursor: pointer;
  color: var(--text-faint); border-radius: 4px; font-size: .8rem;
  display: grid; place-items: center; padding: 0;
}
.block-handle button:hover { background: var(--bg-hover); color: var(--text); }
.bh-grip { cursor: grab; letter-spacing: -2px; }
.bh-grip:active { cursor: grabbing; }
.editor .dragging { opacity: .35; }
.drop-indicator {
  position: fixed; z-index: 75; height: 3px; border-radius: 2px;
  background: var(--accent); pointer-events: none;
}

.block-menu { min-width: 190px; padding: 5px; }
.bmn-item {
  display: block; width: 100%; text-align: left;
  padding: .42rem .6rem; background: none; border: 0;
  border-radius: var(--r-sm); cursor: pointer; font-size: .86rem;
  color: var(--text);
}
.bmn-item:hover { background: var(--bg-hover); }
.bmn-item.danger { color: var(--err-text); }
.bmn-item.danger:hover { background: var(--err-bg); }
.bmn-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); font-weight: 700;
  padding: .5rem .6rem .2rem;
}
.bmn-colors { display: flex; gap: 6px; padding: .3rem .6rem .45rem; }
.bmn-swatch {
  width: 26px; height: 26px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line-strong);
}
.bmn-swatch.callout-info { background: var(--info-bg); border-color: var(--info-line); }
.bmn-swatch.callout-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.bmn-swatch.callout-danger { background: var(--err-bg); border-color: var(--err-line); }
.bmn-swatch.callout-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.bmn-swatch:hover { transform: scale(1.12); }
.editor, .html-source {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  min-height: 440px; padding: var(--sp-5) var(--sp-6); width: 100%;
  outline: none; max-width: none;
}
.editor:focus { border-color: var(--line-strong); }
.html-source { font-family: var(--mono); font-size: .84rem; resize: vertical; line-height: 1.6; }
.edit-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }

/* --- Login --------------------------------------------------------------- */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5);
  background:
    radial-gradient(1100px 520px at 15% -10%, rgba(33, 114, 184, .35), transparent 60%),
    linear-gradient(160deg, #0d3157 0%, #07203c 55%, #05172c 100%);
}
.login-card { width: 100%; max-width: 396px; padding: var(--sp-7) var(--sp-6); }
.login-brand { text-align: center; margin-bottom: var(--sp-6); }
.login-brand .brand-badge {
  background: var(--uta-700); color: #fff; font-size: 1.15rem;
  padding: .7rem 1rem; border-radius: var(--r-md); display: inline-block;
}
.login-brand h1 { font-size: var(--step-1); margin: var(--sp-4) 0 var(--sp-1); letter-spacing: -.02em; }
.login-brand p { color: var(--text-faint); font-size: .88rem; margin: 0; }
.login-card .field { margin-bottom: var(--sp-4); }
.login-foot { text-align: center; font-size: .76rem; color: var(--text-faint); margin: var(--sp-6) 0 0; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1080px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .content { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
  .flash-wrap { padding: var(--sp-4) var(--sp-4) 0; }
  .topbar { padding: var(--sp-2) var(--sp-3); }
  .search-trigger .kbd-hint { display: none; }
  .search-trigger { padding: .5rem var(--sp-3); }
  .user-chip .user-name { display: none; }
  .edit-meta { grid-template-columns: 1fr 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
  .scrim {
    position: fixed; inset: 0; z-index: 50; background: rgba(8, 20, 34, .45);
    display: none;
  }
  .scrim.open { display: block; }
}
@media (max-width: 520px) {
  .page-head { flex-direction: column; gap: var(--sp-3); }
  .btn { padding: .6rem 1rem; }   /* bigger tap targets on a phone in the field */
  .edit-meta { grid-template-columns: 1fr; }
}

/* --- Print --------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .page-actions, .toc, .pager, .flash-wrap,
  .child-grid, .review-note, .scrim, .palette-backdrop, .lightbox,
  .page-meta-row form { display: none !important; }
  .app { display: block; }
  .content { max-width: none; padding: 0; }
  .prose { max-width: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose figure img { border: 1px solid #ccc; break-inside: avoid; }
  .prose h2, .prose h3 { break-after: avoid; }
  a { color: #000; text-decoration: none; }
}

/* ==========================================================================
   Admin suite — team, history, trash, activity, content health
   ========================================================================== */
.admin-tabs {
  display: flex; gap: var(--sp-1); flex-wrap: wrap;
  border-bottom: 1px solid var(--line); margin: var(--sp-5) 0 var(--sp-5);
}
.admin-tabs a {
  padding: .55rem var(--sp-4); text-decoration: none; font-size: .9rem;
  font-weight: 600; color: var(--text-soft); border-bottom: 2px solid transparent;
  margin-bottom: -1px; border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.admin-tabs a:hover { color: var(--text); background: var(--bg-hover); }
.admin-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
@media (max-width: 900px) { .admin-cols { grid-template-columns: 1fr; } }
.admin-note {
  margin-top: var(--sp-5); font-size: .85rem; color: var(--text-faint);
  border-left: 2px solid var(--line); padding-left: var(--sp-3);
}

/* Health */
.health-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.health-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); text-decoration: none; color: inherit;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.health-row:hover { border-color: var(--accent); }
.health-count {
  min-width: 34px; height: 34px; padding: 0 .4rem; border-radius: var(--r-sm);
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
}
.health-count.ok { background: var(--ok-bg); color: var(--ok-text); }
.health-count.warn { background: var(--warn-bg); color: var(--warn-text); }
.health-label { display: block; font-weight: 620; font-size: .92rem; }
.health-help { display: block; font-size: .8rem; color: var(--text-faint); }
.health-block { margin-bottom: var(--sp-6); scroll-margin-top: 90px; }
.health-pages { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.all-clear {
  display: flex; align-items: center; gap: var(--sp-2);
  color: var(--ok-text); font-size: .9rem; font-weight: 600; margin-top: var(--sp-2);
}

/* Activity */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: flex; gap: var(--sp-4); padding: .55rem 0;
  border-bottom: 1px solid var(--line); font-size: .88rem;
}
.activity-row:last-child { border-bottom: 0; }
.activity-when { color: var(--text-faint); flex-shrink: 0; width: 12.5rem; font-variant-numeric: tabular-nums; }
.activity-what { color: var(--text-soft); }
.activity-target { color: var(--text); font-weight: 600; }
.activity-detail { color: var(--text-faint); }
.activity-filters { display: flex; gap: var(--sp-4); align-items: flex-end; margin-bottom: var(--sp-5); flex-wrap: wrap; }
.activity-filters .field { max-width: 220px; }

/* People */
.role-key {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.role-key > div {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
}
.role-key strong { display: block; font-size: .92rem; color: var(--accent); }
.role-key span { font-size: .82rem; color: var(--text-soft); }

.add-person { padding: 0; overflow: hidden; }
.add-person > summary {
  cursor: pointer; padding: var(--sp-4); font-weight: 650; list-style: none;
  display: flex; align-items: center; gap: var(--sp-2); color: var(--accent);
}
.add-person > summary::-webkit-details-marker { display: none; }
.add-person[open] > summary { border-bottom: 1px solid var(--line); }
.add-person-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--sp-4); padding: var(--sp-4); align-items: end;
}

.people-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.people-table th {
  text-align: left; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint); font-weight: 700;
  padding: 0 var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--line);
}
.people-table td { padding: var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.people-table tr.inactive { opacity: .58; }
.person-name { display: block; font-weight: 620; }
.person-sub { display: block; font-size: .78rem; color: var(--text-faint); }
.people-table .dim { color: var(--text-faint); }
.people-table select { padding: .3rem .5rem; border: 1px solid var(--line-strong);
                       border-radius: var(--r-sm); background: var(--bg-raised); font-size: .85rem; }
/* Keep this a real table cell — making the <td> a flex container detaches
   its border from the row and misaligns the buttons. */
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form, .row-actions .btn { display: inline-block; vertical-align: middle; }
.row-actions form + form { margin-left: var(--sp-1); }
.inline-form { display: inline; }
.danger-text { color: var(--err-text) !important; }
.danger-text:hover { background: var(--err-bg) !important; }

/* Version history */
.version-list { display: flex; flex-direction: column; margin-top: var(--sp-4); }
.version-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line);
  border-radius: var(--r-md); margin-bottom: var(--sp-2);
  background: var(--bg-raised);
}
.version-row > div { flex: 1; min-width: 0; }
.version-row.current { border-color: var(--accent); }
.version-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong);
  flex-shrink: 0;
}
.version-row.current .version-dot { background: var(--accent); }
.version-title { font-weight: 620; font-size: .92rem; }
.version-meta { font-size: .8rem; color: var(--text-faint); }

/* My account */
.account-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--sp-5); align-items: start; }
@media (max-width: 860px) { .account-grid { grid-template-columns: 1fr; } }
.account-grid .field input { width: 100%; }

/* --- Updates & backups --------------------------------------------------- */
.tab-badge {
  display: inline-block; margin-left: .35rem; padding: .05rem .38rem;
  border-radius: var(--r-full); background: var(--warn-bg);
  color: var(--warn-text); border: 1px solid var(--warn-line);
  font-size: .7rem; font-weight: 700; vertical-align: text-top;
}
.admin-tabs { overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }

.version-head {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.version-head > div { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.version-head svg.icon { align-self: center; color: var(--text-faint); }
.version-label { font-size: .8rem; color: var(--text-faint); }
.version-num {
  font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.version-num.accent { color: var(--accent); }
.version-date { font-size: .82rem; color: var(--text-faint); }
.release-lede { margin: .35rem 0 0; color: var(--text-soft); font-size: .92rem; }

.result-banner {
  display: flex; flex-direction: column; gap: .25rem;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5); font-size: .9rem;
}
.result-banner.ok   { background: var(--ok-bg);   border-color: var(--ok-line);   border-left-color: var(--ok-text); }
.result-banner.warn { background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn-text); }
.result-banner.bad  { background: var(--err-bg); border-color: var(--err-line); border-left-color: var(--err-text); }
.result-banner.bad strong { color: var(--err-text); }
.result-banner span { color: var(--text-soft); }
.result-error { font-family: var(--mono); font-size: .82rem; }

.attention-row {
  display: flex; align-items: center; gap: var(--sp-4);
  border: 1px solid var(--warn-line); background: var(--warn-bg);
  border-radius: var(--r-md); padding: var(--sp-4);
  margin-bottom: var(--sp-5); text-decoration: none; color: inherit;
}
.attention-row:hover { filter: brightness(1.02); border-color: var(--warn-text); }
.attention-row > span:nth-child(2) { flex: 1; min-width: 0; }
.attention-count {
  flex-shrink: 0; min-width: 2rem; height: 2rem; border-radius: var(--r-full);
  background: var(--warn-text); color: var(--bg-raised);
  display: grid; place-items: center; font-weight: 700;
}
.attention-label { display: block; font-weight: 620; color: var(--warn-text); }
.attention-help { display: block; font-size: .84rem; color: var(--text-soft); margin-top: .15rem; }
.attention-go { flex-shrink: 0; font-weight: 620; color: var(--warn-text); font-size: .88rem; }

.upload-card { display: block; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-4); cursor: pointer; text-align: center;
  background: var(--bg-sunken); transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--accent); background: var(--bg-raised); }
.drop svg.icon { width: 26px; height: 26px; color: var(--text-faint); margin-bottom: .2rem; }
.drop-main { font-weight: 620; }
.drop-sub { font-size: .82rem; color: var(--text-faint); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pkg-name { margin: .6rem 0; font-size: .86rem; color: var(--accent); font-weight: 600; }
.upload-card .btn { margin-top: .2rem; }
.upload-card .btn:disabled { opacity: .45; cursor: not-allowed; }

.release-notes { margin: 0 0 var(--sp-5); padding-left: 1.1rem; color: var(--text-soft); }
.release-notes li { margin: .2rem 0; }

.changelog { display: flex; flex-direction: column; gap: var(--sp-3); }
.release {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4); background: var(--bg-raised);
}
.release.current { border-color: var(--accent); }
.release header { display: flex; align-items: baseline; gap: .5rem; }
.release-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.release-date { font-size: .78rem; color: var(--text-faint); }
.release-title { margin: .3rem 0 .4rem; font-size: .9rem; color: var(--text-soft); }
.release ul { margin: 0; padding-left: 1.1rem; font-size: .86rem; color: var(--text-faint); }
.release ul li { margin: .15rem 0; }

.mini-list { display: flex; flex-direction: column; gap: .3rem; }
.mini-row {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .5rem .7rem; background: var(--bg-raised);
}
.mini-main { display: block; font-size: .85rem; font-weight: 600; }
.mini-sub { display: block; font-size: .78rem; color: var(--text-faint); }

.file-details { margin: var(--sp-5) 0; }
.file-details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.file-details h3 { font-size: .82rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint); margin: var(--sp-4) 0 .4rem; }
.file-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.file-chips code {
  font-size: .76rem; padding: .15rem .45rem; border-radius: var(--r-sm);
  background: var(--bg-sunken); border: 1px solid var(--line);
}
.file-chips.dim code { color: var(--text-faint); }

.confirm-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5); flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-6) 0;
}
.confirm-lead { margin: 0; font-weight: 620; }
.confirm-sub { margin: .2rem 0 0; font-size: .85rem; color: var(--text-faint); }
.confirm-actions { display: flex; gap: .6rem; align-items: center; }

.backup-actions {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

/* Progress */
.progress-card {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); padding: var(--sp-7) var(--sp-5);
  text-align: center; max-width: 32rem; margin: var(--sp-6) auto;
}
.progress-card.ok { border-color: var(--ok-line); }
.progress-card.bad { border-color: var(--err-line); background: var(--err-bg); }
.spinner {
  width: 30px; height: 30px; margin: 0 auto var(--sp-4);
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.progress-step { font-weight: 620; margin: 0 0 var(--sp-3); }
.progress-track {
  height: 6px; border-radius: var(--r-full); background: var(--bg-sunken);
  overflow: hidden; margin-bottom: var(--sp-3);
}
.progress-fill {
  height: 100%; width: 5%; background: var(--accent);
  border-radius: var(--r-full); transition: width .5s ease;
}
.progress-sub { font-size: .86rem; color: var(--text-faint); margin: 0 0 var(--sp-4); }

/* Comparing page text */
.compare-legend { display: flex; gap: var(--sp-5); font-size: .84rem;
  color: var(--text-faint); margin-bottom: var(--sp-3); }
.compare-legend .swatch {
  display: inline-block; width: .7rem; height: .7rem; border-radius: 2px;
  margin-right: .3rem; vertical-align: baseline;
}
.swatch.add { background: var(--ok-line); }
.swatch.remove { background: var(--warn-line); }
.diff-block {
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; margin-bottom: var(--sp-5); background: var(--bg-raised);
}
.diff-row {
  display: flex; gap: .6rem; padding: .3rem .7rem; font-size: .87rem;
  line-height: 1.5; border-bottom: 1px solid var(--line);
}
.diff-row:last-child { border-bottom: 0; }
.diff-row.same { color: var(--text-faint); }
.diff-row.add { background: var(--ok-bg); color: var(--text); }
.diff-row.remove { background: var(--warn-bg); color: var(--text); }
.diff-mark {
  flex-shrink: 0; width: 1ch; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.diff-row.add .diff-mark { color: var(--ok-text); }
.diff-row.remove .diff-mark { color: var(--warn-text); }
.diff-text { min-width: 0; overflow-wrap: anywhere; }
.diff-preview { margin-top: var(--sp-4); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--sp-4); background: var(--bg-sunken); }
details.release > summary {
  cursor: pointer; display: flex; align-items: baseline; gap: .5rem;
  flex-wrap: wrap; list-style: none;
}
details.release > summary::-webkit-details-marker { display: none; }
details.release > summary::before {
  content: "▸"; color: var(--text-faint); font-size: .8em;
  transition: transform .12s ease; display: inline-block;
}
details.release[open] > summary::before { transform: rotate(90deg); }
details.release > summary .release-title {
  font-size: .85rem; color: var(--text-faint); margin: 0; flex: 1 1 100%;
  padding-left: 1.1rem;
}
details.release > ul { margin-top: .5rem; }
/* Backup file names are one token; wrapping them mid-name is unreadable and
   the table already scrolls sideways when it needs to. */
.backup-name { white-space: nowrap; }
