:root{
  --bg:#080b10;--surface:#111822;--surface2:#18212d;--line:#242f3d;
  --text:#eaf1f8;--muted:#8b9bad;--teal:#3ddc97;--amber:#f4b942;
  --red:#ff7a7a;--blue:#6aa9ff;--violet:#b58cff;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--text);font-family:"Segoe UI",Tahoma,Arial,sans-serif;font-size:15px;line-height:1.7}
button,input{font:inherit;color:inherit}
button{cursor:pointer}
.app{display:flex;flex-direction:column;height:100dvh;max-width:720px;margin:0 auto;position:relative;overflow:hidden}

.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:rgba(8,11,16,.92);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);position:relative;z-index:5}
.brand{display:flex;align-items:center;gap:10px}
.logo{width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,var(--teal),#1b8f8f);display:grid;place-items:center;font-weight:900;color:#04120c;font-size:18px}
.brand-name{font-weight:800;font-size:16px;line-height:1.2}
.brand-sub{font-size:11px;color:var(--muted)}
.icon-btn{background:var(--surface2);border:1px solid var(--line);border-radius:12px;width:40px;height:40px;font-size:18px}

.menu-panel{position:absolute;top:62px;left:10px;right:10px;bottom:76px;overflow-y:auto;background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:12px;z-index:20;box-shadow:0 24px 70px rgba(0,0,0,.7)}
.menu-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;padding:0 4px}
.x{background:none;border:0;color:var(--muted);font-size:16px;padding:4px 8px}
.drop{border-bottom:1px solid var(--line)}
.drop:last-child{border-bottom:0}
.drop summary{padding:12px 6px;font-weight:700;font-size:14px;cursor:pointer;list-style:none;display:flex;justify-content:space-between;gap:8px;align-items:center}
.drop summary::-webkit-details-marker{display:none}
.drop summary::after{content:"⌄";color:var(--muted);font-size:16px;order:-1}
.drop[open] summary::after{content:"⌃"}
.drop .hint{font-size:11px;color:var(--muted);font-weight:400}
.drop-body{padding:0 6px 14px;font-size:13px;color:var(--muted)}
.drop-body label{display:flex;align-items:center;gap:9px;padding:7px 0;border-bottom:1px dashed rgba(255,255,255,.05)}
.drop-body input[type=checkbox]{width:19px;height:19px;accent-color:var(--teal);order:-1}
.seg{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.seg button{background:var(--surface2);border:1px solid var(--line);border-radius:9px;padding:5px 10px;font-size:12px;color:var(--muted)}
.seg button.on{background:rgba(61,220,151,.14);border-color:rgba(61,220,151,.4);color:var(--teal)}
.soft-btn{background:var(--surface2);border:1px solid var(--line);border-radius:10px;padding:8px 14px;color:var(--text);font-size:13px}
.field{margin:8px 0}
.field label{display:block;font-size:12px;margin-bottom:3px}
.field input,.field select{width:100%;background:var(--bg);border:1px solid var(--line);border-radius:9px;padding:8px 10px}
.report-out{white-space:pre-wrap;margin-top:10px;font-size:13px;line-height:1.8;color:#cfd9e5;background:rgba(255,255,255,.02);border-radius:10px;padding:10px}
.mini-row{display:flex;justify-content:space-between;gap:8px;padding:6px 0;border-bottom:1px dashed rgba(255,255,255,.05)}
.mini-row b{color:var(--text);font-variant-numeric:tabular-nums}

.chat{flex:1;overflow-y:auto;padding:18px 16px 10px}
.hello{text-align:center;margin:22px 0 26px}
.hello-icon{font-size:34px}
.hello h1{font-size:22px;margin:6px 0}
.hello p{color:var(--muted);font-size:13px;margin:4px 0 14px}
.examples{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.examples button{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:7px 13px;font-size:12px;color:var(--muted)}
.msg{max-width:88%;padding:11px 14px;border-radius:16px;margin:10px 0;font-size:14px;white-space:pre-wrap;word-break:break-word}
.msg.user{background:linear-gradient(135deg,#1f6f5a,#185045);margin-right:auto;border-bottom-right-radius:4px}
.msg.ai{background:var(--surface);border:1px solid var(--line);margin-left:auto;border-bottom-left-radius:4px}
.msg .meta{display:block;font-size:11px;color:var(--muted);margin-top:5px}
.typing{color:var(--muted);font-size:13px;padding:6px}

.preview{position:absolute;left:10px;right:10px;bottom:76px;background:var(--surface);border:1px solid rgba(61,220,151,.35);border-radius:18px;padding:13px;z-index:15;box-shadow:0 20px 60px rgba(0,0,0,.7);max-height:60%;overflow-y:auto}
.preview-head{display:flex;justify-content:space-between;align-items:center;color:var(--teal);font-size:13px;margin-bottom:8px}
.preview-body .field label{color:var(--muted)}
.preview-actions{display:flex;gap:8px;margin-top:12px}
.primary-btn{flex:1;background:var(--teal);color:#03130c;border:0;border-radius:11px;padding:10px;font-weight:800}
.ghost-btn{background:var(--surface2);border:1px solid var(--line);border-radius:11px;padding:10px 14px}
.alert-note{background:rgba(244,185,66,.1);border-right:3px solid var(--amber);border-radius:8px;padding:8px 10px;margin-top:8px;font-size:12px;color:#e8d7b0}

.composer{display:flex;align-items:center;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:rgba(8,11,16,.96)}
.round{width:42px;height:42px;flex:0 0 42px;border-radius:50%;background:var(--surface2);border:1px solid var(--line);font-size:18px}
.input-wrap{flex:1}
.input-wrap input{width:100%;background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:11px 16px;outline:none}
.input-wrap input:focus{border-color:rgba(61,220,151,.5)}
.send{width:42px;height:42px;flex:0 0 42px;border-radius:50%;background:var(--teal);color:#03130c;border:0;font-size:20px;font-weight:900}

@media(max-width:420px){.brand-sub{display:none}.composer{gap:6px}.round,.send{width:38px;height:38px;flex-basis:38px}}
