/* 420 Lounge - Steuerzentrale */

:root {
  --bg: #0f1216;
  --bg2: #151a20;
  --karte: #1a2027;
  --karte2: #212a33;
  --rand: #2a333d;
  --rand-hell: #3a454f;
  --text: #e6ebf0;
  --text2: #9aa7b4;
  --text3: #6b7885;

  /* Hausfarbe der 420 Lounge */
  --akzent: #c084fc;
  --akzent-dunkel: #a855f7;
  --akzent-schrift: #1b0a2b;

  /* Signalfarben - die bleiben, damit man Zustände weiter erkennt */
  --gruen: #4ade80;
  --rot: #ef4444;
  --gelb: #facc15;
  --blau: #60a5fa;
  --lila: #c084fc;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.innen { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------------- Kopf ---------------- */

.kopf {
  background: var(--bg2);
  border-bottom: 1px solid var(--rand);
  position: sticky;
  top: 0;
  z-index: 50;
}
.kopf .innen {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  flex-wrap: wrap;
}
.marke {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}
.marke:hover { text-decoration: none; }
.marke .zeichen { display: block; flex: 0 0 auto; }
.marke small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 14px;
}
.nav a:hover { background: var(--karte); color: var(--text); text-decoration: none; }
.nav a.aktiv { background: var(--karte2); color: var(--akzent); }

.rechts { display: flex; align-items: center; gap: 14px; }

.lampe { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.lampe::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rot);
}
.lampe.an::before { background: var(--gruen); box-shadow: 0 0 8px var(--gruen); }

.ich { font-size: 13px; text-align: right; line-height: 1.3; }
.ich small { display: block; color: var(--text3); font-size: 11px; }

/* ---------------- Inhalt ---------------- */

