/* ═══════════════════════════════════════════════════════════════════════════
   Empire Bot Dashboard · Corporate Design "Luxury Tech"
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #171721;
  --bg-hover: #1d1d2b;
  --border: #2a2a3a;

  --text-primary: #ffffff;
  --text-secondary: #b2b2c4;
  --text-muted: #7a7a91;

  --success: #32d583;
  --warning: #fbbf24;
  --error: #f04438;
  --info: #338cff;

  --gradient: linear-gradient(90deg, #eb004c, #d300a7, #b808f1, #7845ff, #338cff);
  --accent: #7845ff;

  --radius: 16px;
  --radius-sm: 10px;
  --pad: 24px;
  --ease: 180ms cubic-bezier(0.2, 0, 0.2, 1);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: Inter, 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Ambient gradient glow in the background */
.glow {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 60vh;
  background: radial-gradient(ellipse at 20% 0%, rgba(235, 0, 76, 0.16), transparent 60%),
    radial-gradient(ellipse at 80% 10%, rgba(56, 140, 255, 0.16), transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(184, 8, 241, 0.12), transparent 60%);
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform var(--ease), background var(--ease), border-color var(--ease), opacity var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; transform: scale(1.02); }
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--gradient); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--gradient); filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(240, 68, 56, 0.5); color: #ff9c94; }
.btn-danger:hover { background: rgba(240, 68, 56, 0.12); }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ─── Landing page ─────────────────────────────────────────────────────────── */
.landing-main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.landing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 72px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text-primary); text-decoration: none; }
.brand:hover { text-decoration: none; }
/* Das Zeichen selbst, nicht mehr ein Farbverlauf als Platzhalter. 64px Quelle
   fuer 30px Kantenlaenge, damit es auf hochaufloesenden Bildschirmen scharf
   bleibt. Steht hier und nicht im Markup: Dieselbe Regel traegt die Startseite,
   die Aenderungsliste und das Dashboard. */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  /* Zwei Ebenen, durch Komma getrennt: Das Zeichen liegt oben, der bisherige
     Farbverlauf darunter. Faellt das Bild aus, steht dort wieder der Verlauf
     statt eines Lochs. Beides in eine Ebene zu schreiben waere ungueltig - der
     Browser verwuerfe die ganze Regel. */
  background: url('/assets/icon-64.png') center / cover no-repeat, var(--gradient);
  box-shadow: 0 0 24px rgba(120, 69, 255, 0.45);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }

