:root {
  /* lecmich.IT Markenpalette (Navy + Cyan), dunkles Admin-Theme beibehalten */
  --bg: #0B1220;
  --panel: #131C2E;
  --panel-alt: #0E1524;
  --border: #1E2942;
  --border-light: #2A3752;
  --text: #E7ECF3;
  --text-muted: #8B96AC;
  --text-faint: #5C6786;
  --text-ghost: #3A4560;
  --accent: #06B6D4;
  --accent-strong: #0B1220;
  --critical: #FF5D5D;
  --high: #FF9F5A;
  --medium: #F5D547;
  --low: #6EC6FF;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0; background: var(--panel-alt);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 20px 14px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 22px; }
.brand-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: 0.2px; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }

.nav-list { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  background: transparent; border: none; color: var(--text-muted); font-size: 13.5px;
  font-family: var(--font-body); cursor: pointer; width: 100%; text-align: left;
}
.nav-item:hover { background: #161F33; }
.nav-item.active { background: #1A2740; color: var(--text); }
.nav-icon { font-size: 14px; width: 16px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
  font-family: var(--font-mono); background: var(--medium); color: var(--accent-strong);
}
.sidebar-foot { padding: 10px 8px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-faint); }

.sidebar-close { display: none; margin-left: auto; background: transparent; border: none; color: var(--text-faint); font-size: 16px; cursor: pointer; padding: 6px; }
.sidebar-overlay { display: none; }
.menu-btn {
  display: none; background: transparent; border: 1px solid var(--border-light); color: var(--text);
  border-radius: 8px; font-size: 16px; padding: 6px 10px; cursor: pointer; margin-right: 12px; flex-shrink: 0;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 20px 28px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.topbar-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.topbar-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }

.content { flex: 1; padding: 22px 28px; overflow-y: auto; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.field .hint { color: var(--text-faint); font-weight: 400; }

input, select {
  background: var(--panel-alt); border: 1px solid var(--border-light); border-radius: 7px;
  padding: 9px 11px; color: var(--text); font-size: 13.5px; font-family: var(--font-body);
  outline: none; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: var(--accent-strong);
  border: none; border-radius: 8px; padding: 9px 15px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font-body); transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover:not(:disabled) { background: #22D3EE; box-shadow: 0 6px 16px -6px rgba(6, 182, 212, 0.45); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; color: #B7C0D4;
  border: 1px solid var(--border-light); border-radius: 8px; padding: 8px 14px; font-size: 13px;
  cursor: pointer; font-family: var(--font-body); transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.icon-btn { background: transparent; border: none; color: var(--text-faint); cursor: pointer; padding: 5px; font-size: 14px; }
.icon-btn.danger { color: var(--critical); }

table { width: 100%; border-collapse: collapse; }
.table-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th {
  text-align: left; font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 10px 14px; background: var(--panel-alt); border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill-hoch { color: var(--critical); background: rgba(255,93,93,0.12); }
.pill-mittel { color: var(--medium); background: rgba(245,213,71,0.12); }
.pill-niedrig { color: var(--low); background: rgba(110,198,255,0.12); }
.pill-critical { color: var(--critical); background: rgba(255,93,93,0.12); }
.pill-high { color: var(--high); background: rgba(255,159,90,0.12); }
.pill-medium { color: var(--medium); background: rgba(245,213,71,0.12); }
.pill-low { color: var(--low); background: rgba(110,198,255,0.12); }
.pill-ok { color: var(--accent); background: rgba(79,209,197,0.12); }
.pill-err { color: var(--critical); background: rgba(255,93,93,0.12); }

.link { color: var(--accent); text-decoration: none; }

code, .code-inline { font-family: var(--font-mono); background: var(--panel-alt); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.code-block {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); background: var(--panel-alt);
  border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; line-height: 1.6; margin: 0;
  white-space: pre;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px;
  border: 1px dashed var(--border); border-radius: 12px; text-align: center;
}
.empty-state .icon { font-size: 26px; opacity: 0.35; }
.empty-state .title { font-family: var(--font-display); font-size: 15px; color: var(--text-muted); margin-top: 10px; }
.empty-state .text { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; max-width: 340px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel-alt); border: 1px solid var(--border-light);
  border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 12.5px; color: #B7C0D4; font-family: var(--font-mono);
}
.chip button { background: var(--border); border: none; border-radius: 50%; color: var(--text-muted); width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; }

.finding-card { border-left: 3px solid var(--medium); }
.finding-card.seen { opacity: 0.5; }
.finding-head { display: flex; justify-content: space-between; gap: 12px; }
.finding-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.finding-summary { font-size: 13.5px; color: #B7C0D4; line-height: 1.5; }
.finding-foot { margin-top: 8px; display: flex; gap: 14px; font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap; }

.console { border-top: 1px solid var(--border); background: var(--panel-alt); height: 150px; display: flex; flex-direction: column; flex-shrink: 0; }
.console-header { padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.4px; }
.console-body { flex: 1; overflow-y: auto; padding: 10px 16px; font-family: var(--font-mono); font-size: 12px; display: flex; flex-direction: column; gap: 3px; }
.console-empty { color: var(--text-ghost); }
.log-line { display: flex; gap: 8px; }
.log-ts { color: var(--text-ghost); flex-shrink: 0; }
.log-info { color: var(--text-muted); }
.log-success { color: var(--accent); }
.log-warn { color: var(--medium); }
.log-error { color: var(--critical); }

.banner { display: flex; gap: 12px; }
.banner p { font-size: 13.5px; color: #B7C0D4; line-height: 1.55; margin: 0; }

.spin { animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative;
}
.login-wrap.dot-grid-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(6, 182, 212, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%);
}
.login-wrap > * { position: relative; }
.login-card {
  width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px 26px; display: flex; flex-direction: column; gap: 16px;
}
.login-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.brand-logo { height: 30px; width: auto; border-radius: 4px; }
.brand-logo-compact { display: none; height: 26px; width: 26px; border-radius: 6px; flex-shrink: 0; }
.login-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.login-sub { font-size: 11px; color: var(--text-faint); }
.login-btn { justify-content: center; margin-top: 4px; }
.login-error { font-size: 12.5px; color: var(--critical); }

/* Tablet: Sidebar wird zur schmalen Icon-Leiste, Inhalte einspaltig */
@media (max-width: 900px) {
  .sidebar { width: 72px; }
  .brand-title, .brand-sub, .nav-label, .sidebar-foot > div:first-child { display: none; }
  .brand-logo { display: none; }
  .brand-logo-compact { display: block; margin: 0 auto; }
  .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 16px 18px; }
}

/* Handy: Sidebar wird zum Off-Canvas-Menue (Hamburger), volle Breite fuer Inhalte */
@media (max-width: 600px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40; width: 236px;
    transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none;
    overflow: hidden;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.4); }
  .sidebar .brand-title, .sidebar .brand-sub, .sidebar .nav-label,
  .sidebar .sidebar-foot > div:first-child { display: block; }
  .sidebar .brand-logo { display: block; }
  .sidebar .brand-logo-compact { display: none; }
  .brand { position: relative; }
  .sidebar-close { display: block; }

  .sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 30;
  }
  .sidebar-overlay.visible { display: block; }

  .main { width: 100%; }
  .topbar { padding: 14px 16px; }
  .topbar-title { font-size: 16px; }
  .content { padding: 12px; }

  .card { padding: 14px; border-radius: 10px; }
  .row-between { flex-wrap: wrap; }
  .row-between .btn-primary, .row-between .btn-ghost { flex: 1; justify-content: center; }
  .row-end { flex-wrap: wrap; }
  .row-end .btn-primary, .row-end .btn-ghost { flex: 1; justify-content: center; }

  .form-grid, .filter-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Tabellen bleiben horizontal scrollbar statt das Layout zu sprengen */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  th, td { padding: 9px 10px; font-size: 12.5px; }

  .finding-head { flex-wrap: wrap; }
  .finding-meta { gap: 6px; }
  .finding-foot { gap: 8px; }

  .console { height: 110px; }
  .console-body { padding: 8px 12px; font-size: 11px; }

  .login-card { padding: 22px 18px; }
}

