/* ═══ Polier – Design-System ═══════════════════════════════════════════════
   Seriös & clean: System-Schriftstack, neutrale Grautöne (kein Blaustich),
   ein korporates Akzentblau, entsättigte Status-Farben. Die Komponenten-
   Klassen (.card/.btn/.input/.badge) werden von allen Views genutzt –
   Änderungen hier wirken app-weit. */

:root {
  --accent:       #0f62fe;
  --accent-hover: #0353e9;
  --accent-soft:  rgba(15, 98, 254, 0.08);
  --page:         #f4f4f5;
  --surface:      #ffffff;
  --hairline:     rgba(0, 0, 0, 0.08);
  --text:         #18181b;
  --text-muted:   #71717a;
}
html.dark {
  --accent:       #4589ff;
  --accent-hover: #6ea6ff;
  --accent-soft:  rgba(69, 137, 255, 0.14);
  --page:         #101012;
  --surface:      #1a1a1e;
  --hairline:     #2a2a30;
  --text:         #e4e4e7;
  --text-muted:   #8e8e96;
}

/* ── Basis ──────────────────────────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--page);
  color: var(--text);
}
h1, h2, h3 { letter-spacing: -0.02em; }

input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }

/* ── Logo ───────────────────────────────────────────────────────────────── */
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; flex-shrink: 0;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 0.9rem; letter-spacing: 0;
}
.logo-mark-lg { width: 3rem; height: 3rem; border-radius: 0.875rem; font-size: 1.5rem; }

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav-link {
  padding: 0.4rem 0.75rem; border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500; color: #3f3f46;
  transition: background 0.15s, color 0.15s;
  text-decoration: none; white-space: nowrap;
}
.nav-link:hover { background: rgba(0,0,0,0.05); color: #18181b; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link-locked, .nav-link-locked:hover { background: none; color: #c4c4c9; cursor: default; }
html.dark .nav-link { color: #c9c9ce; }
html.dark .nav-link:hover { background: rgba(255,255,255,0.06); color: #f0f0f1; }
html.dark .nav-link.active { background: var(--accent-soft); color: var(--accent); }
html.dark .nav-link-locked, html.dark .nav-link-locked:hover { background: none; color: #4c4c53; }
/* Falls die Link-Leiste doch mal nicht passt: horizontal scrollen statt Overflow, ohne sichtbare Scrollbar */
.nav-scroll { scrollbar-width: none; }
.nav-scroll::-webkit-scrollbar { display: none; }

/* ── Seitenleiste (Desktop) / gruppiertes Mobile-Menü ───────────────────── */
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-radius: 0.5rem;
  font-size: 0.9rem; font-weight: 500; color: #3f3f46;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.side-link:hover { background: rgba(0,0,0,0.05); color: #18181b; }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-link-locked, .side-link-locked:hover { color: #c4c4c9; cursor: default; background: none; }
.side-group-title {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: #a1a1aa; padding: 0 0.75rem; margin: 0.9rem 0 0.25rem;
}
.side-group-title:first-child { margin-top: 0.15rem; }

/* Ganze Karte klickbar, ohne verschachtelte <a> (gültiges HTML) */
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }

/* Standalone-Punkt oben (Übersicht) */
.side-top { font-weight: 600; margin-bottom: 0.15rem; }

/* Aufklappbares Gruppen-Menü */
.side-group { margin-top: 0.5rem; }
.side-group-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.75rem; border-radius: 0.5rem;
  background: none; border: none; cursor: pointer;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: #a1a1aa; transition: background 0.15s, color 0.15s;
}
.side-group-head:hover { background: rgba(0,0,0,0.04); color: #52525b; }
.side-chevron { width: 0.85rem; height: 0.85rem; flex-shrink: 0; transition: transform 0.18s ease; }
.side-group.collapsed .side-chevron { transform: rotate(-90deg); }
.side-group.collapsed .side-group-body { display: none; }
.side-group-body {
  display: flex; flex-direction: column; gap: 1px;
  margin: 0.15rem 0 0 0.75rem; padding-left: 0.4rem;
  border-left: 1px solid var(--hairline);
}
.side-group-body .side-link { font-size: 0.875rem; }

html.dark .side-group-head { color: #6a6a72; }
html.dark .side-group-head:hover { background: rgba(255,255,255,0.05); color: #a1a1aa; }
html.dark .side-link { color: #c9c9ce; }
html.dark .side-link:hover { background: rgba(255,255,255,0.06); color: #f0f0f1; }
html.dark .side-link.active { background: var(--accent-soft); color: #93c5fd; }
html.dark .side-link-locked, html.dark .side-link-locked:hover { color: #4c4c53; background: none; }
html.dark .side-group-title { color: #6a6a72; }
html.dark aside.sidebar, html.dark header.topbar { background-color: #1a1a1e !important; border-color: #2a2a30 !important; }
html.dark aside.sidebar .border-gray-100, html.dark header.topbar .border-gray-200 { border-color: #2a2a30 !important; }

/* ── Karten & Formular-Utilities ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.input {
  display: block; width: 100%;
  padding: 0.625rem 0.9rem;
  border: 1px solid #d4d4d8;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.15rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  text-decoration: none;
  min-height: 42px;
}
.btn:active { transform: scale(0.98); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid #d4d4d8; }
.btn-secondary:hover { background: rgba(0,0,0,0.04); }
.btn-danger  { background: rgba(207,34,46,0.10); color: #cf222e; }
.btn-danger:hover  { background: rgba(207,34,46,0.18); }

/* Bestands-Views nutzen inline bg-blue-600 für Primär-Buttons – auf Akzentfarbe
   vereinheitlichen (nur Links/Buttons, keine sonstigen blauen Flächen). */
a.bg-blue-600, button.bg-blue-600 { background-color: var(--accent) !important; }
a.hover\:bg-blue-700:hover, button.hover\:bg-blue-700:hover { background-color: var(--accent-hover) !important; }
a.text-blue-600 { color: var(--accent) !important; }

/* ── Bottom Nav ─────────────────────────────────────────────────────────── */
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem;
  font-size: 0.65rem; font-weight: 500;
  color: #9ca3af;
  transition: color 0.15s;
  padding: 0.5rem 0.25rem;
  min-width: 0;
}
.bottom-nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item.active svg { stroke: var(--accent); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ── Status-Badges (entsättigt, GitHub-Label-Stil) ──────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-green  { background: rgba(26,127,55,0.10);  color: #1a7f37; }
.badge-red    { background: rgba(207,34,46,0.10);  color: #cf222e; }
.badge-blue   { background: rgba(9,105,218,0.10);  color: #0969da; }
.badge-yellow { background: rgba(154,103,0,0.12);  color: #9a6700; }
.badge-gray   { background: rgba(0,0,0,0.06);      color: #57606a; }
.badge-purple { background: rgba(130,80,223,0.10); color: #8250df; }
.badge-orange { background: rgba(188,76,0,0.10);   color: #bc4c00; }

/* ── Schnellzugriff-Kacheln (Übersicht) ─────────────────────────────────── */
.tile {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.75rem;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.tile:hover { border-color: var(--accent); }
.tile-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.625rem; flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
}
.tile-icon svg { width: 1.15rem; height: 1.15rem; }
.tile p { overflow-wrap: anywhere; hyphens: auto; }
.tile-locked { opacity: 0.55; cursor: default; }
.tile-locked:hover { border-color: var(--hairline); }
.tile-locked .tile-icon { background: rgba(0,0,0,0.05); color: var(--text-muted); }
html.dark .tile-locked .tile-icon { background: rgba(255,255,255,0.06); }

/* ── Karten-Hover ───────────────────────────────────────────────────────── */
.stat-card { transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.stat-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.07); }

/* ── Handbuch (/handbuch) ───────────────────────────────────────────────── */
.hb-layout { display: block; }
.hb-toc { margin-bottom: 1rem; }
.hb-toc-nav { display: flex; flex-direction: column; gap: 1px; max-height: 40vh; overflow-y: auto; }
.hb-toc-nav a {
  font-size: 0.85rem; color: #52525b; text-decoration: none;
  padding: 0.3rem 0.5rem; border-radius: 0.4rem; line-height: 1.3;
}
.hb-toc-nav a:hover { background: var(--accent-soft); color: var(--accent); }
html.dark .hb-toc-nav a { color: #c9c9ce; }

@media (min-width: 1024px) {
  .hb-layout { display: grid; grid-template-columns: 15rem 1fr; gap: 1.5rem; align-items: start; }
  .hb-toc { margin-bottom: 0; position: sticky; top: 1rem; }
  .hb-toc-nav { max-height: calc(100vh - 12rem); }
}

/* Typografie des Handbuch-Inhalts */
.handbuch { color: #27272a; line-height: 1.65; scroll-margin-top: 1rem; }
.handbuch h1 { font-size: 1.8rem; font-weight: 700; color: #18181b; margin: 0 0 0.4rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--accent); }
.handbuch h2 { font-size: 1.3rem; font-weight: 700; color: var(--accent); margin: 2rem 0 0.6rem; scroll-margin-top: 4.5rem; }
.handbuch h2:first-of-type { margin-top: 0.5rem; }
.handbuch h3 { font-size: 1.05rem; font-weight: 600; color: #18181b; margin: 1.3rem 0 0.4rem; scroll-margin-top: 4.5rem; }
.handbuch p { margin: 0.55rem 0; }
.handbuch ul, .handbuch ol { margin: 0.5rem 0 0.8rem; padding-left: 1.4rem; }
.handbuch ul { list-style: disc; }
.handbuch ol { list-style: decimal; }
.handbuch li { margin: 0.28rem 0; }
.handbuch li > ul, .handbuch li > ol { margin: 0.3rem 0; }
.handbuch a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.handbuch strong { font-weight: 700; color: #18181b; }
.handbuch code { background: rgba(0,0,0,0.06); padding: 0.1rem 0.35rem; border-radius: 0.3rem; font-size: 0.88em; }
.handbuch hr { border: none; border-top: 1px solid var(--hairline); margin: 1.6rem 0; }
.handbuch blockquote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 0.6rem 0.9rem; margin: 0.8rem 0; border-radius: 0 0.4rem 0.4rem 0;
  color: #3f3f46; font-size: 0.95rem;
}
.handbuch figure { margin: 1rem 0; }
.handbuch figure img, .handbuch p img {
  max-width: 100%; height: auto; border: 1px solid var(--hairline);
  border-radius: 0.6rem; box-shadow: 0 2px 10px rgba(0,0,0,0.06); display: block;
}
.handbuch figcaption { font-size: 0.82rem; color: #71717a; margin-top: 0.4rem; text-align: center; }
html.dark .handbuch { color: #d4d4d8; }
html.dark .handbuch h1, html.dark .handbuch h3, html.dark .handbuch strong { color: #f4f4f5; }
html.dark .handbuch blockquote { color: #d4d4d8; }
html.dark .handbuch code { background: rgba(255,255,255,0.10); }
html.dark .handbuch figure img, html.dark .handbuch p img { border-color: #2a2a30; }

/* ── Übergänge ──────────────────────────────────────────────────────────── */
html, body, nav, main, .card { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.1s ease; }

/* ── Dark Mode (neutrales Anthrazit, kein Slate-Blaustich) ──────────────── */
html.dark .card               { box-shadow: none; }
html.dark .input              { border-color: #34343b; }
html.dark .input::placeholder { color: #6a6a72; }
html.dark select              { background-color: #1a1a1e; color: #e4e4e7; border-color: #34343b; }
html.dark textarea            { background-color: #1a1a1e; color: #e4e4e7; border-color: #34343b; }
/* Plain <input> (ohne .input-Klasse, z.B. Titel-/Datumsfelder) erbte bisher nur die helle Body-Schrift-
   farbe, aber keinen dunklen Hintergrund -> heller Text auf weißem Feld, quasi unlesbar. */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="color"]) {
  background-color: #1a1a1e; color: #e4e4e7; border-color: #34343b;
}
html.dark input::placeholder  { color: #6a6a72; }
html.dark .bg-white           { background-color: #1a1a1e !important; }
html.dark .bg-gray-50         { background-color: #101012 !important; }
html.dark .bg-gray-100        { background-color: #232327 !important; }
html.dark .bg-gray-200        { background-color: #2e2e34 !important; }
html.dark .border-gray-100,
html.dark .border-gray-200    { border-color: #2a2a30 !important; }
html.dark .text-gray-900      { color: #f0f0f1 !important; }
html.dark .text-gray-800      { color: #e4e4e7 !important; }
html.dark .text-gray-700      { color: #c9c9ce !important; }
html.dark .text-gray-600      { color: #9a9aa1 !important; }
html.dark .text-gray-500      { color: #85858d !important; }
html.dark .text-gray-400      { color: #5c5c64 !important; }
html.dark .shadow-sm          { box-shadow: 0 1px 3px rgba(0,0,0,0.4) !important; }
html.dark .hover\:bg-gray-50:hover  { background-color: #1f1f23 !important; }
html.dark .hover\:bg-gray-100:hover { background-color: #2a2a30 !important; }
html.dark nav.bg-white        { background-color: #1a1a1e !important; border-color: #2a2a30 !important; }
html.dark .bottom-nav-item    { background-color: #1a1a1e; }
html.dark thead.bg-gray-50    { background-color: #1e1e22 !important; }
html.dark .bg-blue-50         { background-color: #17233c !important; }
html.dark .bg-green-50        { background-color: #142219 !important; }
html.dark .bg-green-100       { background-color: #1b3524 !important; }
html.dark .bg-red-50          { background-color: #2a1618 !important; }
html.dark .bg-red-100         { background-color: #3d1d1f !important; }
html.dark .bg-yellow-50       { background-color: #241f10 !important; }
html.dark .bg-yellow-100      { background-color: #3a3016 !important; }
html.dark .bg-purple-100      { background-color: #291f3d !important; }
html.dark .text-green-700, html.dark .text-green-800 { color: #6bc16f !important; }
html.dark .text-red-700, html.dark .text-red-600     { color: #ee7a72 !important; }
html.dark .text-blue-700, html.dark .text-blue-600   { color: #539bf5 !important; }
html.dark .text-yellow-700, html.dark .text-yellow-600 { color: #d4a72c !important; }
html.dark .text-purple-700, html.dark .text-purple-800 { color: #b083f0 !important; }
html.dark .divide-gray-100 > * + * { border-color: #2a2a30 !important; }
html.dark .divide-gray-200 > * + * { border-color: #2a2a30 !important; }
html.dark .badge-green  { background: rgba(87,171,90,0.16);  color: #6bc16f; }
html.dark .badge-red    { background: rgba(229,83,75,0.16);  color: #ee7a72; }
html.dark .badge-blue   { background: rgba(83,155,245,0.16); color: #539bf5; }
html.dark .badge-yellow { background: rgba(196,144,38,0.18); color: #d4a72c; }
html.dark .badge-gray   { background: rgba(255,255,255,0.08); color: #909099; }
html.dark .badge-purple { background: rgba(176,131,240,0.16); color: #b083f0; }
html.dark .badge-orange { background: rgba(204,107,44,0.16);  color: #d0885a; }
html.dark .btn-secondary { border-color: #3a3a42; color: #e4e4e7; }
html.dark .btn-secondary:hover { background: rgba(255,255,255,0.06); }
html.dark .btn-danger  { background: rgba(229,83,75,0.16); color: #ee7a72; }
html.dark .btn-danger:hover { background: rgba(229,83,75,0.26); }

/* Einige Views (Landing, Login, Lager, …) nutzen hart verdrahtete dark:slate-Klassen.
   Auf die neutrale Anthrazit-Palette mappen, damit nichts blaustichig bleibt: */
html.dark [class~="dark:bg-slate-950"]      { background-color: #101012 !important; }
html.dark [class~="dark:bg-slate-950/85"]   { background-color: rgba(16,16,18,0.85) !important; }
html.dark [class~="dark:bg-slate-900"]      { background-color: #161619 !important; }
html.dark [class~="dark:bg-slate-800"]      { background-color: #1a1a1e !important; }
html.dark [class~="dark:bg-slate-700"]      { background-color: #26262c !important; }
html.dark [class~="dark:hover:bg-slate-800"]:hover    { background-color: #1f1f23 !important; }
html.dark [class~="dark:hover:bg-slate-800/50"]:hover { background-color: rgba(31,31,35,0.6) !important; }
html.dark [class~="dark:border-slate-700"]  { border-color: #33333a !important; }
html.dark [class~="dark:border-slate-800"]  { border-color: #2a2a30 !important; }
html.dark [class~="dark:text-slate-200"]    { color: #e4e4e7 !important; }
html.dark [class~="dark:text-slate-300"]    { color: #c9c9ce !important; }
html.dark [class~="dark:text-slate-400"]    { color: #9a9aa1 !important; }
html.dark [class~="dark:text-slate-500"]    { color: #7c7c84 !important; }
html.dark [class~="dark:text-slate-600"]    { color: #5c5c64 !important; }
