/* Olliversum – Erscheinungsbild: dunkel (Standard) und hell, orange als Akzent. Keine Inline-Styles (CSP). */
:root {
  --bg: #15120f; --side: #1b1713; --paper: #211d18; --raised: #2a2520; --line: #36312a; --field: #191612;
  --ink: #f5efe6; --muted: #a79e92;
  --accent: #ff8a3d; --accent-ink: #1a1208; --accent-text: #ffa968;
  --ok: #7bd88f; --ok-bg: #1e3325; --warn: #f5c451; --warn-bg: #3a2f12; --err: #ff8c82; --err-bg: #40201d;
  --info: #8fc3f0; --info-bg: #1d2b3a; --wait: #c5aef0; --wait-bg: #2c2540;
  --radius: 14px;
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f7f2eb; --side: #efe8de; --paper: #ffffff; --raised: #f3ede4; --line: #e3d9cb; --field: #ffffff;
  --ink: #1f1a14; --muted: #6a5f52;
  --accent-text: #a84300;
  --ok: #1d6b34; --ok-bg: #e3f3e7; --warn: #7a5600; --warn-bg: #fbefc9; --err: #b3261e; --err-bg: #fbe3e0;
  --info: #1f5f99; --info-bg: #e4eef7; --wait: #5b3e99; --wait-bg: #efe9f7;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--accent-text); }
h1 { font-size: 1.75rem; margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .85rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
code { background: var(--raised); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* ---- Rahmen: Seitenleiste + Inhalt ---- */
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar { flex: 0 0 260px; background: var(--side); border-right: 1px solid var(--line); padding: 1.5rem .9rem; display: flex; flex-direction: column; gap: 1.4rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.content { flex: 1 1 0; min-width: 0; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 0 .9rem .4rem; font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }
.nav-main { display: flex; flex-direction: column; gap: 1.4rem; }
.logo-ring { fill: #ff8a3d; }
.logo-hole { fill: var(--side); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { padding: 0 .9rem .4rem; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.sidebar a.nav { display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: 0 .9rem; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 500; }
.sidebar a.nav:hover { color: var(--ink); background: var(--raised); }
.sidebar a.nav.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar a.nav svg { flex: none; }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.theme { display: flex; gap: 4px; margin: .6rem .25rem 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.theme button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.theme button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.sidebar form.logout { margin: .25rem 0 0; }
.sidebar form.logout button { width: 100%; min-height: 44px; background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }

.stagingbar { background: #8a1f1f; color: #fff; padding: .45rem 2.5rem; font-size: .85rem; font-weight: 600; letter-spacing: .02em; }
.testbar { background: var(--warn-bg); color: var(--warn); padding: .55rem 2.5rem; font-size: .9rem; border-bottom: 1px solid var(--line); }
.campaignbar { background: var(--raised); padding: .45rem 2.5rem; border-bottom: 1px solid var(--line); }
.campaignbar label { display: flex; align-items: center; gap: .6rem; margin: 0; font-weight: 600; }
.campaignbar select { width: auto; margin: 0; }

main { max-width: 1320px; margin: 0 auto; padding: 2rem 2.5rem 3rem; }
main.plain { max-width: 520px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 420px; margin: 4rem auto; }
.card.nomargin { margin: 0 0 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.grid-mail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .grid-mail { grid-template-columns: 1fr; } }
.side { position: sticky; top: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 0 0 1.5rem; }
.kpi { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; text-decoration: none; color: var(--ink); }
.kpi:hover { border-color: var(--accent); }
.kpi-label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi b { display: block; font-size: 2.4rem; line-height: 1.15; letter-spacing: -.02em; margin: .3rem 0 .1rem; }
.kpi.ok b { color: var(--ok); }
.kpi.warn b { color: var(--warn); }
.kpi.err b { color: var(--err); }
.kpi-note { font-size: .82rem; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn); font-weight: 600; }
.big { font-size: 1.3rem; }
.mt1 { margin-top: 1rem; }
.mt075 { margin-top: .75rem; }
.my075 { margin: .75rem 0; }
.w14 { width: 14rem; }
.checklist { list-style: none; padding: 0; margin: .5rem 0; }
tr.hl td { background: var(--ok-bg); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--paper); }
table.list tr:hover td { background: var(--raised); }
tr.inactive td { opacity: .45; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .5rem 0; }
.stats div { background: var(--raised); border-radius: 10px; padding: .55rem .7rem; }
.stats b { display: block; font-size: 1.4rem; }
.stats span { font-size: .8rem; color: var(--muted); }

.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .75rem; }
.tabs a { padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); background: transparent; }
.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.tabs.small a { font-size: .85rem; padding: .2rem .7rem; }

.prio { display: inline-block; width: 1.6rem; text-align: center; border-radius: 5px; font-weight: 700; font-size: .85rem; }
.prio.pA { background: var(--accent); color: var(--accent-ink); }
.prio.pB { background: var(--raised); color: var(--accent-text); }
.prio.pC { background: var(--raised); color: var(--muted); }

.status { display: inline-block; padding: .12rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.s-open { background: var(--raised); color: var(--muted); }
.s-sent { background: var(--info-bg); color: var(--info); }
.s-due { background: var(--warn-bg); color: var(--warn); }
.s-wait { background: var(--wait-bg); color: var(--wait); }
.s-answer { background: var(--raised); color: var(--accent-text); }
.s-played { background: var(--ok-bg); color: var(--ok); }
.s-no { background: var(--err-bg); color: var(--err); }

.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: .75rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); color: var(--info); }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .75rem; }
label.check { display: flex; gap: .6rem; align-items: center; font-weight: 400; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
input[type=text], input[type=url], input[type=password], input[type=search], input[type=number], input[type=date], input[type=email], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .75rem; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink);
}
textarea { line-height: 1.5; resize: vertical; }
textarea[name=body] { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled { opacity: .6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
form.inline { display: inline-flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
form.inline label { margin-bottom: .5rem; }
.filter { margin-bottom: .75rem; }
.filter input, .filter select { margin-top: 0; width: auto; }
.actions { margin-top: .5rem; }

button, .btn { display: inline-block; font: inherit; font-weight: 700; padding: .6rem 1.2rem; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--accent); filter: none; }
button.small, .btn.small { padding: .3rem .75rem; font-size: .85rem; border-radius: 9px; }
button.danger { background: transparent; border-color: var(--err); color: var(--err); }

details { border-bottom: 1px solid var(--line); padding: .5rem 0; }
summary { cursor: pointer; }
pre.mailbody, pre.copy { white-space: pre-wrap; background: var(--raised); padding: .85rem; border-radius: 10px; font-size: .85rem; }
pre.copy { word-break: break-all; }
ul.small { padding-left: 1.1rem; margin: 0; }
ul.small.checklist { padding-left: 0; }

.qr { display: flex; justify-content: center; margin: 1rem 0; padding: 1rem; background: #fff; border-radius: 12px; }
.qr svg { max-width: 100%; height: auto; }
pre.codes { font-size: 1.1rem; letter-spacing: .05em; }
a.card.choice { display: block; text-decoration: none; color: var(--ink); }
a.card.choice:hover { border-color: var(--accent); }
tr.alert td { background: var(--err-bg); }
.scroll { overflow-x: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.right-float { float: right; }
h2.full { margin-top: .5rem; }
label.check span { font-weight: 400; }
.bulkbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0 0 .5rem; }
.bulkbar select { width: auto; margin: 0; }
.diff del { color: var(--err); }
.diff ins { color: var(--ok); text-decoration: none; }

td { overflow-wrap: break-word; }
td.nw { white-space: nowrap; }
@media (min-width: 761px) { .card.flush table.list { min-width: 940px; } }
td.addr { min-width: 12rem; }
td.col-main { min-width: 14rem; }
th.col-actions, td.col-actions { width: 1%; text-align: right; }
td.col-actions { min-width: 7.5rem; }
td.col-actions .btn { display: block; text-align: center; margin-bottom: .3rem; white-space: nowrap; }
td.col-actions .btn:last-child { margin-bottom: 0; }
td .status { margin-bottom: .15rem; }
.filter input[type=search] { min-width: 14rem; }

.progress { height: .6rem; background: var(--raised); border-radius: 999px; overflow: hidden; margin: .75rem 0; }
.progress span { display: block; height: 100%; background: var(--accent); }
.progress .w0 { width: 0%; }
.progress .w5 { width: 5%; }
.progress .w10 { width: 10%; }
.progress .w15 { width: 15%; }
.progress .w20 { width: 20%; }
.progress .w25 { width: 25%; }
.progress .w30 { width: 30%; }
.progress .w35 { width: 35%; }
.progress .w40 { width: 40%; }
.progress .w45 { width: 45%; }
.progress .w50 { width: 50%; }
.progress .w55 { width: 55%; }
.progress .w60 { width: 60%; }
.progress .w65 { width: 65%; }
.progress .w70 { width: 70%; }
.progress .w75 { width: 75%; }
.progress .w80 { width: 80%; }
.progress .w85 { width: 85%; }
.progress .w90 { width: 90%; }
.progress .w95 { width: 95%; }
.progress .w100 { width: 100%; }

/* Schmale Bildschirme: Menü oben, Zeilen werden zu Karten */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; height: auto; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 .5rem 0 .25rem; }
  .nav-main { flex-direction: row; flex-wrap: wrap; gap: .25rem .5rem; }
  .nav-group, .nav-bottom { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .nav-title { display: none; }
  .sidebar a.nav { min-height: 40px; padding: 0 .65rem; }
  .theme { margin: 0; }
  .stagingbar, .testbar, .campaignbar { padding-left: 1rem; padding-right: 1rem; }
  main { padding: 1rem; }
}
@media (max-width: 760px) {
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr:has(th) { display: none; }
  table.list tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  table.list td { border: 0; padding: .2rem .9rem; min-width: 0; }
  td.col-actions { text-align: left; }
  td.col-actions .btn { display: inline-block; margin: .2rem .3rem .2rem 0; }
}

/* Schnellerfassung */
.erf table input { width: 100%; min-width: 7rem; }
.erf table td:nth-child(1) { min-width: 12rem; }
.erf table td:nth-child(2) input { min-width: 9.5rem; }
.erf table td:nth-child(5) input { min-width: 14rem; }
.erf tr.rowerr td { background: rgba(255, 90, 90, .10); }
.err-text { color: #ff6b6b; }
[data-theme=light] .err-text { color: #b3261e; }
