/* ═══════════════════════════════════════════════════════════════
   LicenseOS · Stylesheet
   Thema: Nachtasphalt · Verkehrsblau · Fahrschulschild-Gelb
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Fläche */
  --bg:        #0d1115;
  --bg-raise:  #131920;
  --surface:   #171f28;
  --surface-2: #1d2732;
  --line:      #263241;
  --line-soft: #1e2833;

  /* Text */
  --text:      #e9eef4;
  --muted:     #8fa0b1;
  --faint:     #5c6b7a;

  /* Akzente */
  --blue:      #2e6fe0;   /* Verkehrsblau */
  --blue-hi:   #4d87f0;
  --blue-dim:  rgba(46,111,224,.14);
  --yellow:    #f7c744;   /* Fahrschulschild */
  --yellow-dim:rgba(247,199,68,.13);
  --green:     #34c176;
  --green-dim: rgba(52,193,118,.13);
  --red:       #e5484d;
  --red-dim:   rgba(229,72,77,.13);

  /* Typo */
  --font:      'Barlow', 'Segoe UI', system-ui, sans-serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 18px 50px rgba(0,0,0,.5);

  /* Fahrbahnmarkierung (Mittellinie) als Struktur-Element */
  --lane: repeating-linear-gradient(90deg, var(--yellow) 0 14px, transparent 14px 26px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: transparent;           /* NUI: Spiel bleibt sichtbar */
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body.web-mode {                      /* Browser: Asphalt-Hintergrund */
  background:
    radial-gradient(1100px 500px at 75% -10%, rgba(46,111,224,.10), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(247,199,68,.05), transparent 60%),
    var(--bg);
}

/* ── App-Shell ──────────────────────────────────────────────── */
.app {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
}
.app.hidden { display: none; }

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  width: min(1380px, 100%);
  height: min(860px, 100%);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: shell-in .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes shell-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line-soft);
  padding: 18px 12px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-badge {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #0d1115;
  background: linear-gradient(140deg, var(--yellow), #eab020);
  box-shadow: 0 4px 14px rgba(247,199,68,.25);
}
.brand-badge svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-cond); font-size: 21px; font-weight: 600; letter-spacing: .02em; }
.brand-name b { color: var(--yellow); font-weight: 700; }
.brand-sub { font-size: 10.5px; color: var(--faint); letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted);
  font: inherit; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--blue-dim); color: var(--blue-hi); }
.nav-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface-2); color: var(--muted);
  border-radius: 20px; padding: 2px 7px;
}
.nav-item.active .nav-count { background: rgba(77,135,240,.2); color: var(--blue-hi); }

.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--line-soft);
}
.mode-pill {
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  color: var(--yellow); background: var(--yellow-dim);
  padding: 3px 9px; border-radius: 20px;
}
.mode-pill.live { color: var(--green); background: var(--green-dim); }
.version { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

/* ── Topbar ─────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.view-title {
  font-family: var(--font-cond);
  font-size: 26px; font-weight: 600; letter-spacing: .01em;
}
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px; height: 38px; width: 300px;
  transition: border-color .12s;
}
.search:focus-within { border-color: var(--blue); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; outline: none; }
.search input::placeholder { color: var(--faint); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: filter .12s, background .12s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(46,111,224,.3); }
.btn-ghost   { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-danger  { background: var(--red-dim); color: var(--red); border-color: rgba(229,72,77,.3); }
.btn-warn    { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(247,199,68,.3); }
.btn-success { background: var(--green-dim); color: var(--green); border-color: rgba(52,193,118,.3); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted); cursor: pointer;
  transition: color .12s, border-color .12s;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:hover { color: var(--red); border-color: rgba(229,72,77,.4); }

/* ── View / Sektionen ───────────────────────────────────────── */
.view { flex: 1; overflow-y: auto; padding: 22px 24px 32px; outline: none; }
.view::-webkit-scrollbar { width: 9px; }
.view::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 2px solid var(--bg-raise); }

