:root {
  --bg: #f5f6f8; --flaeche: #ffffff; --flaeche2: #eef0f3; --linie: #dfe2e7;
  --text: #16181d; --leise: #646b78; --akzent: #c2255c; --akzent-hell: #fdecf2;
  --gut: #2b8a3e; --gut-hell: #e6f4ea; --warn: #c92a2a; --warn-hell: #fdecec;
  --schatten: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05); --r: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121317; --flaeche: #1b1d22; --flaeche2: #24272d; --linie: #31343b;
    --text: #e9eaee; --leise: #9aa0ab; --akzent: #f06595; --akzent-hell: #3a1b27;
    --gut: #69db7c; --gut-hell: #1c3122; --warn: #ff8787; --warn-hell: #3b1f1f; --schatten: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121317; --flaeche: #1b1d22; --flaeche2: #24272d; --linie: #31343b;
  --text: #e9eaee; --leise: #9aa0ab; --akzent: #f06595; --akzent-hell: #3a1b27;
  --gut: #69db7c; --gut-hell: #1c3122; --warn: #ff8787; --warn-hell: #3b1f1f; --schatten: none; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 7px 10px; min-width: 0; }
textarea { resize: vertical; width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 7px 14px; background: var(--akzent); color: #fff; font-weight: 600; }
button.leise { background: var(--flaeche2); color: var(--text); font-weight: 500; }
button.mini { padding: 3px 9px; font-size: 12px; }
button.rot { background: var(--warn-hell); color: var(--warn); }
code { background: var(--flaeche2); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 12px; margin: 18px 0 8px; color: var(--leise); text-transform: uppercase; letter-spacing: .05em; }
p.hinweis { color: var(--leise); margin: 4px 0 10px; font-size: 13px; }

.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: 10px 24px; background: var(--flaeche); border-bottom: 1px solid var(--linie); flex-wrap: wrap; }
.marke { font-weight: 800; font-size: 18px; letter-spacing: -.02em; } .marke span { color: var(--akzent); }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: transparent; color: var(--leise); font-weight: 500; }
nav button.an { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
main { padding: 20px 24px 60px; max-width: 1500px; margin: 0 auto; }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r); box-shadow: var(--schatten); padding: 16px; margin-bottom: 16px; }
.leiste { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.leiste .rechts { margin-left: auto; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r); padding: 12px 14px; }
.kachel b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.kachel span { color: var(--leise); font-size: 12px; }

.tabelle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--linie); text-align: right; white-space: nowrap; }
th { font-size: 12px; color: var(--leise); font-weight: 600; background: var(--flaeche2); position: sticky; top: 0; cursor: pointer; user-select: none; }
th:first-child, td:first-child { text-align: left; }
td.links, th.links { text-align: left; }
tr.summe td { font-weight: 700; background: var(--flaeche2); }
tbody tr:hover td { background: var(--akzent-hell); }
td a, .klickbar { color: var(--akzent); cursor: pointer; text-decoration: none; }
.plus { color: var(--gut); } .minus { color: var(--warn); }
.marke-klein { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--flaeche2); color: var(--leise); }
.marke-klein.gut { background: var(--gut-hell); color: var(--gut); } .marke-klein.warn { background: var(--warn-hell); color: var(--warn); }

.formular { display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; align-items: center; max-width: 900px; }
.formular label { color: var(--leise); font-size: 13px; }
.formular .voll { grid-column: 1 / -1; }
.zeile { display: flex; gap: 8px; align-items: center; }
.zeile > * { flex: 1; } .zeile > .schmal { flex: 0 0 90px; } .zeile > button { flex: 0 0 auto; }
.kopierbar { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.kopierbar code { flex: 1; padding: 8px 10px; display: block; }
.liste-eintrag { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--linie); }
.liste-eintrag:last-child { border-bottom: 0; }
.liste-eintrag .info { color: var(--leise); font-size: 12.5px; word-break: break-all; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 50; }
details summary { cursor: pointer; color: var(--leise); }
pre { background: var(--flaeche2); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; max-height: 300px; }

@media (max-width: 720px) {
  .kopf, main { padding-left: 16px; padding-right: 16px; }
  .formular { grid-template-columns: 1fr; }
}

/* Ads-Manager-Ansicht */
.am-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--linie); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; overflow: hidden; background: var(--flaeche2); }
.am-tab { display: flex; align-items: center; gap: 8px; background: transparent; color: var(--text); font-weight: 600; border-radius: 0; padding: 12px 14px; border-right: 1px solid var(--linie); text-align: left; min-width: 0; }
.am-tab:last-child { border-right: 0; }
.am-tab.an { background: var(--flaeche); color: var(--akzent); box-shadow: inset 0 -2px 0 var(--akzent); }
.am-icon { width: 14px; height: 14px; border-radius: 3px; border: 2px solid currentColor; flex: 0 0 auto; opacity: .7; }
.am-adset { border-radius: 50%; } .am-ad { border-radius: 2px; transform: rotate(45deg) scale(.8); }
.am-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: var(--akzent); color: #fff; font-size: 11.5px; font-weight: 600; padding: 2px 4px 2px 9px; border-radius: 99px; min-width: 0; overflow: hidden; white-space: nowrap; }
.am-x { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: rgba(255,255,255,.25); font-size: 10px; cursor: pointer; }
.am-tabelle { border-radius: 0 0 var(--r) var(--r); }
.am-tabelle td.am-name a { color: var(--akzent); cursor: pointer; font-weight: 500; }
.am-tabelle td.am-name a:hover { text-decoration: underline; }
.am-tabelle th:first-child, .am-tabelle td:first-child { position: sticky; left: 0; background: var(--flaeche); z-index: 1; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.am-tabelle th:first-child { background: var(--flaeche2); z-index: 2; }
.am-tabelle tr.summe td:first-child { background: var(--flaeche2); }
@media (max-width: 720px) { .am-tabs { grid-template-columns: 1fr; } .am-tab { border-right: 0; border-bottom: 1px solid var(--linie); } }

.ich { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--leise); }
.ich a { color: var(--leise); }
