/*
 * Weedlings design base for partner portal and admin page (docs/frontend-plan.md, Abschnitt 2).
 * Colours: brandmark guidelines (background #edeae3, green #66b685) + weedlings.de (dark header #151515, pill buttons).
 * Fonts: Maven Pro (brand guidelines, headings) and Schibsted Grotesk (shop, text), served from our own domain (OFL).
 * Contrast: text colours below are ≥ 4.5:1 on white and on the cream background.
 */
@font-face {
    font-family: "Maven Pro";
    src: url("/assets/fonts/maven-pro-latin.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("/assets/fonts/schibsted-grotesk-latin.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --page: #edeae3;
    --surface: #ffffff;
    --soft: #f6f4ef;
    --ink: #1b1f1c;
    --muted: #5b635e;
    --line: #ddd8cc;
    --line-strong: #8f978f;
    --green: #66b685;
    --green-hover: #59a777;
    --green-ink: #0e2a17;
    --green-dark: #276b43;
    --green-soft: #e3f1e7;
    --bluegrey: #9bb8bf;
    --dark: #151515;
    --dark-2: #1e1e1e;
    --on-dark: #f2f0ea;
    --on-dark-muted: #b9b6ae;
    --amber: #fff3d6;
    --amber-line: #ebd08a;
    --amber-ink: #6b4a00;
    --red: #a52019;
    --red-soft: #fbe5e3;
    --focus: #2f6fdb;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(20, 20, 20, 0.05), 0 4px 16px rgba(20, 20, 20, 0.05);
    --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --font-head: "Maven Pro", "Schibsted Grotesk", system-ui, Arial, sans-serif;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--page); overflow-x: hidden; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 6vw, 2.75rem); }
h2 { font-size: clamp(1.3rem, 3.6vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--green-dark); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 0.92em; overflow-wrap: anywhere; }
small, .fine { color: var(--muted); font-size: 0.875rem; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: var(--ink); padding: 10px 14px; z-index: 100; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 24px; } }

/* ---- header / footer (dark, like weedlings.de) ---------------------------------------------------------------- */
.site-head { position: sticky; top: 0; z-index: 40; background: var(--dark); color: var(--on-dark); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-dark); text-decoration: none; min-width: 0; }
.brand { flex: 0 1 auto; }
.brand img { width: 166px; max-width: 100%; height: auto; display: block; }
.brand .tag { font-family: var(--font-head); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-dark-muted); border-left: 1px solid #3a3a3a; padding-left: 10px; white-space: nowrap; }
@media (max-width: 760px) { .brand .tag { display: none; } }
@media (max-width: 380px) { .brand img { width: 128px; } }
.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.head-actions .who { color: var(--on-dark-muted); font-size: 0.92rem; margin-right: 4px; }
@media (max-width: 560px) { .head-actions .who, .head-actions .hide-sm { display: none; } }
.site-foot { background: var(--dark-2); color: var(--on-dark-muted); padding: 28px 0 36px; font-size: 0.9rem; margin-top: 48px; }
.site-foot a { color: var(--on-dark); }
.site-foot .links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; }
.site-foot .imprint { margin: 0; line-height: 1.6; }

/* ---- buttons --------------------------------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 10px 24px; border-radius: 100px; border: 2px solid var(--green);
    background: var(--green); color: var(--green-ink); font: inherit; font-weight: 700; line-height: 1.2;
    text-decoration: none; cursor: pointer; text-align: center; transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn.secondary:hover { background: var(--soft); }
.btn.quiet { background: transparent; color: var(--green-dark); border-color: transparent; padding-left: 12px; padding-right: 12px; }
.btn.quiet:hover { background: var(--green-soft); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.on-dark { background: transparent; color: var(--on-dark); border-color: #4a4a4a; }
.btn.on-dark:hover { border-color: var(--on-dark); background: transparent; }
.btn.small { min-height: 40px; padding: 6px 16px; font-size: 0.94rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .arrow { font-size: 1.1em; line-height: 1; margin-left: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---- surfaces ---------------------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
@media (min-width: 700px) { .card { padding: 24px 28px; } }
.card > h2:first-child, .card > h3:first-child, .card > header:first-child h2 { margin-top: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.notice { border-radius: var(--radius-sm); padding: 14px 16px; background: var(--green-soft); border: 1px solid #c4e0cd; }
.notice.warn { background: var(--amber); border-color: var(--amber-line); color: var(--amber-ink); }
.notice.error { background: var(--red-soft); border-color: #f1bcb7; color: var(--red); }
.notice > :last-child { margin-bottom: 0; }
.notice a { color: inherit; font-weight: 700; }

/* ---- forms ----------------------------------------------------------------------------------------------------- */
label, .label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type="text"], input:not([type]), input[type="email"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
    width: 100%; font: inherit; padding: 11px 14px; min-height: 48px; border: 1.5px solid var(--line-strong); border-radius: 12px;
    background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
input[disabled], textarea[disabled], select[disabled] { background: var(--soft); color: var(--muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); border-width: 2px; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--red); font-size: 0.9rem; font-weight: 600; margin: 6px 0 0; }
.field-error::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font-size: 0.75rem; display: grid; place-items: center; margin-top: 2px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.opt { color: var(--muted); font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.choice, .check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; margin: 8px 0; cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--line-strong); }
.choice:has(input:checked) { border-color: var(--green-dark); background: var(--green-soft); box-shadow: inset 0 0 0 1px var(--green-dark); }
.choice input, .check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--green-dark); }
.choice small, .check small { display: block; margin-top: 2px; }
.check { border-color: transparent; padding-left: 0; padding-right: 0; background: transparent; }
.form-msg { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--green-soft); }
.form-msg.error { background: var(--red-soft); color: var(--red); }

