/* MyStaat — Dashboard
 *
 * Dunkel, weil es neben Discord benutzt wird und ein helles Fenster dort wie
 * ein Fremdkörper wirkt. Sonst zurückhaltend: Die Farbe im Bild soll vom
 * Wappen der Fraktion kommen, nicht von der Oberfläche.
 */

:root {
  --bg: #16171a;
  --surface: #1e1f23;
  --surface-2: #26282d;
  --line: #33363d;
  --text: #e6e8ec;
  --muted: #9aa0aa;
  --accent: #5865f2;
  --gruen: #3ba55d;
  --rot: #da3f3f;
  --gelb: #d9a441;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

.mark {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 18px;
  text-decoration: none;
}

/* Knöpfe ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover {
  background: #2e3138;
  border-color: #444852;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #4752d4;
  border-color: #4752d4;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: transparent;
  border-color: #5a2d2d;
  color: #f0a0a0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

/* Startseite --------------------------------------------------------------- */

.landing main {
  max-width: 780px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}

.landing header {
  text-align: center;
  margin-bottom: 64px;
}

.landing h1 {
  font-size: 38px;
  margin: 28px 0 16px;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 28px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 14px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.features article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}

.features h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.features p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.landing footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding-top: 20px;
}

/* Anwendung ---------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.spacer {
  flex: 1;
}

.user {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
}

.user img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.view {
  max-width: 940px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.loading,
.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 0;
}

.pagehead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.pagehead h1 {
  font-size: 24px;
}

.pagehead img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
}

/* Serverliste -------------------------------------------------------------- */

.cards {
  display: grid;
  gap: 10px;
  margin-bottom: 36px;
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.card img,
.card .fallback {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: 0 0 auto;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-weight: 500;
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 12px;
}

/* Zustände ----------------------------------------------------------------- */

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.tag-ok {
  border-color: #2c5c3d;
  color: #7fd3a0;
}

.tag-warn {
  border-color: #5c4a24;
  color: var(--gelb);
}

/* Reiter und Abschnitte ---------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 6px;
}

.panel .note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

/* Formulare ---------------------------------------------------------------- */

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type='text'],
input[type='url'],
input[type='number'],
select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

/* Listen mit Zeilen -------------------------------------------------------- */

