/* ==========================================================================
   DBD Stats
   ========================================================================== */

:root {
  --bg: #08090d;
  --surface: #12141b;
  --surface-2: #171a23;
  --surface-3: #1e222c;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eceef3;
  --muted: #8b93a5;
  --killer: #ff5d63;
  --survivor: #59b4f0;
  --gold: #f2b65c;
  --good: #4fcb9b;
  --bad: #f2607a;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow: 0 20px 45px -25px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  letter-spacing: -0.005em;
}

.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 420px at 8% -8%, rgba(255, 93, 99, 0.16), transparent 62%),
    radial-gradient(680px 400px at 96% 4%, rgba(89, 180, 240, 0.12), transparent 60%);
}

main { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -0.02em; }

/* --------------------------------------------------------------- Topbar -- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(8, 9, 13, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar__glyph { color: var(--killer); font-size: 1.1rem; }

.topbar__nav {
  display: flex;
  gap: 0.2rem;
  margin-right: auto;
  padding: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.topbar__nav a {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.topbar__nav a:hover { color: var(--text); }
.topbar__nav a.is-active { color: #fff; background: var(--surface-3); }

.topbar__user { display: flex; align-items: center; gap: 0.6rem; }
.topbar__email { color: var(--muted); font-size: 0.82rem; }

/* ---------------------------------------------------------------- Layout -- */
.app-view, .auth-view {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 4rem;
}

.page-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.page-head h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.page-head__meta { font-size: 0.85rem; color: var(--muted); }

.columns {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 940px) {
  .columns { grid-template-columns: 1fr; }
}

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.75rem; }

/* ----------------------------------------------------------------- Panel -- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.15rem clamp(0.9rem, 2vw, 1.4rem) 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.panel__head { margin-bottom: 1rem; }
.panel__head h2 { font-size: 1.02rem; }
.panel__head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel__meta { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel--editing { border-color: rgba(89, 180, 240, 0.45); }

.subhead {
  margin-bottom: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.subhead--killer { color: var(--killer); }
.subhead--survivor { color: var(--survivor); }

/* ------------------------------------------------------------------ KPIs -- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi {
  position: relative;
  padding: 1rem 1.1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  filter: blur(14px);
}

.kpi--killer::after { background: rgba(255, 93, 99, 0.14); }
.kpi--survivor::after { background: rgba(89, 180, 240, 0.14); }
.kpi--bp::after { background: rgba(242, 182, 92, 0.14); }

.kpi__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
}

.kpi__value {
  display: block;
  margin: 0.3rem 0 0.15rem;
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.kpi__hint { display: block; font-size: 0.76rem; color: var(--muted); }

/* ------------------------------------------------------------------ Icons -- */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.4em;
  vertical-align: -0.2em;
}

.icon:empty { display: none; }
.icon img { width: 100%; height: 100%; object-fit: contain; }

/* Ersatzdarstellung, solange bzw. falls kein Bild da ist. */
.icon__fallback { font-style: normal; font-size: 0.85em; line-height: 1; }
.icon:has(img) .icon__fallback { display: none; }

.kpi__label .icon { width: 1.3em; height: 1.3em; }
.subhead .icon { width: 1.4em; height: 1.4em; }
.segmented__opt .icon { width: 1.4em; height: 1.4em; }

/* Blutpunkte-Einheit: Icon statt "BP" rechts neben der Zahl. */
.bp-display__unit.icon {
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  transform: translateY(-50%);
}

.bp-display__unit .icon__fallback { font-size: 0.78rem; letter-spacing: 0.12em; color: rgba(242, 182, 92, 0.6); }

/* -------------------------------------------------------- Charakterbilder -- */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line);
}

.avatar--killer { border-color: rgba(255, 93, 99, 0.28); background: linear-gradient(160deg, rgba(255, 93, 99, 0.2), rgba(255, 93, 99, 0.05)); }
.avatar--survivor { border-color: rgba(89, 180, 240, 0.28); background: linear-gradient(160deg, rgba(89, 180, 240, 0.2), rgba(89, 180, 240, 0.05)); }

.avatar__fallback { font-size: 0.75rem; font-weight: 700; color: var(--muted); }

/* Die Portraits sind transparent – sobald ein Bild da ist, müssen die
   Initialen weg, sonst scheinen sie durch. `:has()` greift auch bei
   Bildern aus dem Cache, die Klasse ist der Fallback für ältere Browser. */