/* WICHTIG: Einige Komponenten (z. B. .field, .login-card) setzen explizit
   "display: flex". Da das dieselbe Spezifitaet wie die eingebaute
   [hidden]-Regel des Browsers hat und unser Stylesheet spaeter geladen
   wird, wuerde ohne diese Regel das hidden-Attribut/die hidden-Property
   wirkungslos bleiben und Elemente trotz hidden=true sichtbar bleiben
   (siehe z. B. Login-Seite MFA-Felder, Einladungs-Seite). Diese Regel
   erzwingt die korrekte Sichtbarkeit unabhaengig von anderen display-Werten. */
[hidden] { display: none !important; }

/* Kennzahlen-Raster im Uebersichts-Tab: automatisch umbrechende Kacheln,
   damit die Zahlen auch auf dem Handy lesbar nebeneinander stehen. */
.kpi-grid {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.kpi-grid .card { margin: 0; }

/* Code-/Geheimnis-Anzeige fuer einmalig sichtbare Werte (API-Token,
   MFA-Wiederherstellungscodes). */
.secret-list {
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  font-family: var(--font-mono); font-size: 14px; margin: 12px 0;
}
.secret-list span {
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; user-select: all; text-align: center; letter-spacing: 0.5px;
}

/* Textlink-Optik fuer Umschalter innerhalb von Formularfeldern
   (z. B. "Wiederherstellungscode verwenden" auf der Login-Seite). */
.link-btn {
  background: none; border: none; padding: 6px 0 0; margin: 0;
  color: var(--accent); font-size: 12px; cursor: pointer; text-align: left;
  font-family: var(--font-body);
}
.link-btn:hover { text-decoration: underline; }
