/*
 * Changelog Server — site.css
 * All colors via design tokens (tokens.css). No hardcoded palette values.
 * Component prefixes: .cl-* (shared), .reader-* (public), .admin-* (admin),
 *                     .editor-* (entry editor), .auth-* (login/setup)
 */

/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
.cl-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.cl-scroll::-webkit-scrollbar-track { background: transparent; }
.cl-scroll::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED COMPONENT LIBRARY (.cl-*)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── .cl-btn ─────────────────────────────────────────────────────────────── */
.cl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 500 13px var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
  appearance: none;
  flex-shrink: 0;
}
.cl-btn:hover { background: var(--surface-2); text-decoration: none; }
.cl-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cl-btn.primary:hover { filter: brightness(1.08); color: #fff; }
.cl-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.cl-btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.cl-btn.danger {
  background: var(--break);
  border-color: var(--break);
  color: #fff;
}
.cl-btn.danger:hover { filter: brightness(0.92); color: #fff; }
.cl-btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }

/* ── .cl-input ───────────────────────────────────────────────────────────── */
.cl-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 400 13px var(--font-sans);
  outline: 0;
  transition: border-color .12s, box-shadow .12s;
}
.cl-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.cl-input.mono { font-family: var(--font-mono); }

/* ── .cl-tag — chip `#release` ───────────────────────────────────────────── */
.cl-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: 400 11px var(--font-mono);
  text-decoration: none;
  white-space: nowrap;
  transition: background .1s, border-color .1s;
}
.cl-tag::before { content: '#'; opacity: .55; margin-right: 2px; }
a.cl-tag:hover { background: var(--surface-2); border-color: var(--border-2); text-decoration: none; }

/* ── .cl-chip — pill (version, section header) ───────────────────────────── */
.cl-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: 400 11.5px var(--font-mono);
  white-space: nowrap;
}
.cl-chip.solid {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}
.cl-chip.add {
  height: 20px;
  font-size: 10.5px;
  color: var(--add);
  background: var(--surface);
  border-color: color-mix(in oklab, var(--add) 30%, var(--border));
}
.cl-chip.fix {
  height: 20px;
  font-size: 10.5px;
  color: var(--fix);
  background: var(--surface);
  border-color: color-mix(in oklab, var(--fix) 30%, var(--border));
}
.cl-chip.break {
  height: 20px;
  font-size: 10.5px;
  color: var(--break);
  background: var(--surface);
  border-color: color-mix(in oklab, var(--break) 30%, var(--border));
}
.cl-chip.draft {
  height: 20px;
  font-size: 10.5px;
  color: var(--fix);
  background: var(--surface);
  border-color: color-mix(in oklab, var(--fix) 30%, var(--border));
}
.cl-chip.info {
  height: 20px;
  font-size: 10.5px;
  color: var(--info);
  background: var(--surface);
  border-color: color-mix(in oklab, var(--info) 30%, var(--border));
}

/* ── .cl-card ────────────────────────────────────────────────────────────── */
.cl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── .cl-kbd ─────────────────────────────────────────────────────────────── */
.cl-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--faint);
  font: 400 11px var(--font-mono);
}

/* ── .cl-divider ─────────────────────────────────────────────────────────── */
.cl-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ── Eyebrow / label ─────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ── Status dot ──────────────────────────────────────────────────────────── */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.status-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-dot.published { color: var(--add); }
.status-dot.draft     { color: var(--fix); }

/* ── Toast notification ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--add);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  animation: toast-in .18s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(.4rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PUBLIC TOPBAR  (.site-header / header.html component)
   ═══════════════════════════════════════════════════════════════════════════ */

.site-header {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.site-header .topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
}

/* Logo block */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }

.logo-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: 600 12px var(--font-mono);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Topbar nav */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 12px;
}

.topbar-nav a {
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: background .1s, color .1s;
}
.topbar-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar-nav a.active { background: var(--surface-2); color: var(--text); }

.topbar-spacer { flex: 1; }

