/* Affiliate portal (promoters/*): own shell with a sidebar. Every rule lives under .afp
   (prefix afp-), so nothing leaks into or depends on the V4 styles; tokens mirror v4.css. */
.afp {
  --font: "Satoshi", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --brand: #003a3a;
  --brand-bright: #2dd4bf;
  --brand-2: color-mix(in srgb, var(--brand) 80%, var(--brand-bright));
  --bg: #f4f7f7;
  --surface: #ffffff;
  --surface-2: #f2f6f5;
  --line: #e2eae9;
  --line-strong: #cfdcdb;
  --track: #e5edec;
  --ink: #0c1b1e;
  --ink-2: #29403f;
  --muted: #5d7275;
  --muted-2: #95a5a7;
  --accent: color-mix(in srgb, var(--brand) 60%, var(--brand-bright));
  --accent-ink: color-mix(in srgb, var(--accent) 70%, var(--brand));
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 32%, transparent);
  --btn-bg: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --btn-ink: #ffffff;
  --btn-glow: color-mix(in srgb, var(--brand) 38%, transparent);
  --focus: var(--accent);
  --bad: #be123c;  --bad-soft: #fdeef1;  --bad-line: #f5c5d0;
  --warn: #b45309; --warn-soft: #fdf4e6; --warn-line: #f1d7ad;
  --good: #047857; --good-soft: #e6f5ee; --good-line: #bde4d1;
  --bad-ink: #8f1239; --warn-ink: #6b3a05; --open-ink: #8a4207; --good-ink: #065f46;
  --stripe: #eaf1f0;
  --pop-bg: var(--ink); --pop-ink: #ffffff;
  --shadow: 0 1px 2px rgba(12, 27, 30, .04), 0 8px 24px -16px rgba(12, 27, 30, .14);
  --shadow-pop: 0 24px 56px -16px rgba(12, 27, 30, .30), 0 2px 8px rgba(12, 27, 30, .06);
  --overlay: rgba(8, 22, 24, .44);
  --sb-w: 256px;
}
.afp, .afp *, .afp *::before, .afp *::after { box-sizing: border-box; }
.afp { min-height: 100vh; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
:where(.afp) :is(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; }
:where(.afp) :is(ul, ol) { padding: 0; list-style: none; }
:where(.afp) a { color: inherit; }
:where(.afp) :is(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.afp) :is(button, input[type="submit"]) { cursor: pointer; }
.afp :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.afp-mono { font-family: var(--mono); }
.afp-ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.afp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.afp-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); display: flex; flex-direction: column; gap: 20px; padding: 20px 16px; background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.afp-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.afp-brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--btn-bg); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.afp-brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.afp-brand-sub { font-size: 12px; color: var(--muted); }
.afp-nav { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.afp-nav-link { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.afp-nav-link:hover { background: var(--surface-2); }
.afp-nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.afp-nav-link .afp-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.afp-user { border-top: 1px solid var(--line); padding: 16px 8px 0; }
.afp-user-name { font-weight: 700; font-size: 13.5px; }
.afp-user-mail { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afp-logout { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.afp-logout:hover { color: var(--ink); }

.afp-topbar { display: none; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.afp-topbar .afp-brand { padding: 0; }
.afp-topbar .afp-brand-mark { width: 32px; height: 32px; }
.afp-iconbtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.afp-scrim { display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 25; }

.afp-main { margin-left: var(--sb-w); padding: 28px 32px 64px; }
.afp-wrap { max-width: 1080px; margin: 0 auto; }
.afp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.afp-page-title { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
.afp-lead { margin-top: 4px; color: var(--muted); font-size: 14px; max-width: 62ch; }

/* ---------- Bausteine ---------- */
.afp-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.afp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.afp-card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.afp-card-head p { font-size: 13px; color: var(--muted); }
.afp-card-body { padding: 20px 24px; }
.afp-stack > * + * { margin-top: 20px; }
.afp-grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.afp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, filter .15s ease; }
.afp-btn-primary { background: var(--btn-bg); color: var(--btn-ink); box-shadow: 0 6px 14px -6px var(--btn-glow), inset 0 1px 0 rgba(255, 255, 255, .08); }
.afp-btn-primary:hover { filter: brightness(1.08); }
.afp-btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.afp-btn-outline:hover { border-color: var(--accent); color: var(--accent-ink); }
.afp-btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.afp-link .afp-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.afp-link { font-weight: 600; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; }

.afp-banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.afp-banner > .afp-ic { margin-top: 2px; }
.afp-banner--warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.afp-banner--warn > .afp-ic { color: var(--warn); }
.afp-banner--info { background: var(--surface-2); }
.afp-banner--info > .afp-ic { color: var(--muted); }
.afp-banner .afp-banner-main { flex: 1 1 auto; min-width: 0; }
.afp-banner .afp-banner-act { flex: none; align-self: center; }

/* Kacheln */
.afp-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.afp-tile { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; min-width: 0; }
.afp-tile-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.afp-tile-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.afp-tile-meta { font-size: 12.5px; color: var(--muted); }
.afp-tile--due .afp-tile-value { color: var(--good); }

/* Stufen */
.afp-level-now { font-size: 15px; font-weight: 700; }
.afp-level-next { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.afp-steps { display: grid; grid-template-columns: 5fr 10fr 6fr; gap: 6px; margin-top: 16px; }
.afp-step-bar { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.afp-step-bar i { display: block; height: 100%; border-radius: 999px; background: var(--btn-bg); }
.afp-step-label { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.afp-step-label b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.afp-step.is-current .afp-step-label b { color: var(--accent-ink); }
.afp-level-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }

/* Link-Box */
.afp-field + .afp-field { margin-top: 14px; }
.afp-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.afp-hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.afp-linkbox { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 6px 4px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); min-width: 0; }
.afp-linkbox .afp-mono { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-2); }
.afp-linkbox--wrap { border-radius: 16px; padding: 10px 8px 10px 16px; align-items: flex-start; }
.afp-linkbox--wrap .afp-mono { white-space: normal; overflow: visible; word-break: break-all; padding-top: 6px; }
.afp-linkbox--code .afp-mono { font-size: 16px; font-weight: 500; letter-spacing: .06em; color: var(--ink); }
.afp-builder { margin-top: 18px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.afp-builder h3 { font-size: 13.5px; font-weight: 700; }
.afp-builder-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.afp-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14.5px; color: var(--ink); }
.afp-input:hover { border-color: var(--muted-2); }
.afp-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-line); }
.afp-input::placeholder { color: var(--muted-2); }
select.afp-input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235d7275' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

/* Startliste */
.afp-todo li { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-top: 1px solid var(--line); }
.afp-todo li:first-child { border-top: 0; }
.afp-check { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); color: transparent; font-size: 12px; font-weight: 700; }
.afp-todo li.is-done .afp-check { border-color: var(--good); background: var(--good); color: #fff; }
.afp-todo li.is-done .afp-check .afp-ic { width: 14px; height: 14px; stroke-width: 3; }
.afp-todo-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.afp-todo-text { flex: 1 1 auto; min-width: 0; }
.afp-todo-text b { display: block; font-size: 14px; }
.afp-todo-text span { font-size: 13px; color: var(--muted); }
.afp-todo li.is-done .afp-todo-text b { color: var(--muted); }

/* Tabellen */
.afp-table-wrap { overflow-x: auto; }
.afp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.afp-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.afp-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.afp-table tr:last-child td { border-bottom: 0; }
.afp-table th:first-child, .afp-table td:first-child { padding-left: 24px; }
.afp-table th:last-child, .afp-table td:last-child { padding-right: 24px; }
.afp-table .afp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.afp-table td:first-child { white-space: nowrap; }
.afp-table td.afp-strong { font-weight: 700; color: var(--ink); }
.afp-neg { color: var(--bad); }
.afp-zero { color: var(--muted); }
.afp-sub { display: block; font-size: 12.5px; color: var(--muted); }
.afp-empty { padding: 36px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.afp-empty b { display: block; margin-bottom: 4px; color: var(--ink-2); font-size: 15px; }
.afp-foot { padding: 14px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.afp-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.afp-badge--due { background: var(--good-soft); border-color: var(--good-line); color: var(--good); }
.afp-badge--open { background: var(--warn-soft); border-color: var(--warn-line); color: var(--open-ink); }
.afp-badge--paid { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.afp-badge--none { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

.afp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.afp-chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.afp-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.afp-chip b { font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--muted); }
.afp-chip[aria-current="true"] { background: var(--btn-bg); border-color: transparent; color: var(--btn-ink); }
.afp-chip[aria-current="true"] b { color: inherit; opacity: .8; }

/* Werbematerial */
.afp-section-title { margin: 28px 0 12px; font-size: 15px; font-weight: 700; }
.afp-section-title:first-of-type { margin-top: 20px; }
.afp-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.afp-asset { overflow: hidden; display: flex; flex-direction: column; }
.afp-thumb { aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 16px; background: repeating-linear-gradient(135deg, var(--surface-2) 0 12px, var(--stripe) 12px 24px); border-bottom: 1px solid var(--line); }
.afp-thumb-box { display: grid; place-items: center; border-radius: 6px; background: var(--btn-bg); color: #fff; font-family: var(--mono); font-size: 11px; box-shadow: var(--shadow); text-align: center; padding: 4px; }
.afp-asset-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.afp-asset-body b { font-size: 14px; }
.afp-asset-body span { font-size: 12.5px; color: var(--muted); }
.afp-asset-body .afp-btn { margin-top: auto; align-self: flex-start; }

/* Hilfe */
.afp-tips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.afp-tip { padding: 18px 20px; }
.afp-tip b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.afp-tip p { font-size: 13.5px; color: var(--ink-2); }
.afp-example { padding: 18px 20px; }
.afp-example-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.afp-example-head b { font-size: 14.5px; }
.afp-example pre { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--font); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; color: var(--ink-2); }
.afp-faq details { border-top: 1px solid var(--line); }
.afp-faq details:first-child { border-top: 0; }
.afp-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; font-weight: 600; font-size: 14.5px; cursor: pointer; list-style: none; }
.afp-faq summary::-webkit-details-marker { display: none; }
.afp-faq summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--muted); line-height: 1; }
.afp-faq details[open] summary::after { content: "–"; }
.afp-faq details p { padding: 0 24px 18px; color: var(--ink-2); font-size: 14px; max-width: 75ch; }

/* Einstellungen */
.afp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.afp-form-grid .afp-full { grid-column: 1 / -1; }
.afp-radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.afp-radio { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13.5px; cursor: pointer; }
.afp-radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.afp-radio:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.afp-radio input { margin: 3px 0 0; accent-color: var(--brand); }
.afp-radio-col { display: grid; gap: 10px; }
.afp-form-sub { margin: 22px 0 12px; font-size: 13.5px; font-weight: 700; }
.afp-form-sub:first-child { margin-top: 0; }
.afp-form-foot { display: flex; align-items: center; gap: 14px; margin-top: 22px; }

.afp-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 12px; background: var(--pop-bg); color: var(--pop-ink); font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 60; max-width: calc(100vw - 32px); }
.afp-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.afp [hidden] { display: none !important; }

/* ---------- Tablet / Mobil ---------- */
@media (max-width: 1100px) {
  .afp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afp-grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .afp-topbar { display: flex; }
  .afp-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); width: min(var(--sb-w), 84vw); }
  .afp.afp-menu-open .afp-sidebar { transform: none; }
  .afp.afp-menu-open .afp-scrim { display: block; }
  .afp-main { margin-left: 0; padding: 20px 16px 56px; }
  .afp-page-title { font-size: 22px; }
  .afp-head { margin-bottom: 16px; }
  .afp-tips { grid-template-columns: minmax(0, 1fr); }
  .afp-form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .afp-tiles { gap: 12px; }
  .afp-tile { padding: 14px 16px; }
  .afp-tile-value { font-size: 22px; }
  .afp-card-head, .afp-card-body { padding-left: 16px; padding-right: 16px; }
  .afp-todo li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px 14px; align-items: start; padding: 14px 16px; }
  .afp-todo li .afp-btn { grid-column: 2; justify-self: start; }
  .afp-builder-row { grid-template-columns: minmax(0, 1fr); }
  .afp-banner { display: grid; grid-template-columns: 18px minmax(0, 1fr); }
  .afp-banner .afp-banner-act { grid-column: 2; justify-self: start; }
  .afp-steps { grid-template-columns: 1fr 1fr 1fr; }
  .afp-faq summary { padding: 14px 16px; }
  .afp-faq details p { padding: 0 16px 16px; }
  .afp-foot { padding: 14px 16px; }
  .afp-table th:first-child, .afp-table td:first-child { padding-left: 16px; }
  .afp-table th:last-child, .afp-table td:last-child { padding-right: 16px; }
  .afp-table th, .afp-table td { padding-left: 10px; padding-right: 10px; }
  /* Tabellen als Kartenliste */
  .afp-stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .afp-stackable, .afp-stackable tbody, .afp-stackable tr, .afp-stackable td { display: block; width: 100%; }
  .afp-stackable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .afp-stackable tr:last-child { border-bottom: 0; }
  .afp-stackable td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 4px 0 !important; border: 0; text-align: right; }
  .afp-stackable td::before { content: attr(data-label); flex: none; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; }
  .afp-stackable td .afp-sub { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { .afp * { transition: none !important; } }

/* ---------- Additions for the Rails pages ---------- */
.afp-user-terms { display: block; margin-top: 10px; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.afp-banner--good { background: var(--good-soft); border-color: var(--good-line); color: var(--good-ink); }
.afp-banner--good > .afp-ic { color: var(--good); }
.afp-banner--bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad-ink); }
.afp-banner--bad > .afp-ic { color: var(--bad); }
.afp-flash { margin-bottom: 20px; }
.afp-form-errors { margin-bottom: 18px; }
.afp-gap { margin-top: 20px; }
.afp-small { font-size: 13px; }
.afp-pre { white-space: pre-line; }
.afp-tiles--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.afp-hint--tight { margin-top: 2px; }
.afp-hint--up { margin-top: -6px; }
.afp-builder-field { margin-top: 12px; }

