/* ════════════════════════════════════════════════════════════════
   style.css — Dashboard-Stylesheet (ersetzt das Tailwind-CDN)
   DSGVO: keine externen Ressourcen, keine Webfonts — System-Fonts.
   Dark-Slate-Optik 1:1 aus der bisherigen index.html übernommen.
   Verbindliche Klassen für alle Tab-Module (Bau-Spec §3.2):
   .card .btn .btn-primary .btn-ghost .btn-danger
   .badge .badge-indigo .badge-emerald .badge-amber .badge-rose
   .badge-slate .badge-violet .badge-sky
   .kpi .kpi-wert .kpi-label .grid-kpi
   .table .table-wrap .kf-input .hidden .muted
   .modal-backdrop .modal .tabbar .tab .tab-active
   .toast .toast-fehler .banner-amber .banner-rose .chip
   .no-print .print-card
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg: #020617;
  --card: #0f172a;
  --border: #1e293b;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --indigo: #6366f1;
  --emerald: #34d399;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --violet: #a78bfa;
  --sky: #38bdf8;
  color-scheme: dark; /* native Controls (Datepicker, Select) dunkel rendern */
}

/* ── Basis ── */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: #818cf8; text-decoration: none; }
a:hover { color: #a5b4fc; text-decoration: underline; }

h1, h2, h3 { margin: 0 0 0.5rem; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
  background: var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  word-break: break-all;
}

label { font-size: 0.875rem; color: var(--muted); }

input[type="checkbox"] { accent-color: var(--indigo); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
@media (max-width: 640px) { .container { padding: 12px; } }

.hidden { display: none !important; }
.muted  { color: var(--muted); }

/* ── Karten ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

/* ── KPI-Kacheln ── */
.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
}
.kpi-label { font-size: 0.8rem; color: var(--muted); }
.kpi-wert  { font-size: 1.75rem; font-weight: 600; margin-top: 4px; line-height: 1.2; }
/* KPI-Kacheln sind oft Links auf ihren Tab — Link-Optik neutralisieren */
a.kpi { display: block; color: var(--ink); }
a.kpi:hover { text-decoration: none; border-color: var(--indigo); color: var(--ink); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #1e293b;             /* slate-800 wie Bestand */
  color: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: #334155; color: var(--ink); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: #4f46e5; color: #fff; }          /* indigo-600 */
.btn-primary:hover { background: var(--indigo); color: #fff; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { background: rgba(30, 41, 59, 0.5); color: var(--ink); }

.btn-danger { background: #e11d48; color: #fff; }            /* rose-600 */
.btn-danger:hover { background: var(--rose); color: #fff; }

/* ── Badges (kleine Pillen, Farbton/20-Hintergrund) ── */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-indigo  { background: rgba(99, 102, 241, 0.2);  color: #a5b4fc; }
.badge-emerald { background: rgba(52, 211, 153, 0.2);  color: #6ee7b7; }
.badge-amber   { background: rgba(245, 158, 11, 0.2);  color: #fcd34d; }
.badge-rose    { background: rgba(244, 63, 94, 0.2);   color: #fda4af; }
.badge-slate   { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-violet  { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
.badge-sky     { background: rgba(56, 189, 248, 0.2);  color: #7dd3fc; }

/* ── Tabellen ── */
.table-wrap { overflow-x: auto; border-radius: 12px; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  vertical-align: middle;
}
.table tbody tr:hover { background: rgba(30, 41, 59, 0.3); }
.table tbody tr:last-child td { border-bottom: none; }
/* Rechtsbündige Zahlenspalten */
.table th.num, .table td.num { text-align: right; }

/* ── Formularfelder (Optik aus dem Bestand) ── */
.kf-input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  background: #020617;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.875rem;
}
.kf-input:focus { outline: none; border-color: var(--indigo); }
.kf-input::placeholder { color: #475569; }
textarea.kf-input { resize: vertical; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}
/* Optionale breite Variante (z. B. große Formulare/Reports) */
.modal.modal-breit { max-width: 720px; }

/* ── Tab-Leiste ── */
.tabbar { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.tab:hover { background: #334155; color: var(--ink); text-decoration: none; }
.tab-active, .tab-active:hover { background: #4f46e5; color: #fff; }

/* ── Toast (unten rechts, 3 s) ── */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  background: #065f46;                      /* emerald-800 */
  color: #d1fae5;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  max-width: 360px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  animation: toast-rein 0.2s ease-out;
}
.toast-fehler {
  background: #881337;                      /* rose-900 */
  color: #fecdd3;
  border-color: rgba(244, 63, 94, 0.4);
}
@keyframes toast-rein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Banner (Hinweise über volle Breite) ── */
.banner-amber, .banner-rose {
  width: 100%;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.875rem;
}
.banner-amber {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}
.banner-rose {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

/* ── Chips (klickbare Filter-Pillen, z. B. „30 Tage / 90 Tage") ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--indigo); color: var(--ink); }
.chip-active, .chip-active:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--indigo);
  color: #a5b4fc;
}

/* ── Leerzustand (ui.mjs → leerhinweis()) ── */
.leerhinweis {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Scrollbars dezent (WebKit) ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── Druck (Reports als PDF) ── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .print-card {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}