.avatar:has(img) .avatar__fallback,
.avatar--has-image .avatar__fallback { display: none; }

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.avatar--xl { width: 72px; height: 72px; border-radius: 16px; }
.avatar--xl .avatar__fallback { font-size: 1.15rem; }
.avatar--lg { width: 88px; height: 88px; border-radius: 16px; }
.avatar--lg .avatar__fallback { font-size: 1.3rem; }

.char-cell { display: inline-flex; align-items: center; gap: 0.7rem; min-width: 0; }
.char-cell__text { min-width: 0; }
.char-cell__name { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-cell__sub { display: block; font-size: 0.72rem; color: var(--muted); }

/* --------------------------------------------------------------- Formular -- */
.field { display: block; margin-bottom: 0.9rem; border: 0; padding: 0; }

.field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  appearance: none;
  padding-right: 2.1rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 53%, calc(100% - 12px) 53%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus, select:focus {
  outline: none;
  border-color: rgba(255, 93, 99, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 93, 99, 0.14);
}

input:disabled, select:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }
option { background: var(--surface-2); color: var(--text); }

.select-row { display: flex; align-items: center; gap: 0.7rem; }
.select-row select { flex: 1; min-width: 0; }
.portrait:empty { display: none; }

/* Segmented Control */
.segmented {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.segmented__opt { flex: 1 1 auto; position: relative; cursor: pointer; min-width: 0; }
.segmented__opt input { position: absolute; opacity: 0; pointer-events: none; }

.segmented__opt > span {
  display: block;
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--muted);
  border-radius: 9px;
  transition: color 0.15s, background 0.15s;
}

.segmented__opt:hover > span { color: var(--text); }

.segmented__opt input:checked + span {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 93, 99, 0.9), rgba(178, 32, 40, 0.9));
}

.segmented__opt--good input:checked + span { background: linear-gradient(135deg, rgba(79, 203, 155, 0.9), rgba(30, 122, 88, 0.9)); }
.segmented__opt--bad input:checked + span { background: linear-gradient(135deg, rgba(242, 96, 122, 0.9), rgba(150, 30, 55, 0.9)); }
.segmented__opt input:focus-visible + span { outline: 2px solid var(--survivor); outline-offset: 2px; }

/* ------------------------------------------------------- Blutpunkte-Feld -- */
.bp-field {
  padding: 0.9rem;
  border: 1px solid rgba(242, 182, 92, 0.22);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(242, 182, 92, 0.08), transparent 70%);
}

.bp-display { position: relative; }

.bp-display input {
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: right;
  padding: 0.45rem 2.9rem 0.45rem 0.8rem;
  color: var(--gold);
  border-color: rgba(242, 182, 92, 0.25);
  background:
    linear-gradient(90deg, rgba(242, 182, 92, 0.14) var(--bp-fill, 0%), var(--surface-2) var(--bp-fill, 0%));
}

.bp-display input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 182, 92, 0.16);
}

.bp-display__unit {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: rgba(242, 182, 92, 0.6);
  pointer-events: none;
}

.bp-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  margin: 0.9rem 0 0.75rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), rgba(242, 182, 92, 0.12));
  cursor: pointer;
}

.bp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffdb9a, var(--gold));
  border: 2px solid var(--bg);
  box-shadow: 0 0 10px rgba(242, 182, 92, 0.5);
}

.bp-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffdb9a, var(--gold));
  border: 2px solid var(--bg);
}

.bp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.chip {
  flex: 1 1 auto;
  padding: 0.4rem 0.55rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--gold);
  background: rgba(242, 182, 92, 0.1);
  border: 1px solid rgba(242, 182, 92, 0.22);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}

