/* Wardex One Dashboard – Layout B „Kopfleiste und Karten“, Markenfarben aus dem Logo (Graphit, Gold, Rot) */
@font-face { font-family: 'Space Grotesk'; font-weight: 400; font-display: swap; src: url('/static/fonts/sg-400.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 700; font-display: swap; src: url('/static/fonts/sg-700.woff2') format('woff2'); }

:root {
  --bg: #1C1D21;
  --bar: #202125;
  --surface: #24262B;
  --surface-2: #2A2C31;
  --border: #3A3C43;
  --text: #F4F4F5;
  --muted: #B4B4BC;
  --gold: #D9A930;
  --gold-hover: #E8BE45;
  --red: #D7263D;
  --ok-bg: #1F3A2B;
  --ok-text: #7EE2A8;
  --warn-bg: #3A2A1B;
  --warn-text: #F2C27A;
  --discord: #5865F2;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 'Space Grotesk', system-ui, sans-serif;
}
a { color: var(--gold); }
a:hover { color: var(--gold-hover); }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
h1 { font-size: 30px; line-height: 1.2; margin: 0; }
h2 { font-size: 20px; line-height: 1.3; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.small { font-size: 14px; }
.strong { font-weight: 700; }
.grow { flex: 1; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex-shrink: 0; vertical-align: -0.15em; }
.row { display: flex; align-items: center; gap: 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Kopfleiste mit Serverwahl und Reitern */
.top { background: var(--bar); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 32px; }
.brand { position: relative; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.sep { color: var(--border); font-size: 20px; }
.switcher { position: relative; }
.switcher summary {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; cursor: pointer; list-style: none;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-weight: 700;
}
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary:hover, .switcher[open] summary { border-color: var(--gold); }
.switcher summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.switcher-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-icon { width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; font-size: 11px; }
.switcher-list {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 260px; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.switcher-list a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 8px; color: var(--text); text-decoration: none; min-height: 44px; }
.switcher-list a:hover, .switcher-list a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.switcher-all { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.switcher-all a { color: var(--gold); }
.user { display: flex; align-items: center; gap: 10px; }
.user form { margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 13px; }
.user-name { font-weight: 700; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 0 32px; flex-wrap: wrap; }
.tabs a { padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--gold); }

/* Inhalt */
.wrap { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 36px 32px 56px; display: flex; flex-direction: column; gap: 28px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head.row { flex-direction: row; gap: 16px; }
.initials { display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text); font-weight: 700; }
.head-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; flex-shrink: 0; }
.pill { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill .dot, .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ok-text { color: var(--ok-text); }
.warn { color: var(--warn-text); }
.notice { background: var(--ok-bg); color: var(--ok-text); border-radius: var(--radius); padding: 12px 16px; }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.back { text-decoration: none; font-weight: 700; }

/* Anmeldung und Meldungen */
.login { width: 100%; max-width: 440px; margin: 32px auto; padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.btn-discord { align-self: stretch; display: flex; align-items: center; justify-content: center; min-height: 52px; background: var(--discord); color: #FFFFFF; font-size: 16px; }
.btn-discord:hover { background: #4752C4; color: #FFFFFF; }

/* Serverübersicht */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.server { padding: 0; overflow: hidden; color: var(--text); text-decoration: none; height: 100%; }
a.server:hover { border-color: var(--gold); color: var(--text); }
.server-banner { display: block; height: 72px; background: linear-gradient(135deg, var(--surface-2), var(--border)); }
.server-body { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 20px; }
.server-icon { width: 64px; height: 64px; margin-top: -32px; border-radius: 18px; border: 3px solid var(--surface); font-size: 20px; background: var(--surface-2); }
.server-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.server-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.is-missing .server-name { color: var(--muted); }

/* Server: Übersicht */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat strong { font-size: 28px; line-height: 1.1; }
.stat .of { font-size: 16px; font-weight: 400; }
.split { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.split > :first-child { flex: 2 1 420px; }
.split > :last-child { flex: 1 1 280px; }
.plugin-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 20px; color: var(--text); text-decoration: none; }
a.plugin-row:hover { border-color: var(--gold); color: var(--text); }
.plugin-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--gold); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.plugin-icon.lg { width: 56px; height: 56px; border-radius: 14px; }
.plugin-text { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plugin-name { font-weight: 700; }
.plugin-open { font-weight: 700; text-decoration: none; }
.plugin-card { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.placeholder { border-style: dashed; color: var(--muted); display: flex; align-items: center; justify-content: center; min-height: 140px; background: transparent; }

/* Schalter für Plugins (Knopf im eigenen Formular) */
.switch-form { margin: 0; display: inline-flex; }
.toggle { width: 48px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); position: relative; cursor: pointer; flex-shrink: 0; }
.toggle .knob { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.15s; }
.toggle.is-on { background: var(--gold); border-color: var(--gold); }
.toggle.is-on .knob { transform: translateX(20px); background: var(--bg); }
.toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

a.toggle { display: inline-block; }

/* Bestätigung vor dem Umschalten eines Plugins */
.confirm { width: 100%; max-width: 520px; margin: 24px auto; padding: 32px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.confirm h1 { font-size: 26px; }
.confirm-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.confirm-actions form { margin: 0; }

/* Plugin-Seiten: Liste links, Inhalt rechts */
.plugin-layout { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.plugin-nav { flex: 0 1 220px; display: flex; flex-direction: column; gap: 4px; }
.plugin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; color: var(--muted); text-decoration: none; font-weight: 500; min-height: 44px; }
.plugin-nav a:hover { color: var(--text); }
.plugin-nav a[aria-current="page"] { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 700; }
.plugin-nav .dot { width: 8px; height: 8px; }
.dot.on { background: var(--ok-text); }
.dot.off { background: var(--border); }
.plugin-nav-more { padding: 10px 12px; }
.plugin-main { flex: 999 1 560px; min-width: 0; gap: 24px; }
.plugin-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; }
.plugin-head h1 { font-size: 26px; }
.plugin-head .grow { flex: 1 1 260px; }

/* Tabellen */
.table-box { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 12px 16px; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: top; }
td a { font-weight: 700; text-decoration: none; }

/* Einstellungen und Formulare */
.settings { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.settings fieldset { width: 100%; }
fieldset.card { min-width: 0; }
legend { font-weight: 700; color: var(--gold); padding: 0 6px; }
.setting { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; cursor: pointer; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex-shrink: 0; width: 48px; height: 28px; margin-top: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.setting input:checked + .switch { background: var(--gold); border-color: var(--gold); }
.setting input:checked + .switch::after { transform: translateX(20px); background: var(--bg); }
.setting input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 2px; }
.setting-text { display: flex; flex-direction: column; }
.setting-label { font-weight: 700; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 3px 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; min-width: 0; }
.radio { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.indent { margin-left: 26px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
input[type=text], input[type=number], select {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; min-height: 44px; width: 100%; min-width: 0;
}
input[type=text]:focus-visible, input[type=number]:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
input[type=range] { width: 100%; accent-color: var(--gold); min-height: 32px; }
.group-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 8px; }
.error { background: #3A1E22; color: #F5B7BF; border-radius: var(--radius); padding: 12px 16px; }
.error ul { margin: 6px 0 0; padding-left: 20px; }
.danger-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--border); }

/* Schaltflächen */
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; border-radius: 8px; padding: 0 18px; min-height: 44px; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--gold); color: #1C1D21; }
.btn-primary:hover { background: var(--gold-hover); color: #1C1D21; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold); color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-danger { background: transparent; color: #F5B7BF; border-color: #7A2E38; }
.btn-danger:hover { border-color: var(--red); color: #FFFFFF; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.foot { padding: 14px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 640px) {
  .top-row, .tabs { padding-left: 16px; padding-right: 16px; }
  .wrap { padding: 24px 16px 48px; }
  .user-name, .sep { display: none; }
  .switcher-name { max-width: 140px; }
  .indent { margin-left: 0; }
}

/* Testhinweise: liegen über dem Live-Layout, verschieben nichts */
.test-stripe {
  position: fixed; top: 0; left: 0; right: 0; height: 8px; z-index: 10; pointer-events: none;
  background: repeating-linear-gradient(45deg, #FFFFFF 0 12px, #2A2C31 12px 24px);
}
/* „TEST BUILD“ hängt mittig am Warnstreifen, damit er Serverwahl und Konto nicht verdeckt */
.test-badge {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 11; pointer-events: none; white-space: nowrap;
  background: #FFFFFF; color: #2A2C31; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; padding: 2px 10px; border-radius: 0 0 4px 4px;
}

/* Live-Ansicht umschalten (nur Test-Dashboard): bleibt auch in der Live-Ansicht sichtbar, damit man zurückkommt */
.view-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 20;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-decoration: none;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); opacity: 0.85;
}
.view-toggle:hover, .view-toggle:focus-visible { opacity: 1; color: var(--text); border-color: var(--gold); outline: none; }
.view-toggle.is-on { color: var(--gold); border-color: var(--gold); }