/* Search bar */
.topbar-search {
  position: relative;
  width: 320px;
}
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.topbar-search input {
  width: 100%;
  height: 32px;
  padding: 0 32px 0 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: 400 12.5px var(--font-mono);
  outline: 0;
  transition: border-color .12s, box-shadow .12s;
}
.topbar-search input::placeholder { color: var(--faint); }
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.topbar-search .kbd-hint {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

/* Topbar controls */
.topbar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

/* ── Site footer ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: .875rem 1.5rem;
  margin-top: auto;
  flex-shrink: 0;
}
.footer-inner {
  max-width: calc(var(--rail-width) + var(--reader-max) + 80px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .8125rem;
  color: var(--muted);
}
.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--accent); }
.footer-version { font-family: var(--font-mono); font-size: .75rem; opacity: .6; }

/* ── Settings page ───────────────────────────────────────────────────────── */
.settings-page { max-width: 760px; }
.settings-section { margin-top: 20px; padding: 0; overflow: hidden; }
.settings-section-title {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.settings-fields { padding: 4px 0; }
.settings-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text);
  padding-top: 7px;
}
.settings-control { display: flex; flex-direction: column; gap: 6px; }
.settings-control .cl-input { width: 100%; }
.settings-help {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.5;
}
.settings-help a { color: var(--accent); }
.settings-help a:hover { text-decoration: underline; }
.settings-help code {
  font-family: var(--font-mono);
  font-size: .7rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}
.tz-examples { display: block; margin-top: 4px; line-height: 1.8; }
.settings-tz-resolved {
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--muted);
}
.settings-tz-resolved.error { color: var(--break); }
.password-wrap { display: flex; gap: 6px; align-items: center; }
.password-wrap .cl-input { flex: 1; }
.settings-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0 4px;
}
.settings-restart-note {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--muted);
}

/* ── Admin footer ────────────────────────────────────────────────────────── */
.admin-footer {
  border-top: 1px solid var(--border);
  padding: .5rem 1.5rem;
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--faint);
  text-align: center;
  flex-shrink: 0;
}

/* ── Icon helper ─────────────────────────────────────────────────────────── */
.icon { width: 14px; height: 14px; flex-shrink: 0; vertical-align: middle; }
.icon-sm { width: 12px; height: 12px; flex-shrink: 0; vertical-align: middle; }
.icon-rss { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   SCREEN 1 · PUBLIC READER
   ═══════════════════════════════════════════════════════════════════════════ */

body.reader-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.reader-page {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Version rail */
.version-rail {
  width: var(--rail-width);
  flex: 0 0 var(--rail-width);
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: 28px 20px 28px 28px;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}
.version-rail::-webkit-scrollbar { width: 4px; }
.version-rail::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.rail-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}

.version-list {
  position: relative;
  padding-left: 14px;
}
.version-list::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.version-year {
  margin-bottom: 18px;
}
.version-year-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
  margin-bottom: 8px;
  margin-left: -2px;
}

.version-item {
  position: relative;
  margin-bottom: 4px;
}
.version-item::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  transition: background .1s, border-color .1s;
}
.version-item.active::before {
  background: var(--accent);
  border-color: var(--accent);
}

.version-item a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
  transition: background .1s;
}
.version-item a:hover { background: var(--surface-2); text-decoration: none; }
.version-item.active a {
  background: var(--surface-2);
  font-weight: 500;
}
.version-item .v-num { font-family: var(--font-mono); }
.version-item .v-date { color: var(--faint); font-family: var(--font-mono); font-size: 11px; }

.rail-divider { margin: 16px 0 12px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

/* Reader main */
.reader-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
}
.reader-main::-webkit-scrollbar { width: 6px; }
.reader-main::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.reader-inner {
  max-width: var(--reader-max);
  margin: 0 auto;
  padding: 32px 8px 80px;
}

/* Reader hero (page header) */
.reader-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 32px 28px;
  gap: 16px;
}
.reader-hero-left .eyebrow { margin-bottom: 6px; }
.reader-hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.15;
}
.reader-hero p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.5;
}
.reader-hero-actions { display: flex; gap: 6px; align-items: flex-start; padding-top: 4px; }

/* Tag filter banner */
.tag-filter-banner {
  margin: 0 32px 20px;
  padding: 8px 14px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}
.tag-filter-banner a { color: var(--accent); }

/* Empty state */
.reader-empty {
  padding: 64px 32px;
  text-align: center;
}
.reader-empty .eyebrow { margin-bottom: 12px; }
.reader-empty h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; color: var(--text); }
.reader-empty p { margin: 0 0 20px; font-size: 14px; color: var(--muted); }

/* Entry card */
.entry-card {
  padding: 28px 32px 32px;
  border-bottom: 1px solid var(--border);
}
.entry-card:last-of-type { border-bottom: none; }

