/* registry: Lagerbuch. Tokens, Raster, Bauteile. Wird spaeter zu web/static/app.css. */

:root {
  --paper: #f4f1e9;
  --paper-2: #ebe7dc;
  --ink: #1c1a16;
  --ink-2: #5b574d;
  --rule: #d3cdbf;
  /* Rahmen, an denen man ein Bedienelement erkennt: mindestens 3:1 (K2). --rule bleibt fuer reine Trennlinien. */
  --field: #857f71;
  --accent: #b23c0a;
  --on-accent: #fffaf3;
  --ok: #2e6a3a;
  --warn: #8a5800;
  --hover: rgba(178, 60, 10, 0.07);
  --select: rgba(178, 60, 10, 0.09);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --rail: 232px;
  --tree: 320px;
  --head: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141311;
    --paper-2: #1c1b18;
    --ink: #ece7dc;
    --ink-2: #a9a396;
    --rule: #33312b;
    --field: #6e695e;
    --accent: #ff8f52;
    --on-accent: #141311;
    --ok: #7fc28c;
    --warn: #e2b25a;
    --hover: rgba(255, 143, 82, 0.08);
    --select: rgba(255, 143, 82, 0.14);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #141311;
  --paper-2: #1c1b18;
  --ink: #ece7dc;
  --ink-2: #a9a396;
  --rule: #33312b;
  --field: #6e695e;
  --accent: #ff8f52;
  --on-accent: #141311;
  --ok: #7fc28c;
  --warn: #e2b25a;
  --hover: rgba(255, 143, 82, 0.08);
  --select: rgba(255, 143, 82, 0.14);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
  /* Ligaturen machen aus </ und <!-- Pfeile; in einer Registry muss Code so aussehen, wie man ihn kopiert. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

.prose { font-family: var(--text); font-size: 14px; line-height: 1.55; color: var(--ink-2); max-width: 64ch; }

.muted { color: var(--ink-2); }
.num { text-align: right; white-space: nowrap; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 10;
  height: var(--head);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: flex; align-items: baseline; gap: 10px;
  font-weight: 600; letter-spacing: 0.02em; color: var(--ink);
  white-space: nowrap;
}
.brand b { font-weight: 600; }
.brand small { font-weight: 400; color: var(--ink-2); font-size: 12px; }

.search-trigger {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 32px; padding: 0 10px;
  font: inherit; font-size: 13px; color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--field);
  cursor: text;
}
.search-trigger:hover { border-color: var(--ink-2); }
/* Eine Zeile: reicht die Breite nicht, schneidet der Platzhalter mit Auslassung ab, statt umzubrechen. */
.search-trigger { white-space: nowrap; overflow: hidden; }
.search-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.search-trigger kbd { flex: none; white-space: nowrap; }

kbd {
  font: 500 11px/1 var(--mono);
  padding: 3px 5px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  color: var(--ink-2);
  background: var(--paper);
}

.top nav { display: flex; gap: 18px; margin-left: auto; font-size: 13px; }
.top nav a { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 14px; margin-bottom: -16px; }

.icon-btn {
  height: 32px; min-width: 32px; padding: 0 8px;
  font: inherit; font-size: 12px; color: var(--ink);
  background: transparent; border: 1px solid var(--field); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink-2); }

/* Seitenraster */
.layout {
  display: grid;
  grid-template-columns: var(--rail) var(--tree) minmax(0, 1fr);
  min-height: calc(100vh - var(--head));
}

/* Die Spalte traegt ihren Grund ueber die ganze Hoehe; nur der Inhalt laeuft mit, damit die Navigation am Ende
   einer langen Seite sichtbar bleibt und keine leere Flaeche entsteht. */
.rail {
  border-right: 1px solid var(--rule);
  background: var(--paper-2);
}
.rail-inner {
  position: sticky; top: var(--head);
  max-height: calc(100vh - var(--head));
  overflow-y: auto;
  padding: 16px 0 24px;
}

