/* NexGen MarketingPlattform – ruhiges, datenlastiges Layout */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --ink: #17202b;
    --ink-2: #4b5766;
    --muted: #7c8794;
    --line: #e2e6eb;
    --accent: #0b6e69;
    --accent-ink: #ffffff;
    --accent-soft: #e3f2f1;
    --warn: #b26b00;
    --warn-soft: #fff4e0;
    --bad: #b3261e;
    --bad-soft: #fdeceb;
    --good: #1f7a3a;
    --good-soft: #e6f4ea;
    --radius: 8px;
    --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141a; --surface: #171e26; --ink: #e6ebf0; --ink-2: #b4bec9; --muted: #85909c;
        --line: #2a333d; --accent: #3fb8ae; --accent-ink: #06201e; --accent-soft: #15302e;
        --warn-soft: #3a2a10; --bad-soft: #3b1715; --good-soft: #13301c;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h2.spaced { margin-top: 1.5rem; }
small { font-weight: normal; }
code, pre { font-family: var(--mono); font-size: .85em; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem; background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 650; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.brand-mark { background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700;
    padding: .2rem .35rem; border-radius: 4px; letter-spacing: .04em; }
.mainnav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.mainnav a, .usermenu a { color: var(--ink-2); padding: .35rem .65rem; border-radius: 6px; }
.mainnav a:hover, .usermenu a:hover { background: var(--bg); text-decoration: none; }
.mainnav a.active, .usermenu a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.usermenu { display: flex; align-items: center; gap: .5rem; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pagehead-actions { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.crumb { margin: 0; font-size: .85rem; color: var(--muted); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .75rem 0 0; }
.notes { white-space: pre-wrap; background: var(--surface); border-left: 3px solid var(--line); padding: .5rem .75rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.25rem; align-items: start; }
.split > .card { margin-bottom: 0; }
.split + .card, .split + section { margin-top: 1.25rem; }
.empty { color: var(--muted); padding: 1rem 0; margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.kpi-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi-accent { border-color: var(--accent); background: var(--accent-soft); }
.kpi-accent .kpi-value { color: var(--accent); }
.kpi-muted .kpi-value { color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
    font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table.compact td { padding: .35rem .6rem; font-size: .9rem; }
.table tfoot td { font-weight: 650; border-top: 2px solid var(--line); border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.table .num { text-align: right; white-space: nowrap; }
.table .strong { font-weight: 650; }
.table .actions { text-align: right; white-space: nowrap; }
.table .url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.row-warn td { background: var(--warn-soft); }

.barcell { display: flex; align-items: center; gap: .5rem; min-width: 150px; }
.barcell span { font-size: .8rem; color: var(--muted); min-width: 3em; text-align: right; }
.bar { width: 110px; height: 8px; flex: none; }
.bar-bg { fill: var(--line); }
.bar-fg { fill: var(--accent); }

.countrylist { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.countrylist li { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr auto; align-items: center; gap: .75rem; }
.countrylist .bar { width: 100%; }
.country { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.flag-text { font-size: .6rem; font-weight: 700; display: inline-grid; place-items: center; background: var(--bg); color: var(--ink-2); }
.flag { width: 20px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); object-fit: cover; flex: none; }

.tag { display: inline-block; font-size: .75rem; padding: .1rem .45rem; border-radius: 999px; background: var(--bg);
    border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; vertical-align: middle; font-weight: 500; }
.tag-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tag-good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.tag-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.tag-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }

form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 550; color: var(--ink-2); margin-bottom: .9rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
    border-radius: 6px; padding: .5rem .6rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.field-error { color: var(--bad); font-size: .8rem; font-weight: 500; }
form.inline { display: inline; }

.filterbar { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.filterbar label { margin: 0; font-size: .75rem; }
.filterbar input, .filterbar select { padding: .35rem .5rem; width: auto; }

.metric-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem .75rem; align-items: end; }
.metric-form label { margin: 0; }
.metric-form .btn { height: 2.4rem; }

.btn, .btn-secondary, .btn-small, .btn-link { font: inherit; cursor: pointer; border-radius: 6px; display: inline-block; text-align: center; }
.btn { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: .5rem 1rem; font-weight: 600; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: .45rem .9rem; }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-small { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); padding: .2rem .55rem; font-size: .8rem; }
.btn-small:hover { background: var(--bg); text-decoration: none; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-link { background: none; border: none; color: var(--ink-2); padding: .35rem .5rem; }
.btn-link:hover { color: var(--accent); }

.flash { background: var(--good-soft); color: var(--good); border-radius: var(--radius); padding: .65rem 1rem; margin-bottom: 1rem; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: .6rem .8rem; }
.notice { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: .6rem .8rem; }

.auth-card { max-width: 400px; margin: 3rem auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; }
.auth-card h1 { margin-bottom: 1rem; }
.auth-card .btn { width: 100%; margin-top: .25rem; }

.snippet { position: relative; margin-bottom: 1rem; }
.snippet pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .75rem; padding-right: 5.5rem;
    white-space: pre-wrap; word-break: break-all; margin: 0; }
.snippet .btn-small { position: absolute; top: .5rem; right: .5rem; }
.danger-zone { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }

@media (max-width: 640px) {
    .split { grid-template-columns: 1fr; }
    .grid2 { grid-template-columns: 1fr; }
    .countrylist li { grid-template-columns: 1fr auto; }
    .countrylist .bar { display: none; }
}

/* Verbindungen */
.platforms { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.platforms .card { margin-bottom: 0; }
.spaced-top { margin-top: 1rem; }
details summary { cursor: pointer; color: var(--ink-2); font-size: .88rem; }
details form { margin-top: .75rem; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
label.check { flex-direction: row; align-items: flex-start; gap: .6rem; margin: 0; font-weight: normal; color: var(--ink); }
label.check input { width: auto; margin-top: .25rem; }
label.check small { display: block; }

/* ---------- Ausbau 3 ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.navmore { position: relative; }
.navmore summary { list-style: none; color: var(--ink-2); padding: .35rem .65rem; border-radius: 6px; font-size: 15px; }
.navmore summary::-webkit-details-marker { display: none; }
.navmore summary::after { content: " ▾"; font-size: .75em; }
.navmore summary:hover { background: var(--bg); }
.navmore summary.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.navmore-menu { position: absolute; top: 2.3rem; left: 0; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .35rem; display: grid; min-width: 190px; z-index: 20; }
.navmore-menu a { padding: .4rem .65rem; }
.workspace-switch select { width: auto; max-width: 220px; padding: .25rem .5rem; font-size: .85rem; }
.scopebar { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); padding: .5rem 1rem; margin-bottom: 1rem; font-size: .9rem; }

/* Nur-Lesen: Bearbeiten ausblenden (Server lehnt Schreibzugriffe ohnehin ab) */
.readonly form[method=post]:not(.keep), .readonly .edit-only { display: none !important; }

/* Veränderung ggü. Vorperiode */
.delta { font-size: .78rem; color: var(--muted); margin-top: .15rem; font-variant-numeric: tabular-nums; }
.delta-good { color: var(--good); }
.delta-bad { color: var(--bad); }

/* Diagramme (SVG, Farben nur per Klasse – CSP-konform) */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart polyline.series { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart circle.series { stroke: none; }
.series-0 { stroke: #0b6e69; fill: #0b6e69; }
.series-1 { stroke: #c2410c; fill: #c2410c; }
.series-2 { stroke: #4f46e5; fill: #4f46e5; }
.series-3 { stroke: #b45309; fill: #b45309; }
.series-4 { stroke: #be185d; fill: #be185d; }
.series-5 { stroke: #4b5563; fill: #4b5563; }
@media (prefers-color-scheme: dark) {
    .series-0 { stroke: #3fb8ae; fill: #3fb8ae; }
    .series-1 { stroke: #fb923c; fill: #fb923c; }
    .series-2 { stroke: #a5b4fc; fill: #a5b4fc; }
    .series-3 { stroke: #fbbf24; fill: #fbbf24; }
    .series-4 { stroke: #f472b6; fill: #f472b6; }
    .series-5 { stroke: #cbd5e1; fill: #cbd5e1; }
}
.chart polyline.series { fill: none; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: 0; margin: .5rem 0 0; font-size: .85rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.swatch.series-0 { background: #0b6e69; } .swatch.series-1 { background: #c2410c; } .swatch.series-2 { background: #4f46e5; }
.swatch.series-3 { background: #b45309; } .swatch.series-4 { background: #be185d; } .swatch.series-5 { background: #4b5563; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.charts .card { margin-bottom: 0; }
.charts h2 { font-size: .95rem; }

/* Warnungen */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.alerts li { display: flex; gap: .6rem; align-items: baseline; padding: .45rem .7rem; border-radius: 6px; background: var(--bg); font-size: .9rem; }
.alerts li.sev-KRITISCH { background: var(--bad-soft); }
.alerts li.sev-WARNUNG { background: var(--warn-soft); }
.alerts time { color: var(--muted); font-size: .8rem; white-space: nowrap; margin-left: auto; }

/* Budgets */
.budgetbar { width: 140px; height: 10px; }
.budgetbar .bar-fg.st-warn { fill: var(--warn); }
.budgetbar .bar-fg.st-over { fill: var(--bad); }
.table input.money { width: 8.5rem; text-align: right; padding: .3rem .45rem; }

/* Trichter */
.funnel-steps { display: grid; gap: .35rem; }
.funnel-step { display: grid; grid-template-columns: 9rem 1fr 6rem 5rem; gap: .6rem; align-items: center; font-size: .88rem; }
.funnel-step .bar { width: 100%; height: 12px; }
.funnel-step .rate { color: var(--muted); text-align: right; font-size: .8rem; }
.funnel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.25rem; }
.funnel-grid .card { margin-bottom: 0; }

/* Code/Keys */
.secret { font-family: var(--mono); background: var(--warn-soft); padding: .6rem .8rem; border-radius: 6px; word-break: break-all; }
.steps { padding-left: 1.2rem; margin: .5rem 0; }
.steps li { margin-bottom: .35rem; }
.inline-fields { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-fields label { margin: 0; }
@media (max-width: 640px) {
    .charts, .funnel-grid { grid-template-columns: 1fr; }
    .funnel-step { grid-template-columns: 6rem 1fr 4.5rem; }
    .funnel-step .rate { display: none; }
}
/* QR-Code: immer dunkel auf hell (auch im Dark Mode), sonst scannen manche Apps nicht */
.qrbox { margin: .6rem 0; }
.qr { width: 200px; height: 200px; display: block; border-radius: 6px; }
.qr .qr-bg { fill: #ffffff; }
.qr .qr-fg { fill: #000000; }