.hero { max-width: 760px; margin-bottom: 72px; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hero h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 800; margin-bottom: 20px; }
.lead { color: var(--text-secondary); font-size: 17px; max-width: 620px; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hint { margin-top: 20px; color: #ff9c94; font-size: 14px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  transition: transform var(--ease), border-color var(--ease);
}
.feature:hover { transform: translateY(-2px); border-color: #3a3a52; }
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { margin: 0; color: var(--text-secondary); font-size: 14px; }

.landing-head-actions { display: inline-flex; align-items: center; gap: 10px; }

/* Die Abschnitte unter dem Aufmacher: Ueberschrift, ein Satz, dann Karten. */
.landing-section { margin-bottom: 72px; }
.landing-section h2,
.landing-close h2 {
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.section-lead { color: var(--text-secondary); font-size: 16px; max-width: 620px; margin: 0 0 28px; }

/* Merkt an, ab welchem Tarif ein Punkt gilt - direkt an der Ueberschrift, weil
   die Angabe sonst erst im Kleingedruckten auftaucht. */
.pill {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--accent);
}

.landing-note { margin: 20px 0 0; color: var(--text-muted); font-size: 13px; max-width: 620px; }

.tier-save { color: var(--success); font-weight: 600; }

/* ─── Änderungsliste ───────────────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 14px; }
.log-list-full { gap: 22px; margin-bottom: 64px; }

.log-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.log-entry h3 { margin: 0 0 8px; font-size: 17px; }
.log-entry p { margin: 0 0 10px; color: var(--text-secondary); font-size: 14px; }
.log-entry p:last-child { margin-bottom: 0; }
.log-entry-small { padding: 16px 20px; }
.log-teaser { margin: 0; }

.log-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.log-version { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.log-date { font-size: 13px; color: var(--text-muted); }

/* Die Stufe traegt die Farbe, nicht der ganze Eintrag: In einer Liste soll das
   Auge die groesseren Aenderungen finden, ohne jeden Kasten zu lesen. */
.log-level {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
}
.log-patch { background: #3a3a52; }
.log-feature { background: var(--accent); }
.log-major { background: var(--gradient); }

.log-points { margin: 0 0 10px; padding-left: 20px; color: var(--text-secondary); font-size: 14px; }
.log-points li { margin-bottom: 4px; }
.log-points li::marker { color: var(--text-muted); }

.landing-close {
  padding: 40px 0 8px;
  border-top: 1px solid var(--border);
}

.landing-foot { margin-top: 56px; color: var(--text-muted); font-size: 13px; text-align: center; }

/* ─── App shell ────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: rgba(10, 10, 15, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-guild { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--text-secondary); font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); }

.layout { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 24px; max-width: 1440px; margin: 0 auto; padding: 24px; }

.sidebar {
  position: sticky;
  top: 82px;
  flex: 0 0 250px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 4px;
}
.sidebar-group { margin: 14px 0 6px; padding: 0 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--ease), color var(--ease);
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--bg-card); border-color: var(--border); color: var(--text-primary); }
.nav-item.active::before {
  content: '';
  width: 3px;
  height: 18px;
  margin-left: -6px;
  border-radius: 2px;
  background: var(--gradient);
}
.nav-item svg { flex: 0 0 17px; opacity: 0.8; }
.nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex: 0 0 auto; }
.nav-dot.on { background: var(--success); box-shadow: 0 0 8px rgba(50, 213, 131, 0.6); }

.content { flex: 1; min-width: 0; }

.loading { display: flex; align-items: center; gap: 12px; padding: 60px 0; color: var(--text-muted); }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Cards, sections ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 20px;
}
.card-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.card-head h2 { font-size: 20px; }
.card-head p { margin: 6px 0 0; color: var(--text-secondary); font-size: 14px; max-width: 62ch; }
.card-head .spacer { margin-left: auto; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin-bottom: 6px; }
.page-head p { margin: 0; color: var(--text-secondary); }

.section-title {
  margin: 28px 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ─── Stat tiles ───────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient); opacity: 0.85; }
.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.stat-value { font-size: 27px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.stat-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.field label, .field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-help { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }

input[type='text'], input[type='number'], textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--ease), background var(--ease);
}
input:hover, textarea:hover, select:hover { border-color: #3a3a52; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); background: var(--bg-primary); }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7a91' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.switch span::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--ease), background var(--ease);
}
.switch input:checked + span { background: var(--gradient); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Multi select (channels / roles) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}
.chip button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.chip button:hover { color: var(--error); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* String list */
.string-list { display: flex; flex-direction: column; gap: 8px; }
.string-row { display: flex; gap: 8px; }
.string-row input { flex: 1; }

/* Member search - a picker with every member would be far too heavy */
.user-picker { display: flex; flex-direction: column; gap: 8px; }
.user-results { display: flex; flex-direction: column; gap: 4px; }
.user-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.user-result:hover { background: var(--bg-hover); border-color: var(--accent); }
.user-result:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-avatar { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px; }

/* One-off module action, e.g. posting the ticket panel */
.action-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.action-bar > div { flex: 1; min-width: 200px; }
.action-bar .field-help { margin-top: 2px; }

/* Repeater */
.repeater { display: flex; flex-direction: column; gap: 12px; }
.repeater-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.repeater-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.repeater-head strong { font-size: 13px; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.repeater-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.repeater-grid .field { margin-bottom: 0; }
/* A nested repeater (e.g. the questions of a ticket category) needs the full row. */
.repeater-grid > .field:has(.repeater) { grid-column: 1 / -1; }
.repeater-item .repeater-item { background: var(--bg-card); }

/* Sticky save bar */
.savebar {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 14px 18px;
  background: rgba(23, 23, 33, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.savebar .status { color: var(--text-muted); font-size: 13px; margin-right: auto; }
.savebar.dirty { border-color: rgba(120, 69, 255, 0.6); }

/* ─── Guild picker ─────────────────────────────────────────────────────────── */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.guild-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform var(--ease), border-color var(--ease);
  color: inherit;
  text-decoration: none;
}
.guild-card:hover { transform: scale(1.02); border-color: #3a3a52; text-decoration: none; }
.guild-card.missing { opacity: 0.62; }
.guild-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--bg-hover); object-fit: cover; flex: 0 0 48px; }
.guild-icon.sm { width: 26px; height: 26px; border-radius: 8px; flex: 0 0 26px; }
.guild-icon.placeholder { display: grid; place-items: center; font-weight: 700; color: var(--text-secondary); }
.guild-meta { min-width: 0; }
.guild-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-meta span { color: var(--text-muted); font-size: 13px; }

/* ─── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-secondary); color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
td.wrap { white-space: normal; min-width: 220px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-hover);
}
.badge.ok { color: var(--success); border-color: rgba(50, 213, 131, 0.4); background: rgba(50, 213, 131, 0.1); }
.badge.warn { color: var(--warning); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); }
.badge.err { color: #ff9c94; border-color: rgba(240, 68, 56, 0.4); background: rgba(240, 68, 56, 0.1); }
.badge.info { color: var(--info); border-color: rgba(51, 140, 255, 0.4); background: rgba(51, 140, 255, 0.1); }

.empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* ─── Activity chart ───────────────────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; margin-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; min-width: 0; }
.chart-bar { background: var(--gradient); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity var(--ease); }
.chart-col:hover .chart-bar { opacity: 0.75; }
.chart-label { font-size: 10px; color: var(--text-muted); text-align: center; overflow: hidden; }
.chart-bar.ok { background: var(--success); }
.chart-bar.err { background: var(--error); }

/* Zu- und Abgaenge um eine Mittellinie: obere Haelfte waechst nach oben,
   untere nach unten. Ein Balkenpaar je Tag waere bei 90 Tagen unlesbar. */
.chart-diverge { align-items: stretch; }
.chart-diverge .chart-col { justify-content: center; gap: 0; }
.diverge-half { flex: 1; display: flex; min-height: 0; }
.diverge-half.up { align-items: flex-end; }
.diverge-half.down { align-items: flex-start; border-top: 1px solid var(--border); }
.diverge-half > .chart-bar { width: 100%; }
.diverge-half.down > .chart-bar { border-radius: 0 0 4px 4px; }

/* ─── Toasts ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  min-width: 260px;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  animation: toast-in 200ms cubic-bezier(0.2, 0, 0.2, 1);
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--error); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 940px) {
  .layout { flex-direction: column; padding: 16px; }
  .sidebar {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .sidebar-group { display: none; }
  .nav-item { white-space: nowrap; }
  .nav-item.active::before { display: none; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .topbar-user { width: 100%; margin-left: 0; }
  .field-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ─── Tarif & gesperrte Module ─────────────────────────────────────────────── */
.nav-item.nav-locked { opacity: 0.62; }
.nav-item.nav-locked:hover { opacity: 1; }
.nav-lock {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #fff;
  background: linear-gradient(90deg, #7845ff, #338cff);
}

.upgrade-card { border-color: rgba(120, 69, 255, 0.45); }
.upgrade-card h2 { margin-top: 0; }

.guild-id-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
}
.guild-id-box code { font-size: 15px; letter-spacing: 0.4px; color: var(--text-primary); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 22px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Business hebt sich vom Pro-Abzeichen ab, damit die Stufen unterscheidbar sind. */
.nav-lock.lock-business { background: linear-gradient(90deg, #eb004c, #b808f1); }

/* ─── Tarifvergleich ───────────────────────────────────────────────────────── */
.tier-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tier-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.tier-card.is-top { border-color: rgba(120, 69, 255, 0.5); }
.tier-card.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
/* Der farbige Streifen markiert die oberste Stufe, ohne Text zu brauchen. */
.tier-card.is-top::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--gradient);
}

.tier-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
  background: var(--accent);
}

.tier-card h3 { margin: 0; font-size: 20px; }
.tier-pitch { margin: 0; color: var(--text-secondary); font-size: 14px; min-height: 40px; }

.tier-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.tier-list li { position: relative; padding-left: 20px; font-size: 14px; color: var(--text-primary); }
.tier-list li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 700; }
.tier-list .tier-carry { color: var(--text-secondary); font-style: italic; }
.tier-list .tier-carry::before { content: "↑"; color: var(--text-muted); }
.tier-list .tier-limit { color: var(--text-muted); }
.tier-list .tier-limit::before { content: "·"; color: var(--text-muted); }

.tier-card .btn { margin-top: auto; }

/* Eine Laufzeit je Knopf, untereinander: nebeneinander wuerde der laengere
   Text ("jaehrlich · 49,99 € · spare 17 %") die Karte auseinanderziehen. */
/* Der Hinweis auf einen zu grossen Server. Warnfarbe statt Fehlerfarbe: Es ist
   nichts kaputt, es waechst nur etwas ueber die kostenlose Stufe hinaus. */
.size-warning { border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.06); }
.size-warning h2 { color: var(--warning); }

.buy-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.buy-actions .btn { margin-top: 0; }

.cmp-cell { text-align: center; }
.cmp-yes { color: var(--success); font-weight: 700; }
.cmp-no  { color: var(--text-muted); }

.tier-price { display: flex; flex-direction: column; gap: 2px; }
.tier-price strong { font-size: 28px; line-height: 1.1; color: var(--text-primary); }
.tier-per { font-size: 13px; color: var(--text-muted); }
.tier-yearly { font-size: 13px; color: var(--text-secondary); }
.tier-price-tbd { font-size: 16px; color: var(--text-muted); font-style: italic; }

/* ─── Geführte Einrichtung ─────────────────────────────────────────────────── */

.setup-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.setup-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--bg-secondary); overflow: hidden; }
.setup-fill { height: 100%; background: var(--gradient); transition: width var(--ease); }
.setup-percent { font-size: 14px; font-weight: 600; color: var(--text-secondary); min-width: 44px; text-align: right; }

