:root{
  --bg:#f3f2f2;--surface:#eae9e9;--inb:#d7d3d3;--raised:#d7d3d3;--fg:#201e1d;--muted:#605d5d;--rule:#9b9797;
  --sent:#201e1d;--sentink:#f3f2f2;--acc:#1f9d55;--acchover:#178a49;--accpress:#0f6b38;--accink:#201e1d;--acctext:#0f6b38;
  --burnbg:#d4f2e0;--burntext:#0b4f29;color-scheme:light;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{background:var(--bg);color:var(--fg);font-family:Archivo,system-ui,sans-serif;font-size:17px;line-height:1.4;-webkit-font-smoothing:antialiased;overflow:hidden}
button,input,textarea,select{font:inherit;color:inherit;background:none;border:0;border-radius:0}
button{cursor:pointer}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}
a{color:var(--acctext)}a:hover{color:#0b4f29}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
input:focus-visible,textarea:focus-visible{outline:0;border-color:var(--acc)!important}
svg{display:block;flex:none}
.hide{display:none!important}

@keyframes zIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
@keyframes zFade{from{opacity:0}to{opacity:1}}
@keyframes zDot{0%,80%,100%{opacity:.25}40%{opacity:1}}
@keyframes zOut{to{opacity:0;filter:blur(4px)}}
@keyframes ring{to{stroke-dashoffset:50.27}}

/* ---- app frame */
#app{height:100dvh;display:flex;flex-direction:column;background:var(--bg)}
.screen{flex:1;min-height:0;display:flex;flex-direction:column}
.hdr{display:flex;align-items:center;gap:8px;min-height:64px;padding:8px 8px 8px 12px;border-bottom:2px solid var(--rule);flex:none}
.hdr h1{font-size:34px;font-weight:800;line-height:1.12;letter-spacing:-.02em;flex:1;padding-left:8px}
.hdr h1.settings{font-size:28px;padding-left:0}
.hdr .spacer{flex:1}
.content{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column}

/* ---- type */
.display{font-size:42px;font-weight:800;line-height:1.02;letter-spacing:-.025em}
.large{font-size:34px;font-weight:800;line-height:1.12;letter-spacing:-.02em}
.title{font-size:22px;font-weight:800}
.headline{font-size:17px;font-weight:600}
.callout{font-size:15px}
.meta{font-size:13px}
.muted{color:var(--muted)}
.label{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--muted)}
.section-label{display:flex;align-items:center;gap:12px;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--muted)}
.section-label::after{content:"";flex:1;height:1px;background:var(--rule)}

/* ---- buttons */
.btn{display:flex;align-items:center;justify-content:space-between;width:100%;height:56px;padding:0 18px;background:var(--acc);color:var(--accink);font-size:19px;font-weight:800;transition:background .15s}
.btn:hover{background:var(--acchover)}.btn:active{background:var(--accpress)}
.btn[disabled]{opacity:.45;pointer-events:none}
.btn-sec{display:flex;align-items:center;justify-content:center;width:100%;height:48px;border:1px solid var(--rule);font-weight:600}
.btn-sec:hover{background:var(--surface)}
.ghost{text-decoration:none;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 10px;color:var(--acctext);font-size:16px;font-weight:600}
.ghost:hover{background:var(--burnbg)}
.ghost.under{text-decoration:underline}
.icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px}
.icon:hover{background:var(--surface)}
.icon[disabled]{opacity:.35;pointer-events:none}

/* ---- inputs */
.input{display:flex;align-items:center;gap:10px;min-height:48px;padding:0 14px;background:var(--surface);border:1px solid var(--rule);width:100%;transition:border-color .2s}
.input input{flex:1;min-width:0;height:100%;min-height:46px}
.field{display:flex;align-items:center;min-height:48px;padding:0 14px;background:var(--surface);border:1px solid var(--rule);width:100%;transition:border-color .2s}

