/* ProsperRust staff hub. Built from the logo: pure black, the P's cobalt blue, the R's white. */
:root {
  color-scheme: dark;

  --black: #000;          /* logo background: rail and brand areas */
  --bg: #0c1016;          /* content canvas, lifted from black for long reading */
  --panel: #131922;
  --panel-2: #1a222e;
  --field: #080b10;
  --line: #212a36;
  --line-strong: #2f3b4b;
  --text: #f1f4f8;
  --muted: #9ba7b6;
  --faint: #7a8698;

  --blue: #0164b0;        /* logo P: fills, with white text on top */
  --blue-hover: #0a74c4;
  --blue-text: #5aa7ea;   /* the same blue, lightened so it reads as text on dark */
  --white: #fff;          /* logo R */

  --danger: #e5534b;
  --danger-deep: #b8322b;
  --danger-text: #ff9e97;
  --ok: #4cc38a;
  --amber: #f0a43c;
  --info: #86a9c9;

  --stripe: repeating-linear-gradient(-45deg, var(--danger) 0 6px, var(--black) 6px 12px);

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --wide: 116%;           /* heavy, extended headings echo the PR monogram */
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-sm: 4px;
  --r-md: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--blue); color: var(--white); }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
img { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: .86em; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .05em .35em; }
h1, h2, h3 { font-family: var(--font); font-stretch: var(--wide); margin: 0; }
h1 { font-size: 2.3rem; font-weight: 800; line-height: 1.04; letter-spacing: -.018em; }
h2 { font-size: 1.1rem; font-weight: 700; line-height: 1.25; letter-spacing: -.006em; margin-bottom: 12px; }
h3 { font-weight: 700; }
p { margin: 0 0 .8em; }

:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 2px; }
.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 { position: absolute; left: 12px; top: -40px; background: var(--blue); color: var(--white); padding: 6px 12px; z-index: 10; border-radius: var(--r-sm); font-weight: 600; }
.skip:focus { top: 12px; }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.hint { color: var(--faint); font-size: .86rem; }
.empty { color: var(--muted); padding: 6px 0 4px; max-width: 60ch; }
.id { font-family: var(--mono); font-size: .8rem; color: var(--faint); }
.mono { font-family: var(--mono); font-size: .9rem; line-height: 1.6; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--black); border-right: 1px solid var(--line);
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 24px; text-decoration: none; }
.brand-logo { flex: none; width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 800 1.06rem/1.1 var(--font); font-stretch: 112%; letter-spacing: -.012em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none;
  font: 600 .94rem/1.25 var(--font); font-stretch: 106%;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.is-active { color: var(--white); background: var(--panel); box-shadow: inset 3px 0 0 var(--blue); }
.nav-badge {
  min-width: 22px; padding: 0 6px; border-radius: 10px;
  background: var(--blue); color: var(--white);
  font: 700 .74rem/1.6 var(--font); text-align: center;
}
.me {
  margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 6px 10px; align-items: center;
}
.me-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.me-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.me-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px; }

.main { padding: 34px 44px 72px; max-width: 1260px; width: 100%; }

/* ---------- Avatars, chips, ranks ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; }
.avatar-lg { width: 72px; height: 72px; border: 2px solid var(--line-strong); }
.who { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.who .avatar { width: 28px; height: 28px; }
a.who:hover strong { text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); font-size: .8rem; line-height: 1.65; white-space: nowrap;
}
.chip-ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.chip-warn { border-color: color-mix(in srgb, var(--amber) 60%, transparent); color: var(--amber); }
.chip-danger { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger-text); }

/* Ranks: Admin wears the logo's blue P, Owner its white R. */
.rank { display: inline-block; padding: 0 7px; border-radius: var(--r-sm); font: 700 .74rem/1.65 var(--font); }
.rank-0 { background: var(--panel-2); color: var(--muted); }
.rank-1 { background: color-mix(in srgb, var(--info) 18%, transparent); color: #c0d3e5; }
.rank-2 { background: color-mix(in srgb, var(--ok) 18%, transparent); color: #a6e6c6; }
.rank-3 { background: var(--blue); color: var(--white); }
.rank-4 { background: var(--white); color: var(--black); }
.rank-5 { background: var(--black); color: var(--white); box-shadow: inset 0 0 0 1px var(--blue-text); }

.role { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 999px; background: var(--panel-2); font-size: .8rem; line-height: 1.65; }
.role::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--role, var(--muted)); }
.roles { display: flex; flex-wrap: wrap; gap: 5px; }

