/* PayBae — one column, phone-first, receipt-style rows.
   Brand: Hot Pink #FF007F (primary, logo, buttons) · Asphalt Black #171717 (dark ground, text on light)
   · Blush White #FFF0F6 (light ground, text on dark and on pink).
   --accent is the exact brand pink for fills; --accent-ink is pink for small text, darkened on light
   ground so it reaches 4.5:1 (pure #FF007F on #FFF0F6 is only 3.4:1). */
:root {
  --bg: #fff0f6; --surface: #ffffff; --fg: #171717; --muted: #6b5560; --line: #f6d6e4;
  --accent: #ff007f; --accent-ink: #c8005f; --accent-fg: #fff0f6; --soft: #ffdcec; --danger: #b3261e; --ok: #13734a;
  --f-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171717; --surface: #211c1f; --fg: #fff0f6; --muted: #b9a5ae; --line: #352a30;
    --accent: #ff007f; --accent-ink: #ff4fa3; --accent-fg: #fff0f6; --soft: #3b1328; --danger: #ff8a80; --ok: #5fd39a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--f-body);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 32px) max(16px, env(safe-area-inset-left, 0px));
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.wrap { max-width: 560px; margin: 0 auto; display: grid; gap: 20px; }
section, #adminBody { display: grid; gap: 16px; }
.top { display: flex; justify-content: space-between; align-items: center; }
.brand-logo { display: block; width: 106px; height: auto; }
h1 { font: 800 2rem/1.15 var(--f-display); margin: 8px 0 0; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font: 700 1.05rem var(--f-display); margin: 0; }
.lede { margin: -8px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-weight: 400; }
input {
  font: inherit; font-size: 16px; font-weight: 400; width: 100%; min-width: 0;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg);
  -webkit-appearance: none; appearance: none;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
button { font: inherit; cursor: pointer; border: 0; -webkit-appearance: none; appearance: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); color: var(--accent-fg); font-weight: 800; font-size: 1.2rem; padding: 14px; border-radius: 14px; }
.primary:active { transform: scale(.985); }
.chip { background: var(--soft); color: var(--accent-ink); font-weight: 600; font-size: .9rem; padding: 0 14px; border-radius: 12px; white-space: nowrap; }
.linkbtn { background: none; color: var(--muted); font-weight: 600; padding: 8px 4px; }
.linkbtn.danger { color: var(--danger); justify-self: center; }
.pasterow, .toolbar { display: flex; gap: 8px; }
.toolbar .chip { padding: 12px 14px; }
.pricebox { position: relative; }
.pricebox input { padding-right: 40px; font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.pricebox span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.msg { margin: 0; font-size: .9rem; min-height: 1.35em; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.listhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sum { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; padding: 12px 0; border-top: 1px dashed var(--line); }
.items li:first-child { border-top: 0; padding-top: 0; }
.url { color: var(--fg); font-weight: 600; overflow-wrap: anywhere; text-decoration: none; }
a.url { color: var(--accent-ink); }
.price { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.meta { grid-column: 1; color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.who { background: var(--soft); color: var(--fg); border-radius: 99px; padding: 0 8px; font-weight: 600; }
.del { grid-column: 2; grid-row: 2; justify-self: end; background: none; color: var(--danger); font-size: .82rem; font-weight: 600; padding: 2px 0; }
.del.confirm { text-decoration: underline; }
.empty { margin: 0; color: var(--muted); font-size: .92rem; }
.topnav { display: flex; gap: 6px; }
.notice { margin: 0; background: var(--soft); color: var(--fg); border-radius: 14px; padding: 12px 14px; font-size: .92rem; }
.userform { display: grid; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.role { color: var(--muted); font-size: .82rem; text-align: right; }
.del { white-space: nowrap; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: grid; }
.statlabel { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.statval { font: 700 1.5rem var(--f-mono); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .primary:active { transform: none; } }

/* ---------- Status, stars, budget ---------- */
:root {
  --st-offen-bg: #efe7eb; --st-offen-fg: #5b4a53;
  --st-akz-bg: #e2ebfb; --st-akz-fg: #1f4f9a;
  --st-bearb-bg: #ebe5fb; --st-bearb-fg: #573aa3;
  --st-zahl-bg: #fcefd6; --st-zahl-fg: #855600;
  --st-bez-bg: #dcf2e6; --st-bez-fg: #146239;
  --st-abg-bg: #fbe2df; --st-abg-fg: #a1261d;
  --star-on: #e8a317; --star-off: #e6d5dd; --track: #f3e6ec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --st-offen-bg: #33282e; --st-offen-fg: #d6c3cc;
    --st-akz-bg: #1c2b45; --st-akz-fg: #9dbdf5;
    --st-bearb-bg: #2a2145; --st-bearb-fg: #c3b0f7;
    --st-zahl-bg: #3a2c12; --st-zahl-fg: #f2c46b;
    --st-bez-bg: #163325; --st-bez-fg: #7fdcaa;
    --st-abg-bg: #3d1c1a; --st-abg-fg: #f59a92;
    --star-on: #f4b942; --star-off: #45333c; --track: #2e2129;
  }
}
h3 { font: 700 .95rem var(--f-display); margin: 0; }
select {
  font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--fg); width: 100%;
}
.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.st-offen { background: var(--st-offen-bg); color: var(--st-offen-fg); }
.st-akzeptiert { background: var(--st-akz-bg); color: var(--st-akz-fg); }
.st-in_bearbeitung { background: var(--st-bearb-bg); color: var(--st-bearb-fg); }
.st-zahlung_angewiesen { background: var(--st-zahl-bg); color: var(--st-zahl-fg); }
.st-bezahlt { background: var(--st-bez-bg); color: var(--st-bez-fg); }
.st-abgelehnt { background: var(--st-abg-bg); color: var(--st-abg-fg); }
.statussel { width: auto; font-size: .85rem; font-weight: 700; padding: 6px 30px 6px 12px; border-radius: 99px; border: 0;
  -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.items li .actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.items li .actions .del { margin-left: auto; }
.del { grid-column: auto; grid-row: auto; }

.stars { display: inline-flex; gap: 2px; font-size: 1.35rem; line-height: 1; letter-spacing: 0; }
.stars.small { font-size: .95rem; }
.stars .on, .starpick .on { color: var(--star-on); }
.stars .off, .starpick .off { color: var(--star-off); }
.starsrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.starlabel { color: var(--muted); font-size: .9rem; font-weight: 600; }
.remain { display: grid; gap: 2px; }
.bignum { font: 800 2.4rem/1.1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.meter { height: 14px; border-radius: 7px; background: var(--track); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--accent); border-radius: 7px; transition: width .5s ease; }
.meter-fill.full { background: var(--danger); }
.meterlabels { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.meterlabels b { color: var(--fg); font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.key-used { background: var(--accent); }
.adjust { border-top: 1px solid var(--line); padding-top: 12px; }
.adjust summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); list-style: none; }
.adjust summary::-webkit-details-marker { display: none; }
.adjust summary::after { content: " ›"; }
.adjust[open] summary::after { content: " ⌄"; }
.adjustbody { display: grid; gap: 12px; padding-top: 12px; }
.adjustbody .hint { margin: 0; font-size: .88rem; }
input[type="range"] { -webkit-appearance: auto; appearance: auto; padding: 0; border: 0; background: none; accent-color: var(--accent); height: 32px; box-shadow: none; width: 100%; }
input[type="range"]:focus { box-shadow: none; }
.primary.small { font-size: 1.2rem; padding: 11px; }
.tiers { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tiers th { text-align: left; color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding: 6px 0; }
.tiers td { padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tiers tr.current td { font-weight: 700; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { background: var(--bg); border: 1px solid var(--line); color: var(--fg); font-size: .82rem; font-weight: 600; padding: 6px 12px; border-radius: 99px; }
.fchip[aria-pressed="true"] { background: var(--soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.chip.slim { padding: 6px 12px; font-size: .82rem; }
.starpick { display: inline-flex; gap: 0; }
.starpick button { background: none; font-size: 1.45rem; line-height: 1; padding: 4px 3px; }
.userrow .role { display: flex; justify-content: flex-end; }
.userform { border-bottom: 0; border-top: 1px solid var(--line); padding-top: 14px; padding-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } }
.rangeval { font: 700 1.1rem var(--f-mono); font-variant-numeric: tabular-nums; margin-left: 6px; }

/* ---------- Navigation, tabs, badges ---------- */
.topnav { flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-fg); font: 800 .75rem/1 var(--f-body); vertical-align: 1px; }
.badge.big { min-width: 30px; height: 30px; font-size: .95rem; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--soft); padding: 4px; border-radius: 14px; }
.tabs button { background: none; color: var(--fg); font-weight: 700; font-size: .85rem; padding: 10px 4px; border-radius: 10px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.panel { display: grid; gap: 16px; }
.steps { margin: 0; color: var(--accent-ink); font-weight: 700; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; font-size: .95rem; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); -webkit-appearance: auto; appearance: auto; padding: 0; }
textarea { font: inherit; font-size: 16px; width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); resize: vertical; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.hint.small, p.small { font-size: .82rem; margin: 0; color: var(--muted); }
.linkbtn.center { justify-self: center; }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding-top: 8px; }
.foot a { color: var(--muted); }
.chatteaser { display: flex; justify-content: space-between; align-items: center; text-align: left; font: inherit; color: var(--fg); border-color: var(--accent); cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }
.invresult { display: flex; gap: 8px; }
.invresult input { font-family: var(--f-mono); font-size: .8rem; }
.rowuser { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.rowuser .hint { font-size: .82rem; }
.starpick.compact button { font-size: 1.1rem; padding: 2px 2px; }
.obstate { color: var(--accent-ink); font-weight: 600; }
.profilebox { grid-column: 1 / -1; margin-top: 6px; }
.profilebox summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); font-size: .88rem; }
.profilebox dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .88rem; }
.profilebox dt { color: var(--muted); font-weight: 600; }
.profilebox dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.profilebox a { color: var(--accent-ink); }
.logs li { grid-template-columns: minmax(0, 1fr) auto; }
.logtime { color: var(--muted); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.url.failed { color: var(--danger); }
.threadrow { cursor: pointer; }
.threadrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Chat ---------- */
.chatcard { gap: 12px; }
.thread { list-style: none; margin: 0; padding: 4px 2px; display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.bubble { max-width: 82%; padding: 9px 12px 6px; border-radius: 16px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.bubble.theirs { align-self: flex-start; background: var(--soft); color: var(--fg); border-bottom-left-radius: 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 6px; }
.btext { margin: 0; white-space: pre-wrap; font-size: .97rem; line-height: 1.4; }
.btime { font-size: .7rem; opacity: .8; justify-self: end; font-variant-numeric: tabular-nums; }
.bubble.mine .btime { color: var(--accent-fg); }
.sysmsg { align-self: center; text-align: center; font-size: .82rem; color: var(--fg); background: var(--surface); border: 1px dashed var(--accent); border-radius: 12px; padding: 6px 12px; display: grid; gap: 2px; }
.bimage { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.imgopen { background: rgba(0,0,0,.12); color: inherit; font-weight: 700; font-size: .9rem; padding: 10px 12px; border-radius: 10px; }
.bubble.theirs .imgopen { background: var(--surface); color: var(--accent-ink); }
.imgstate { font-style: italic; font-size: .9rem; opacity: .85; }
.keptlabel { font-size: .78rem; font-weight: 700; }
.composerform { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.composerform textarea { resize: none; min-height: 46px; }
.composerrow { display: flex; gap: 8px; align-items: center; }
.composerrow .sendbtn { margin-left: auto; padding: 10px 18px; }
.imgbtn { display: inline-flex; align-items: center; padding: 10px 14px; cursor: pointer; font-size: .9rem; }
.once { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; font-weight: 600; cursor: pointer; }
.once input { width: 18px; height: 18px; accent-color: var(--accent); -webkit-appearance: auto; appearance: auto; padding: 0; }

/* Image viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 10, .88); display: grid; place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(16px, env(safe-area-inset-left, 0px)); }
.viewerbox { display: grid; gap: 12px; justify-items: center; max-width: 100%; }
.viewerbox img { max-width: 100%; max-height: 72vh; border-radius: 12px; object-fit: contain; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.viewercap { margin: 0; color: #fff0f6; font-size: .9rem; text-align: center; }
.viewerbtns { display: flex; gap: 10px; }

/* ---------- Legal ---------- */
.legal { gap: 12px; }
.backlink { color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.legaltext h1 { font-size: 1.6rem; }
.legaltext h2, .legalscroll h2 { font-size: 1rem; margin: 10px 0 0; }
.legaltext p, .legaltext li, .legalscroll p, .legalscroll li { font-size: .92rem; line-height: 1.55; max-width: 65ch; }
.legaltext ul, .legalscroll ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.placeholder { background: var(--soft); border: 1px dashed var(--accent); padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.legalbox summary { cursor: pointer; font-weight: 700; font: 700 1.05rem var(--f-display); }
.legalscroll { max-height: 45vh; overflow-y: auto; display: grid; gap: 8px; padding-right: 4px; margin-top: 10px; }

/* ---------- Onboarding: back, fields, info, tiles ---------- */
.stephead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.backbtn { color: var(--accent-ink); font-weight: 700; padding: 6px 0; }
.field { border: 0; margin: 0; padding: 0 0 16px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.field:last-of-type { border-bottom: 0; }
.field legend { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; padding: 0; margin-bottom: 10px; }
.info { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--accent-ink); background: none; color: var(--accent-ink);
  font: italic 800 .8rem/1 Georgia, "Times New Roman", serif; display: inline-grid; place-items: center; padding: 0; flex: none; }
.info[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.infotext { margin: 0; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: .88rem; line-height: 1.45; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.tile { aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--fg);
  font-weight: 700; font-size: .95rem; display: grid; place-items: center; padding: 6px; text-align: center; line-height: 1.2; }
.tiles.big .tile { font-size: .85rem; }
.tile[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tile:active { transform: scale(.96); }
.heightrow { display: flex; align-items: baseline; justify-content: space-between; }
#pfHeightOut { font: 700 1.5rem var(--f-mono); font-variant-numeric: tabular-nums; }
#pfHeightOut.unset { font: 600 1rem var(--f-body); color: var(--muted); }
input[type="range"].unset { opacity: .45; }
.linkbtn.small { font-size: .85rem; padding: 4px 0; }
.warnhint { margin: 0; font-size: .85rem; font-weight: 600; color: var(--fg); border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--soft); border-radius: 0 10px 10px 0; }
@media (prefers-reduced-motion: reduce) { .tile:active { transform: none; } }

/* ---------- Admin chat: limits beside the conversation ---------- */
.chatgrid { display: grid; gap: 12px; }
.limitsaside { border: 2px solid var(--accent); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; background: var(--soft); }
.limitsaside h3 { font-size: .9rem; }
.limitlist { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.limitlist li { background: var(--surface); border: 1px solid var(--accent); color: var(--fg); font-weight: 700; font-size: .82rem; padding: 4px 10px; border-radius: 8px; }
.limitlist li.other { font-weight: 500; flex-basis: 100%; }
.chatmain { display: grid; gap: 12px; min-width: 0; }
@media (max-width: 819px) { .limitsaside { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; } }
@media (min-width: 820px) {
  .wrap:has(#viewAdmin:not([hidden])) { max-width: 980px; }
  .chatgrid { grid-template-columns: minmax(0, 1fr) 260px; }
  .limitsaside { order: 2; position: sticky; top: 16px; align-self: start; }
}

/* ---------- Internal IDs, demo page ---------- */
.idlabel { font-family: var(--f-mono); letter-spacing: .02em; }
.who { font-family: var(--f-mono); }
.loginname { grid-column: 1 / -1; }
.myid { margin: -10px 0 0; color: var(--muted); font: 600 .85rem var(--f-mono); }
.demolink { display: grid; gap: 2px; text-decoration: none; color: var(--fg); border-color: var(--accent); }
.demolink b { color: var(--accent-ink); }
.demolinkbox a { color: var(--accent-ink); font-weight: 700; }
.demotag { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 99px; padding: 2px 8px; }
.demo .card h3 { font-size: .9rem; margin: 6px 0 0; color: var(--muted); }
.demo .card p { margin: 0; }
.demo-link { color: var(--accent-ink); }
.demolist { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .92rem; }

/* ---------- Monthly pool ---------- */
.poolblock { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.meter.pool .meter-fill { background: var(--fg); }
.meter.pool .meter-fill.full { background: var(--danger); }
.key-pool { background: var(--fg); }
.personalhead { font-size: .95rem; margin: 0; }
.poolset { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.poolset .primary.small { padding: 13px 18px; }

/* ---------- Roles, Administrator badge, groups ---------- */
.subtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--soft); padding: 4px; border-radius: 12px; }
.subtabs button { background: none; color: var(--fg); font-weight: 700; font-size: .9rem; padding: 9px 4px; border-radius: 9px; }
.subtabs button[aria-selected="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.chathead { margin: 0; font: 700 1.05rem var(--f-display); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adminbadge { display: inline-flex; align-items: center; gap: 4px; font: 800 .68rem/1 var(--f-body); letter-spacing: .04em; text-transform: uppercase;
  background: var(--fg); color: var(--bg); padding: 4px 7px; border-radius: 6px; }
.adminbadge::before { content: "✓"; font-size: .75rem; }
.bsender { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; margin-bottom: 2px; }
.rolebadge { margin-left: 8px; font: 800 .66rem/1 var(--f-body); letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; vertical-align: 2px; border: 1px solid var(--accent); color: var(--accent-ink); }
.rolebadge.superadmin { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.rolebadge.demo { border-style: dashed; color: var(--muted); border-color: var(--muted); }
.meta .rolebadge { margin-left: 0; }
.rolesel { width: auto; font-size: .85rem; padding: 6px 10px; border-radius: 10px; }
.idtiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tile.idtile { aspect-ratio: auto; min-height: 52px; font-family: var(--f-mono); font-size: .85rem; display: grid; gap: 2px; }
.tile.idtile small { font-family: var(--f-body); font-size: .68rem; font-weight: 600; opacity: .8; }
.memberchips { display: flex; flex-wrap: wrap; gap: 6px; }
.memberchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); border-radius: 99px; padding: 3px 4px 3px 10px; font-size: .82rem; font-weight: 700; }
.memberchip.invited { border-style: dashed; color: var(--muted); }
.memberchip small { font-weight: 500; }
.chipx { background: var(--soft); color: var(--fg); width: 22px; height: 22px; border-radius: 50%; padding: 0; font-weight: 800; line-height: 1; }
.gcomposer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; border-top: 1px solid var(--line); padding-top: 12px; }
.gcomposer textarea { resize: none; min-height: 46px; }
.gcomposer .primary.small { padding: 12px 18px; }

/* ---------- Pool: already spent outside the app ---------- */
.poolpct { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.meter.split { display: flex; }
.meter.split .meter-fill { border-radius: 0; }
.meter.split .meter-fill:first-child { border-radius: 7px 0 0 7px; }
.meter.pool .meter-fill.offset { background: var(--accent); }
.meter.split .meter-fill + .meter-fill { box-shadow: -2px 0 0 var(--surface); }
.key-offset { background: var(--accent); }
.offsetrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.offsetrow .primary.small { margin-left: auto; padding: 10px 16px; }

/* ---------- Manual payments ---------- */
.manualchip { font-weight: 700; color: var(--accent-ink); border: 1px dashed var(--accent); border-radius: 6px; padding: 0 6px; }
.manualbox { grid-column: 1 / -1; margin-top: 4px; }
.manualbox summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); font-size: .88rem; }
.manualbody { display: grid; gap: 10px; padding-top: 10px; }
.items li .actions { flex-wrap: wrap; }

/* ---------- Request kinds, photo proofs, request button ---------- */
.kindtiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile.kindtile { aspect-ratio: auto; min-height: 76px; display: grid; gap: 2px; align-content: center; }
.tile.kindtile b { font-size: .95rem; }
.tile.kindtile small { font-size: .7rem; font-weight: 500; opacity: .85; line-height: 1.2; }
.tile.kindtile[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.photobtns { display: flex; gap: 8px; flex-wrap: wrap; }
.photobtn { display: inline-flex; align-items: center; padding: 11px 14px; cursor: pointer; font-size: .9rem; }
.proofpreview { display: flex; align-items: center; gap: 12px; }
.proofpreview img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.kindchip { font-weight: 700; color: var(--fg); background: var(--soft); border-radius: 6px; padding: 0 6px; }
.requestcta { display: grid; gap: 2px; text-align: left; font: inherit; color: var(--fg); border: 2px solid var(--accent); cursor: pointer; }
.requestcta b { color: var(--accent-ink); font-size: 1rem; }
.composerrow { flex-wrap: wrap; }
.composerrow .once { flex: 1 1 auto; }
.card, .panel, section { min-width: 0; }

/* ---------- Push ---------- */
.pushstate { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; }
.pushstate.on { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.pushsteps { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.primary.ghostbtn { background: var(--soft); color: var(--accent-ink); }

/* ---------- App updates ---------- */
.updbanner { display: grid; gap: 2px; text-align: left; font: inherit; color: var(--fg); border: 2px solid var(--accent); cursor: pointer; }
.updbanner b { color: var(--accent-ink); }

:root[data-theme="light"] {
  --bg: #fff0f6; --surface: #ffffff; --fg: #171717; --muted: #6b5560; --line: #f6d6e4;
  --accent: #ff007f; --accent-ink: #c8005f; --accent-fg: #fff0f6; --soft: #ffdcec; --danger: #b3261e; --ok: #13734a;
  --f-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;

  --st-offen-bg: #efe7eb; --st-offen-fg: #5b4a53;
  --st-akz-bg: #e2ebfb; --st-akz-fg: #1f4f9a;
  --st-bearb-bg: #ebe5fb; --st-bearb-fg: #573aa3;
  --st-zahl-bg: #fcefd6; --st-zahl-fg: #855600;
  --st-bez-bg: #dcf2e6; --st-bez-fg: #146239;
  --st-abg-bg: #fbe2df; --st-abg-fg: #a1261d;
  --star-on: #e8a317; --star-off: #e6d5dd; --track: #f3e6ec;
}
:root[data-theme="dark"] {
    --bg: #171717; --surface: #211c1f; --fg: #fff0f6; --muted: #b9a5ae; --line: #352a30;
    --accent: #ff007f; --accent-ink: #ff4fa3; --accent-fg: #fff0f6; --soft: #3b1328; --danger: #ff8a80; --ok: #5fd39a;
    color-scheme: dark;
    --st-offen-bg: #33282e; --st-offen-fg: #d6c3cc;
    --st-akz-bg: #1c2b45; --st-akz-fg: #9dbdf5;
    --st-bearb-bg: #2a2145; --st-bearb-fg: #c3b0f7;
    --st-zahl-bg: #3a2c12; --st-zahl-fg: #f2c46b;
    --st-bez-bg: #163325; --st-bez-fg: #7fdcaa;
    --st-abg-bg: #3d1c1a; --st-abg-fg: #f59a92;
    --star-on: #f4b942; --star-off: #45333c; --track: #2e2129;
}

/* Main navigation and signed-in screens */
body:has(#bottomNav:not([hidden])) {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav {
  position: fixed;
  z-index: 8;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: center;
  padding: 5px max(12px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 26px #17171710;
}
.bottom-nav a {
  position: relative;
  min-width: 0;
  min-height: 54px;
  border-radius: 14px;
  padding: 5px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}
.bottom-nav a[aria-current="page"] { background: var(--soft); color: var(--accent-ink); }
.bottom-nav .badge { position: absolute; top: 2px; left: calc(50% + 10px); }
.nav-icon { display: block; width: 19px; height: 19px; position: relative; }
.nav-home { width: 15px; height: 13px; border: 2px solid; border-radius: 3px; border-top: 0; margin-top: 6px; }
.nav-home::before { content: ""; position: absolute; inset: -5px 0 auto; width: 10px; height: 10px; border: solid; border-width: 2px 0 0 2px; transform: rotate(45deg); border-radius: 2px; }
.nav-chat { height: 16px; margin-bottom: 3px; border: 2px solid; border-radius: 6px; }
.nav-chat::after { content: ""; position: absolute; bottom: -4px; left: 2px; width: 5px; height: 5px; border: solid; border-width: 0 0 2px 2px; background: var(--surface); transform: skewY(-35deg); }
[aria-current="page"] .nav-chat::after { background: var(--soft); }
.nav-settings { border: 2px dotted; border-radius: 50%; display: grid; place-items: center; }
.nav-settings::after { content: ""; width: 7px; height: 7px; border: 2px solid; border-radius: 50%; }
@media (min-width: 680px) {
  .bottom-nav { grid-template-columns: repeat(3, minmax(0, 158px)); gap: 6px; }
}
#viewSettings :is(.chip, .linkbtn, .primary), .subtabs button, .message-action, #newRequest,
#viewChat :is(.linkbtn, .imgopen, .sendbtn, .photobtn), #threadCard :is(.linkbtn, .imgopen, .sendbtn, .photobtn) { min-height: 44px; }
#viewSettings .check { min-height: 44px; }
#viewSettings .check input { flex: 0 0 auto; }
#viewSettings p { margin-block: 0; }
#coverForm, #coverSetup { display: grid; gap: 10px; }
.install-link { display: grid; align-items: center; text-decoration: none; white-space: normal; }
#form { scroll-margin-top: max(12px, env(safe-area-inset-top, 0px)); }
#viewSubmit > h1, #viewSettings > h1 { overflow-wrap: anywhere; }
#viewAdmin.admin-chat-route > .tabs { display: none; }
.chathead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.presence { color: var(--muted); font-size: .82rem; font-weight: 650; white-space: nowrap; }
.presence.online { color: var(--ok); }
.presence.online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: currentColor; border-radius: 50%; vertical-align: .07em; }
.message-action { justify-self: start; font-size: .86rem; text-align: start; white-space: normal; color: inherit; }
.chatcard .thread { max-height: min(48dvh, 520px); }
#threadCard .listhead { flex-wrap: wrap; }
#uDirect > .requestcta { margin-bottom: 12px; }
#uDirect > .notice { margin-bottom: 12px; }
#peerMembers li { display: grid; }
.keyboard-open .bottom-nav { display: none; }
.keyboard-open .chatcard .thread { max-height: 25dvh; }

/* Locally locked launch screens */
html[data-locked] :is(#appShell, #bottomNav, #viewer) { display: none !important; }
.device-cover { width: min(100%, 430px); margin-inline: auto; min-height: 82dvh; align-content: start; padding-block: 14px; }
.device-cover:has(.cover-calculator:not([hidden])) { background: #14263b; color: #f5f8ff; padding: 20px 14px; border-radius: 22px; }
.device-cover:has(#coverNotes:not([hidden])) { background: #fdf0c6; color: #3c2f23; padding: 20px 16px; border-radius: 20px; }
#coverGesture { background: transparent; color: inherit; padding: 0; font-weight: 800; min-height: 44px; touch-action: manipulation; user-select: none; }
#coverGesture:disabled { opacity: 1; }
#coverNumber { display: block; font-size: clamp(1.6rem, 8vw, 3rem); min-height: 90px; padding: 14px 4px; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cover-keys { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.cover-keys button { min-height: clamp(46px, 10dvh, 72px); background: #263f59; color: #fff; font-size: 1.45rem; font-weight: 600; border-radius: 15px; }
.cover-keys .operator { background: #bde9f6; color: #14263b; }
.cover-keys .zero { grid-column: span 2; }
#coverNote { width: 100%; border: 1px solid #d3b267; background: #fff8e2; color: #3c2f23; font-size: 16px; }
#coverDialog { width: min(90vw, 360px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--fg); }
#coverDialog form { display: grid; gap: 12px; }
#coverDialog::backdrop { background: #0008; }

.chat-retention { color: var(--muted); font-size: .86rem; margin-bottom: 10px; }
.chat-retention summary { min-height: 44px; padding-block: 11px; cursor: pointer; }
@media (max-width: 679px) {
  .chatcard { padding: 12px; }
  .chatcard .thread { min-height: min(27dvh, 225px); }
  .keyboard-open .chatcard .thread { min-height: 0; }
  #viewChat .requestcta { padding: 10px 12px; }
  #viewChat .chathead { margin-top: 0; }
  .chatcard .composerrow { column-gap: 6px; }
  .chatcard .composerrow .sendbtn { margin-left: auto; }
}

.captcha { min-width: 0; }
.captcha:empty { display: none; }
[id$="CaptchaStatus"] { margin: 0; }
