/* ZertArchiv — Design System
 * Selbst geschrieben, keine externen Abhängigkeiten.
 * Nüchtern, verwaltungstauglich, ruhig (ADR-0011, UI-Plan U1-U4).
 */

/* ----------------------------------------------------------------
 * Reset
 * ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
h1, h2, h3, h4, h5, h6, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg, video { display: block; max-width: 100%; }
button, [role="button"] { cursor: pointer; border: 0; background: transparent; padding: 0; font: inherit; color: inherit; }
input, select, textarea, button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-5) 0; }

/* ----------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------- */

:root {
  /* ZertArchiv brand palette (ADR-0015) */
  --color-primary:        #1E3A5F;
  --color-primary-hover:  #152A47;
  --color-primary-strong: #0F2238;
  --color-primary-faint:  #E8EFF7;
  --color-accent:         #2A6DD8;
  --color-accent-hover:   #1F58B0;
  --color-accent-faint:   #DCE7F8;

  --color-text:           #1A1E23;
  --color-text-muted:     #5A6471;
  --color-text-subtle:    #8A929E;

  --color-bg:             #F7F8FA;
  --color-surface:        #FFFFFF;
  --color-surface-alt:    #FAFBFC;
  --color-border:         #E1E5EB;
  --color-border-strong:  #C5CBD3;

  --color-ok:      #1F7A3D;
  --color-ok-bg:   #E6F3EB;
  --color-warn:    #8A5E0A;
  --color-warn-bg: #FBF1DC;
  --color-error:   #A12C25;
  --color-error-bg: #FAE8E6;

  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Monaco, Consolas, "Courier New", monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  2rem;

  --leading-tight:   1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  --shadow-sm: 0 1px 2px rgba(27, 32, 42, 0.05);
  --shadow-md: 0 1px 3px rgba(27, 32, 42, 0.06), 0 1px 2px rgba(27, 32, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(27, 32, 42, 0.08), 0 2px 6px rgba(27, 32, 42, 0.04);

  --content-width: 72rem;
  --sidebar-width: 15rem;
  --header-height: 4rem;

  color-scheme: light;
}

/* ZertArchiv ist bewusst eine reine Hell-UI (Verwaltungs-Kontext, ADR-0015).
 * Dark-Mode wird nicht automatisch aus der OS-Einstellung übernommen,
 * weil die Brand-Farbpalette + Druck-Stylesheet auf Hell optimiert sind.
 * Eine optionale Dark-Variante kann später als opt-in über
 * ``html[data-theme="dark"]`` ergänzt werden, ohne diesen Block zu reaktivieren.
 */

/* ----------------------------------------------------------------
 * Body, typography
 * ---------------------------------------------------------------- */

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { color: var(--color-primary-strong); }
h1 { font-size: var(--text-2xl); line-height: var(--leading-tight); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--text-xl); line-height: var(--leading-tight); font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: var(--text-lg); line-height: var(--leading-tight); font-weight: 600; }
h4 { font-size: var(--text-md); line-height: var(--leading-tight); font-weight: 600; }

p { line-height: var(--leading-normal); }
small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }

.subtle { color: var(--color-text-muted); }
.muted  { color: var(--color-text-subtle); }

a { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 0.08em; }
a:hover { color: var(--color-accent-hover); }
a.unstyled, nav a, .breadcrumb a { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ----------------------------------------------------------------
 * Layout — Header, main, footer
 * ---------------------------------------------------------------- */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
/* Brand accent line on top: navy → brand-blue gradient (ADR-0015) */
.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    var(--color-primary) 45%,
    var(--color-accent) 55%,
    var(--color-accent) 100%
  );
}

.site-header__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-5);
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--color-text);
}
.site-header__brand svg { color: var(--color-primary); }

.site-nav {
  display: flex;
  gap: var(--space-5);
  flex: 1;
}

.site-nav a {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.site-nav a:hover { color: var(--color-primary); }
.site-nav a.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.site-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
}
.site-header__meta .tenant {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--color-accent-faint);
  color: var(--color-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-warn);
  background: var(--color-warn-bg);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(138, 94, 10, 0.2);
}

.breadcrumb {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5) 0;
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb__sep { color: var(--color-text-subtle); display: inline-flex; }
.breadcrumb__sep svg { width: 14px; height: 14px; }
.breadcrumb__current { color: var(--color-text); font-weight: 500; }

main {
  flex: 1;
  width: 100%;
}

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-5);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  padding: var(--space-5);
  margin-top: var(--space-7);
  border-image: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    var(--color-accent) 100%
  ) 1;
  border-top-width: 2px;
  border-top-style: solid;
}
.site-footer__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.site-footer a { color: var(--color-text-muted); }

