:root {
  --bg: #F5F4F0;
  --card: #FFFFFF;
  --ink: #1B1F24;
  --muted: #5A6169;
  --line: #E4E1DA;
  --line2: #D9D6CE;
  --brand: #1F4E5F;
  --brand-soft: #E3ECEE;
  --brand-ink: #CFE0E5;
  --warn: #8A4B12;
  --warn-soft: #FBEFE3;
  --ok: #2F6B3A;
  --ok-soft: #E4EFE4;
  --err: #B3261E;
  --err-soft: #FCE8E6;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #4FB0C6; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { max-width: 560px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
@media (min-width: 700px) {
  body { background: #E9E7E1; }
  .app { margin: 24px auto; height: calc(100dvh - 48px); border-radius: 28px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
}
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pad { padding: 8px 24px 24px; }
.scroll { flex: 1; overflow-y: auto; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.s6 { gap: 6px; } .s10 { gap: 10px; } .s12 { gap: 12px; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.center-text { text-align: center; }
.full { width: 100%; }
h1 { margin: 0; font-size: 24px; line-height: 1.25; }
h2 { margin: 0; font-size: 26px; }
p { margin: 0; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.label.warn { color: var(--warn); }

.top { display: flex; align-items: center; justify-content: space-between; padding: calc(16px + var(--safe-top)) 24px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.logo.big { width: 72px; height: 72px; border-radius: 20px; font-size: 32px; }
.lock { color: var(--ok); display: flex; }
.langs { display: flex; gap: 2px; padding: 3px; background: #E7E5DF; border-radius: 12px; }
.lang { min-width: 42px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.lang.on { background: #fff; color: var(--ink); }

.mandates { padding: 4px 24px 12px; display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex-shrink: 0; min-height: 42px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line2); background: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--warn); color: #fff; margin-left: 4px; }
.chip.on .badge { background: #F0B37E; color: var(--ink); }

.action { display: flex; align-items: center; gap: 16px; min-height: 78px; padding: 14px 20px; border: 1.5px solid var(--line2); border-radius: 20px; background: #fff; text-align: left; color: var(--brand); }
.action span { display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.action b { font-size: 17px; font-weight: 600; }
.action small { font-size: 14px; color: var(--muted); }
.action.primary { background: var(--brand); border-color: var(--brand); color: #fff; min-height: 86px; }
.action.primary span, .action.primary b { color: #fff; }
.action.primary small { color: var(--brand-ink); }
.action.primary b { font-size: 18px; }

.request { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; background: var(--warn-soft); border-radius: 16px; font-weight: 500; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.doc svg { color: var(--ok); flex-shrink: 0; }
.doc span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.doc time { font-size: 13px; color: var(--muted); }
.logout { align-self: center; }

.btn { min-height: 54px; padding: 0 18px; border-radius: 16px; border: 1.5px solid var(--line2); background: #fff; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }

label { font-size: 14px; font-weight: 600; margin-bottom: -10px; }
input[type=email], input[type=text], .composer input { width: 100%; height: 54px; padding: 0 16px; border: 1.5px solid var(--line2); border-radius: 14px; background: #fff; font-size: 17px; }
input.code { font-size: 28px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.error { padding: 12px 14px; border-radius: 12px; background: var(--err-soft); color: var(--err); font-size: 15px; }

.install { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--brand-soft); border-radius: 16px; font-size: 14px; line-height: 1.45; }
.install .row { display: flex; gap: 8px; margin-top: 4px; }

.tabs { display: flex; gap: 8px; padding: 8px 24px calc(12px + var(--safe-bottom)); background: #fff; border-top: 1px solid var(--line); }
.tab { flex: 1; min-height: 54px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; }
.tab svg { width: 22px; height: 22px; }
.tab.on { background: var(--brand-soft); color: var(--brand); }

/* Scannen */
.screen.dark { background: #111417; color: #fff; }
.scanbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(14px + var(--safe-top)) 16px 12px; }
.scanbar .link { min-width: 90px; min-height: 44px; border: 0; background: transparent; color: #fff; text-align: left; font-size: 16px; }
.scanbar .title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.scanbar .title small { color: #A9B1B8; font-size: 12px; }
.scanbar .toggle { min-width: 90px; min-height: 40px; border: 1.5px solid #3A4249; border-radius: 999px; background: transparent; color: #fff; font-size: 13px; font-weight: 600; }
.scanarea { flex: 1; overflow-y: auto; margin: 0 16px; border-radius: 20px; background: #22282D; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.scanhint { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: #C7CDD2; padding: 24px; }
.scanhint svg { width: 48px; height: 48px; color: #4FB0C6; }
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.thumbs figure { position: relative; margin: 0; background: #fff; border-radius: 8px; overflow: hidden; aspect-ratio: 3/4; }
.thumbs img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumbs figcaption { position: absolute; left: 8px; bottom: 8px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.thumbs .remove { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 999px; border: 0; background: rgba(17,20,23,.75); color: #fff; display: flex; align-items: center; justify-content: center; }
.scanfoot { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px calc(20px + var(--safe-bottom)); }
.btn.light { background: #fff; border-color: #fff; color: var(--brand); min-height: 60px; font-size: 17px; }
.btn.bright { background: #4FB0C6; border-color: #4FB0C6; color: #0E2A33; min-height: 56px; }

.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.okcircle { width: 96px; height: 96px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.filecard { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; max-width: 100%; text-align: left; font-size: 13px; overflow-wrap: anywhere; }
.filecard svg { color: var(--err); flex-shrink: 0; }

/* Chat */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chatlist { flex: 1; overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.pill { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 10px; background: #ECEAE4; border-radius: 999px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 4px 18px 18px 18px; background: #fff; border: 1px solid var(--line); line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bubble.mine { align-self: flex-end; background: var(--brand); border-color: var(--brand); color: #fff; border-radius: 18px 18px 4px 18px; }
.bubble.mine time { color: var(--brand-ink); text-align: right; }
.theirs { align-self: flex-start; max-width: 85%; display: flex; flex-direction: column; gap: 4px; }
.theirs .bubble { max-width: 100%; }
.sender { font-size: 12px; font-weight: 600; color: var(--brand); padding-left: 4px; }
.composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--line); }
.composer input { height: 46px; border-radius: 999px; background: var(--bg); font-size: 16px; min-width: 0; flex: 1; }
.round { width: 46px; height: 46px; flex-shrink: 0; border: 0; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.round svg { width: 22px; height: 22px; }
.round.primary { background: var(--brand); color: #fff; }
.round.soft { background: #ECEAE4; color: var(--brand); }