.rail h2 {
  margin: 16px 16px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.rail h2:first-child { margin-top: 0; }

.rail a {
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px;
  padding: 5px 16px; color: var(--ink); font-size: 13px;
}
.rail a:hover { background: var(--hover); text-decoration: none; }
.rail a[aria-current="page"] { background: var(--select); box-shadow: inset 3px 0 0 var(--accent); }
.rail a .count { font-size: 11px; color: var(--ink-2); }

.fmt {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  font: 600 10px/1 var(--mono);
  border: 1px solid currentColor;
  color: var(--ink-2);
}
.fmt.group { border-style: dashed; }

/* Baum */
.tree {
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  padding: 12px 0 24px;
}
.tree-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 16px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 6px;
}
.tree-head strong { font-weight: 600; }
.tree-head span { font-size: 11px; color: var(--ink-2); }

.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li > .node {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 3px 16px 3px calc(16px + var(--depth, 0) * 14px);
  font: inherit; font-size: 13px; text-align: left; color: var(--ink);
  background: none; border: 0; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree li > .node:hover { background: var(--hover); }
.tree li > .node[aria-current="page"] { background: var(--select); box-shadow: inset 3px 0 0 var(--accent); }
.tree a.node:hover { text-decoration: none; }
.tree .twist { display: inline-block; width: 10px; color: var(--ink-2); transition: transform 120ms; }
.tree li[aria-expanded="true"] > .node > .twist { transform: rotate(90deg); }
.tree .leaf .twist { visibility: hidden; }
.tree .tag { margin-left: auto; font-size: 11px; color: var(--ink-2); }
.tree-more { margin: 8px 0 0; padding: 0 10px; font-size: 13px; }

/* Einrückung je Ebene. Klassen statt Stil-Attribut, damit die Richtlinie ohne Inline-Stil gilt (K6). */
.depth-0 { --depth: 0; }
.depth-1 { --depth: 1; }
.depth-2 { --depth: 2; }
.depth-3 { --depth: 3; }
.depth-4 { --depth: 4; }
.depth-5 { --depth: 5; }
.depth-6 { --depth: 6; }
.depth-7 { --depth: 7; }
.depth-8 { --depth: 8; }

/* Detail */
.detail { padding: 24px 40px 64px; max-width: 1040px; }

.crumbs { font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-hidden] { color: var(--ink-2); }
::placeholder { color: var(--ink-2); opacity: 1; }

.coord {
  display: flex; align-items: center; gap: 14px;
  margin: 14px 0 6px;
  font-size: 26px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2;
  overflow-wrap: anywhere;
}
.coord button {
  flex: none;
  font: 500 12px/1 var(--mono); letter-spacing: 0;
  height: 28px; padding: 0 10px;
  color: var(--accent); background: transparent;
  border: 1px solid var(--accent); cursor: pointer;
}
.coord button:hover { background: var(--accent); color: var(--on-accent); }

.facts {
  display: flex; flex-wrap: wrap; gap: 6px 28px;
  margin: 10px 0 28px; padding: 10px 0;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  font-size: 12px;
}
.facts div { display: flex; gap: 8px; min-width: 0; }
.facts dt { color: var(--ink-2); }
/* min-width: 0, sonst bleibt das Flex-Element so breit wie ein langer Digest und bricht nicht um. Beliebig mitten im
   Wort bricht nur der Digest (dd.digest, weiter unten); der Medientyp bricht an den <wbr> der Vorlage. */
.facts dd { margin: 0; min-width: 0; }

.state-ok { color: var(--ok); }
.state-warn { color: var(--warn); }

section + section { margin-top: 36px; }
h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
  display: flex; align-items: baseline; gap: 12px;
}
h3 .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Reiter mit Befehlen */
.tabs { border: 1px solid var(--field); }
/* Reiter brechen um statt rechts auszulaufen. */
.tablist { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.tablist a, .tablist button {
  font: inherit; font-size: 12px; padding: 8px 14px; text-decoration: none;
  color: var(--ink-2); background: none; border: 0; border-right: 1px solid var(--field);
  cursor: pointer; white-space: nowrap;
}
.tablist [aria-selected="true"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 2px 0 var(--accent); margin-bottom: -1px; }
.tablist a:hover, .tablist button:hover { color: var(--ink); text-decoration: none; }

/* Der Knopf hat eine eigene Zeile ueber dem Code, der Code scrollt waagrecht in sich. So liegt nie etwas ueber Text. */
.snippet { display: flex; flex-direction: column; min-width: 0; }
.snippet[hidden] { display: none; }
.snippet pre {
  margin: 0; padding: 4px 16px 14px;
  font: 13px/1.6 var(--mono); overflow-x: auto; white-space: pre;
}
.snippet .copy {
  order: -1; align-self: flex-end; margin: 8px 8px 0;
  font: 500 12px/1 var(--mono); height: 26px; padding: 0 10px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--field); cursor: pointer;
}
.snippet .copy:hover { border-color: var(--accent); color: var(--accent); }
.snippet .copy.done { border-color: var(--ok); color: var(--ok); }
.snippet.setup { border: 1px solid var(--field); }
.tok { color: var(--accent); }
.cm { color: var(--ink-2); }

