:root{
  --green:#00A523;--green-dark:#007A1A;--green-soft:#E6F6E9;
  --blue:#367CDE;--purple:#7D409D;--teal:#3AF1D3;--red:#E01F22;
  --ink:#2A2C27;--muted:#6B6E66;--line:#E3E5DF;--bg:#F4F6F2;--card:#FFFFFF;
  --bot:#FFFFFF;--me:#DDF3E1;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--ink:#E8EAE4;--muted:#A3A69D;--line:#33362F;--bg:#151714;--card:#1E211C;--bot:#262A24;--me:#1D4A27;--green-soft:#173D1F}}
:root[data-theme="dark"]{--ink:#E8EAE4;--muted:#A3A69D;--line:#33362F;--bg:#151714;--card:#1E211C;--bot:#262A24;--me:#1D4A27;--green-soft:#173D1F}
.me .bubble{color:var(--ink)}
.brand img{background:#fff;border-radius:6px;padding:2px 4px}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",sans-serif;-webkit-font-smoothing:antialiased}
.app{max-width:480px;margin:0 auto;height:100dvh;display:flex;flex-direction:column;background:var(--bg);position:relative}
@media(min-width:520px){body{background:#E9ECE6}.app{box-shadow:0 0 0 1px var(--line),0 12px 40px rgba(0,0,0,.08)}}

header{background:var(--card);border-bottom:1px solid var(--line);padding:10px 16px 0;flex:none}
.brand{display:flex;align-items:center;gap:10px}
.brand img{height:34px;width:auto;display:block}
.brand .tag{margin-left:auto;font-size:12px;color:var(--muted);text-align:right;line-height:1.2}
.progress{display:flex;align-items:center;gap:10px;padding:10px 0 10px}
.steps{display:flex;gap:4px;flex:1}
.steps span{height:4px;flex:1;border-radius:2px;background:var(--line);transition:background .4s}
.steps span.on{background:var(--green)}
.steps span.reg{background:var(--purple)}
.plabel{font-size:12px;color:var(--muted);white-space:nowrap;min-width:0}

main{flex:1;overflow-y:auto;padding:16px 12px 8px;scroll-behavior:smooth}
.msg{display:flex;margin:6px 0;animation:pop .22s ease-out}
.msg.me{justify-content:flex-end}
.bubble{max-width:85%;padding:10px 13px;border-radius:16px;box-shadow:0 1px 1px rgba(0,0,0,.06);white-space:pre-wrap;overflow-wrap:anywhere}
.bot .bubble{background:var(--bot);border-top-left-radius:4px}
.me .bubble{background:var(--me);border-top-right-radius:4px;color:#14321A}
.bubble a{color:var(--blue)}
.typing .bubble{display:flex;gap:4px;padding:14px 14px}
.typing i{width:7px;height:7px;border-radius:50%;background:#B8BBB3;animation:blink 1s infinite}
.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
.section-chip{align-self:center;margin:14px auto 6px;font-size:12px;color:var(--purple);background:#F2EAF6;border-radius:999px;padding:4px 12px;width:max-content;max-width:90%;text-align:center}
.idcard{margin:8px 0 4px;background:linear-gradient(135deg,#F3FBF4,#FFFFFF);border:1px solid #BFE6C6;border-radius:14px;padding:12px 14px}
.idcard small{display:block;color:var(--muted);font-size:12px}
.idcard b{font:600 20px/1.3 ui-monospace,Consolas,monospace;letter-spacing:.5px;color:var(--green-dark)}

footer{flex:none;max-height:65dvh;overflow-y:auto;background:var(--card);border-top:1px solid var(--line);padding:10px 12px calc(10px + env(safe-area-inset-bottom))}
.opts{display:flex;flex-wrap:wrap;gap:8px}
.opts.row button{flex:1 1 0}
.opts.col{flex-direction:column;max-height:42dvh;overflow-y:auto}
button{font:inherit;cursor:pointer;border:0;-webkit-tap-highlight-color:transparent}
.opt{min-height:48px;padding:10px 14px;border-radius:12px;background:var(--card);color:var(--ink);border:1.5px solid var(--line);text-align:left;transition:transform .08s,border-color .15s,background .15s}
.opt:hover{border-color:#BFC3B9}
.opt:active{transform:scale(.98)}
.opts.row .opt{text-align:center;font-weight:600}
.opt.primary{background:var(--green);border-color:var(--green);color:#fff}
.opt.primary:hover{background:var(--green-dark);border-color:var(--green-dark)}
.opt.ghost{color:var(--muted)}
.inrow{display:flex;gap:8px}
input,select{font:inherit;width:100%;min-height:48px;padding:10px 12px;border-radius:12px;border:1.5px solid var(--line);background:var(--card);color:var(--ink)}
input:focus,select:focus{outline:none;border-color:var(--green);box-shadow:0 0 0 3px rgba(0,165,35,.15)}
.send{flex:none;width:48px;height:48px;border-radius:50%;background:var(--green);color:#fff;display:grid;place-items:center}
.send:disabled{background:#C9CCC4}
.send svg{width:22px;height:22px}
.err{color:var(--red);font-size:13px;margin:0 0 8px}
.geo{display:grid;gap:8px}
.geo .opt{text-align:center;font-weight:600}
.geo .hint.first{margin:0}
.geo label{font-size:12px;color:var(--muted);margin-bottom:-4px}
.hint{font-size:12px;color:var(--muted);margin:6px 2px 0}
.endbar{display:flex;gap:8px}
.endbar .opt{flex:1;text-align:center;font-weight:600}
button:focus-visible,a:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.note{align-self:center;margin:8px auto;font-size:12px;color:var(--muted);text-align:center}
.status{font-size:13px;color:var(--muted);margin:0 0 8px;text-align:center}
.retry{width:100%;text-align:center;font-weight:600}
#ts{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);z-index:10}
.opt:disabled,.send:disabled{cursor:default}
@keyframes pop{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@keyframes blink{0%,80%,100%{opacity:.3}40%{opacity:1}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