/* ----------------------------------------------------------------
 * Admin layout (Sidebar + content)
 * ---------------------------------------------------------------- */

.admin-layout {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-5);
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-6);
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-5));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.admin-sidebar__title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-subtle);
  padding: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
}
.admin-sidebar__title:first-child { margin-top: 0; }

.admin-sidebar ul { list-style: none; }
.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.admin-sidebar a:hover {
  background: var(--color-accent-faint);
  color: var(--color-primary-strong);
}
.admin-sidebar a.is-active {
  background: var(--color-primary-faint);
  color: var(--color-primary-strong);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--color-accent);
  padding-left: calc(var(--space-3) - 3px);
}
.admin-sidebar a.is-active svg { color: var(--color-accent); }
.admin-sidebar a.is-disabled {
  color: var(--color-text-subtle);
  cursor: not-allowed;
}
.admin-sidebar a.is-disabled:hover { background: transparent; color: var(--color-text-subtle); }
.admin-sidebar .soon {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  background: var(--color-bg);
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
}

.admin-main { min-width: 0; }

@media (max-width: 840px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
}

/* ----------------------------------------------------------------
 * Page header
 * ---------------------------------------------------------------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.page-header__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary-strong);
  letter-spacing: -0.015em;
}
.page-header__subtitle { color: var(--color-text-muted); margin-top: var(--space-1); font-size: var(--text-sm); }
.page-header__actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* ----------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.btn:focus-visible { outline-offset: 2px; }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn--primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-faint);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  padding-inline: var(--space-2);
}
.btn--ghost:hover { color: var(--color-text); background: var(--color-bg); }

.btn--danger {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}
.btn--danger:hover { filter: brightness(0.95); color: #fff; }

.btn--sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }

.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* ----------------------------------------------------------------
 * Forms
 * ---------------------------------------------------------------- */

form { display: flex; flex-direction: column; gap: var(--space-4); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.field > label,
.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.field__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
input[type="file"], select, textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: 1.4;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(42, 109, 216, 0.18);
}
input[type="file"] { padding: var(--space-1); cursor: pointer; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%), linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: 0;
  background: var(--color-surface-alt);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
legend {
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.form-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding-top: var(--space-2);
}

/* ----------------------------------------------------------------
 * Cards, sections
 * ---------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-5); }
.card__title {
  font-size: var(--text-md);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.card__title .count { color: var(--color-text-subtle); font-weight: 400; font-size: var(--text-sm); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-accent-faint);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card { transition: border-color 0.15s, box-shadow 0.15s; }
.stat-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.stat-card__icon svg { width: 20px; height: 20px; }
.stat-card__value { font-size: var(--text-xl); font-weight: 600; line-height: 1.2; color: var(--color-text); }
.stat-card__label { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }

section.section { margin-bottom: var(--space-7); }
section.section > h2 { margin-bottom: var(--space-3); }
section.section > h3 { margin-bottom: var(--space-3); }

/* ----------------------------------------------------------------
 * Tables
 * ---------------------------------------------------------------- */