/* ---- avatar */
.av{display:flex;align-items:center;justify-content:center;flex:none;width:48px;height:48px;background:var(--raised);font-size:16px;font-weight:600;color:var(--fg)}
.av.s{width:40px;height:40px;font-size:14px}.av.l{width:64px;height:64px;font-size:22px;font-weight:800}
.av.out{background:none;border:1px solid var(--rule);color:var(--muted)}

/* ---- welcome / code */
.onb{padding:56px 24px 16px;flex:1;display:flex;flex-direction:column;gap:12px}
.onb .top{display:flex;flex-direction:column;gap:14px}
.logo{display:flex;align-items:center;justify-content:center;width:48px;height:48px;background:var(--acc);color:var(--accink);font-size:26px;font-weight:800}
.onb .bottom{margin-top:auto;display:flex;flex-direction:column;gap:12px}
.phone-row{display:flex;height:56px}
.country{display:flex;align-items:center;gap:6px;white-space:nowrap;padding:0 14px;height:56px;background:var(--surface);border:1px solid var(--rule);border-right:0;font-weight:600;position:relative}
.country select{position:absolute;inset:0;opacity:0;width:100%;cursor:pointer}
.phone-row .field{height:56px;font-size:20px}
.phone-row .field input{width:100%;font-size:20px;height:100%}
.note{display:flex;gap:10px;align-items:flex-start;font-size:15px;color:var(--muted)}
.note svg{margin-top:2px;color:var(--fg)}
.err{color:var(--burntext);background:var(--burnbg);border:1px solid var(--acc);padding:10px 14px;font-size:15px;font-weight:600}
.otp{display:flex;gap:10px;margin-top:24px}
.otp input{flex:1;min-width:0;height:60px;border:2px solid var(--rule);background:var(--surface);text-align:center;font-size:28px;font-weight:800;transition:border-color .15s}
.otp input.filled{border-color:var(--fg)}
.otp input:focus-visible{border-color:var(--acc)!important}
.otp-row{display:flex;justify-content:space-between;align-items:center;margin-top:8px;min-height:44px}