.rows {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.rowitem {
  display: grid;
  grid-template-columns: 44px 1fr 200px auto;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.rowitem .lvl {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 13px;
}

.rowitem input,
.rowitem select {
  padding: 6px 10px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .rowitem {
    grid-template-columns: 36px 1fr;
  }
  .rowitem select,
  .rowitem .btn {
    grid-column: 2;
  }
}

/* Kennzahlen --------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
}

.stat .value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 8px;
  border-bottom: 1px solid #26282d;
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: 0;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-on {
  background: var(--gruen);
}
.dot-off {
  background: #5a5f68;
}
.dot-away {
  background: var(--gelb);
}

/* Meldungen ---------------------------------------------------------------- */

.error {
  background: #2a1c1c;
  border: 1px solid #5a2d2d;
  color: #f0a0a0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 45%);
  z-index: 50;
}

.toast.ok {
  border-color: #2c5c3d;
}
.toast.bad {
  border-color: #5a2d2d;
  color: #f0a0a0;
}

/* Startseite, neu ----------------------------------------------------------
 *
 * Die erste Fassung war eine schmale Spalte mit vier grauen Kästen — korrekt,
 * aber nichtssagend. Was fehlte, war Rhythmus: eine Schriftgrößen-Staffel, die
 * den Blick führt, Raum um die Hauptaussage und ein Akzent, der nicht überall
 * gleichzeitig auftritt.
 *
 * Alles unter `.landing`, damit das Dashboard davon nichts abbekommt.
 */

.landing {
  --akzent: #d97757;
  --akzent-hell: #eb8f6d;
  --akzent-tief: #a24f34;
  --karte: #14171e;
  --linie-fein: #232935;

  background:
    radial-gradient(1200px 720px at 50% -12%, #1a2233 0%, transparent 58%),
    radial-gradient(900px 520px at 88% 4%, #241b20 0%, transparent 52%),
    #0b0d11;
  background-attachment: fixed;
  min-height: 100vh;
}

/* Kopfleiste ---------------------------------------------------------------
 *
 * Drei Spalten statt links-rechts: Marke, Bereiche, Konto. Die alte Fassung
 * war eine Marke links und ein Knopf rechts — dazwischen sechzig Prozent
 * Leere, und angemeldet standen drei Elemente ohne Ordnung nebeneinander.
 *
 * Ganz oben ist die Leiste durchsichtig und liegt im Farbverlauf des
 * Kopfbereichs; Rahmen und Milchglas kommen erst beim Scrollen dazu. So
 * schneidet am Seitenanfang keine Kante durch das Bild, und sobald Inhalt
 * darunter durchläuft, hebt sie sich trotzdem ab.
 */

.landing .topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid transparent;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 30;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.landing .topbar.gescrollt {
  background: rgba(11, 13, 17, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--linie-fein);
}

.landing .marke {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  font-weight: 680;
  font-size: 16px;
  letter-spacing: -0.015em;
  text-decoration: none;
  color: #eceef3;
}

.marke-zeichen {
  width: 21px;
  height: 21px;
  flex: none;
}

.marke-schild {
  fill: rgba(217, 119, 87, 0.14);
  stroke: var(--akzent);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.marke-stern {
  fill: var(--akzent);
}

.marke-wort span {
  color: var(--akzent);
}

/* Bereiche — auf schmalen Schirmen fällt die Mitte weg, nicht das Konto. */
.kopf-nav {
  display: flex;
  gap: 2px;
}

.kopf-nav a {
  color: #98a1b2;
  text-decoration: none;
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 8px;
  transition:
    color 0.14s ease,
    background 0.14s ease;
}

.kopf-nav a:hover {
  color: #eceef3;
  background: rgba(255, 255, 255, 0.05);
}

.kopf-konto {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.link-still {
  color: #98a1b2;
  text-decoration: none;
  font-size: 13.5px;
  transition: color 0.14s ease;
}

.link-still:hover {
  color: #eceef3;
}

/* Angemeldete Person in der Kopfleiste --------------------------------------
 *
 * Ersetzt den Anmeldeknopf, sobald `/api/me` eine Sitzung bestaetigt.
 */

/* Die angemeldete Person als Pille — jetzt anklickbar: Sie öffnet das
 * Kontomenü. Dashboard und Abmelden liegen darin, statt als lose Elemente
 * daneben. Eine Leiste mit drei Dingen rechts sieht nach drei gleich
 * wichtigen Dingen aus; es ist aber eines mit zwei Unterpunkten. */
.nutzer {
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13px;
  color: #eceef3;
  padding: 3px 10px 3px 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--linie-fein);
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease;
}

.nutzer:hover,
.nutzer[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.07);
  border-color: #39414f;
}

/* Das Dreieck dreht sich beim Öffnen — der billigste Hinweis darauf, dass
   hier etwas aufklappt und nicht navigiert wird. */
.nutzer-pfeil {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #98a1b2;
  flex: none;
  transition: transform 0.16s ease;
}

.nutzer[aria-expanded='true'] .nutzer-pfeil {
  transform: rotate(180deg);
}

.konto-huelle {
  position: relative;
}

.kontomenue {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  padding: 5px;
  border-radius: 12px;
  background: #14171e;
  border: 1px solid var(--linie-fein);
  box-shadow: 0 18px 46px -20px rgba(0, 0, 0, 1);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 40;
}

.kontomenue a {
  display: block;
  padding: 8px 11px;
  border-radius: 8px;
  color: #d3d8e0;
  text-decoration: none;
  font-size: 13.5px;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}

.kontomenue a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.kontomenue hr {
  border: 0;
  border-top: 1px solid var(--linie-fein);
  margin: 4px 6px;
}

.kontomenue .menue-still {
  color: #8b94a5;
}

.nutzer img {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  flex: none;
}

/* Ohne Bild bleibt der Platz trotzdem besetzt, damit die Pille nicht
 * unterschiedlich hoch wird. */
.nutzer-zeichen {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--akzent-tief);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.nutzer-name {
  font-weight: 600;
  /* Ein sehr langer Discord-Name soll die Leiste nicht auseinanderziehen. */
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Kopfbereich --------------------------------------------------------------- */

.landing main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 40px;
}

.held {
  text-align: center;
  padding: 92px 0 88px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #98a1b2;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--linie-fein);
  border-radius: 99px;
  padding: 5px 13px 5px 10px;
  margin-bottom: 26px;
}

.chip-punkt {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--akzent);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.16);
}

.landing h1 {
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 0 0 22px;
  color: #f3f5f8;
}

.landing h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--akzent-hell), var(--akzent) 55%, #c9a27e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing .lead {
  color: #98a1b2;
  font-size: 17.5px;
  line-height: 1.65;
  max-width: 640px;
  margin: 0 auto 34px;
}