.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
table.table {
  font-size: var(--text-sm);
}
table.table th,
table.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
}
table.table th {
  background: var(--color-surface-alt);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: 600;
  border-bottom-color: var(--color-border-strong);
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--color-accent-faint); }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.table .compact-col { width: 1%; white-space: nowrap; }

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--color-text-muted);
}
.empty-state__icon {
  margin: 0 auto var(--space-3);
  width: 48px;
  height: 48px;
  background: var(--color-accent-faint);
  color: var(--color-accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state__icon svg { width: 24px; height: 24px; }
.empty-state__title { font-size: var(--text-md); font-weight: 600; color: var(--color-text); margin-bottom: var(--space-1); }
.empty-state__text { font-size: var(--text-sm); max-width: 30rem; margin: 0 auto var(--space-4); }

/* ----------------------------------------------------------------
 * Definition list (metadata)
 * ---------------------------------------------------------------- */

.dl {
  display: grid;
  grid-template-columns: minmax(12rem, auto) 1fr;
  gap: var(--space-3) var(--space-5);
}
.dl dt {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  padding-top: 2px;
}
.dl dd {
  margin: 0;
  color: var(--color-text);
  font-size: var(--text-sm);
  min-width: 0;
  word-break: break-word;
}
.dl dd details summary {
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  padding: var(--space-1) 0;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.dl dd details summary::before {
  content: "▶";
  font-size: 0.7em;
  transition: transform 0.15s;
}
.dl dd details[open] summary::before {
  transform: rotate(90deg);
}
.dl dd details[open] summary {
  margin-bottom: var(--space-2);
}

@media (max-width: 640px) {
  .dl { grid-template-columns: 1fr; gap: var(--space-1); }
  .dl dd { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
  .dl dt { padding-top: var(--space-3); }
}

/* ----------------------------------------------------------------
 * Badges
 * ---------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid transparent;
}
.badge--ok      { background: var(--color-ok-bg);   color: var(--color-ok); }
.badge--warn    { background: var(--color-warn-bg); color: var(--color-warn); }
.badge--error   { background: var(--color-error-bg); color: var(--color-error); }
.badge--info    { background: var(--color-primary-faint); color: var(--color-primary-strong); }
.badge--neutral { background: var(--color-bg); color: var(--color-text-muted); }

/* Mapping: Document status */
.badge.archived         { background: var(--color-primary-faint); color: var(--color-primary-strong); }
.badge.superseded       { background: var(--color-bg); color: var(--color-text-muted); }
.badge.blocked          { background: var(--color-warn-bg); color: var(--color-warn); }
.badge.pending_deletion { background: var(--color-error-bg); color: var(--color-error); }
.badge.hard_deleted     { background: #2b323b; color: #fff; }
.badge.current          { background: var(--color-ok-bg); color: var(--color-ok); }
.badge.active           { background: var(--color-ok-bg); color: var(--color-ok); }
.badge.pending          { background: var(--color-warn-bg); color: var(--color-warn); }

/* ----------------------------------------------------------------
 * Flash messages
 * ---------------------------------------------------------------- */

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.flash.info    { background: var(--color-primary-faint); color: var(--color-primary-strong); border-color: rgba(30, 58, 95, 0.25); }
.flash.success { background: var(--color-ok-bg);   color: var(--color-ok);    border-color: rgba(31, 122, 61, 0.2); }
.flash.error   { background: var(--color-error-bg); color: var(--color-error); border-color: rgba(161, 44, 37, 0.2); }
.flash.warn    { background: var(--color-warn-bg); color: var(--color-warn);  border-color: rgba(138, 94, 10, 0.2); }

/* ----------------------------------------------------------------
 * Audit timeline
 * ---------------------------------------------------------------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.timeline__item {
  position: relative;
  padding-left: var(--space-6);
  padding-bottom: var(--space-4);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}
.timeline__dot svg { width: 10px; height: 10px; color: var(--color-text-muted); }
.timeline__item--ok     .timeline__dot { border-color: var(--color-ok); }
.timeline__item--ok     .timeline__dot svg { color: var(--color-ok); }
.timeline__item--failed .timeline__dot { border-color: var(--color-error); }
.timeline__item--failed .timeline__dot svg { color: var(--color-error); }

.timeline__time {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
}
.timeline__title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-top: 2px;
}
.timeline__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}
.timeline__details {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
}
.timeline__details summary { color: var(--color-text-muted); cursor: pointer; }
.timeline__details pre {
  background: var(--color-surface-alt);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-top: var(--space-2);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ----------------------------------------------------------------
 * Version list item (current highlighted)
 * ---------------------------------------------------------------- */

.version-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  align-items: center;
  border-left: 3px solid transparent;
}
.version-row:last-child { border-bottom: 0; }
.version-row.is-current {
  border-left-color: var(--color-ok);
  background: linear-gradient(90deg, var(--color-ok-bg) 0%, transparent 8%);
}
.version-row__num {
  font-weight: 600;
  color: var(--color-text);
  min-width: 2.5rem;
}
.version-row__meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
.version-row__actions { display: flex; gap: var(--space-2); }

/* ----------------------------------------------------------------
 * Filter bar (for list pages)
 * ---------------------------------------------------------------- */

.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.filter-bar form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.filter-bar .field { flex: 1 1 12rem; min-width: 8rem; }
.filter-bar .form-actions { padding-top: 0; margin-left: auto; }

/* ----------------------------------------------------------------
 * Utility
 * ---------------------------------------------------------------- */

.stack-2 > * + * { margin-top: var(--space-2); }
.stack-3 > * + * { margin-top: var(--space-3); }
.stack-4 > * + * { margin-top: var(--space-4); }
.inline-flex { display: inline-flex; align-items: center; gap: var(--space-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }

.sha-long { word-break: break-all; font-family: var(--font-mono); font-size: 0.85em; color: var(--color-text-muted); }

/* Print */
@media print {
  .site-header, .site-footer, .admin-sidebar, .form-actions, .page-header__actions { display: none; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; border-color: #ccc; }
  .container, .admin-layout { max-width: 100%; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