/* Tabellen */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td { padding: 7px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:hover td { background: var(--hover); }
td.hash { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
/* Docker-Ansicht: Digests und Kopierzeilen brechen um, statt waagrecht zu scrollen. */
.snippet pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
code.digest, dd.digest, td.digest { overflow-wrap: anywhere; }
/* Der Kurz-Digest steht in einer Zeile; der volle Digest steht im title. */
.digest-short { white-space: nowrap; overflow-wrap: normal; }
ul.digest-list { margin: 0; padding-left: 18px; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tr[aria-selected="true"] td { background: var(--select); }
tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }

/* Knoepfe und Felder */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px;
  font: 500 13px/1 var(--mono);
  color: var(--ink); background: var(--paper); border: 1px solid var(--ink); cursor: pointer;
}
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { border-color: var(--field); }
.btn.danger { color: var(--warn); border-color: var(--warn); }

label.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
input[type="text"], input[type="search"], select {
  height: 32px; padding: 0 10px; width: 100%;
  font: 13px var(--mono); color: var(--ink);
  background: var(--paper); border: 1px solid var(--field);
}
input:focus-visible, select:focus-visible { border-color: var(--accent); outline-offset: 0; }

.pill {
  display: inline-block; font-size: 11px; line-height: 18px; padding: 0 6px;
  border: 1px solid var(--rule); color: var(--ink); white-space: nowrap;
}
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.warn { border-color: var(--warn); color: var(--warn); }
.pill.accent { border-color: var(--accent); color: var(--accent); }

/* Suche Strg+K */
.palette {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  backdrop-filter: blur(2px);
}
.palette[data-open] { display: flex; animation: fade 90ms ease-out; }
.palette-box {
  width: min(720px, 100%);
  background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 8px 8px 0 var(--rule);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--rule); }
