:root {
  --ink: #1c1c1e; --muted: #6b6b70; --line: #dcdce0;
  --bg: #f7f7f8; --card: #ffffff; --accent: #2a5db0; --accent-dark: #204b8f;
  --error: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem; padding: 1rem 1.5rem; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
header nav { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
main { max-width: 52rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
h1 { font-size: 1.5rem; margin: 0 0 1.5rem; }

/* Kopfzeile einer Seite mit Aktion daneben (z. B. "Geplante Mails" + Abmelden) */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.page-head h1 { margin: 0; }

footer {
  max-width: 52rem; margin: 0 auto; padding: 0 1.5rem 3rem;
  color: var(--muted); font-size: .85rem;
}

/* Tabelle darf auf schmalen Bildschirmen scrollen statt den Rahmen zu sprengen */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 40rem; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  background: #eceef2; font-size: .82rem;
}
.status-sent .badge { background: #e3f1e6; }
.status-failed .badge, .status-missed .badge { background: #fbe4e2; color: var(--error); }
.status-cancelled .badge { color: var(--muted); }
.error-detail { font-size: .8rem; color: var(--error); margin-top: .3rem; }
.empty { color: var(--muted); }

/* Nur echte Formulare bekommen den Karten-Rahmen — Aktionsformulare wie
   Stornieren/Abmelden/Entfernen sind je ein einzelner Button in einem
   <form>-Tag und wuerden sonst 1,5rem Karten-Polsterung um sich herum
   bekommen und Tabellenzellen bzw. die Kopfzeile aufblaehen. */
form { margin: 0; }
form.formular { background: var(--card); padding: 1.5rem; border: 1px solid var(--line); border-radius: 8px; }
form.schmal { max-width: 24rem; margin: 0 auto; }

label { display: block; font-weight: 600; margin: 1.1rem 0 .35rem; }
label:first-child { margin-top: 0; }
input, textarea, select {
  width: 100%; padding: .55rem .65rem; font: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit;
}
textarea { resize: vertical; }
small { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin-top: 1.75rem; }

button, .button {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: .6rem 1.1rem; font: inherit; font-weight: 500; line-height: 1.2;
  text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark); }
button:focus-visible, .button:focus-visible, .link:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

a.link { color: var(--accent); }
a.link:hover { text-decoration: none; }

/* Buttons, die wie ein Link aussehen sollen (Stornieren, Abmelden, Testversand):
   ohne diesen Reset erbt der Button trotzdem den blauen Hintergrund von
   oben, ".link" aendert dann nur noch die Textfarbe auf dasselbe Blau —
   weisse Schrift auf Blau wird so zu blauer Schrift auf Blau, unsichtbar. */
button.link {
  background: none; border: 0; padding: 0; border-radius: 0;
  color: var(--accent); text-decoration: underline; font-weight: 500;
}
button.link:hover { color: var(--accent-dark); }

.warning {
  background: #fdf3e0; border-left: 3px solid #b06f00;
  color: #7a4c00; padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1.5rem;
}
.error {
  background: #fbe4e2; border-left: 3px solid var(--error);
  color: var(--error); padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1.5rem;
}

/* Anhänge (Slice 2) */
ul.anhaenge { list-style: none; margin: 0.3rem 0; padding: 0; }
ul.anhaenge li { display: flex; gap: 0.6rem; align-items: baseline;
                 padding: 0.15rem 0; flex-wrap: wrap; }
ul.anhaenge .groesse { color: #666; font-size: 0.85em; }
ul.anhaenge button.link { color: #b00; font-size: 0.85em; }

.hinweis { background: #e7f5ec; border: 1px solid #4a9c6d; padding: .6rem .8rem;
           border-radius: 4px; }
.hinweis-detail { color: #2f6b48; font-size: .85rem; }

fieldset.modus { border: 1px solid var(--line); border-radius: 6px; margin: 1rem 0;
                 padding: .9rem 1rem 1.1rem; }
fieldset.modus legend { font-weight: 600; padding: 0 .3rem; }
fieldset.modus label.radio { display: block; font-weight: 600; margin: .9rem 0 .4rem; }
fieldset.modus label.radio:first-of-type { margin-top: 0; }

/* Felder eines Modus einruecken; der nicht gewaehlte Modus wird nur
   abgeblendet, nicht ausgeblendet — sonst springt beim Umschalten der Rest
   des Formulars nach oben/unten (server- und JS-seitig dieselbe Klasse,
   siehe form.html und app.js). */
.modus-felder { padding-left: 1.6rem; transition: opacity .15s ease; }
.modus-felder.inaktiv { opacity: .45; pointer-events: none; }
.slot-felder { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.slot-felder > div { flex: 1 1 10rem; }
.slot-felder label { font-weight: 500; font-size: .82rem; margin: 0 0 .25rem; }