.chip:hover { background: rgba(242, 182, 92, 0.2); }
.chip.is-pulsing { transform: scale(1.07); }
.chip--reset { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.chip--reset:hover { background: var(--surface-3); }

/* --------------------------------------------------------------- Buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}

.btn:active { transform: translateY(1px); }

.btn--primary { color: #fff; background: linear-gradient(135deg, #ff5d63, #b21f28); }
.btn--primary:hover { background: linear-gradient(135deg, #ff7278, #c5242e); }

.btn--ghost { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--line-strong); }

.btn--passkey {
  color: var(--survivor);
  background: rgba(89, 180, 240, 0.12);
  border-color: rgba(89, 180, 240, 0.3);
}

.btn--passkey:hover { background: rgba(89, 180, 240, 0.2); }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn--block { width: 100%; margin-top: 0.3rem; }

.link-btn {
  display: block;
  margin: 0.8rem auto 0;
  padding: 0;
  font: inherit;
  font-size: 0.83rem;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover { color: var(--text); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.icon-btn:hover { color: var(--survivor); background: rgba(89, 180, 240, 0.12); border-color: rgba(89, 180, 240, 0.3); }
.icon-btn--danger:hover { color: var(--killer); background: rgba(255, 93, 99, 0.12); border-color: rgba(255, 93, 99, 0.3); }
.icon-btn.is-editing { color: var(--survivor); background: rgba(89, 180, 240, 0.18); border-color: rgba(89, 180, 240, 0.45); }
.row-actions { display: flex; gap: 0.2rem; justify-content: flex-end; }

/* ------------------------------------------------------------------ Tabs -- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 550;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--text); }
.tab.is-active { color: #fff; background: var(--surface-3); }

.tab__count {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}

/* ---------------------------------------------------------------- Serien -- */
.streak-groups { display: grid; gap: 1.5rem; }
.streak-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.6rem; }

.streak-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem 0.6rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.15s, transform 0.15s;
}

.streak-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.streak-card--hot {
  border-color: rgba(255, 93, 99, 0.35);
  background: linear-gradient(120deg, rgba(255, 93, 99, 0.12), var(--surface-2) 60%);
}

.streak-card__body { flex: 1; min-width: 0; }
.streak-card__name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streak-card__meta { display: block; font-size: 0.74rem; color: var(--muted); }

.streak-card__value {
  font-size: 1.35rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--muted);
}

