body{margin:0;background:var(--bg);overflow:hidden;height:100vh;display:flex;flex-direction:column}

/* TOPBAR */
.page-topbar{height:50px;background:var(--s);border-bottom:1px solid var(--b);display:flex;align-items:center;padding:0 20px;flex-shrink:0;gap:12px}
.topbar-icon{width:30px;height:30px;background:linear-gradient(135deg,#EA580C,#B45309);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:13px;color:#fff}
.topbar-title{font-size:14px;font-weight:700;color:var(--t)}
.topbar-badges{margin-left:auto;display:flex;gap:6px}
.tbadge{padding:3px 8px;border-radius:12px;font-size:9px;font-weight:700;letter-spacing:.04em}
.tbadge-ai{background:var(--diamond-l);color:var(--diamond)}
.tbadge-beta{background:var(--orange-l);color:var(--orange)}

/* TABS */
.tab-bar{display:flex;background:var(--s);border-bottom:1px solid var(--b);padding:0 20px;flex-shrink:0}
.tab-btn{padding:10px 18px;font-size:12px;font-weight:600;color:var(--m);cursor:pointer;border:none;background:none;border-bottom:2px solid transparent;font-family:inherit;transition:all .15s}
.tab-btn:hover{color:var(--t)}
.tab-btn.active{color:var(--gold);border-bottom-color:var(--gold)}
.tab-content{display:none;flex:1;overflow:hidden;min-height:0}
.tab-content.active{display:flex}

/* ═══ TAB 1: SIMULATOR ═══ */
.sim-layout{flex:1;display:flex;overflow:hidden}
.sim-left{width:360px;flex-shrink:0;background:var(--s);border-right:1px solid var(--b);display:flex;flex-direction:column;overflow:hidden}
.sim-right{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column;gap:16px}
.sim-right::-webkit-scrollbar{width:3px}
.sim-right::-webkit-scrollbar-thumb{background:var(--b);border-radius:2px}

/* Form */
.form-section{padding:14px 16px;border-bottom:1px solid var(--b)}
.form-section:last-child{border-bottom:none}
.form-label{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--m);margin-bottom:6px}
.form-select,.form-textarea{width:100%;padding:9px 10px;border:1px solid var(--b);border-radius:var(--rs);font-size:12px;font-family:inherit;color:var(--t);background:var(--bg);outline:none}
.form-textarea{min-height:90px;resize:vertical;line-height:1.6}
.form-textarea:focus,.form-select:focus{border-color:var(--gold);box-shadow:0 0 0 2px rgba(180,83,9,.06)}
.form-textarea::placeholder{color:var(--f)}

/* Tuning sliders */
.tuning-section{padding:10px 16px;flex:1;overflow-y:auto}
.tuning-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--m);margin-bottom:8px;display:flex;align-items:center;gap:6px}
.slider-row{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.slider-name{font-size:10px;font-weight:600;color:var(--t);min-width:90px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.slider-input{flex:1;accent-color:var(--gold);height:4px}
.slider-val{font-size:10px;font-weight:700;color:var(--gold);min-width:28px;text-align:right;font-family:'Fraunces',serif}

/* Buttons */
.btn-row{padding:10px 16px;display:flex;gap:8px}
.btn-sim{flex:1;padding:10px;border:none;border-radius:var(--rs);font-size:12px;font-weight:600;font-family:inherit;cursor:pointer;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}
.btn-primary{background:var(--t);color:#fff}
.btn-primary:hover{opacity:.85}
.btn-secondary{background:var(--bg);color:var(--t);border:1px solid var(--b)}
.btn-sim:disabled{opacity:.4;cursor:not-allowed}
.spinner{width:12px;height:12px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .6s linear infinite;display:none}
.btn-sim.loading .spinner{display:block}
.btn-sim.loading .btn-text{display:none}
@keyframes spin{to{transform:rotate(360deg)}}

/* Presets */
.presets{padding:10px 16px;border-top:1px solid var(--b)}
.preset-chips{display:flex;flex-wrap:wrap;gap:4px}
.preset-chip{padding:4px 10px;border-radius:14px;border:1px solid var(--b);font-size:10px;color:var(--m);cursor:pointer;transition:all .12s;font-family:inherit;background:var(--bg)}
.preset-chip:hover{border-color:var(--gold);color:var(--gold);background:var(--gold-l)}

/* Empty state */
.empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;color:var(--f)}
.empty-icon{font-size:40px;opacity:.4}
.empty-title{font-size:14px;font-weight:600;color:var(--m)}
.empty-desc{font-size:11px;color:var(--f);text-align:center;max-width:280px;line-height:1.6}

/* Sentiment overview */
.sent-overview{display:grid;grid-template-columns:160px 1fr;gap:16px;padding:14px;background:var(--s);border:1px solid var(--b);border-radius:var(--r)}
.sent-chart{position:relative;width:130px;height:130px;margin:0 auto}
.sent-chart canvas{width:100%!important;height:100%!important}
.sent-center{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center}
.sent-score{font-size:24px;font-weight:700;font-family:'Fraunces',serif;color:var(--t)}
.sent-lbl{font-size:9px;color:var(--m);font-weight:600;text-transform:uppercase;letter-spacing:.06em}
.sent-bars{display:flex;flex-direction:column;justify-content:center;gap:8px}
.sbar{display:flex;align-items:center;gap:8px}
.sbar-label{font-size:10px;font-weight:600;min-width:60px;color:var(--m)}
.sbar-track{flex:1;height:6px;background:var(--bg);border-radius:3px;overflow:hidden}
.sbar-fill{height:100%;border-radius:3px;transition:width 1s ease}
.sbar-val{font-size:11px;font-weight:700;min-width:30px;text-align:right;font-family:'Fraunces',serif}
.fill-pos{background:#059669}.fill-neu{background:#D97706}.fill-neg{background:#DC2626}
.val-pos{color:#059669}.val-neu{color:#D97706}.val-neg{color:#DC2626}

/* Section title */
.sec-title{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--m);display:flex;align-items:center;gap:6px}
.sec-count{background:var(--bg);border:1px solid var(--b);padding:1px 6px;border-radius:10px;font-size:9px;font-family:'Fraunces',serif;color:var(--t)}

/* Reaction cards */
.rx-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:10px}
.rx-card{background:var(--s);border:1px solid var(--b);border-radius:var(--r);overflow:hidden;transition:all .2s}
.rx-card:hover{box-shadow:0 3px 12px rgba(0,0,0,.04)}
.rx-head{padding:10px 14px;display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--b)}
.rx-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:12px;color:#fff;font-weight:700;flex-shrink:0}
.rx-info{flex:1;min-width:0}
.rx-name{font-size:12px;font-weight:600;color:var(--t)}
.rx-seg{font-size:9px;color:var(--m);margin-top:1px}
.rx-sent{padding:2px 8px;border-radius:10px;font-size:9px;font-weight:700;flex-shrink:0}
.s-pos{background:var(--green-l);color:var(--green)}.s-neu{background:var(--gold-l);color:var(--gold)}.s-neg{background:var(--red-l);color:var(--red)}
.rx-body{padding:12px 14px}
.rx-comment{font-size:12px;color:var(--t);line-height:1.6;font-style:italic;padding-left:14px;position:relative}
.rx-comment::before{content:'"';position:absolute;left:0;top:-3px;font-size:20px;color:var(--f);font-family:'Fraunces',serif}
.rx-meta{display:flex;gap:10px;margin-top:8px;padding-top:8px;border-top:1px solid var(--b)}
.rx-mi{font-size:9px;color:var(--m);display:flex;align-items:center;gap:3px}

/* Agent thinking */
.think-box{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:16px}
.ag-row{display:flex;align-items:center;gap:10px;padding:6px 0}
.ag-icon{width:28px;height:28px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff;flex-shrink:0}
.ag-name{font-size:11px;font-weight:600;color:var(--t);min-width:90px}
.ag-status{font-size:10px;color:var(--m);flex:1}
.ag-dots{display:flex;gap:3px}
.ag-dots span{width:5px;height:5px;border-radius:50%;background:var(--f);animation:dp 1.4s infinite}
.ag-dots span:nth-child(2){animation-delay:.2s}
.ag-dots span:nth-child(3){animation-delay:.4s}
@keyframes dp{0%,80%,100%{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}
.ag-check{color:var(--green);font-weight:700;font-size:11px}

/* Recommendations */
.reco-box{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:14px}
.reco-item{display:flex;gap:8px;padding:6px 0;border-bottom:1px solid var(--b);font-size:11px;line-height:1.5}
.reco-item:last-child{border-bottom:none}
.reco-icon{font-size:12px;flex-shrink:0;margin-top:1px}
.reco-text{color:var(--t)}.reco-text strong{color:var(--gold)}

/* ═══ TAB 2: CRISIS ALERT ═══ */
.crisis-layout{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:16px}
.crisis-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.crisis-stat{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:16px;text-align:center}
.cs-value{font-size:28px;font-weight:700;font-family:'Fraunces',serif}
.cs-label{font-size:10px;color:var(--m);font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin-top:4px}
.cs-trend{font-size:10px;font-weight:700;margin-top:2px}
.trend-up{color:var(--red)}.trend-down{color:var(--green)}.trend-flat{color:var(--m)}
.alert-feed{display:flex;flex-direction:column;gap:8px}
.alert-card{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:12px 16px;display:flex;align-items:flex-start;gap:12px}
.alert-severity{width:8px;height:8px;border-radius:50%;flex-shrink:0;margin-top:4px}
.sev-critical{background:#DC2626}.sev-warning{background:#D97706}.sev-info{background:#0891B2}
.alert-body{flex:1}
.alert-title{font-size:12px;font-weight:600;color:var(--t)}
.alert-desc{font-size:11px;color:var(--m);margin-top:2px;line-height:1.5}
.alert-time{font-size:9px;color:var(--f);margin-top:4px}
.alert-tag{padding:2px 6px;border-radius:8px;font-size:9px;font-weight:700;margin-left:auto;flex-shrink:0}
.tag-critical{background:var(--red-l);color:var(--red)}.tag-warning{background:var(--gold-l);color:var(--gold)}.tag-info{background:var(--cyan-l);color:var(--cyan)}

/* ═══ TAB 3: DOCS ═══ */
.docs-layout{flex:1;overflow-y:auto;padding:24px 32px;max-width:800px}
.docs-layout h2{font-size:18px;font-family:'Fraunces',serif;margin:20px 0 10px;color:var(--t)}
.docs-layout h3{font-size:14px;margin:14px 0 6px;color:var(--gold)}
.docs-layout p,.docs-layout li{font-size:12px;line-height:1.7;color:var(--m)}
.docs-layout ul{padding-left:20px}
.docs-layout code{background:var(--bg);padding:1px 6px;border-radius:4px;font-size:11px}
.docs-layout .arch-box{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:16px;margin:12px 0;font-family:monospace;font-size:11px;line-height:1.8;white-space:pre;overflow-x:auto;color:var(--t)}
.docs-layout .feature-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}
.docs-layout .feat-card{background:var(--s);border:1px solid var(--b);border-radius:var(--rs);padding:12px}
.feat-card .feat-icon{font-size:20px;margin-bottom:6px}
.feat-card .feat-title{font-size:12px;font-weight:700;color:var(--t)}
.feat-card .feat-desc{font-size:10px;color:var(--m);margin-top:4px;line-height:1.5}

@media(max-width:900px){.sim-left{width:100%;max-height:35vh;border-right:none;border-bottom:1px solid var(--b)}.sim-layout{flex-direction:column}.crisis-stats{grid-template-columns:1fr 1fr}.docs-layout .feature-grid{grid-template-columns:1fr}}