/* Gemeinsames Design für Tuner-Portal und Admin. Dunkel, ruhig, wenige Farben; eine Karte, eine Tabelle, ein Button-Satz. */
:root {
  --bg: #020814;
  --bg-2: #061022;
  --card: #0a1628;
  --card-2: #0d1b30;
  --line: #1a2a44;
  --line-2: #26395a;
  --text: #f2f7ff;
  --muted: #8d9db8;
  --faint: #5c6c88;
  --accent: #1675ff;
  --accent-hi: #4d9cff;
  --accent-soft: rgba(22, 117, 255, 0.14);
  --red: #ff2530;
  --red-soft: rgba(255, 37, 48, 0.12);
  --green: #1fe08f;
  --green-soft: rgba(31, 224, 143, 0.12);
  --amber: #ffb02e;
  --amber-soft: rgba(255, 176, 46, 0.13);
  --blue: #4c9bff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1100px 520px at 70% -12%, rgba(22, 117, 255, 0.16), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* Marke */
.brand { display: inline-flex; align-items: baseline; gap: 0; font-weight: 800; letter-spacing: 0.02em; font-size: 20px; }
.brand::before { content: ""; width: 1.3em; height: 1.3em; align-self: center; margin-right: 0.4em; flex: none;
  background: url("emblem.png") center / contain no-repeat; filter: drop-shadow(0 0 10px rgba(22, 117, 255, 0.45)); }
.brand b { background: linear-gradient(180deg, #8cc7ff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(22, 117, 255, 0.45)); }
.brand span { letter-spacing: 0; background: linear-gradient(180deg, #fafcff, #b4b9c2 60%, #e9edf3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { font-weight: 600; color: var(--muted); letter-spacing: 0.1em; font-size: 11px; text-transform: uppercase; margin-left: 10px; }

/* Karten */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card.tight { padding: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { color: var(--muted); font-size: 13px; }
.card.alert { border-color: rgba(255, 176, 46, 0.5); background: linear-gradient(180deg, rgba(255, 176, 46, 0.09), var(--card)); }
.card.danger { border-color: rgba(255, 37, 48, 0.45); }

/* Formulare */
label.field { display: block; font-size: 12.5px; color: var(--muted); font-weight: 550; }
label.field > span { display: block; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: #050d1c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled { opacity: 0.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.help { font-size: 12.5px; color: var(--muted); }
.help.err { color: #ff9aa0; }
.help.ok { color: var(--green); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--card-2); color: var(--text); border: 1px solid var(--line-2);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { border-color: #3d525c; background: #13233d; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 22px rgba(22, 117, 255, 0.32); }
.btn.primary:hover { background: #ff3d47; border-color: #ff3d47; }
.btn.ok { background: var(--green-soft); border-color: rgba(31, 224, 143, 0.4); color: var(--green); }
.btn.ok:hover { background: rgba(31, 224, 143, 0.2); }
.btn.danger { background: var(--red-soft); border-color: rgba(255, 37, 48, 0.4); color: #ff8a90; }
.btn.danger:hover { background: rgba(255, 37, 48, 0.2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }
.btn svg, .icon svg { display: block; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: #ff8a90; }
.badge.blue { background: rgba(76, 155, 255, 0.13); color: var(--blue); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: rgba(255, 255, 255, 0.015); position: sticky; top: 0; }
td { padding: 12px 16px; border-bottom: 1px solid rgba(30, 42, 48, 0.7); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: rgba(255, 255, 255, 0.03); }
td.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Statistik-Kacheln */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .num { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .sub { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.stat.alert { border-color: rgba(255, 176, 46, 0.55); }
.stat.alert .num { color: var(--amber); }

/* Tabs / Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--accent-soft); border-color: rgba(22, 117, 255, 0.5); color: #b9d6ff; }

/* Toast */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--card-2); border: 1px solid var(--line-2); border-left: 3px solid var(--green); border-radius: 10px; padding: 12px 15px; box-shadow: var(--shadow);
  animation: rise 0.2s ease-out; font-size: 14px; }
.toast.error { border-left-color: var(--red); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Dialog */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(3px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 0.15s; }
.overlay.side { justify-content: flex-end; padding: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog { background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.dialog.wide { width: min(720px, 100%); }
.overlay.side .dialog { border-radius: 0; height: 100vh; max-height: none; width: min(560px, 100%); animation: slide 0.2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 4px; }
.dialog-body { padding: 12px 20px 8px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; flex-wrap: wrap; }

/* Sonstiges */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.callout { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); font-size: 13.5px; color: var(--muted); }
.callout svg { flex: none; margin-top: 2px; }
.callout.warn { border-color: rgba(255, 176, 46, 0.4); background: var(--amber-soft); color: #ffd28a; }
.callout.good { border-color: rgba(31, 224, 143, 0.35); background: var(--green-soft); color: #9af0c8; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 38px; }

/* Diagramme */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 10.5px; }
.chart rect.bar { transition: opacity 0.12s; }
.chart g.col:hover rect.bar { opacity: 0.75; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

@media (max-width: 720px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  th, td { padding: 10px 12px; }
  h1 { font-size: 22px; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* Listenzeile in Karten (Kundenbereich, Admin) */
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid rgba(30, 42, 48, 0.7); }
.list-item:last-child { border-bottom: 0; }

/* Sprachumschalter EN | DE */
.auth-lang { display: flex; justify-content: flex-end; align-self: stretch; margin-bottom: 4px; }
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.lang-switch button.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px rgba(22, 117, 255, 0.45); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