/* Copy buttons: the "copied" note of the clipboard controller */
.afp-linkbox, .afp-copy-wrap { position: relative; }
.afp-copy-wrap { display: inline-flex; }
.afp-copied { position: absolute; right: 6px; bottom: calc(100% + 6px); padding: 4px 10px; border-radius: 8px; background: var(--pop-bg); color: var(--pop-ink); font-size: 12px; font-weight: 600; white-space: nowrap; z-index: 5; }
.afp-copied.hidden { display: none; }

/* Material previews */
.afp-thumb { overflow: hidden; }
.afp-thumb img, .afp-thumb video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.afp-thumb-file { display: grid; place-items: center; width: 64px; height: 80px; border-radius: 8px; background: var(--btn-bg); color: #fff; }
.afp-thumb-file .afp-ic { width: 28px; height: 28px; }
.afp-asset-text { margin-top: 6px; font-size: 13px; color: var(--ink-2); }

/* Settings forms */
.afp-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.afp-fieldset legend { padding: 0; }
.afp-fieldset .afp-form-sub { margin-top: 0; }
.afp-form-gap { margin-top: 14px; }
.afp-static { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.afp-payout-form:has(input[value="paypal"]:checked) .afp-bank-fields { display: none; }
.afp-payout-form:not(:has(input[value="paypal"]:checked)) .afp-paypal-fields { display: none; }

/* Page numbers (pagy_nav) */
.afp-pagy nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.afp-pagy nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.afp-pagy nav a.current { background: var(--btn-bg); border-color: transparent; color: var(--btn-ink); }
.afp-pagy nav a[aria-disabled="true"] { opacity: .45; }
/* ---------- Dark mode (html.dark, set by the theme toggle in the sidebar) ---------- */
html.dark .afp {
  color-scheme: dark;
  --bg: #0b1416;
  --surface: #111d20;
  --surface-2: #16252a;
  --line: #22343a;
  --line-strong: #2e454c;
  --track: #22343a;
  --ink: #e6f0ef;
  --ink-2: #c3d3d2;
  --muted: #8fa3a5;
  --muted-2: #6b8083;
  --accent: color-mix(in srgb, var(--brand) 25%, var(--brand-bright));
  --accent-ink: #5eead4;
  --accent-soft: color-mix(in srgb, var(--brand-bright) 12%, var(--surface));
  --accent-line: color-mix(in srgb, var(--brand-bright) 35%, transparent);
  --btn-bg: linear-gradient(135deg, #0f5c5a 0%, #12807a 100%);
  --btn-glow: rgba(0, 0, 0, .45);
  --bad: #fb7185;  --bad-soft: #2a1218;  --bad-line: #5b2230;
  --warn: #fbbf24; --warn-soft: #2a1f0c; --warn-line: #5a4318;
  --good: #34d399; --good-soft: #0c2a20; --good-line: #1d5141;
  --bad-ink: #fecdd3; --warn-ink: #fde68a; --open-ink: #fde68a; --good-ink: #a7f3d0;
  --stripe: #1a2b30;
  --pop-bg: #e6f0ef; --pop-ink: #0c1b1e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -16px rgba(0, 0, 0, .6);
  --shadow-pop: 0 24px 56px -16px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .4);
  --overlay: rgba(0, 0, 0, .6);
}
html.dark .afp .afp-todo li.is-done .afp-check { color: var(--bg); }
.afp-theme { display: flex; margin-top: 10px; padding: 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.afp-theme:hover { color: var(--ink); }
.afp-theme > span { display: inline-flex; align-items: center; gap: 8px; }
.afp-theme .afp-ic { width: 16px; height: 16px; }
html.dark .afp .afp-theme-to-dark, html:not(.dark) .afp .afp-theme-to-light { display: none; }