.setup-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.setup-list { display: flex; flex-direction: column; }
.setup-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.setup-step:first-child { border-top: none; }

/* Der Marker ist rund und immer gleich gross, damit die Titel eine Linie
   bilden - offene Punkte bekommen einen leeren Ring statt eines Hakens. */
.setup-mark {
  flex: 0 0 24px; height: 24px; margin-top: 2px;
  display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text-muted);
}
.setup-step.is-done .setup-mark { border-color: var(--success); color: var(--success); }
.setup-step.is-locked .setup-mark { border-style: dashed; font-size: 11px; }

.setup-body { flex: 1; min-width: 0; }
.setup-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.setup-step.is-done .setup-title strong { color: var(--text-secondary); }
.setup-step.is-locked .setup-title strong { color: var(--text-muted); }
.setup-body .field-help { margin: 0; }

.setup-step .btn { flex: 0 0 auto; align-self: center; }

@media (max-width: 720px) {
  .setup-step { flex-wrap: wrap; }
  .setup-step .btn { margin-left: 38px; }
}


/* ─── Dialog ───────────────────────────────────────────────────────────────── */

.dialog-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(5, 5, 9, 0.72);
  backdrop-filter: blur(3px);
  animation: dialog-in 140ms ease-out;
}

.dialog {
  width: min(520px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* Der Verlauf oben als schmale Kante - dasselbe Zeichen wie auf den Karten,
   damit der Dialog nicht wie ein Fremdkörper wirkt. */
.dialog::before {
  content: ''; display: block; height: 3px;
  background: var(--gradient);
}

.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px 0;
}
.dialog-head h2 { font-size: 18px; margin: 0; }

.dialog-close {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.dialog-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.dialog-body { padding: 12px 22px 4px; }
.dialog-body p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.dialog-body .field-help { color: var(--text-muted); }

.dialog-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 20px;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ─── Pflichtseiten ────────────────────────────────────────────────────────── */

.site-foot {
  padding: 18px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.site-foot a { color: var(--text-secondary); text-decoration: none; }
.site-foot a:hover { color: var(--text-primary); text-decoration: underline; }

.legal-page { background: var(--bg-primary); }

.legal {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  color: var(--text-secondary);
  line-height: 1.65;
}
.legal h1 { font-size: 30px; color: var(--text-primary); margin: 0 0 28px; }
.legal h2 { font-size: 18px; color: var(--text-primary); margin: 32px 0 10px; }
.legal h3 { font-size: 15px; color: var(--text-primary); margin: 22px 0 8px; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--info); }
.legal code {
  padding: 2px 6px; border-radius: 5px;
  background: var(--bg-card); color: var(--text-primary);
  font-size: 13px;
}

.legal-back { display: inline-block; margin-bottom: 20px; font-size: 14px; color: var(--text-muted); text-decoration: none; }
.legal-back:hover { color: var(--text-primary); }

/* Der Hinweis auf fehlende Angaben soll auffallen - eine halb ausgefüllte
   Pflichtseite ist schlimmer als eine, die ihren Zustand zugibt. */
.legal-warn {
  margin: 0 0 24px;
  padding: 14px 18px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.07);
}
.legal-warn strong { color: var(--warning); }
.legal-warn p { margin: 6px 0 0; font-size: 14px; }

/* Art. 21 Abs. 4 DSGVO verlangt, dass auf das Widerspruchsrecht „in einer
   verstaendlichen und von anderen Informationen getrennten Form" hingewiesen
   wird. Ein eigener Kasten mit eigener Ueberschrift leistet das - lesbarer
   als der uebliche Block in Grossbuchstaben. */
.legal-objection {
  margin: 32px 0;
  padding: 4px 22px 8px;
  border: 1px solid rgba(120, 69, 255, 0.45);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(120, 69, 255, 0.07);
}
.legal-objection h2 { margin-top: 20px; }
.legal-objection strong { color: var(--text-primary); }

/* Die eigenen Ergänzungen neben einem zugekauften Text. Sichtbar abgesetzt,
   damit niemand sie für einen Teil davon hält - dessen Schutzwirkung hängt
   daran, dass er unverändert bleibt. */
.legal-supplement {
  margin: 36px 0;
  padding: 4px 22px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}
.legal-supplement > h2 { margin-top: 22px; }
.legal-supplement h3 { color: var(--text-primary); }

/* Die Auftragsverarbeiter-Tabelle. Auf dem Handy laesst sie sich seitlich
   schieben, statt die ganze Seite breiter zu machen. */
/* Rechtstexte enthalten lange URLs und deutsche Bandwurmwoerter. Ohne
   Umbruch laufen sie aus dem Absatz heraus, und die Seite scrollt seitlich,
   obwohl kein Element sichtbar zu breit ist. */
.legal { overflow-wrap: break-word; }

.legal-table { overflow-x: auto; margin: 14px 0 18px; }
.legal-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
/* Die Dashboard-Tabellen setzen td auf nowrap. Hier stehen ganze Saetze drin -
   ohne Umbruch wuchs die Tabelle auf 1603 statt 684 Pixel. */
.legal-table th,
.legal-table td { padding: 10px 12px; text-align: left; vertical-align: top; white-space: normal; border-bottom: 1px solid var(--border); }
.legal-table th { color: var(--text-secondary); font-weight: 600; }
.legal-table td .hint { display: block; margin-top: 2px; }
.legal-table a { color: var(--accent, var(--text-primary)); }

.legal-foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 14px; }
.legal-foot a { color: var(--text-secondary); text-decoration: none; }
.legal-foot a:hover { color: var(--text-primary); text-decoration: underline; }