/* ---- chat list */
.row{display:flex;align-items:center;gap:14px;min-height:78px;padding:0 20px;width:100%;text-align:left;border-bottom:1px solid var(--rule)}
.row:hover{background:var(--surface)}
.row.sel{background:var(--surface)}
.row .mid{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.row .top{display:flex;align-items:baseline;gap:10px}
.row .name{flex:1;min-width:0;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .time{font-size:13px;color:var(--muted)}
.row.unread .time{color:var(--acctext);font-weight:600}
.row .prev{font-size:15px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:21px;display:flex;align-items:center}
.row.unread .prev{color:var(--fg)}
.row .prev .flame{color:var(--acc)}
.dot{flex:none;width:10px;height:10px;background:var(--acc)}
.crow{display:flex;align-items:center;gap:14px;min-height:64px;padding:0 20px;width:100%;text-align:left}
.crow:hover{background:var(--surface)}
.crow .mid{flex:1;min-width:0}
.crow .ph{font-size:13px;color:var(--muted)}

/* ---- empty states */
.empty{flex:1;display:flex;flex-direction:column;justify-content:center;gap:12px;padding:0 20px}
.empty h2{font-size:28px;font-weight:800;line-height:1.12;letter-spacing:-.02em}
.empty p{color:var(--muted)}
.empty .btn{margin-top:8px}

/* ---- conversation */
.conv{flex:1;min-height:0;display:flex;flex-direction:column}
.conv .hdr{min-height:64px}
.conv .who{flex:1;min-width:0;display:flex;flex-direction:column}
.conv .who .n{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv .who .s{font-size:13px;color:var(--muted)}
.banner{display:flex;align-items:center;gap:12px;padding:8px 8px 8px 16px;background:var(--surface);border-bottom:2px solid var(--acc)}
.banner svg{color:var(--acctext)}
.banner .mid{flex:1}
.banner .t{font-size:15px;font-weight:600}.banner .d{font-size:13px;color:var(--muted)}
.thread{flex:1;min-height:0;overflow:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
.thread .fill{flex:1}
.day{display:flex;align-items:center;gap:12px;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--muted)}
.day::after{content:"";flex:1;height:1px;background:var(--rule)}
.m{display:flex;flex-direction:column;max-width:78%;gap:4px}
.m.in{align-self:flex-start;align-items:flex-start}.m.out{align-self:flex-end;align-items:flex-end}
.m.new{animation:zIn .28s cubic-bezier(.2,.7,.2,1)}
.bub{padding:10px 14px;white-space:pre-wrap;overflow-wrap:anywhere}
.in .bub{background:var(--inb)}.out .bub{background:var(--sent);color:var(--sentink)}
.bub.burn{background:var(--burnbg)!important;color:var(--fg)!important;border:1px solid var(--acc)}
.bub.gone{background:none!important;border:1px solid var(--rule);color:var(--muted)!important;font-size:15px;display:flex;align-items:center;gap:8px;animation:zFade .32s}
.m.waiting .bub{opacity:.6}
.mrow{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
.mrow .b{display:flex;align-items:center;gap:4px;color:var(--acctext)}
.mrow .read{color:var(--acctext)}
.m.out.dying .bub,.m.in.dying .bub{animation:zOut .45s forwards}
.sealed{position:relative;width:268px;max-width:100%;min-height:76px;text-align:left;background:var(--burnbg);border:1px solid var(--acc);padding:10px 14px;color:var(--fg)}
.sealed .blur{filter:blur(8px);opacity:.35;white-space:pre-wrap;overflow-wrap:anywhere;max-height:120px;overflow:hidden}
.sealed .ov{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:8px}
.sealed .ov .t{display:flex;align-items:center;gap:6px;font-weight:600}
.sealed .ov .d{font-size:13px;color:var(--burntext)}
.ring{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--acctext);font-weight:600}
.ring svg{width:18px;height:18px}
.ring circle.p{stroke:var(--acc);stroke-dasharray:50.27;stroke-dashoffset:0;animation:ring var(--dur) linear forwards;animation-delay:var(--delay,0s)}
.typing{align-self:flex-start;display:flex;gap:6px;padding:16px;background:var(--inb);animation:zFade .2s}
.typing i{width:7px;height:7px;background:var(--fg);animation:zDot 1.2s infinite}
.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
.hello{margin-top:auto;display:flex;flex-direction:column;gap:6px;padding-bottom:8px}
.hello h2{font-size:22px;font-weight:800}.hello p{font-size:15px;color:var(--muted)}

/* ---- composer */
.comp{flex:none;border-top:2px solid var(--rule);padding:10px 12px;display:flex;flex-direction:column;gap:8px;background:var(--bg);transition:background .2s,border-color .2s}
.comp .lab{display:none;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--burntext)}
.comp .r{display:flex;align-items:flex-end;gap:8px}
.comp .tog{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;background:var(--surface);border:1px solid var(--rule);transition:background .2s,border-color .2s}
.comp .tog:hover{background:var(--inb)}
.comp textarea{flex:1;min-width:0;min-height:44px;max-height:140px;padding:10px 14px;background:var(--surface);border:1px solid var(--rule);resize:none;line-height:1.3;transition:background .2s,border-color .2s}
.comp .send{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;background:var(--sent);color:var(--sentink);transition:opacity .15s,background .2s}
.comp .send.txt{width:auto;padding:0 14px;font-size:16px;font-weight:800;height:48px}
.comp .send.off{opacity:.45}
.comp.burn{background:var(--burnbg);border-top-color:var(--acc)}
.comp.burn .lab{display:flex}
.comp.burn .tog{background:var(--acc);border-color:var(--acc);color:var(--accink)}
.comp.burn textarea{background:var(--bg);border-color:var(--acc)}
.comp.burn .send{background:var(--acc);color:var(--accink)}

/* ---- toast */
.toast{position:absolute;left:16px;right:16px;bottom:88px;z-index:20;display:flex;align-items:center;gap:10px;padding:14px 16px;background:var(--fg);color:var(--bg);font-size:15px;font-weight:600;box-shadow:0 12px 32px color-mix(in srgb,#2d2b2b 22%,transparent);animation:zIn .28s cubic-bezier(.2,.7,.2,1)}
.toast .d{margin-left:auto;min-height:44px;font-weight:800;text-decoration:underline;color:var(--bg);padding:0 4px}
.toast-host{position:relative}

/* ---- settings */
.set{padding:0 20px 24px;display:flex;flex-direction:column}
.prof{display:flex;align-items:center;gap:14px;padding:20px 0;border-bottom:1px solid var(--rule)}
.prof .mid{flex:1;min-width:0}
.prof .n{font-size:22px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.prof .p{font-size:15px;color:var(--muted)}
.sec{padding:20px 0;border-bottom:1px solid var(--rule);display:flex;flex-direction:column;gap:8px}
.sec .t{font-weight:600}.sec .d{font-size:15px;color:var(--muted)}
.seg{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--rule);margin-top:6px}
.seg button{height:44px;padding:0 12px;text-align:left;font-size:16px;font-weight:600;border-left:1px solid var(--rule)}
.seg button:first-child{border-left:0}
.seg button[aria-checked=true]{background:var(--acc);color:var(--accink)}
.switch-row{display:flex;align-items:flex-start;gap:12px}
.switch-row .mid{flex:1}
.sw{width:52px;height:44px;flex:none;display:flex;align-items:center}
.sw .tr{width:52px;height:32px;padding:4px;background:var(--raised);display:flex;transition:background .2s}
.sw .kn{width:24px;height:24px;background:var(--fg);transition:transform .2s,background .2s}
.sw[aria-checked=true] .tr{background:var(--acc)}
.sw[aria-checked=true] .kn{background:var(--accink);transform:translateX(20px)}
.foot{margin-top:auto;padding-top:24px;font-size:13px;color:var(--muted)}

/* ---- modal */
.modal{position:fixed;inset:0;z-index:30;background:color-mix(in srgb,#201e1d 55%,transparent);display:flex;align-items:center;justify-content:center;padding:20px}
.modal .box{background:var(--bg);padding:24px;width:100%;max-width:360px;display:flex;flex-direction:column;gap:14px;animation:zIn .28s cubic-bezier(.2,.7,.2,1)}
.modal h3{font-size:22px;font-weight:800}
.modal .btn{background:var(--fg);color:var(--bg)}.modal .btn:hover{background:#000}

/* ---- new chat */
.search{padding:12px 20px;border-bottom:2px solid var(--rule)}
.list-sec{padding:16px 20px 4px}

/* ---- desktop */
#app.desk{flex-direction:row}
.pane-l{display:none}
@media(min-width:768px){
  #app.desk .pane-l{display:flex;flex-direction:column;width:380px;flex:none;border-right:2px solid var(--rule)}
  #app.desk .pane-r{flex:1;min-width:0;display:flex;flex-direction:column}
  .pane-l .hdr{padding:16px 12px 12px 24px}
  .pane-l .hdr h1{font-size:28px;padding-left:0}
  .pane-l .search{padding:0 24px 12px;border-bottom:2px solid var(--rule)}
  .pane-l .input{min-height:44px}
  .kbd{font-size:12px;font-weight:600;color:var(--muted);border:1px solid var(--rule);padding:2px 6px}
  .pane-l .row{min-height:76px;padding:0 24px}
  .pane-l .row .av{width:44px;height:44px}
  .pane-r .conv .hdr{min-height:74px;padding:8px 24px}
  .pane-r .conv .who .n{font-size:18px}
  .pane-r .thread{padding:24px 15% 24px 24px}
  .pane-r .m{max-width:60%}
  .pane-r .comp{padding:14px 24px 18px}
  .pane-r .comp .tog{width:48px;height:48px}
  .pane-r .comp textarea{min-height:48px}
  .pane-r .toast{left:24px;right:15%}
  .pane-r .idle{flex:1;display:flex;align-items:center;justify-content:center;color:var(--muted);flex-direction:column;gap:8px}
  .pane-r .idle .logo{margin-bottom:8px}
  .onb{max-width:480px;width:100%;margin:0 auto;padding-top:96px}
  .set,.pane-r .hdr.single{max-width:720px;width:100%;margin:0 auto}
}
