:root {
  --brand: #e60000; --brand-dark: #c20000;
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d2330; --muted: #8a909b;
  --line: #e7e9ee; --line-soft: #f1f3f5;
  --ok: #1f7a4d; --attention: #854f0b; --danger: #9b1c1c;
  --vodafone-bg: #fcebeb; --vodafone-tx: #a32d2d;
  --otelo-bg: #f0eee7;   --otelo-tx: #5f5e5a;
  --laufend-bg: #e7f4ec; --laufend-tx: #1f7a4d;
  --warn-bg: #faeeda;    --warn-tx: #854f0b;
  --neutral-bg: #eef0f3; --neutral-tx: #5f6b7a;
  --shadow: 0 1px 3px rgba(20,25,40,.05);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }

/* Roter Markenstreifen ganz oben */
.accent-top { height: 3px; background: var(--brand); }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: .6rem 1.25rem; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.brand-mark svg { width: 16px; height: 16px; }
.brand-text { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.brand-sub { color: var(--muted); font-weight: 400; }

.mainnav { display: flex; gap: 6px; align-items: center; }
.navpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: #3f444c; text-decoration: none; transition: background .12s, color .12s;
}
.navpill .ic { width: 16px; height: 16px; }
.navpill:hover { background: var(--line-soft); }
.navpill.aktiv { background: var(--brand); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.modus-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line);
}
.modus-chip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.modus-chip-safe { background: #f1f3f5; color: #4b5563; }
.modus-chip-safe .dot { background: var(--ok); }
.modus-chip-live { background: var(--brand); color: #fff; border-color: var(--brand); }
.modus-chip-live .dot { background: #fff; }
.konto {
  width: 32px; height: 32px; border-radius: 50%; background: #f1f3f5;
  border: 1px solid var(--line); color: #4b5563; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.konto svg { width: 16px; height: 16px; }
.konto:hover { background: #e9ebef; }

.iconlink {
  width: 32px; height: 32px; border-radius: 50%; color: #4b5563;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.iconlink svg { width: 17px; height: 17px; }
.iconlink:hover { background: #eef0f3; }
.iconlink.aktiv { background: var(--brand); color: #fff; }

/* Textbausteine */
.vorlage-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.vorlage-label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.vorlage-card textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: .6rem .7rem; font: inherit; font-size: .92rem; resize: vertical;
}
.vorlage-card textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }
.vorlage-meta { margin-top: .45rem; font-size: .8rem; color: var(--muted); }
.vorlage-meta .seg.warn { color: var(--attention); font-weight: 600; }

.live-banner {
  background: var(--brand); color: #fff; text-align: center;
  padding: .5rem; font-size: .9rem; font-weight: 500; letter-spacing: .02em;
}

main { max-width: 1040px; margin: 0 auto; padding: 1.6rem 1.25rem; }
h1 { font-size: 1.5rem; font-weight: 600; margin: .2rem 0 .2rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.8rem 0 .6rem; }
.muted { color: var(--muted); font-weight: 400; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 1.2rem; }

/* Tabellen */
table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
th, td { text-align: left; padding: .7rem .9rem; }
th {
  background: var(--panel); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); font-weight: 500;
}
td { border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }
.kunde-name { font-weight: 500; }
.kunde-num { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .78rem; color: var(--muted); margin-top: 1px; }
.tarif { color: #4b5159; font-size: .88em; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 500; line-height: 1.6; white-space: nowrap;
}
.badge-vodafone   { background: var(--vodafone-bg); color: var(--vodafone-tx); }
.badge-otelo      { background: var(--otelo-bg);    color: var(--otelo-tx); }
.badge-laufend    { background: var(--laufend-bg);  color: var(--laufend-tx); }
.badge-abgelaufen { background: var(--warn-bg);     color: var(--warn-tx); }
.badge-pruefen    { background: var(--warn-bg);     color: var(--warn-tx); }
.badge-storniert  { background: var(--neutral-bg);  color: var(--neutral-tx); }
.badge-kein       { background: var(--neutral-bg);  color: var(--neutral-tx); }

/* SMS-Segment-Anzeige */
.sms { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; }
.sms-warn {
  display: inline-block; background: var(--warn-bg); color: var(--warn-tx);
  padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 500;
}

/* Buttons */
button, .linkbtn {
  font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer;
  border-radius: 8px; padding: .55rem .95rem; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; transition: background .12s, border-color .12s;
}
button svg, .linkbtn svg { width: 16px; height: 16px; }
button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
button.sekundaer { background: #fff; color: #3f444c; border-color: #d8dce2; }
button.sekundaer:hover { background: var(--line-soft); }
button.warn { background: transparent; color: var(--danger); border-color: transparent; }
button.warn:hover { background: #faf0f0; }
.linkbtn { background: #fff; color: var(--brand); border-color: var(--line); }
.linkbtn:hover { background: var(--line-soft); }
.inline { display: inline; }
button.linkbtn { border: 1px solid var(--line); }

/* Aktionen */
.aktionen { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.1rem 0; }
.snoozebox label { color: var(--muted); font-size: .9rem; }
.snoozebox input { border: 1px solid var(--line); border-radius: 7px; padding: .35rem .5rem; font: inherit; }
.werkzeuge { display: flex; gap: .7rem; align-items: center; margin-bottom: 1rem; }

/* Kundensuche */
.seiten-kopf {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem;
}
.seiten-kopf h1 { margin: 0; min-width: 0; }
.btn-neu {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .5rem .9rem; border-radius: 9px; font-size: .9rem; font-weight: 600;
  line-height: 1.2; text-decoration: none; flex: 0 0 auto;
  color: var(--brand); border: 1px solid var(--brand); background: var(--panel);
}
.btn-neu:hover { background: var(--brand); color: #fff; }
.badge-vf {
  background: #fde8e8; color: #9b1c1c; border: 1px solid #f5c2c2;
  margin-left: .4rem; font-size: 11px;
}
.badge-vvl { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }
.badge-reakt { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.status-ok { color: #166534; }
.status-fehler { color: #9b1c1c; font-weight: 600; }
.suche { display: flex; gap: .5rem; margin: 0 0 1.2rem; }
.suche input {
  flex: 1; padding: .6rem .75rem; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; background: var(--panel);
}
.suche input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }

.editcol { width: 40px; text-align: right; }
.editlink { color: var(--muted); display: inline-flex; }
.editlink svg { width: 17px; height: 17px; }
.editlink:hover { color: var(--brand); }

/* Karten + Formular (Bearbeiten) */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.feld { margin-bottom: .9rem; }
.feld label { display: block; font-size: .85rem; color: #3f444c; margin-bottom: .25rem; }
.feld input, .feld select {
  width: 100%; max-width: 420px; padding: .55rem .65rem;
  border: 1px solid var(--line); border-radius: 9px; font: inherit;
}
.feld input:focus, .feld select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }
.readonly { color: var(--muted); font-size: .88rem; }
.back { display: inline-block; margin-bottom: .6rem; color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--brand); }

/* Zeitraum-Filter (Erfolg) */
.zeitfilter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .3rem; }
.zpill {
  padding: 6px 13px; border-radius: 999px; font-size: 13px; text-decoration: none;
  color: #3f444c; border: 1px solid var(--line); background: var(--panel);
}
.zpill:hover { background: var(--line-soft); }
.zpill.aktiv { background: var(--brand); color: #fff; border-color: var(--brand); }
.zfrei { display: flex; gap: .4rem; align-items: center; margin-left: auto; }
.zfrei input[type=date] {
  padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .85rem;
}
.zfrei button { padding: .45rem .8rem; }
button.sekundaer.aktiv { border-color: var(--brand); color: var(--brand); }

/* Login */
.loginwrap {
  max-width: 360px; margin: 3rem auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; box-shadow: var(--shadow);
}
.loginwrap .brand { justify-content: center; margin-bottom: 1rem; }
.loginwrap h1 { text-align: center; font-size: 1.25rem; margin: 0 0 .4rem; }
.loginwrap label { display: block; margin: .85rem 0 .25rem; font-size: .88rem; color: #3f444c; }
.loginwrap input {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px; font: inherit;
}
.loginwrap input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }
.loginwrap button { width: 100%; justify-content: center; margin-top: 1.2rem; }

/* Flash / Status */
.flash { list-style: none; padding: 0; margin: 0 0 1rem; }
.flash li { padding: .6rem .8rem; border-radius: 9px; margin-bottom: .4rem; border: 1px solid var(--line); font-size: .92rem; }
.flash-ok { background: #e7f4ec; border-color: #b6dcc4; color: #14613a; }
.flash-fehler { background: #fdeaea; border-color: #f0b6b6; color: #8a1f1f; }
.flash-hinweis { background: #eef3fa; border-color: #c6d8ee; color: #234e86; }
.leer {
  color: var(--muted); background: var(--panel); border: 1px dashed var(--line);
  border-radius: 12px; padding: 1.1rem; font-size: .92rem;
}

/* Bestätigung */
.zusammenfassung {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}

/* Monitoring-Kennzahlen als Karten */
.kennzahlen {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem; margin-bottom: 1.3rem;
}
.kennzahlen div {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: .9rem 1rem; color: var(--muted); font-size: .82rem; box-shadow: var(--shadow);
}
.kennzahlen span { display: block; font-size: 1.6rem; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.kennzahlen .alert { border-color: #e6c07a; }
.kennzahlen .alert span { color: var(--attention); }

/* Quality-Floor */
:focus-visible { outline: 3px solid rgba(230,0,0,.35); outline-offset: 2px; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: .6rem; }
  .mainnav { order: 3; width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 6px 8px; }
  .navpill { padding: 7px 11px; }
  table { font-size: .85rem; }

  /* Stufe 1 (Mobil): nichts schwingt mehr — Navi bricht um, breite Tabellen einzeln seitlich scrollbar */
  html, body { overflow-x: hidden; }
  main table {
    display: block;                     /* eigener horizontaler Scroll-Kontext */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;  /* weiches Wischen auf iOS */
  }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- Paket 1: weiches Löschen + Reaktivierungs-Filter --- */
.badge-entfernt { background: #f7e3e3; color: var(--danger); }

.hidden-form { display: none; }

/* Reaktivierungs-Liste: Filterfeld */
.reakt-suche { margin: 0 0 .9rem; }
.reakt-suche input {
  width: 100%; max-width: 340px; padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.reakt-suche input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }

/* Lösch-Icon-Button in der Listenzeile (überschreibt den roten Default-Button) */
.loeschcol { width: 34px; text-align: right; }
button.btn-loesch {
  background: transparent; border-color: transparent; color: var(--muted);
  padding: .3rem; border-radius: 6px;
}
button.btn-loesch:hover { background: #faf0f0; border-color: transparent; color: var(--danger); }

/* Datensatz entfernen (Bearbeiten-Seite): Danger-Outline statt Primär-Rot */
button.btn-danger { background: #fff; color: var(--danger); border-color: #e3b5b5; }
button.btn-danger:hover { background: #faf0f0; border-color: var(--danger); }

/* Wiederherstellen: sekundär */
button.btn-restore { background: #fff; color: #3f444c; border-color: #d8dce2; }
button.btn-restore:hover { background: var(--line-soft); border-color: #d8dce2; }

/* --- Paket 2: assistierter Drip (Reaktivierung) --- */
.drip {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem;
  margin: 0 0 1rem; padding: .6rem .8rem;
  background: var(--line-soft); border: 1px solid var(--line); border-radius: 8px;
}
.drip-form { display: inline-flex; align-items: center; gap: .5rem; }
.drip-label { font-size: 13px; color: #3f444c; }
.anzahl-input {
  width: 64px; padding: .35rem .5rem; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; text-align: center;
}
.anzahl-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230,0,0,.12); }
.drip-heute { font-size: 12px; }

/* --- prüfen-Aktionen im Monitoring --- */
.pruefen-akt { display: flex; align-items: center; gap: .5rem; }
button.btn-ok {
  background: #fff; color: var(--ok); border-color: #bfe0cd;
  padding: .32rem .7rem; font-size: .82rem;
}
button.btn-ok:hover { background: #eef7f1; border-color: var(--ok); }

/* --- SMS-Vorschau auf der Bestätigungsseite --- */
.warnung { background: var(--warn-bg); color: var(--warn-tx); border-radius: 8px;
  padding: .55rem .8rem; margin: 0 0 1rem; font-size: .9rem; }
.warnung-inline { color: var(--warn-tx); font-weight: 600; font-size: .85rem; }
table.vorschau td { vertical-align: top; }
.sms-vorschau { display: block; background: #eef4ff; color: #1d2330;
  border: 1px solid #d3e0f5; border-radius: 10px; padding: .5rem .7rem;
  font-size: .86rem; line-height: 1.35; max-width: 52ch; }
.zeichen { display: inline-block; margin-top: .25rem; font-size: .76rem; }
tr.gesperrt { opacity: .6; }
tr.gesperrt .sms-vorschau { background: var(--warn-bg); border-color: #e7d2ad; }

/* Abrechnung-Upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 12px; padding: 1.7rem 1rem;
  color: var(--muted); transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: #fff7f7; color: var(--ink); }
.dropzone svg { width: 30px; height: 30px; color: var(--brand); }
.dz-titel { font-weight: 600; color: var(--ink); }
.dz-sub { font-size: .82rem; }
.dz-datei { font-size: .85rem; color: var(--brand); font-weight: 600; min-height: 1em; }
.dz-aktionen { margin-top: .9rem; }
.dz-fuss { font-size: .85rem; margin: .4rem 0 0; }
.abschnitt { margin: 0; font-size: 1.05rem; }
.abschnitt-leer { margin: 0; }
.listen-card { padding: 0; overflow: hidden; }
.liste { width: 100%; border-collapse: collapse; font-size: .9rem; }
.liste th, .liste td { text-align: left; padding: .55rem .85rem; border-bottom: 1px solid var(--line); }
.liste thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.liste tbody tr:last-child td { border-bottom: none; }

/* Ansprache-Zaehler (X/3) in Reaktivierung/Follow-up/Altbestand */
.badge-count { background: var(--neutral-bg); color: var(--neutral-tx); font-variant-numeric: tabular-nums; }

/* WP-B Protokoll-Statistik */
.badge-altbestand { background:#fff7ed; color:#9a3412; border:1px solid #fed7aa; }
.protokoll-stats { display:flex; flex-wrap:wrap; gap:.6rem; margin:.6rem 0 .4rem; }
.pstat { background:var(--neutral-bg); border:1px solid var(--line-soft); border-radius:10px; padding:.5rem .8rem; min-width:92px; }
.pstat-gesamt { background:var(--brand); border-color:var(--brand); }
.pstat-gesamt .pstat-n, .pstat-gesamt .pstat-lbl { color:#fff; }
.pstat-n { display:block; font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.1; }
.pstat-lbl { display:block; font-size:12px; color:var(--neutral-tx); margin-top:.15rem; }
.pstat-fehler { color:var(--danger); font-weight:600; }

/* WP-C Protokoll-Pagination */
.pager-info { color:var(--neutral-tx); font-size:12px; margin:.7rem 0 .3rem; }
.pager { display:flex; flex-wrap:wrap; gap:.35rem; align-items:center; margin:.2rem 0 .6rem; }
.pager-pill { display:inline-block; padding:.3rem .6rem; border:1px solid var(--line-soft); border-radius:8px; text-decoration:none; color:var(--neutral-tx); font-size:13px; font-variant-numeric:tabular-nums; }
.pager-pill:hover { background:var(--line-soft); }
.pager-pill.aktiv { background:var(--brand); color:#fff; border-color:var(--brand); }
.pager-pill.disabled { opacity:.45; pointer-events:none; }
.pager-ellipse { color:var(--neutral-tx); padding:0 .2rem; }

/* WP-D Navi-Gruppen (Dropdown, kein JS) + Upload */
.navgroup { position: relative; }
.navgroup > summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: #3f444c; cursor: pointer; list-style: none; user-select: none;
  transition: background .12s, color .12s;
}
.navgroup > summary::-webkit-details-marker { display: none; }
.navgroup > summary::after { content: "\25be"; font-size: 10px; opacity: .65; }
.navgroup > summary:hover { background: var(--line-soft); }
.navgroup.aktiv > summary { background: var(--brand); color: #fff; }
.navgroup > summary .ic { width: 16px; height: 16px; }
.navpanel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 232px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.navitem { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
.navitem:hover { background: var(--line-soft); }
.navitem.aktiv { background: var(--brand); }
.navitem .t { display: block; font-size: 13px; font-weight: 500; color: #3f444c; }
.navitem .s { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.navitem.aktiv .t, .navitem.aktiv .s { color: #fff; }
.uploadlink {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: #3f444c; text-decoration: none; border: 1px solid var(--line);
  transition: background .12s;
}
.uploadlink .ic { width: 16px; height: 16px; }
.uploadlink:hover { background: var(--line-soft); }
.uploadlink.aktiv { background: var(--brand); color: #fff; border-color: var(--brand); }

@media (max-width: 760px) {
  .navgroup[open] { width: 100%; }
  .navgroup[open] > summary { width: 100%; justify-content: flex-start; }
  .navpanel { position: static; width: 100%; min-width: 0; margin-top: 6px; box-shadow: none; }
  .navitem { padding: 11px 12px; }
  .navgroup > summary { padding: 9px 13px; }
  .uploadlink { padding: 8px 12px; }
}