.inhalt {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

h1 { font-size: 24px; margin: 0 0 6px; font-weight: 600; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.unter { color: var(--text2); margin: 0 0 24px; }

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
}
.karte.warn { border-color: var(--gelb); }

.gitter { display: grid; gap: 14px; }
.gitter.vier { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.gitter.zwei { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.zahl {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 16px 18px;
}
.zahl .wert { font-size: 27px; font-weight: 600; line-height: 1.2; }
.zahl .titel { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.zahl .zusatz { font-size: 12px; color: var(--text2); margin-top: 4px; }
.zahl.akzent .wert { color: var(--akzent); }
.zahl.gruen .wert { color: var(--gruen); }
.zahl.blau .wert { color: var(--blau); }
.zahl.lila .wert { color: var(--lila); }
.zahl.gelb .wert { color: var(--gelb); }

/* ---------------- Bedienelemente ---------------- */

.knopf {
  display: inline-block;
  background: var(--akzent-dunkel);
  color: var(--akzent-schrift);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.knopf:hover { background: var(--akzent); text-decoration: none; }
.knopf.grau { background: var(--karte2); color: var(--text); border: 1px solid var(--rand-hell); }
.knopf.grau:hover { background: var(--rand); }
.knopf.klein { padding: 6px 12px; font-size: 13px; }
.knopf.rot { background: var(--rot); color: #fff; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--akzent-dunkel);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, .18);
}
textarea { min-height: 90px; resize: vertical; }
select[multiple] { min-height: 130px; }

label.feld { display: block; margin-bottom: 14px; }
label.feld > span { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; }
label.feld small { display: block; color: var(--text3); font-size: 12px; margin-top: 4px; }

.meldung {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid;
}
.meldung.ok { background: rgba(74, 222, 128, .1); border-color: var(--gruen); color: var(--gruen); }
.meldung.fehler { background: rgba(239, 68, 68, .1); border-color: var(--rot); color: #fca5a5; }
.meldung.info { background: rgba(96, 165, 250, .1); border-color: var(--blau); color: #93c5fd; }

/* ---------------- Funktionsauswahl ---------------- */

.werkzeugleiste {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.werkzeugleiste input[type="text"] { max-width: 320px; }

.vorlagen { display: flex; gap: 8px; flex-wrap: wrap; }
.vorlagen button {
  background: var(--karte2);
  border: 1px solid var(--rand-hell);
  color: var(--text2);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.vorlagen button:hover { color: var(--text); border-color: var(--akzent-dunkel); }

.bereich {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.bereich > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.bereich > summary::-webkit-details-marker { display: none; }
.bereich > summary:hover { background: var(--karte2); }
.bereich .icon { font-size: 19px; }
.bereich .name { font-weight: 600; flex: 1; }
.bereich .name em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--text3); }
.bereich .zaehler { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; }
.bereich .alle {
  background: none;
  border: 1px solid var(--rand-hell);
  color: var(--text3);
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.bereich .alle:hover { color: var(--text); }

.liste { border-top: 1px solid var(--rand); }

.zeile {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(42, 51, 61, .5);
}
.zeile:last-child { border-bottom: 0; }
.zeile:hover { background: var(--karte2); }
.zeile .text { flex: 1; min-width: 0; }
.zeile .fname { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zeile .fbesch { font-size: 13px; color: var(--text2); margin-top: 2px; }
.zeile .fcmd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text3); }

.marke-st { font-size: 10px; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.st-ready { background: rgba(74, 222, 128, .15); color: var(--gruen); }
.st-beta { background: rgba(250, 204, 21, .15); color: var(--gelb); }
.st-geplant { background: rgba(107, 120, 133, .18); color: var(--text3); }

.stufe { font-size: 10px; color: var(--text3); border: 1px solid var(--rand-hell); border-radius: 999px; padding: 1px 7px; }

/* Schalter */
.schalter { position: relative; flex: 0 0 auto; margin-top: 2px; }
.schalter input { position: absolute; opacity: 0; width: 0; height: 0; }
.schalter span {
  display: block;
  width: 40px; height: 23px;
  background: var(--rand);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.schalter span::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--text3);
  transition: transform .15s, background .15s;
}
.schalter input:checked + span { background: var(--akzent-dunkel); }
.schalter input:checked + span::after { transform: translateX(17px); background: #fff; }
.schalter input:disabled + span { opacity: .4; cursor: not-allowed; }

/* Speicherleiste */
.speicherleiste {
  position: sticky;
  bottom: 0;
  background: var(--bg2);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .35);
}
.speicherleiste .info { font-size: 14px; color: var(--text2); }
.speicherleiste .info b { color: var(--text); }

/* ---------------- Tabellen ---------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rand); }
th { color: var(--text3); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.tabellenrahmen { overflow-x: auto; }

.punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text3); margin-right: 6px; }
.punkt.an { background: var(--gruen); }

/* ---------------- Anmeldung ---------------- */

.anmeldung {
  max-width: 430px;
  margin: 80px auto;
  text-align: center;
}
.anmeldung .karte { padding: 34px 30px; }
.anmeldung .logo { display: block; margin: 0 auto; }
.discord-knopf {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #5865f2;
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-weight: 600;
  margin-top: 18px;
}
.discord-knopf:hover { background: #4752c4; text-decoration: none; }

/* ---------------- Fuss ---------------- */

.fuss {
  border-top: 1px solid var(--rand);
  padding: 18px 0;
  color: var(--text3);
  font-size: 12px;
}
.fuss .innen { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------- Widget im iframe ---------------- */

body.widget { background: transparent; }
body.widget .inhalt { padding: 12px; }

@media (max-width: 700px) {
  .kopf .innen { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .rechts { width: 100%; justify-content: space-between; }
  .speicherleiste { flex-direction: column; align-items: stretch; }
  .speicherleiste .knopf { width: 100%; }
}

/* ---------------- Ergänzungen für das HTML-Panel ---------------- */

/* Ladezustand, solange die API noch antwortet */
.laedt {
  padding: 40px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 14px;
}
.laedt::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 12px;
  border: 2px solid var(--rand);
  border-top-color: var(--akzent);
  border-radius: 50%;
  animation: dreht .7s linear infinite;
}
@keyframes dreht { to { transform: rotate(360deg); } }

/* Kurze Rückmeldung oben rechts */
#toast {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 40px));
}
#toast .meldung {
  margin: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
  animation: rein .18s ease-out;
}
@keyframes rein { from { opacity: 0; transform: translateY(-6px); } }

/* Knopf, während er arbeitet */
.knopf[data-laeuft] { opacity: .6; pointer-events: none; }

/* Zweispaltiges Formular */
.zeilen { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }

/* Einbettung der Discord-Vorschau */
.vorschau { background: #313338; border-radius: 8px; padding: 14px; }
.vorschau .balken { width: 4px; border-radius: 4px 0 0 4px; background: var(--akzent-dunkel); flex: 0 0 4px; }
.vorschau .karte2 { background: #2b2d31; border-radius: 0 4px 4px 0; padding: 12px 16px; flex: 1; min-width: 0; }
.vorschau .titel2 { font-size: 16px; font-weight: 600; color: #f2f3f5; margin-bottom: 6px; }
.vorschau .autor2 { font-size: 13px; font-weight: 600; color: #f2f3f5; margin-bottom: 6px; }
.vorschau .text2 { font-size: 14px; color: #dbdee1; white-space: pre-wrap; word-break: break-word; }
.vorschau .fuss2 { font-size: 12px; color: #949ba4; margin-top: 10px; }
.vorschau .felder2 { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }

/* Kleiner Hinweis unter einer Überschrift */
.leer { padding: 18px; color: var(--text3); font-size: 14px; text-align: center; }