.streak-card--hot .streak-card__value { color: #ff9d6b; }

.streak-badge { font-weight: 650; color: #ff9d6b; white-space: nowrap; }

.mode-tag {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ----------------------------------------------------------------- Login -- */
.auth-view { display: flex; justify-content: center; padding-top: clamp(2rem, 9vh, 5rem); }

.auth-card {
  width: min(420px, 100%);
  padding: 2rem clamp(1.25rem, 4vw, 2rem) 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.auth-card__brand { text-align: center; margin-bottom: 1.4rem; }
.auth-card__glyph { display: block; font-size: 2rem; color: var(--killer); }
.auth-card__brand h1 { margin: 0.35rem 0 0.2rem; font-size: 1.35rem; letter-spacing: 0.12em; text-transform: uppercase; }
.auth-card__brand p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.auth-actions { display: flex; gap: 0.5rem; }
.auth-actions .btn { flex: 1; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-hint { min-height: 1.2rem; margin: 0.8rem 0 0; font-size: 0.83rem; text-align: center; color: var(--muted); }
.auth-hint--error { color: var(--bad); }
.auth-hint--success { color: var(--good); }

/* -------------------------------------------------------------- Passkeys -- */
.passkey-list { display: grid; gap: 0.5rem; margin-bottom: 0.9rem; }

.passkey-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.passkey-item__icon { font-size: 1.05rem; }
.passkey-item__main { flex: 1; min-width: 0; }
.passkey-item__main strong { display: block; font-size: 0.92rem; font-weight: 600; }
.passkey-item__meta { display: block; font-size: 0.75rem; color: var(--muted); }
.passkey-hint { min-height: 1.1rem; margin: 0.7rem 0 0; font-size: 0.83rem; color: var(--muted); }
.passkey-hint--error { color: var(--bad); }
.passkey-hint--success { color: var(--good); }

/* --------------------------------------------------------------- Tabellen -- */
.table-wrap { overflow-x: auto; margin: 0 -0.4rem; padding: 0 0.4rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

.table th {
  padding: 0.4rem 0.6rem 0.65rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { text-align: center; color: var(--muted); padding: 1.75rem 0; }
.empty { color: var(--muted); font-size: 0.86rem; }
.notes { color: var(--muted); max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
}

.pill--good { color: var(--good); border-color: rgba(79, 203, 155, 0.35); background: rgba(79, 203, 155, 0.1); }
.pill--bad { color: var(--bad); border-color: rgba(242, 96, 122, 0.35); background: rgba(242, 96, 122, 0.1); }
.pill--k0 { color: var(--muted); }
.pill--k1 { color: #d6b58f; }
.pill--k2 { color: #e5a463; }
.pill--k3 { color: #ef7d54; }
.pill--k4 { color: #fff; border-color: rgba(255, 93, 99, 0.5); background: rgba(255, 93, 99, 0.25); }

.pill .icon { width: 1.1em; height: 1.1em; margin-right: 0.3em; }
.bar__label .icon { width: 1.2em; height: 1.2em; }

.tally { display: inline-flex; align-items: center; justify-content: flex-end; font-weight: 600; }
.tally .icon { width: 1.15em; height: 1.15em; margin-right: 0.3em; }
.tally--good { color: var(--good); }
.tally--bad { color: var(--bad); }

.quote { font-weight: 600; }
.quote--high { color: var(--good); }
.quote--low { color: var(--muted); }

/* ------------------------------------------------------------------ Bars -- */
.bars { display: grid; gap: 0.45rem; }

.bar {
  display: grid;
  grid-template-columns: minmax(90px, 190px) 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.86rem;
}

.bar__label { color: var(--muted); min-width: 0; overflow: hidden; }
.bar__label .avatar { width: 36px; height: 36px; border-radius: 10px; }
.bar__label .avatar__fallback { font-size: 0.65rem; }
.bar__track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar__fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff5d63, #b21f28); transition: width 0.35s ease; }
.bar__fill--good { background: linear-gradient(90deg, #4fcb9b, #24805d); }
.bar__fill--bad { background: linear-gradient(90deg, #f2607a, #922440); }
.bar__fill--killer { background: linear-gradient(90deg, #ff5d63, #b21f28); }
.bar__fill--survivor { background: linear-gradient(90deg, #59b4f0, #1c6396); }
.bar__fill--k0 { background: linear-gradient(90deg, #6f7684, #3b4049); }
.bar__fill--k1 { background: linear-gradient(90deg, #d6b58f, #856b48); }
.bar__fill--k2 { background: linear-gradient(90deg, #e5a463, #93602c); }
.bar__fill--k3 { background: linear-gradient(90deg, #ef7d54, #96351c); }
.bar__fill--k4 { background: linear-gradient(90deg, #ff5d63, #b21f28); }
.bar__value { font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; color: var(--text); }

/* ---------------------------------------------------------------- Filter -- */
.filters { padding-bottom: 1.15rem; }
.filters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem 0.8rem; align-items: end; }
.filters__grid .field { margin-bottom: 0; }

/* ---------------------------------------------------------- Einstellungen -- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.settings-grid .panel { margin-bottom: 0; }
.settings-form .field:last-of-type { margin-bottom: 1rem; }
.settings-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.form-hint { min-height: 1.1rem; margin: 0.7rem 0 0; font-size: 0.83rem; color: var(--muted); }
.form-hint--error { color: var(--bad); }
.form-hint--success { color: var(--good); }

.icon-btn.is-active { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }

/* ------------------------------------------------------------ Ladefehler -- */
.boot-error {
  display: grid;
  gap: 0.35rem;
  max-width: 640px;
  margin: clamp(2rem, 8vh, 4rem) auto 0;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(242, 96, 122, 0.4);
  border-radius: var(--r-lg);
  font-size: 0.9rem;
}

.boot-error strong { color: var(--bad); font-weight: 650; }
.boot-error span { color: var(--muted); }

.boot-error code {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-word;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 0.4rem 0.6rem;
}

.boot-error code:empty { display: none; }

/* ----------------------------------------------------------------- Toast -- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 160%);
  z-index: 50;
  max-width: min(92vw, 460px);
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  color: #fff;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast--success { border-color: rgba(79, 203, 155, 0.45); }
.toast--error { border-color: rgba(242, 96, 122, 0.5); }

/* ---------------------------------------------------------------- Mobile -- */
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 0; padding: 0.22rem 0.2rem; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }
  .table td.row-actions::before { margin-right: auto; }
  .notes { max-width: none; }
  .topbar__email { display: none; }
  .bar { grid-template-columns: minmax(80px, 130px) 1fr auto; }
  .page-head { flex-wrap: wrap; gap: 0.35rem 0.75rem; }
}

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