.entry-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.entry-meta-sep { color: var(--faint); }
.entry-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.entry-type {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.entry-card-actions { margin-left: auto; }
.copy-link-btn { height: 26px; padding: 0 8px; }

.entry-card h2 {
  margin: 4px 0 14px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  color: var(--text);
}
.entry-card h2 a { color: var(--text); }
.entry-card h2 a:hover { color: var(--accent); text-decoration: none; }
.entry-card.featured h2 { font-size: 26px; }

.entry-card .tag-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* Entry body — rendered markdown */
.entry-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.entry-body > *:first-child { margin-top: 0; }
.entry-body > *:last-child  { margin-bottom: 0; }

.entry-body h1,
.entry-body h2,
.entry-body h3,
.entry-body h4 {
  margin: 1.4em 0 .5em;
  font-weight: 600;
  line-height: 1.25;
}
.entry-body h2 { font-size: 15px; }
.entry-body h3 { font-size: 14px; }

/* Section headings styled as chips */
.entry-body h2.section-add { color: var(--add); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.entry-body h2.section-fix { color: var(--fix); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.entry-body h2.section-break { color: var(--break); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.entry-body h3.section-add { color: var(--add); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.entry-body h3.section-fix { color: var(--fix); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }
.entry-body h3.section-break { color: var(--break); font-size: 10.5px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; font-weight: 400; }

.entry-body p  { margin: .75em 0; }
.entry-body ul,
.entry-body ol { margin: .6em 0; padding-left: 1.5em; }
.entry-body li { margin: .3em 0; font-size: 14px; line-height: 1.55; }

.entry-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}
.entry-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: .75em 0;
  line-height: 1.55;
}
.entry-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
}
.entry-body blockquote {
  margin: .75em 0;
  padding: .5em 1em;
  border-left: 3px solid var(--border-2);
  color: var(--muted);
}
.entry-body hr { border: none; border-top: 1px solid var(--border); margin: 1.25em 0; }
.entry-body strong { font-weight: 600; }
.entry-body em     { font-style: italic; }
.entry-body del    { text-decoration: line-through; color: var(--muted); }
.entry-body a      { color: var(--accent); }

/* "Show older" / pagination link */
.reader-pagination {
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCREEN 2 · ADMIN SHELL
   ═══════════════════════════════════════════════════════════════════════════ */

body.admin-body {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Admin topbar */
.admin-topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.admin-topbar .topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
}

.admin-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  padding: 2px 6px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  letter-spacing: .08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 18px;
}
.admin-nav a {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  text-decoration: none;
  transition: background .1s, color .1s;
}
.admin-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.admin-nav a.active { background: var(--surface-2); color: var(--text); font-weight: 500; }

/* Admin page container */
.admin-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Dashboard: main pane + activity rail */
.admin-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.admin-main-pane {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

/* Activity rail */
.activity-rail {
  width: var(--activity-rail);
  flex: 0 0 var(--activity-rail);
  border-left: 1px solid var(--border);
  background: var(--bg);
  padding: 20px 18px;
  overflow-y: auto;
}
.activity-rail::-webkit-scrollbar { width: 4px; }
.activity-rail::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.activity-items { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

.activity-item {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

.activity-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  font: 600 11px var(--font-mono);
  color: var(--muted);
}

.activity-body { min-width: 0; }
.activity-who { font-weight: 500; color: var(--text); }
.activity-what { color: var(--muted); }
.activity-target {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-when { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

.quick-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.quick-actions .cl-btn { justify-content: flex-start; width: 100%; }

/* Solo pages (trash, setup, login) */
.admin-solo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 28px 40px;
  width: 100%;
}

/* Dashboard header */
.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.dashboard-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.dashboard-header .eyebrow { margin-bottom: 4px; }
.dashboard-actions { display: flex; gap: 8px; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.stat-label { /* uses .eyebrow */ }
.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.1;
}
.stat-delta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* Entries table card */
.entries-card { overflow: hidden; }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.filter-search {
  position: relative;
  width: 280px;
}
.filter-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
.filter-search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: 400 12.5px var(--font-sans);
  outline: 0;
}
.filter-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.filter-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* Admin entries table */
.cl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cl-table thead tr { background: var(--surface-2); }
.cl-table th {
  padding: 8px 12px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cl-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cl-table tbody tr:last-child td { border-bottom: none; }
.cl-table tbody tr:hover { background: var(--surface-2); }

.cl-table .td-title { font-weight: 500; color: var(--text); }
.cl-table .td-title a { color: var(--text); text-decoration: none; }
.cl-table .td-title a:hover { color: var(--accent); }
.cl-table .td-mono { font-family: var(--font-mono); color: var(--muted); }
.cl-table .td-actions { text-align: right; white-space: nowrap; }
.cl-table .td-tags { display: inline-flex; gap: 4px; flex-wrap: nowrap; }

/* Trash page */
.trash-empty {
  padding: 48px 28px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCREEN 3 · EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */

body.editor-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Crumb bar */
.editor-crumb {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 10;
}
.editor-crumb-back { color: var(--muted); font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.editor-crumb-back:hover { color: var(--text); text-decoration: none; }
.editor-crumb-sep { color: var(--faint); }
.editor-crumb-title { font-size: 13px; font-weight: 500; color: var(--text); }
.editor-crumb-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* Meta strip */
.editor-meta {
  background: var(--bg);
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.6fr 0.5fr 0.6fr 1fr;
  gap: 16px;
  flex-shrink: 0;
}
.meta-field { display: flex; flex-direction: column; gap: 6px; }
.meta-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.meta-field input,
.meta-field select {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 400 13px var(--font-sans);
  outline: 0;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
.meta-field input.title-input { font-size: 15px; font-weight: 500; }
.meta-field input.mono-input { font-family: var(--font-mono); }
.meta-field input:focus,
.meta-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* Tags input */
.tags-input-wrap {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
  cursor: text;
}
.tags-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.tags-input-wrap .cl-tag { flex-shrink: 0; cursor: default; }
.tags-input-wrap .cl-tag-remove {
  margin-left: 4px;
  opacity: .5;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.tags-input-wrap .cl-tag-remove:hover { opacity: 1; }
.tags-input-wrap input {
  flex: 1;
  min-width: 60px;
  border: 0;
  background: transparent;
  outline: 0;
  font: 400 12.5px var(--font-mono);
  color: var(--text);
  padding: 0 4px;
}
.tags-input-wrap input::placeholder { color: var(--faint); }

/* Split editor / preview */
.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.editor-toolbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.editor-textarea {
  flex: 1;
  padding: 18px 22px;
  border: 0;
  outline: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13.5px var(--font-mono);
  line-height: 1.65;
  resize: none;
  width: 100%;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}
.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 4px 30px;
}
.preview-inner {
  max-width: 620px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH & SETUP PAGES
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.auth-box h1 { margin: 0 0 .375rem; font-size: 22px; font-weight: 600; letter-spacing: -0.018em; color: var(--text); }
.auth-box p  { margin: .5rem 0 1.25rem; color: var(--muted); font-size: 14px; }

.auth-form { display: flex; flex-direction: column; gap: .75rem; }
.auth-form input[type="email"],
.auth-form input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: 400 14px var(--font-sans);
  outline: 0;
}
.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SETUP / GENERAL FORMS  (admin-solo context)
   ═══════════════════════════════════════════════════════════════════════════ */

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--text);
  margin: 0 0 4px;
}
.page-subtitle { font-size: 14px; color: var(--muted); margin: 0 0 1.5rem; }

.form-grid { display: flex; flex-direction: column; gap: 1.25rem; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row-half { flex-direction: row; gap: 1rem; align-items: flex-start; }
.form-row-half > * { flex: 1; display: flex; flex-direction: column; gap: 4px; }

label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .01em;
}
.required { color: var(--break); margin-left: .15em; }
.hint { font-weight: 400; color: var(--faint); font-size: 12px; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .75rem;
  outline: none;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  min-height: 300px;
}
small { font-size: 12px; color: var(--muted); }

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding-top: .25rem;
  border-top: 1px solid var(--border);
  margin-top: .5rem;
}
.form-actions-right { margin-left: auto; display: flex; gap: .5rem; }

/* Error/info notices */
.notice {
  padding: .5rem .875rem;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: .75rem;
}
.notice.error {
  background: color-mix(in oklab, var(--break) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--break) 30%, transparent);
  color: var(--break);
}
.notice.success {
  background: color-mix(in oklab, var(--add) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--add) 30%, transparent);
  color: var(--add);
}
.notice.info {
  background: color-mix(in oklab, var(--info) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--info) 30%, transparent);
  color: var(--info);
}

/* Legacy aliases so existing C# builders still work */
.error {
  padding: .5rem .875rem;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: .75rem;
  background: color-mix(in oklab, var(--break) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--break) 30%, transparent);
  color: var(--break);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .activity-rail { display: none; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .version-rail { display: none; }
  .reader-inner { padding: 24px 0 60px; }
  .reader-hero { padding: 0 20px 20px; }
  .entry-card { padding: 20px 20px 24px; }
  .editor-meta { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar-search { display: none; }
  .topbar-nav { display: none; }
  .admin-nav { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .editor-split { grid-template-columns: 1fr; }
  .preview-pane { display: none; }
  .form-row-half { flex-direction: column; }
  .form-actions { flex-direction: column; }
  .form-actions-right { margin-left: 0; }
  .auth-box { margin: 1rem; }
}