.palette-input input { border: 0; height: 48px; font-size: 16px; padding: 0; background: transparent; }
.palette-input input:focus-visible { outline: none; }
/* Das eigene Kreuz des Suchfelds ist im Browser blau; zum Schliessen gibt es Esc, das Kuerzel steht daneben. */
.palette-input input::-webkit-search-cancel-button, .palette-input input::-webkit-search-decoration { display: none; -webkit-appearance: none; }
.palette ol { list-style: none; margin: 0; padding: 6px 0; max-height: 52vh; overflow-y: auto; }
.palette li a {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: baseline;
  padding: 7px 14px; color: var(--ink); font-size: 13px;
}
.palette li a:hover, .palette li a[aria-selected="true"] { background: var(--select); text-decoration: none; }
.palette li a[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.palette mark { background: none; color: var(--accent); font-weight: 600; }
.palette .where { font-size: 11px; color: var(--ink-2); }
.palette .group-label { padding: 10px 14px 4px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.palette footer { display: flex; gap: 18px; padding: 8px 14px; border-top: 1px solid var(--rule); font-size: 11px; color: var(--ink-2); }

@keyframes fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

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

/* Unter 1024 px wird die Leiste eine Zeile oben, Baum und Detail stehen darunter. Unter 768 px ist der Baum ausgeblendet
   und die Ebenen-Navigation (Zurück, Kinder der Ebene) übernimmt. */
.short { display: none; }
.level-back { display: none; }

/* Unter 1280 px reicht die Breite nicht fuer drei Spalten: die Leiste wird eine Zeile ueber Baum und Detail.
   Die Leistenzeile bleibt so hoch wie ihr Inhalt; die Mindesthoehe der Seite geht an die Zeile darunter. */
@media (max-width: 1279px) {
  .layout { grid-template-columns: var(--tree) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail-inner { position: static; max-height: none; overflow: visible; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px 16px; }
  .rail h2 { margin: 0; font-size: 11px; }
  .rail a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
  .rail a[aria-current="page"] { box-shadow: none; padding: 4px 6px; background: var(--select); }
  .detail { padding: 20px 24px 48px; }
  .top nav { gap: 12px; }
}

/* Der lange Platzhalter braucht etwa 330 px im Suchfeld; darunter steht der kurze. Gemessen: bei 768 px ist das
   Feld 280 px breit, bei 960 px etwa 440 px. */
@media (max-width: 959px) {
  .long { display: none; }
  .short { display: inline; }
}

@media (max-width: 767px) {
  :root { --head: 48px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .tree { display: none; }
  .level-back { display: block; margin: 0 0 12px; font-size: 13px; }
  .detail { padding: 16px 16px 48px; }
  .coord { font-size: 19px; flex-wrap: wrap; }
  .brand small, .top nav .wide { display: none; }
  .search-trigger { max-width: none; min-width: 0; }
  .search-trigger kbd { display: none; }
  .top { gap: 10px; padding: 0 12px; }
  .top nav { gap: 10px; font-size: 12px; }
  .facts { gap: 4px 18px; }
  .hide-sm { display: none; }
  td, th { padding-left: 8px; padding-right: 8px; }
}

/* Ergänzt für Anmeldung und Startseite (M4, Schritt 1b). Alles davor stammt unverändert aus dem Mockup. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 28px; margin-bottom: 8px; }
h2 { font-size: 20px; margin: 32px 0 10px; }
h2:first-child { margin-top: 0; }

.page { max-width: 1040px; padding: 24px 16px 64px; }
@media (min-width: 768px) {
  .page { padding: 32px 40px 64px; }
}

.top form { display: flex; margin: 0; }
.search-trigger, .search-trigger:hover { text-decoration: none; }

/* Anmeldung: schmale Spalte in der Mitte, Felder volle Breite */
.sign-in { max-width: 360px; margin: 48px auto 0; padding: 0 16px; }
.sign-in form { display: grid; gap: 16px; margin-top: 24px; }
input[type="password"] {
  height: 32px; padding: 0 10px; width: 100%;
  font: 13px var(--mono); color: var(--ink);
  background: var(--paper); border: 1px solid var(--field);
}
input[type="password"]:focus-visible { border-color: var(--accent); outline-offset: 0; }

.notice { font-family: var(--text); font-size: 14px; line-height: 1.55; color: var(--ink-2); max-width: 64ch; }
.notice-warn { margin: 0; font-size: 13px; color: var(--warn); }

/* Startseite: die erste Spalte bleibt beim waagrechten Scrollen stehen */
.repos td:first-child, .repos th:first-child {
  position: sticky; left: 0; background: var(--paper);
}

/* Die Tabellen je Format stehen untereinander; feste Spaltenbreiten halten sie buendig. */
.repos { table-layout: fixed; }
.repos .c-fmt { width: 72px; }
.repos .c-kind { width: 96px; }
.repos .c-count { width: 112px; }
/* "4 Images, 6 Tags" bei Docker umbricht in der Zelle, statt in die Groesse hineinzuragen. */
.repos td.num { white-space: normal; overflow-wrap: anywhere; }
.repos .c-size { width: 112px; }
.repos .c-changed { width: 200px; }
.repos td:first-child { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .repos .c-kind { width: 64px; }
  .repos .c-count { width: 96px; }
  .repos .c-size { width: 80px; }
}

/* Ohne Navigation (Anmeldung) steht der Umschalter trotzdem rechts. */
.brand + .icon-btn { margin-left: auto; }

@media (max-width: 767px) {
  /* Auf dem Handy reicht die Kopfzeile nicht fuer alles: Abmelden steht dort auf der Seite Zugang. */
  .top form { display: none; }
  .search-trigger { flex: 1 1 0; overflow: hidden; white-space: nowrap; }
}

/* Browser geben code, kbd, pre und samp eine eigene Festbreitenschrift; hier gilt ueberall JetBrains Mono. */
code, pre, samp { font-family: var(--mono); font-size: inherit; color: inherit; }

@media (max-width: 767px) {
  /* Auf dem Handy wechselt man das Repository ueber die Startseite; die Leiste als umbrechende Zeile ist zu unruhig. */
  .rail { display: none; }
}

/* Die Kurzschreibweise font: setzt font-variant-ligatures zurueck. Deshalb hier ausdruecklich und zuletzt (K1). */
pre, code, samp, kbd, .coord, .repo-name, .snippet pre {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

/* Suchseite: Suchfeld, Treffer je Komponente, Markierung im Namen. */
.search-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 24px; max-width: 64ch; }
.search-form label { flex: 0 0 100%; font-size: 13px; color: var(--ink-2); }
.search-form input {
  flex: 1 1 240px; min-width: 0; height: 36px; padding: 0 10px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--field);
}
.search-form button {
  height: 36px; padding: 0 14px; font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid var(--field); cursor: pointer;
}
.hit { border-top: 1px solid var(--rule); padding: 12px 0; }
.hit-title { font-family: var(--mono); font-size: 14px; font-weight: 600; margin: 0 0 4px; line-height: 1.4; overflow-wrap: anywhere; }
.hit-title a { color: var(--accent); text-decoration: none; }
.hit-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Der Link ist schon in der Signalfarbe; der Treffer hebt sich darum durch Unterstreichung ab, nicht durch Farbe. */
.hit-title mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.hit-title .fmt { margin-right: 8px; }
.hit-meta { margin: 0 0 4px; font-size: 12px; color: var(--ink-2); }
.hit-files { margin: 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }

/* Mein Zugang: Tokenliste, Ausstellung und die einmalige Anzeige (Vorlage admin-users.html, Abschnitt Tokens). */
.tokens { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.tokens li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.tokens li form { margin: 0; }
.tokens li small { grid-column: 1; color: var(--ink-2); font-size: 11px; }
.issue { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 14px; }
.once { margin-top: 14px; border: 1px solid var(--accent); }
.once-head { display: grid; gap: 2px; padding: 10px 12px; background: var(--select); font-size: 12px; }
.once-head strong { color: var(--accent); }
.once .secret { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.secret code { min-width: 0; overflow-wrap: anywhere; }
.once .tablist { border-top: 1px solid var(--rule); }
/* Auf dem Handy steht Abmelden auf der Seite Zugang, weil die Kopfzeile dort keinen Platz dafür hat. */
.phone-only { display: none; }
@media (max-width: 767px) {
  .phone-only { display: block; }
}

/* Auf Mein Zugang folgt der Abschnitt Sitzung auf den Token-Kasten, nicht auf einen Abschnitt. */
.phone-only { margin-top: 36px; }

/* Verwaltung (M4, Schritt 5): Raster, Leiste, Liste und rechtes Panel nach vorlage admin-users.html. Die Vorlage hat
   Stil-Attribute nur, weil sie in sich geschlossen sein muss; hier stehen Klassen (K6). */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr) 420px; min-height: calc(100vh - var(--head)); }
.admin.no-panel { grid-template-columns: 220px minmax(0, 1fr); }
.admin-nav { padding: 20px 0 24px; border-right: 1px solid var(--rule); background: var(--paper-2); }
.admin-nav h2 { margin: 16px 16px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.admin-nav h2:first-child { margin-top: 0; }
.admin-nav a { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; padding: 5px 16px; color: var(--ink); font-size: 13px; }
.admin-nav a:hover { background: var(--hover); text-decoration: none; }
.admin-nav a[aria-current="page"] { background: var(--select); box-shadow: inset 3px 0 0 var(--accent); }
.admin-nav .count { font-size: 11px; color: var(--ink-2); }
.admin-list { padding: 24px 32px 48px; min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.admin-head h1 { margin: 0; font-size: 26px; font-weight: 600; }
.admin-head .prose { margin: 4px 0 0; }
.admin-panel { border-left: 1px solid var(--ink); background: var(--paper); padding: 24px 24px 48px; overflow-y: auto; min-width: 0; }
.admin-panel h2 { margin: 0; font-size: 22px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.admin-panel .sub { margin: 4px 0 18px; font-size: 12px; color: var(--ink-2); }
.admin-panel section + section { margin-top: 28px; }
.admin .notice-warn { margin-bottom: 12px; }
.admin-list .roles { display: flex; flex-wrap: wrap; gap: 4px; }

.admin-create { margin: 0 0 16px; }
.admin-create summary { display: inline-flex; list-style: none; cursor: pointer; }
.admin-create summary::-webkit-details-marker { display: none; }
.admin-create[open] summary { margin-bottom: 12px; }
.admin-create .admin-form { max-width: 420px; }

.admin-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.admin-filters input[type="search"] { flex: 1 1 240px; max-width: 280px; }
.admin-filters .seg { display: flex; border: 1px solid var(--field); }
.admin-filters .seg a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; font-size: 12px; color: var(--ink-2); border-right: 1px solid var(--rule); }
.admin-filters .seg a:last-child { border-right: 0; }
.admin-filters .seg a:hover { color: var(--ink); text-decoration: none; }
.admin-filters .seg a[aria-current="true"] { color: var(--ink); background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--accent); }
.admin-filters .btn { height: 32px; }

.admin-list td form { margin: 0; }
.admin-list td .btn, .admin-panel .btn { white-space: nowrap; }
/* Die Nummern stehen innerhalb der Spalte, buendig mit Name und Faktenzeile. */
.members { margin: 0; padding-left: 0; list-style-position: inside; }

/* Repositories: eine Liste statt Tabelle. Je Repository ein Abschnitt, eine Haarlinie dazwischen, keine Karten. */
.repo-list { border-top: 1px solid var(--ink); }
.repo { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.repo-name { margin: 0; font-family: var(--mono); font-size: 18px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.repo-facts { margin: 8px 0 0; padding: 0; border: 0; }
.repo-line { margin: 8px 0 0; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.repo .members { margin-top: 6px; font-size: 13px; }

.admin-form { display: grid; gap: 12px; margin-top: 12px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.row-actions form { margin: 0; }
.btn[disabled] { color: var(--ink-2); border-color: var(--rule); cursor: not-allowed; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.chips { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.chips li { display: inline-flex; align-items: center; gap: 4px; }
.chips form { margin: 0; }
.perm { width: 100%; font-size: 12px; }
.perm td, .perm th { padding: 5px 8px; }
.perm td:first-child, .perm th:first-child { padding-left: 0; }

/* Unter 1280 px schmaler, unter 1024 px Leiste als Zeile oben und das Panel unter der Liste. */
@media (max-width: 1279px) {
  .admin { grid-template-columns: 200px minmax(0, 1fr) 380px; }
  .admin.no-panel { grid-template-columns: 200px minmax(0, 1fr); }
  .admin-list { padding: 20px 20px 40px; }
}
/* Der Hinweis im Panel nennt die Lage der Liste: links neben dem Panel, unter 1024 px darueber. */
.narrow-only { display: none; }
@media (max-width: 1023px) {
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .admin, .admin.no-panel { grid-template-columns: minmax(0, 1fr); }
  .admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .admin-nav h2 { margin: 0; }
  .admin-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
  .admin-nav a[aria-current="page"] { box-shadow: none; padding: 4px 6px; background: var(--select); }
  .admin-panel { border-left: 0; border-top: 1px solid var(--ink); }
}
@media (max-width: 767px) {
  .admin-list, .admin-panel { padding: 16px 16px 40px; }
  .admin-head { flex-direction: column; align-items: stretch; }
  .admin-filters { flex-direction: column; align-items: stretch; }
  /* In der Spalte wird flex-basis zur Hoehe: ohne flex: none waere das Suchfeld 240 px hoch. */
  .admin-filters input[type="search"] { flex: none; max-width: none; }
  .kv { grid-template-columns: 116px 1fr; }
  /* Ein Name bricht nur auf dem Handy und nur, wenn er sonst die Breite sprengt. */
  .repo-name { white-space: normal; overflow-wrap: anywhere; }
}
/* Eine .stack-Tabelle wird unter 1024 px zu Bloecken, eine .stack-xl-Tabelle schon unter 1280 px: Spaltenkoepfe weg, links
   das Label aus data-label, rechts der Wert, der Knopf in voller Breite. Bis dorthin steht noch der Baum oder das
   Panel neben dem Inhalt; die Tabelle waere sonst breiter als ihre Spalte. Die Label-Spalte (128 px) ist breit genug
   fuer das laengste Label; Labels brechen nie, der Wert daneben schon. */
@media (max-width: 1023px) {
  .stack, .stack tbody { display: block; }
  .stack thead { display: none; }
  .stack tr { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .stack td { display: block; padding: 0; border: 0; }
  .stack td[data-label] { display: contents; overflow-wrap: anywhere; }
  .stack td[data-label]::before { content: attr(data-label); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; hyphens: none; overflow-wrap: normal; }
  .stack td.empty, .stack td.act { grid-column: 1 / -1; }
  .stack td.act .btn { width: 100%; justify-content: center; }
  .stack td.num { text-align: left; }
}
@media (max-width: 1279px) {
  .stack-xl, .stack-xl tbody { display: block; }
  .stack-xl thead { display: none; }
  .stack-xl tr { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .stack-xl td { display: block; padding: 0; border: 0; }
  .stack-xl td[data-label] { display: contents; overflow-wrap: anywhere; }
  .stack-xl td[data-label]::before { content: attr(data-label); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; hyphens: none; overflow-wrap: normal; }
  .stack-xl td.empty, .stack-xl td.act { grid-column: 1 / -1; }
  .stack-xl td.act .btn { width: 100%; justify-content: center; }
  .stack-xl td.num { text-align: left; }
}

/* Zwischen 768 und 1023 px bekommt der Repository-Name mehr Platz, sonst bricht jeder Name am Bindestrich. */
@media (min-width: 768px) and (max-width: 1023px) {
  .repos .c-fmt { width: 64px; }
  .repos .c-kind { width: 72px; }
  .repos .c-count { width: 96px; }
  .repos .c-size { width: 80px; }
  .repos .c-changed { width: 184px; }
}