/* ---- status pills, tables -------------------------------------------------------------------------------------- */
.pill { display: inline-block; padding: 3px 11px; border-radius: 100px; font-size: 0.84rem; font-weight: 600; background: #ebe8e0; color: var(--ink); white-space: nowrap; }
.pill.ok, .pill.paid, .pill.active { background: #cfe8d7; color: #14502c; }
.pill.ready { background: var(--green-soft); color: var(--green-dark); }
.pill.wait, .pill.pending, .pill.paused { background: var(--amber); color: var(--amber-ink); }
.pill.off, .pill.blocked { background: var(--red-soft); color: var(--red); }
.tablewrap { overflow-x: auto; }
table.data .pill { white-space: normal; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Tables become cards on phones: each cell shows its column name. */
@media (max-width: 700px) {
    table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
    table.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; background: #fff; }
    table.cards td { border: 0 !important; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    table.cards td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; font-size: 0.9rem; }
    table.cards td .pill { white-space: nowrap; }
    table.cards td .pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
    table.cards td.full { display: block; text-align: left; padding-top: 8px; }
    table.cards td.full::before { display: none; }
    table.cards td:empty { display: none; }
}

/* ---- chips (filters) --------------------------------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { font: inherit; font-size: 0.92rem; font-weight: 600; min-height: 38px; padding: 6px 14px; border-radius: 100px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count { font-weight: 400; opacity: 0.75; margin-left: 4px; }

/* ---- tiles --------------------------------------------------------------------------------------------------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.tile .label { color: var(--muted); font-size: 0.88rem; }
.tile .value { font-family: var(--font-head); font-size: clamp(1.35rem, 4.6vw, 1.75rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; margin: 2px 0; }
.tile .sub { color: var(--muted); font-size: 0.85rem; }
.tile .up { color: var(--green-dark); font-weight: 600; }
a.tile, button.tile { color: inherit; text-decoration: none; text-align: left; font: inherit; cursor: pointer; display: block; width: 100%; }
a.tile:hover, button.tile:hover { border-color: var(--line-strong); }
.bar { height: 8px; background: #ebe8e0; border-radius: 100px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 100px; }

/* ---- dialogs, toasts, tooltips --------------------------------------------------------------------------------- */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); color: var(--ink); }
dialog::backdrop { background: rgba(21, 21, 21, 0.55); }
dialog .dlg-body { padding: 22px 22px 8px; overflow: auto; }
dialog .dlg-foot { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 14px 22px 18px; background: #fff; border-top: 1px solid var(--line); }
dialog h2 { font-size: 1.3rem; margin-top: 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--bottom-bar, 0px)); transform: translateX(-50%); z-index: 90; max-width: calc(100vw - 32px); width: max-content; background: var(--dark); color: var(--on-dark); padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); }
.toast.error { background: var(--red); color: #fff; }
.tip { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line-strong); color: var(--muted); font-size: 0.75rem; font-weight: 700; cursor: help; position: relative; vertical-align: middle; margin-left: 4px; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 260px; background: var(--dark); color: var(--on-dark); font-weight: 400; font-size: 0.85rem; line-height: 1.4; padding: 8px 10px; border-radius: 8px; z-index: 50; text-align: left; }
details.more { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
details.more > summary { cursor: pointer; font-weight: 600; padding: 10px 0; color: var(--green-dark); }

@media print {
    .site-head, .site-foot, .no-print, .skip { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 0; padding: 0; }
}
