:root {
  --bg: #0f172a; --panel: #ffffff; --ink: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --accent: #2563eb; --ok: #16a34a; --warn: #b45309; --bad: #dc2626;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink); background: #f1f5f9; min-height: 100vh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--bg); color: #fff; }
.brand { font-size: 16px; letter-spacing: .3px; }
.spacer { flex: 1; }
.who { color: #cbd5e1; font-size: 13px; }
.view { flex: 1; padding: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 14px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

.btn { border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 8px;
  font-size: 14px; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); width: 100%; }
.btn.ghost { background: transparent; color: #fff; border-color: #475569; }
.btn.danger { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn.danger:hover { background: #fef2f2; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card.auth { max-width: 380px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
.card.auth h1 { font-size: 18px; margin: 0 0 4px; }
.card.auth label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.card.auth input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; text-align: center; }
.err { background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; padding: 8px 10px;
  border-radius: 8px; font-size: 13px; }
.warn { background: #fffbeb; color: var(--warn); border: 1px solid #fde68a; padding: 10px;
  border-radius: 8px; font-size: 13px; }
/* #263 Phase C — Erfolg ≠ gelb: neutrale/grüne Erfolgsmeldung (gelb nur für echte Warnungen). */
.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; padding: 10px;
  border-radius: 8px; font-size: 13px; }
.qr { width: 200px; height: 200px; align-self: center; border: 1px solid var(--line); border-radius: 8px; }
.secret { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.codes { columns: 2; font-family: var(--mono); font-size: 14px; }
.codes li { margin: 4px 0; }

.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; min-width: 120px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.ok .n { color: var(--ok); } .stat.warn .n { color: var(--warn); }
.stat.bad .n { color: var(--bad); } .stat.neutral .n { color: var(--muted); }

.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h .ro { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.muted { color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.mono { font-family: var(--mono); font-size: 13px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--muted); }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.neutral { background: #e2e8f0; color: #475569; }

/* Enroll-Token-Mint-Formular */
.mint { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mint input { flex: 1 1 160px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.mint .mintbtn { width: auto; flex: 0 0 auto; }
.tokenlist { margin-top: 8px; }
#mintout { margin-bottom: 10px; }
.btn.xs { padding: 5px 10px; font-size: 12px; width: auto; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── #263 Phase A: feste Seitenleiste (Desktop) + Inhaltsspalte mit Seitenkopf ─ */
.shell { display: flex; gap: 20px; align-items: flex-start; }
.sidebar { flex: 0 0 200px; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 4px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.areahead { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.areahead h1 { font-size: 20px; margin: 0; }
#areabody { display: flex; flex-direction: column; gap: 16px; }
.logs { font-family: var(--mono); font-size: 12px; background: #0f172a; color: #e2e8f0;
  padding: 10px; border-radius: 8px; }

/* #208 — Topbar-Hamburger + Vollbild-Overlay-Menü (mobiler Fallback) */
.navtoggle { background: transparent; color: #fff; border: 1px solid #475569; border-radius: 8px;
  font-size: 18px; line-height: 1; padding: 6px 11px; cursor: pointer; }
/* Desktop: Seitenleiste sichtbar, Hamburger versteckt. */
@media (min-width: 821px) { .navtoggle { display: none; } }
/* Schmaler Viewport: Seitenleiste klappt zum Hamburger ein (Overlay übernimmt). */
@media (max-width: 820px) { .sidebar { display: none; } }
.navoverlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60; display: flex; }
.navoverlay[hidden] { display: none; }
.navpanel { background: #fff; width: 280px; max-width: 84vw; height: 100%; padding: 14px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: 2px 0 24px rgba(0,0,0,.3);
  animation: slidein .15s ease-out; }
@keyframes slidein { from { transform: translateX(-12px); opacity: .6; } to { transform: none; opacity: 1; } }
.navpanel-h { display: flex; align-items: center; margin-bottom: 6px; }
.navpanel-h strong { font-size: 15px; }
.navclose { margin-left: auto; background: transparent; border: none; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px; }
.navitem { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; font-size: 14px; cursor: pointer; color: var(--ink); }
.navitem:hover { border-color: var(--accent); }
.navitem.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* #202 — kompaktes Zeilen-Menü (⋯) für Nutzer-Aktionen */
.rowmenu { position: relative; display: inline-block; }
.rowmenu > summary { list-style: none; cursor: pointer; border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 10px; font-size: 16px; line-height: 1; user-select: none; background: #fff; }
.rowmenu > summary::-webkit-details-marker { display: none; }
.rowmenu[open] > summary { border-color: var(--accent); }
.rowmenu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12);
  display: flex; flex-direction: column; min-width: 180px; overflow: hidden; }
.rowmenu-pop button { text-align: left; background: #fff; border: none; padding: 10px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink); }
.rowmenu-pop button:hover { background: #f1f5f9; }
.rowmenu-pop button.danger { color: #b91c1c; }
.rowmenu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* #208-Punch — native Dropdowns ans App-Design angleichen */
select { padding: 9px 30px 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--ink); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M3 4.5 6 8l3-3.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* #208-Punch — Filter-Toggle (gesperrte/entfernte zeigen) */
.filtertoggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--muted); margin: 4px 0 10px; cursor: pointer; }

/* #208-Punch — Einmal-Geheimnis-Modal (initial_password etc.) */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex;
  align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 12px; padding: 22px; max-width: 460px; width: 100%;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h2 { font-size: 17px; margin: 0; }
.secret.big { font-size: 18px; padding: 12px; background: #f1f5f9; border: 1px solid var(--line);
  border-radius: 8px; text-align: center; user-select: all; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Mobile (≤ 640px): Tabellen → Karten, Auth/QR/Recovery aufräumen ───────── */
@media (max-width: 640px) {
  .view { padding: 12px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 15px; }
  .who { display: none; }
  .card { padding: 14px; border-radius: 10px; }
  .card.auth { margin: 16px auto; max-width: 100%; }
  .qr { width: 220px; height: 220px; max-width: 80vw; }
  .codes { columns: 1; font-size: 16px; }
  .stat { flex: 1 1 40%; min-width: 0; }

  /* responsive Tabelle → gestapelte Karten mit data-label */
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; }
  .tbl.responsive td { border: none; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; }
  .tbl.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .mint input { flex: 1 1 100%; }
  .mint .mintbtn { width: 100%; }
}

/* #263 Phase C — Reiter (Audit: Nutzer | Fleet) */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: none; border-bottom: 2px solid transparent; padding: 8px 12px;
  font-size: 14px; cursor: pointer; color: var(--muted); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
/* #263 Phase C — ausklappbare Rohdaten statt JSON.stringify-Wand */
details.raw > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 6px; }
details.raw[open] > summary { color: var(--ink); }
.modal input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }

/* #212 — Backup/Restore-Sektion */
ul.kv { list-style:none; margin:8px 0 0; padding:0; }
ul.kv li { display:flex; justify-content:space-between; gap:12px; padding:5px 2px; border-bottom:1px solid #eee; }
ul.kv li span { color:#555; }
ul.kv li b { text-align:right; }
label.chk { display:flex; align-items:center; gap:6px; font-size:.92em; color:#555; }
label.chk input { width:auto; }