/* Action type colours: used by history tags and activity dots */
.t-note { --t: var(--info); }
.t-warn { --t: var(--amber); }
.t-timeout { --t: var(--amber); }
.t-kick { --t: var(--danger); }
.t-ban { --t: var(--danger-deep); }
.t-untimeout, .t-unban, .t-close { --t: var(--ok); }
.t-open, .t-claim, .t-panel { --t: var(--blue-text); }
/* Rust bans: statuses in tables/history, and audit actions (ban.add / ban.lift) in feeds */
.t-active, .t-add { --t: var(--danger); }
.t-expired { --t: var(--faint); }
.t-lifted, .t-lift { --t: var(--ok); }
.t-left_server, .t-import { --t: var(--amber); }
/* Hub login changes (login.create / reset / rank / disable / enable) */
.t-create, .t-enable { --t: var(--ok); }
.t-reset, .t-rank { --t: var(--blue-text); }
.t-disable { --t: var(--danger); }
.tag {
  display: inline-block; padding: 0 8px; border-radius: var(--r-sm);
  border-left: 3px solid var(--t, var(--muted)); background: color-mix(in srgb, var(--t, var(--muted)) 14%, transparent);
  font: 700 .84rem/1.75 var(--font); font-stretch: 108%;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--t, var(--faint)); margin-right: 6px; vertical-align: .1em; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
  font: 600 .92rem/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-danger { background: var(--danger-deep); border-color: var(--danger-deep); color: #fff4f3; }
.btn-danger:hover { background: #cc3d35; border-color: #cc3d35; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn-sm { padding: 4px 10px; font-size: .84rem; }
.btn-lg { padding: 13px 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .84rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--text); }
.link-quiet { color: var(--muted); font-size: .88rem; }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  width: 100%; padding: 8px 10px;
  background: var(--field); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font: inherit;
}
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-text); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: .88rem; }
.field[hidden], .check[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; font-size: .92rem; cursor: pointer; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.inline-form { display: flex; gap: 8px; max-width: 460px; }

/* ---------- Page structure ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.lede { color: var(--muted); margin: 10px 0 0; max-width: 68ch; }
.crumb { margin: 0 0 8px; font-size: .9rem; }
.crumb a { color: var(--muted); }
.head-actions { display: flex; gap: 8px; align-items: center; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block { margin-bottom: 34px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; }
.panel + .panel { margin-top: 14px; }
.panel > :last-child { margin-bottom: 0; }

.flash { padding: 10px 14px; margin-bottom: 18px; border-radius: var(--r-sm); border: 1px solid; font-weight: 500; }
.flash-ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 11%, transparent); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.banner { padding: 10px 14px; border-radius: var(--r-sm); margin-top: 16px; }
.banner-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); border-left: 3px solid var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--panel) 80%, transparent); }
.table th.num, .table td.num { text-align: right; }
.row-link { font-weight: 500; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.is-stale { color: var(--amber); }
.is-old { color: var(--danger-text); }
.strikes { color: var(--amber); font-weight: 600; }
.table-log td { vertical-align: top; }
.log-details { display: flex; flex-direction: column; gap: 2px; max-width: 46ch; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.pager-pos { color: var(--muted); font-size: .88rem; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  font: 600 .95rem/1.2 var(--font); font-stretch: 106%;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--white); border-bottom-color: var(--blue); }
.tab-count { margin-left: 6px; color: var(--faint); font-size: .8rem; font-weight: 500; font-stretch: 100%; }

.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 200px; }

/* ---------- Dashboard ---------- */
.quick-find { width: min(320px, 100%); }
.dash {
  display: grid; gap: 36px 44px;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-areas: "queue notes" "feed notes";
  align-items: start;
}
.queue { grid-area: queue; }
.notes { grid-area: notes; }
.feed-wrap { grid-area: feed; }

.q-list { list-style: none; margin: 0; padding: 0; }
.q-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 11px 4px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.q-list li:last-child .q-row { border-bottom: 0; }
.q-row:hover .q-subject { text-decoration: underline; text-underline-offset: 3px; }
.q-num { font: 700 1rem/1 var(--font); font-stretch: var(--wide); color: var(--faint); }
.q-main { display: flex; flex-direction: column; min-width: 0; }
.q-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { color: var(--muted); font-size: .86rem; }
.q-unclaimed { color: var(--amber); font-weight: 500; }
.q-age { font-size: .86rem; color: var(--muted); white-space: nowrap; }
.q-age.is-stale { color: var(--amber); }
.q-age.is-old { color: var(--danger-text); font-weight: 600; }

.note-list { list-style: none; margin: 0 0 16px; padding: 0; }
.note { border-left: 2px solid var(--blue); padding: 2px 0 2px 14px; margin-bottom: 18px; }
.note-body { font-size: .96rem; }
.note-body > :last-child { margin-bottom: 4px; }
.note-meta { display: flex; gap: 10px; align-items: baseline; color: var(--faint); font-size: .82rem; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.feed-item a { text-decoration: none; }
.feed-item a:hover { text-decoration: underline; }
.feed-time { color: var(--faint); font-size: .82rem; white-space: nowrap; }

/* ---------- Members ---------- */
.search { display: flex; gap: 10px; max-width: 620px; margin-bottom: 28px; }
.search input { font-size: 1.05rem; padding: 10px 12px; }

.profile { display: flex; gap: 18px; align-items: center; padding-bottom: 22px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.profile-text { min-width: 0; }
.profile-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 8px 0 0; color: var(--muted); }
.id-chip { display: inline-flex; gap: 8px; align-items: center; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 32px; align-items: start; }
.col-side { position: sticky; top: 24px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.history { list-style: none; margin: 0; padding: 0; }
.history-item { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.history-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.history-reason { margin: 0 0 4px; overflow-wrap: anywhere; }
.history-meta { margin: 0; color: var(--faint); font-size: .84rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }

/* The action panel turns into a warning zone for kicks and bans. */
.act-panel { position: relative; overflow: hidden; }
.act-panel::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 6px;
  background: transparent; transition: background-color .15s;
}
.act-panel[data-kind="kick"]::before,
.act-panel[data-kind="ban"]::before { background: var(--stripe); }
.act-panel[data-kind="kick"] .btn-act,
.act-panel[data-kind="ban"] .btn-act { background: var(--danger-deep); border-color: var(--danger-deep); color: #fff4f3; }
.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 3px; padding: 3px; margin: 0 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--field); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg-opt span {
  display: block; padding: 6px 4px; border-radius: 2px; text-align: center; white-space: nowrap;
  color: var(--muted); font: 600 .86rem/1.3 var(--font);
}
.seg-opt:hover span { color: var(--text); }
.seg-opt input:checked + span { background: var(--panel-2); color: var(--white); box-shadow: inset 0 -2px 0 var(--blue); }
.seg-kick input:checked + span, .seg-ban input:checked + span { box-shadow: inset 0 -2px 0 var(--danger); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--blue-text); outline-offset: 1px; }
.mini-form .field { margin-bottom: 10px; }

/* ---------- Rust bans ---------- */
.search-hint { margin: -18px 0 24px; max-width: 620px; }
.ban-reason { max-width: 42ch; }
.ban-notes { margin: 8px 0 0; padding: 8px 12px; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.ban-lifted { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--ok); color: var(--muted); font-size: .88rem; }
.side-hint { margin: 10px 2px 0; }

/* ---------- Hub logins & account ---------- */
.chip-sm { padding: 0 7px; font-size: .72rem; line-height: 1.6; margin-left: 6px; vertical-align: .1em; }
.banner-info { background: color-mix(in srgb, var(--blue) 16%, transparent); border-left: 3px solid var(--blue); margin: 0 0 22px; max-width: 640px; }
.account-form { max-width: 460px; }
.account-form .panel { margin-bottom: 10px; }
.issued { max-width: 640px; margin-bottom: 30px; border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); }
.issued code { font-size: .95rem; }
.issued-pw { font-size: 1.05rem !important; letter-spacing: .04em; color: var(--white); }
.inline-rank select { width: auto; min-width: 130px; padding: 4px 8px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.new-login { max-width: 760px; }
.new-login-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }

.pw-login { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.pw-login summary { cursor: pointer; color: var(--muted); font-size: .92rem; font-weight: 500; width: fit-content; }
.pw-login summary:hover { color: var(--text); }
.pw-login[open] summary { color: var(--text); margin-bottom: 14px; }
.pw-form .gate-foot { margin-top: 10px; }

/* ---------- Tickets ---------- */
.ticket-body { white-space: normal; max-width: 75ch; overflow-wrap: anywhere; }
.chat { list-style: none; margin: 0; padding: 0; }
.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.msg .avatar { width: 34px; height: 34px; }
.msg.is-member .msg-head strong { color: var(--blue-text); }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 2px; }
.msg-time { color: var(--faint); font-size: .8rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-embed { margin-top: 6px; padding: 6px 12px; border-left: 3px solid var(--line-strong); background: color-mix(in srgb, var(--panel) 80%, transparent); border-radius: 0 var(--r-sm) var(--r-sm) 0; max-width: 70ch; }
.embed-author { margin: 0; font-size: .82rem; color: var(--muted); font-weight: 600; }
.embed-title { margin: 0 0 2px; font-weight: 600; }
.bot-tag { padding: 0 5px; border-radius: 3px; background: #5865f2; color: #fff; font-size: .68rem; font-weight: 600; line-height: 1.5; }
.attachment { display: inline-block; margin-top: 6px; margin-right: 8px; font-size: .88rem; color: var(--blue-text); }
.reply { margin-top: 10px; }
.setup-block { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---------- Handbook ---------- */
.book { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 44px; align-items: start; }
.toc { position: sticky; top: 24px; }
.toc-title { font: 700 1.1rem/1.25 var(--font); font-stretch: var(--wide); margin: 0 0 10px; }
.toc ul { list-style: none; margin: 0 0 16px; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--white); border-left-color: var(--blue); font-weight: 500; }
.toc-lock { font-size: .72rem; color: var(--faint); white-space: nowrap; }
.book-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.book-foot { margin-top: 36px; color: var(--faint); font-size: .86rem; }

.prose { max-width: 70ch; font-size: 1.02rem; line-height: 1.68; }
.prose h2 { font-size: 1.45rem; margin: 1.7em 0 .5em; }
.prose h3 { font-size: 1.15rem; margin: 1.5em 0 .4em; }
.prose h4, .prose h5 { font: 600 1rem/1.4 var(--font); margin: 1.3em 0 .3em; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .3em; }
.prose li::marker { color: var(--blue-text); }
.prose strong { font-weight: 700; color: var(--white); }
.prose a { color: var(--blue-text); }
.prose blockquote { padding: 2px 0 2px 16px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.prose pre { padding: 12px 14px; overflow-x: auto; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); }
.prose pre code { background: none; border: 0; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

.editor { max-width: 900px; }
.editor-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.field-grow { flex: 1 1 320px; }
.field-narrow { width: 90px; }
.danger-zone { max-width: 900px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Login / setup / errors ---------- */
/* Split screen: the logo on its own black on the left, the app's canvas on the right. */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.gate-art {
  display: grid; place-items: center; padding: 48px;
  background: var(--black); border-right: 1px solid var(--line);
}
.gate-art img { width: min(100%, 440px, 60vh); height: auto; }
.gate-card { align-self: center; width: min(100%, 520px); padding: 56px clamp(24px, 5vw, 64px); }
.gate-title {
  font: 800 clamp(2.1rem, 3.3vw, 2.8rem)/1.04 var(--font); font-stretch: var(--wide);
  letter-spacing: -.024em; margin: 0 0 16px; text-wrap: balance;
}
.gate-text { color: var(--muted); margin-bottom: 28px; max-width: 38ch; }
.gate-foot { margin-top: 18px; color: var(--faint); font-size: .84rem; max-width: 40ch; }
.setup-list { margin: 0 0 22px; padding-left: 1.2em; }
.setup-list li { margin-bottom: 6px; }
.error-page { padding-top: 40px; max-width: 60ch; }
.error-code { font: 800 4.5rem/1 var(--font); font-stretch: var(--wide); color: var(--line-strong); margin: 0 0 8px; }
.error-page h1 { margin-bottom: 8px; }
.error-page .lede { margin-bottom: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; order: -1; }
  .dash { grid-template-columns: minmax(0, 1fr); grid-template-areas: "queue" "notes" "feed"; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand-logo { width: 34px; height: 34px; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; }
  .nav-link { padding: 6px 10px; }
  .nav-link.is-active { box-shadow: inset 0 -2px 0 var(--blue); }
  .me { margin: 0 0 0 auto; padding: 0; border: 0; grid-template-columns: auto auto; }
  .me .avatar, .me-text { display: none; }
  .me-actions { grid-column: auto; }
  .main { padding: 22px 16px 56px; }
  h1 { font-size: 1.8rem; }
  .book { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .toc { position: static; }
  .history-item { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .history-side { flex-direction: row; align-items: center; }
  .search, .inline-form { flex-direction: column; }
  .new-login-fields { grid-template-columns: minmax(0, 1fr); }
  .row-actions { justify-content: flex-start; }

  .gate { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .gate-art { place-items: start; padding: 20px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .gate-art img { width: 72px; }
  .gate-card { align-self: start; padding: 36px 24px 48px; }
}

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