/* WehrOne-License Portal — slate-Palette, rot als Primärfarbe (wie WehrOne) */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --green-bg: #dcfce7; --green-text: #15803d;
  --amber-bg: #fef3c7; --amber-text: #b45309;
  --red-bg: #fee2e2; --red-text: #b91c1c;
  --slate-bg: #e2e8f0; --slate-text: #475569;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617;
    --card: #0f172a;
    --border: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #ef4444;
    --primary-hover: #dc2626;
    --green-bg: #052e16; --green-text: #86efac;
    --amber-bg: #451a03; --amber-text: #fcd34d;
    --red-bg: #450a0a; --red-text: #fca5a5;
    --slate-bg: #1e293b; --slate-text: #cbd5e1;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red-text); font-size: 14px; }
.secret {
  background: var(--slate-bg); color: var(--slate-text);
  border-radius: 6px; padding: 8px 10px; font-family: ui-monospace, monospace;
  word-break: break-all; font-size: 14px; user-select: all;
}
.secret.small { font-size: 12px; }
code { background: var(--slate-bg); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.view.center { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.w-96 { width: 400px; max-width: 100%; }
.input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit;
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { color: var(--red-text); border-color: var(--red-text); }
.flex { display: flex; } .flex-1 { flex: 1; } .gap-2 { gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }
.block { display: block; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-6 { margin-top: 24px; }
.text-sm { font-size: 14px; } .text-xs { font-size: 12px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 24px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.text-center { text-align: center; } .tracking-widest { letter-spacing: .3em; }
.break-all { word-break: break-all; } .font-mono { font-family: ui-monospace, monospace; }

/* Layout */
#view-app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100dvh;
}
.brand { font-weight: 700; font-size: 16px; padding: 6px 10px 16px; }
.brand-logo { margin-right: 4px; }
.nav-item {
  display: block; padding: 9px 10px; border-radius: 8px; color: var(--text);
  text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--slate-bg); }
.nav-item.active { background: var(--red-bg); color: var(--red-text); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 10px; }
.content { flex: 1; padding: 24px; max-width: 1100px; }
.page { max-width: 100%; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }

/* Klickbare Kacheln (Übersicht) */
.stat-clickable {
  font-family: inherit; text-align: left; cursor: pointer; color: var(--text);
}
.stat-clickable:hover { border-color: var(--primary); }
.stat-clickable:hover .lbl { color: var(--primary); }

/* Listen & Tabellen */
.list-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.list-item .grow { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 14px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border);
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green-text); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); }
.badge-red { background: var(--red-bg); color: var(--red-text); }
.badge-slate { background: var(--slate-bg); color: var(--slate-text); }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 50; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 64px);
  overflow-y: auto;
}
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 60; background: var(--text);
  color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px;
}

/* QR-Code (immer weißer Hintergrund — Scanner-freundlich, auch im Dark Mode) */
.qr-wrap {
  display: flex; justify-content: center; background: #ffffff;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.qr-img { width: 200px; height: 200px; image-rendering: pixelated; }

/* Charts (Sicherheit) */
.chart-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; overflow-x: auto;
}
.chart { width: 100%; min-width: 480px; display: block; }
.chart-label { fill: var(--muted); font-size: 9px; }

/* Tabs (Sicherheit) */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.tab {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 9px 14px; border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: var(--slate-bg); }
.tab.active {
  color: var(--red-text); background: var(--card);
  border-color: var(--border); border-bottom: 1px solid var(--card);
}

/* Mobile */
@media (max-width: 768px) {
  #view-app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--border); }
  .brand { padding: 4px 8px; }
  nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-item { margin-bottom: 0; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 4px; }
  .content { padding: 16px; }
}