.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 26px 0 12px;
}
.section-head:first-child { margin-top: 0; }
.section-head h2 {
  font-family: var(--font-cond);
  font-size: 17px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
/* Mittellinien-Divider */
.section-head::after {
  content: ''; flex: 1; height: 3px;
  background: var(--lane); opacity: .28; border-radius: 2px;
}

/* ── KPI-Karten ─────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--kpi-color, var(--blue));
}
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-family: var(--font-cond); font-size: 34px; font-weight: 700; line-height: 1.05; }
.kpi-hint  { font-size: 12px; color: var(--faint); }

/* ── Panels & Grids ─────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }

/* ── Tabellen ───────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 11px 16px;
  font-family: var(--font-cond); font-size: 13px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted);
  background: var(--bg); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: rgba(46,111,224,.05); }
tr.clickable { cursor: pointer; }
td .sub { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.mono { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .02em; }
.t-right { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--faint);
}
.empty b { display: block; color: var(--muted); font-size: 15px; margin-bottom: 4px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.aktiv         { color: var(--green);  background: var(--green-dim); }
.badge.gesperrt      { color: var(--yellow); background: var(--yellow-dim); }
.badge.entzogen      { color: var(--red);    background: var(--red-dim); }
.badge.abgelaufen    { color: var(--muted);  background: var(--surface-2); }
.badge.offen         { color: var(--blue-hi);background: var(--blue-dim); }
.badge.bestanden     { color: var(--green);  background: var(--green-dim); }
.badge.durchgefallen { color: var(--red);    background: var(--red-dim); }
.badge.bezahlt       { color: var(--green);  background: var(--green-dim); }

.class-chip {
  display: inline-grid; place-items: center;
  min-width: 38px; height: 26px; padding: 0 8px;
  border-radius: 7px;
  background: var(--blue-dim); color: var(--blue-hi);
  font-family: var(--font-cond); font-size: 15px; font-weight: 700; letter-spacing: .04em;
}

/* Punkte-Anzeige */
.points-meter { display: inline-flex; align-items: center; gap: 8px; }
.points-track { width: 64px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.points-fill  { height: 100%; border-radius: 4px; background: var(--green); transition: width .3s; }
.points-fill.warn   { background: var(--yellow); }
.points-fill.danger { background: var(--red); }
.points-num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ── Filterleiste ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); color: var(--muted);
  padding: 6px 14px; font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all .12s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--blue-dim); border-color: var(--blue); color: var(--blue-hi); }