/* Zustimmungszeile im Dialog. Das Häkchen bleibt oben, damit langer Text nicht
   um die Mitte der Box herumfließt. */
.consent-row {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 14px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  cursor: pointer;
}
.consent-row input { margin-top: 3px; flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent); }
.consent-row span { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* Kündigungsformular. Bewusst schlicht - es muss auffindbar und bedienbar
   sein, nicht schön. */
.legal-form { display: flex; flex-direction: column; gap: 14px; margin: 24px 0; max-width: 460px; }
.legal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-secondary); }
.legal-form input, .legal-form select, .legal-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text-primary);
  font: inherit; font-size: 14px;
}
.legal-form input:focus, .legal-form select:focus, .legal-form textarea:focus {
  outline: none; border-color: var(--accent);
}
.legal-form button { align-self: flex-start; margin-top: 4px; }
.legal-lead { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }
.legal-ok {
  padding: 16px 18px; margin-bottom: 20px;
  border: 1px solid rgba(50, 213, 131, 0.4); border-left: 3px solid var(--success);
  border-radius: var(--radius-sm); background: rgba(50, 213, 131, 0.07);
}
.legal-ok strong { color: var(--success); }
.legal-ok p { margin: 6px 0 0; font-size: 14px; }

/* Kopfzeile der Pflichtseiten: Rücksprung links, Sprachumschalter rechts. */
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.legal-top .legal-back { margin-bottom: 0; }

.legal-lang {
  padding: 5px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
  transition: border-color var(--ease), color var(--ease);
}
.legal-lang:hover { border-color: var(--accent); color: var(--text-primary); }

/* Der Widerrufsknopf nach § 356a Abs. 1 BGB.
   Er muss sich von den uebrigen Verweisen abheben und leicht zu finden sein -
   als gleich aussehender Link zwischen Impressum und AGB waere er genau das
   nicht. */
.legal-withdraw-link {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--text-primary) !important;
  font-weight: 600;
}
.legal-withdraw-link:hover { background: var(--accent); text-decoration: none; }

/* Die Pruefstufe des Widerrufs: Was gleich erklaert wird, steht abgesetzt. */
.legal-confirm p { margin: 6px 0; }
.legal-confirm p:first-child { margin-bottom: 14px; }