.knopfreihe {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.landing .btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 11px;
  padding: 12px 22px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.landing .btn-primary {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #1a0e08;
  box-shadow: 0 8px 26px -12px rgba(217, 119, 87, 0.7);
}

.landing .btn-primary:hover {
  background: var(--akzent-hell);
  border-color: var(--akzent-hell);
  transform: translateY(-1px);
}

.btn-still {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--linie-fein);
  color: #d3d8e0;
}

.btn-still:hover {
  border-color: #39414f;
  color: #fff;
}

.btn-klein {
  padding: 7px 15px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--linie-fein);
  color: #eceef3;
}

.btn-klein:hover {
  border-color: #39414f;
}

.discord {
  width: 18px;
  height: 14px;
  flex: none;
}

.landing .hint {
  color: #626b7c;
  font-size: 13px;
  margin-top: 20px;
}

/* Kacheln ------------------------------------------------------------------- */

.landing .features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.landing .features article {
  background: var(--karte);
  border: 1px solid var(--linie-fein);
  border-radius: 16px;
  padding: 24px 24px 26px;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}

.landing .features article:hover {
  border-color: #313947;
  transform: translateY(-2px);
}

.feature-kopf {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 11px;
}

.feature-symbol {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border-radius: 10px;
  background: rgba(217, 119, 87, 0.1);
  border: 1px solid rgba(217, 119, 87, 0.18);
  flex: none;
}

.landing .features h2 {
  font-size: 15.5px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
  color: #eceef3;
}

.landing .features p {
  color: #8b94a5;
  font-size: 13.8px;
  line-height: 1.62;
  margin: 0;
}

/* Abschluss ----------------------------------------------------------------- */

.abschluss {
  text-align: center;
  margin: 72px 0 24px;
  padding: 54px 28px;
  background: linear-gradient(180deg, #14171e 0%, #10131a 100%);
  border: 1px solid var(--linie-fein);
  border-radius: 20px;
}

.abschluss h2 {
  font-size: 27px;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  color: #f3f5f8;
}

.abschluss p {
  color: #8b94a5;
  margin: 0 auto 26px;
  max-width: 480px;
  font-size: 15px;
}

.abschluss code {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13px;
  color: var(--akzent-hell);
}

/* Fuß ----------------------------------------------------------------------- */

.fuss {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--linie-fein);
  font-size: 13px;
}

.fuss .marke {
  font-weight: 680;
  color: #8b94a5;
}

.fuss .marke span {
  color: var(--akzent);
}

.fuss-links {
  display: flex;
  gap: 20px;
}

.fuss-links a {
  color: #626b7c;
  text-decoration: none;
  transition: color 0.14s ease;
}

.fuss-links a:hover {
  color: #eceef3;
}

.landing .error {
  margin: 24px auto 0;
  max-width: 460px;
  color: #e8a2a2;
  background: rgba(218, 63, 63, 0.09);
  border: 1px solid rgba(218, 63, 63, 0.24);
  border-radius: 11px;
  padding: 11px 16px;
  font-size: 13.5px;
}

/* Auf schmalen Schirmen fällt die Mitte weg — das Konto rechts ist wichtiger
 * als die Sprungmarken, die man auch durch Scrollen erreicht. */
@media (max-width: 780px) {
  .landing .topbar {
    grid-template-columns: auto 1fr;
    padding: 0 18px;
  }

  .kopf-nav {
    display: none;
  }

  .nutzer-name {
    max-width: 110px;
  }
}

@media (max-width: 640px) {
  .held {
    padding: 60px 0 56px;
  }

  .landing .topbar,
  .landing main,
  .fuss {
    padding-left: 18px;
    padding-right: 18px;
  }
}

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