/* ── Charts ─────────────────────────────────────────────────── */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 42px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--blue-hi), var(--blue));
  min-height: 3px;
  transition: height .5s cubic-bezier(.2,.8,.3,1);
}
.chart-bar.zero { background: var(--surface-2); }
.chart-x { font-size: 11px; color: var(--faint); }
.chart-v { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.donut-row { display: flex; align-items: center; gap: 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-item b { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text); }

/* ── Aktivitäts-Feed ────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-soft); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 6px; flex: none; }
.feed-body { min-width: 0; }
.feed-text { font-size: 13px; }
.feed-text b { font-weight: 600; }
.feed-meta { font-size: 11.5px; color: var(--faint); margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════════
   Signature: EU-Führerschein-Karte
   ═══════════════════════════════════════════════════════════════ */
.license-card {
  width: 400px; max-width: 100%;
  aspect-ratio: 85.6 / 54;
  border-radius: 14px;
  position: relative; overflow: hidden;
  color: #232d3a;
  background: linear-gradient(155deg, #f6f8fb 0%, #e8edf4 45%, #f2f4f8 100%);
  box-shadow: 0 14px 34px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.6);
  font-family: var(--font);
}
/* Hologramm-Schimmer */
.license-card::before {
  content: ''; position: absolute; inset: -40%;
  background: conic-gradient(from 210deg at 60% 40%,
    transparent 0deg, rgba(244,143,177,.16) 60deg, rgba(129,180,255,.18) 130deg,
    rgba(178,255,214,.13) 200deg, transparent 280deg);
  pointer-events: none;
}
/* Guilloche-Andeutung */
.license-card::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(46,111,224,.035) 0 2px, transparent 2px 7px);
  pointer-events: none;
}
.lc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px 7px;
  background: linear-gradient(90deg, #2456b8, #2e6fe0);
  color: #fff; position: relative; z-index: 1;
}
.lc-head h3 { font-family: var(--font-cond); font-size: 15px; font-weight: 700; letter-spacing: .16em; }
.lc-stars {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-cond); font-size: 11px; font-weight: 700; color: #f7c744;
  background:
    radial-gradient(circle, transparent 58%, rgba(247,199,68,.9) 59% 61%, transparent 62%),
    #1d4699;
  border: 1px dashed rgba(247,199,68,.85);
}
.lc-body { display: flex; gap: 12px; padding: 10px 14px 8px; position: relative; z-index: 1; }
.lc-photo {
  width: 74px; height: 92px; flex: none;
  border-radius: 6px;
  background: linear-gradient(180deg, #c6d2e0, #a9b8c9);
  display: grid; place-items: center;
  border: 1px solid rgba(35,45,58,.15);
}
.lc-photo svg { width: 44px; height: 44px; stroke: #7488a0; fill: none; stroke-width: 1.6; }
.lc-fields { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; align-content: start; min-width: 0; }
.lc-field { min-width: 0; }
.lc-field.full { grid-column: 1 / -1; }
.lc-k { font-size: 8.5px; font-weight: 600; color: #7488a0; letter-spacing: .05em; }
.lc-k b { color: #2456b8; margin-right: 3px; }
.lc-v { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-v.mono { font-family: var(--font-mono); font-size: 11px; }
.lc-classes {
  display: flex; gap: 5px; padding: 0 14px 11px;
  position: relative; z-index: 1;
}
.lc-class {
  flex: 1; text-align: center;
  border: 1px solid rgba(36,86,184,.25); border-radius: 5px;
  padding: 3px 0 2px;
  font-family: var(--font-cond); font-size: 12px; font-weight: 700;
  color: #9fb0c4;
  background: rgba(255,255,255,.5);
}
.lc-class.owned { color: #1d4699; background: rgba(46,111,224,.12); border-color: #2456b8; }
.license-card.is-revoked { filter: grayscale(.7) brightness(.92); }
.lc-stamp {
  position: absolute; z-index: 2; right: 12px; bottom: 34px;
  transform: rotate(-14deg);
  border: 2.5px solid var(--red); border-radius: 6px; color: var(--red);
  font-family: var(--font-cond); font-size: 17px; font-weight: 700; letter-spacing: .2em;
  padding: 3px 10px; opacity: .85;
}

.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6,9,12,.66);
  display: grid; place-items: center; padding: 24px;
  animation: fade-in .15s;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modal-in .2s cubic-bezier(.2,.9,.3,1);
}
.modal.wide { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-family: var(--font-cond); font-size: 20px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line-soft);
}

/* ── Formulare ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  height: 40px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; outline: none;
  transition: border-color .12s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field .hint { font-size: 11.5px; color: var(--faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.picker-results { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; color: var(--text); cursor: pointer; text-align: left;
  transition: border-color .12s;
}
.picker-item:hover, .picker-item.selected { border-color: var(--blue); background: var(--blue-dim); }
.picker-item .mono { color: var(--faint); }

.class-select { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.class-opt {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted);
  padding: 8px 4px; text-align: center; cursor: pointer; font: inherit;
  transition: all .12s;
}
.class-opt b { display: block; font-family: var(--font-cond); font-size: 17px; font-weight: 700; color: var(--text); }
.class-opt span { font-size: 10px; }
.class-opt.selected { border-color: var(--blue); background: var(--blue-dim); }
.class-opt.selected b { color: var(--blue-hi); }

/* ── Toasts ─────────────────────────────────────────────────── */
#toast-root {
  position: fixed; right: 26px; bottom: 26px; z-index: 100;
  display: flex; flex-direction: column; gap: 9px;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  min-width: 280px; max-width: 380px;
  background: var(--bg-raise);
  border: 1px solid var(--line); border-left: 3px solid var(--blue);
  border-radius: 10px;
  padding: 12px 15px;
  box-shadow: var(--shadow);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1);
  font-size: 13px;
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warn    { border-left-color: var(--yellow); }
.toast.leaving { animation: toast-out .2s forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(24px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(24px); } }

/* ── Einstellungen ──────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }

/* ── A11y & Motion ──────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Responsive (Web) ───────────────────────────────────────── */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .settings-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .search { width: 190px; }
}
@media (max-width: 760px) {
  .app { padding: 0; }
  .shell { grid-template-columns: 1fr; height: 100%; border-radius: 0; }
  .sidebar { flex-direction: row; align-items: center; padding: 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand-text, .sidebar-foot { display: none; }
  .nav { flex-direction: row; }
  .nav-item { white-space: nowrap; }
  .btn-primary span { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Web-Plattform: Auth, Team, User-Menü, API-Keys, Settings-Form
   ═══════════════════════════════════════════════════════════════ */

/* ── Auth-Seite ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px; position: relative;
}
.auth-page::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(46,111,224,.16), transparent 60%),
    radial-gradient(700px 420px at 100% 110%, rgba(247,199,68,.07), transparent 55%);
}
.auth-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 30px 28px 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.auth-card::before {
  content: ''; position: absolute; left: 24px; right: 24px; top: 0; height: 3px;
  background: var(--lane); border-radius: 2px; opacity: .8;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-badge { width: 44px; height: 44px; font-size: 19px; }
.auth-brand h1 { font: 700 22px/1 'Barlow Condensed', sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.auth-brand p { font-size: 12px; color: var(--faint); margin-top: 4px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 20px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.auth-tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font: 600 13px 'Barlow', sans-serif; padding: 8px 0; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--blue); color: #fff; }
.auth-card .field { margin-bottom: 14px; }
.auth-submit { width: 100%; justify-content: center; margin-top: 6px; }
.auth-error {
  display: none; background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.4);
  color: #ff9a9e; font-size: 13px; border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px;
}
.auth-error.show { display: block; }
.auth-invite {
  background: rgba(46,111,224,.1); border: 1px solid rgba(46,111,224,.35);
  border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.5;
}
.auth-invite b { color: var(--blue-soft); }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--faint); }

/* ── Topbar: User-Menü ──────────────────────────────────────── */
.user-chip {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: 999px; padding: 5px 12px 5px 5px;
  cursor: pointer; transition: border-color .15s; position: relative;
}
.user-chip:hover { border-color: var(--blue); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), #1d4ca8);
  display: grid; place-items: center; font: 700 11px 'Barlow', sans-serif; color: #fff; letter-spacing: .04em;
}
.user-chip .u-name { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 18px 50px rgba(0,0,0,.55); padding: 8px; display: none;
}
.user-menu.open { display: block; }
.user-menu .um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.user-menu .um-head b { display: block; font-size: 14px; }
.user-menu .um-head span { font-size: 12px; color: var(--faint); }
.um-item {
  display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: transparent;
  color: var(--text); font: 500 13px 'Barlow', sans-serif; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; text-align: left;
}
.um-item:hover { background: var(--panel-2); }
.um-item.danger { color: #ff9a9e; }
.um-role { font-size: 11px; color: var(--faint); margin-left: auto; text-transform: uppercase; letter-spacing: .05em; }

/* ── Rollen-Badges ──────────────────────────────────────────── */
.badge.owner      { background: rgba(247,199,68,.14); color: var(--yellow); border-color: rgba(247,199,68,.4); }
.badge.admin      { background: rgba(46,111,224,.16); color: var(--blue-soft); border-color: rgba(46,111,224,.45); }
.badge.instructor { background: rgba(52,193,118,.13); color: var(--green); border-color: rgba(52,193,118,.4); }
.badge.viewer     { background: rgba(143,160,177,.12); color: var(--muted); border-color: rgba(143,160,177,.35); }

/* ── Team / Einladungen / API-Keys ──────────────────────────── */
.invite-link {
  display: flex; align-items: center; gap: 8px; background: var(--panel-2);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 12px; margin-top: 10px;
}
.invite-link code { flex: 1; font: 500 12px 'JetBrains Mono', monospace; color: var(--blue-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-reveal {
  background: rgba(52,193,118,.08); border: 1px solid rgba(52,193,118,.35);
  border-radius: var(--r-sm); padding: 12px 14px; margin-top: 12px;
}
.key-reveal code { display: block; font: 600 13px 'JetBrains Mono', monospace; color: var(--green); word-break: break-all; margin-top: 6px; }
.key-reveal p { font-size: 12px; color: var(--muted); }
select.inline-select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); font: 500 12px 'Barlow', sans-serif; padding: 5px 8px; cursor: pointer;
}
select.inline-select:focus { outline: none; border-color: var(--blue); }

/* ── Editierbare Einstellungen ──────────────────────────────── */
.settings-form .field { margin-bottom: 12px; }
.class-editor { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.class-editor table { width: 100%; }
.class-editor input {
  width: 100%; background: transparent; border: 1px solid transparent; color: var(--text);
  font: 500 13px 'Barlow', sans-serif; padding: 6px 8px; border-radius: 6px;
}
.class-editor input.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.class-editor input:focus { outline: none; border-color: var(--blue); background: var(--panel-2); }
.class-editor .cl-del { opacity: .55; }
.class-editor .cl-del:hover { opacity: 1; }
.settings-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.plan-pill {
  display: inline-flex; align-items: center; gap: 6px; font: 600 11px 'Barlow', sans-serif;
  text-transform: uppercase; letter-spacing: .08em; border-radius: 999px; padding: 4px 12px;
  background: rgba(247,199,68,.12); color: var(--yellow); border: 1px solid rgba(247,199,68,.4);
}
.plan-pill.pro { background: rgba(52,193,118,.12); color: var(--green); border-color: rgba(52,193,118,.4); }

@media (max-width: 760px) {
  .user-chip .u-name { display: none; }
}
