:root {
  --bg: #0b1020;
  --surface: #11182a;
  --surface-2: #182238;
  --surface-3: #202c46;
  --border: #263451;
  --text: #f7f9fc;
  --muted: #94a3b8;
  --accent: #6ea8fe;
  --accent-2: #8b5cf6;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --radius: 0.9rem;
  --sidebar-w: 17rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 80% 0%, rgba(110,168,254,.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(13,19,34,.96);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  backdrop-filter: blur(18px);
}
.brand { padding: 1.35rem 1rem; border-bottom: 1px solid var(--border); display:flex; gap:.75rem; align-items:center; }
.brand-mark { width:2.3rem;height:2.3rem;border-radius:.75rem;display:grid;place-items:center;background:linear-gradient(135deg,var(--accent),var(--accent-2));font-weight:800;box-shadow:0 8px 28px rgba(110,168,254,.2); }
.brand h1 { font-size: 1rem; font-weight: 750; letter-spacing:-.02em; }
.brand p { font-size: .72rem; color: var(--muted); margin-top: .2rem; line-height: 1.35; }
.nav { padding: .9rem .65rem; flex: 1; }
.nav-label { color:#64748b;font-size:.62rem;font-weight:700;letter-spacing:.12em;margin:.75rem .6rem .35rem; }
.nav-btn { width:100%;text-align:left;background:transparent;border:none;color:#dbe4f0;padding:.72rem .8rem;border-radius:.7rem;cursor:pointer;font-size:.86rem;display:flex;align-items:center;gap:.65rem;transition:.15s ease; }
.nav-btn span { width:1.15rem;text-align:center;color:#8ea3c5; }
.nav-btn:hover { background:rgba(255,255,255,.04); }
.nav-btn.active { background:linear-gradient(90deg,rgba(110,168,254,.16),rgba(139,92,246,.08));color:#fff;font-weight:650;box-shadow:inset 0 0 0 1px rgba(110,168,254,.12); }
.sidebar-footer { padding: .85rem 1rem; border-top: 1px solid var(--border); font-size: .72rem; color: var(--muted); }
.live-dot { display:inline-block;width:.45rem;height:.45rem;border-radius:999px;background:var(--success);margin-right:.4rem;box-shadow:0 0 0 4px rgba(52,211,153,.08); }

.main { display:flex;flex-direction:column;min-width:0; }
.topbar { display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.85rem 1.5rem;border-bottom:1px solid rgba(38,52,81,.8);background:rgba(11,16,32,.72);backdrop-filter:blur(16px);position:sticky;top:0;z-index:20; }
.topbar-title { display:flex;align-items:center;gap:.75rem; }
.topbar h2 { font-size:.95rem;font-weight:650;color:#dce7f6; }
.status-pill { display:inline-flex;align-items:center;gap:.35rem;padding:.3rem .65rem;border-radius:999px;font-size:.7rem;border:1px solid var(--border);color:var(--muted);background:rgba(255,255,255,.02); }
.status-pill.ok { color:var(--success);border-color:rgba(52,211,153,.3); }
.status-pill.warn { color:var(--warning);border-color:rgba(251,191,36,.25); }
.status-pill.err { color:var(--danger);border-color:rgba(251,113,133,.25); }
.content { padding:1.5rem;flex:1;overflow-y:auto;max-width:1600px;width:100%;margin:0 auto; }
.view { display:none; }
.view.active { display:block; }

.hero { padding:2.3rem 1rem 1.45rem;max-width:64rem;margin:0 auto;text-align:center; }
.eyebrow { font-size:.68rem;font-weight:800;letter-spacing:.16em;color:#8cb8ff;margin-bottom:.7rem; }
.hero h1,.section-intro h1 { font-size:clamp(1.8rem,3vw,3rem);letter-spacing:-.04em;line-height:1.05; }
.hero p { max-width:50rem;margin:.8rem auto 0;color:var(--muted);line-height:1.65;font-size:.95rem; }
.prompt-row { display:flex;flex-wrap:wrap;justify-content:center;gap:.55rem;margin-top:1.15rem; }
.prompt-chip { background:rgba(255,255,255,.03);border:1px solid var(--border);color:#d6e4f7;padding:.5rem .75rem;font-size:.75rem;font-weight:550;border-radius:999px; }
.prompt-chip:hover { background:rgba(110,168,254,.08);border-color:rgba(110,168,254,.4); }
.section-intro { margin-bottom:1.2rem;max-width:52rem; }
.section-intro h1 { font-size:1.8rem; }
.section-intro p { color:var(--muted);margin-top:.45rem;line-height:1.55; }

.panel { background:linear-gradient(180deg,rgba(19,28,48,.96),rgba(14,22,39,.96));border:1px solid var(--border);border-radius:1rem;padding:1.05rem;margin-bottom:1rem;box-shadow:0 18px 55px rgba(0,0,0,.12); }
.panel h3 { font-size:.95rem;margin-bottom:.65rem;color:#f4f7fb; }
.panel-heading { display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:.85rem; }
.panel-heading h3 { margin:0; }
.panel-heading p { color:var(--muted);font-size:.76rem;margin-top:.25rem; }
.mode-pill { font-size:.65rem;padding:.28rem .5rem;border-radius:999px;background:rgba(52,211,153,.08);color:#7ee7bc;border:1px solid rgba(52,211,153,.18);white-space:nowrap; }
.chat-layout { display:grid;grid-template-columns:minmax(0,1.15fr) minmax(22rem,.85fr);gap:1rem;max-width:82rem;margin:0 auto; }
.chat-panel,.answer-panel { min-height:36rem; }
.chat-thread { display:flex;flex-direction:column;gap:.75rem;max-height:25rem;overflow-y:auto;margin-bottom:1rem;padding:.2rem; }
.assistant-welcome { color:#9db0ca;background:rgba(255,255,255,.025);border:1px dashed #32415f;border-radius:.8rem;padding:1rem;line-height:1.5;font-size:.86rem; }
.msg { max-width:52rem;line-height:1.55;padding:.78rem 1rem;border-radius:.85rem;white-space:pre-wrap;font-size:.9rem; }
.msg.user { align-self:flex-end;background:linear-gradient(135deg,#3478f6,#6d5dfc);color:#fff; }
.msg.assistant { align-self:flex-start;background:var(--surface-2);border:1px solid var(--border); }
.msg.error { align-self:flex-start;background:rgba(251,113,133,.08);border:1px solid rgba(251,113,133,.35);color:#fecdd3; }
.composer { background:#0b1220;border:1px solid #32415f;border-radius:1rem;padding:.75rem;box-shadow:0 10px 30px rgba(0,0,0,.16); }
.composer textarea { border:none;background:transparent;min-height:6.7rem;padding:.25rem;color:#f7f9fc;outline:none; }
.composer-footer { display:flex;justify-content:space-between;align-items:center;gap:1rem;border-top:1px solid #202d46;padding-top:.65rem;margin-top:.35rem; }
.composer-footer span { color:#64748b;font-size:.68rem; }
.composer-footer button { border-radius:.7rem;padding:.6rem 1rem; }

.grid-2 { display:grid;grid-template-columns:1fr 1fr;gap:1rem; }
.toolbar { display:flex;flex-wrap:wrap;gap:.7rem;align-items:center;margin-bottom:1rem; }
.upload-toolbar { padding:.85rem;background:rgba(255,255,255,.025);border:1px solid var(--border);border-radius:.9rem; }
input[type="text"],input[type="file"],select,textarea { background:#0c1322;border:1px solid #2c3b59;color:var(--text);border-radius:.7rem;padding:.58rem .75rem;font:inherit; }
input[type="file"] { min-width:18rem; }
textarea { width:100%;resize:vertical;min-height:4rem; }
button,.btn { padding:.58rem .95rem;background:linear-gradient(135deg,#4d8dff,#765cf7);color:#fff;border:none;border-radius:.7rem;font-size:.84rem;font-weight:650;cursor:pointer;transition:.15s ease; }
button:hover,.btn:hover { transform:translateY(-1px);filter:brightness(1.05); }
button:disabled,.btn:disabled { background:#2b3549;color:#7d8ca6;cursor:not-allowed;transform:none; }
.btn-secondary { background:#182238;border:1px solid #2d3c59;color:#dbe6f5; }
.btn-secondary:hover { background:#202c46; }
.table-wrap { overflow-x:auto; }
table { width:100%;border-collapse:collapse;font-size:.8rem; }
th,td { text-align:left;padding:.65rem .55rem;border-bottom:1px solid #263451;vertical-align:top; }
th { color:#7f91ad;font-weight:650; }

.badge { display:inline-block;padding:.16rem .45rem;border-radius:999px;font-size:.66rem;font-weight:700;text-transform:uppercase; }
.badge.high { background:rgba(251,113,133,.12);color:#fda4af; }
.badge.medium { background:rgba(251,191,36,.12);color:#fcd34d; }
.badge.low { background:rgba(52,211,153,.12);color:#6ee7b7; }
.badge.demo { background:rgba(110,168,254,.12);color:#93c5fd; }
.alert { padding:.75rem 1rem;border-radius:.8rem;margin:0 1.5rem 1rem;font-size:.84rem;border:1px solid var(--border); }
.alert.error { background:rgba(251,113,133,.1);border-color:rgba(251,113,133,.32);color:#fecdd3; }
.alert.info { background:rgba(110,168,254,.08);border-color:rgba(110,168,254,.22); }
.alert.success { background:rgba(52,211,153,.08);border-color:rgba(52,211,153,.22);color:#a7f3d0; }
.alert.warn { background:rgba(251,191,36,.08);border-color:rgba(251,191,36,.22);color:#fde68a; }
.spinner { width:1rem;height:1rem;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.overlay { position:fixed;inset:0;background:rgba(5,10,20,.72);display:flex;align-items:center;justify-content:center;z-index:100;backdrop-filter:blur(7px); }
.overlay-card { background:var(--surface);border:1px solid var(--border);border-radius:.9rem;padding:1rem 1.25rem;display:flex;align-items:center;gap:.7rem;box-shadow:0 20px 60px rgba(0,0,0,.35); }
.sections-grid { display:grid;gap:.7rem; }
.section-card { background:#141e32;border:1px solid #283752;border-radius:.8rem;padding:.78rem; }
.section-card h4 { font-size:.72rem;color:#8fa3c0;margin-bottom:.45rem;text-transform:uppercase;letter-spacing:.04em; }
.section-card ul { padding-left:1.1rem;font-size:.8rem; }
.section-card li { margin-bottom:.35rem;line-height:1.45; }
.citation-chip { display:inline-block;margin:.12rem .2rem .12rem 0;padding:.18rem .42rem;background:#0b1220;border:1px solid #2b3a57;border-radius:999px;font-size:.66rem;color:#8294af; }
.verification { display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.45rem; }
.form-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));gap:.75rem; }
.form-field label { display:block;font-size:.72rem;color:#8495b1;margin-bottom:.28rem; }
.wide { grid-column:1/-1; }
.empty-state { color:#7f91ad;font-size:.84rem;padding:1.4rem;text-align:center;border:1px dashed #30405f;border-radius:.8rem; }
.empty-state.soft { background:rgba(255,255,255,.018); }
.wizard-steps { display:flex;flex-wrap:wrap;gap:.35rem;margin-bottom:.8rem; }
.wizard-step { font-size:.68rem;padding:.27rem .5rem;border-radius:999px;border:1px solid #31415f;color:#71839e; }
.wizard-step.active { border-color:#6ea8fe;color:#9fc4ff;background:rgba(110,168,254,.1); }
.wizard-step.done { border-color:rgba(52,211,153,.4);color:#6ee7b7; }
.aszf-wizard-form fieldset { border:none;padding:0;margin:0; }
.wizard-panel { display:none;grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem; }
.wizard-panel.active { display:grid; }
.wizard-panel legend { grid-column:1/-1;font-size:.78rem;font-weight:700;color:#a8b7ca;margin-bottom:.25rem; }
.wizard-actions { margin-top:.8rem; }
.grey-area-list .grey-option { border:1px solid var(--border);border-radius:.75rem;padding:.65rem;margin-bottom:.5rem; }
.grey-area-list .grey-option.selected { border-color:#6ea8fe;background:rgba(110,168,254,.07); }
.version-row { display:flex;justify-content:space-between;gap:.5rem;padding:.55rem 0;border-bottom:1px solid var(--border);font-size:.8rem; }
.version-row button { padding:.25rem .5rem;font-size:.68rem; }
.subsection-title { margin-top:1.1rem; }
.diff-added { color:var(--success); }.diff-removed { color:var(--danger); }.diff-changed { color:var(--warning); }
.mobile-nav-toggle { display:none; }
.impact-subhead { margin-top:.75rem;font-size:.72rem;color:var(--muted); }
.impact-meta { font-size:.72rem;color:var(--muted);margin-top:.35rem; }
.amendment-card { border:1px solid var(--border);border-radius:.8rem;padding:.75rem;margin-top:.5rem;background:var(--surface-2); }
.amendment-header { display:flex;justify-content:space-between;gap:.5rem;align-items:center; }
.diff-block { margin-top:.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.7rem;border:1px solid var(--border);border-radius:.7rem;overflow:hidden; }
.diff-line { padding:.15rem .5rem;white-space:pre-wrap; }.diff-insert { background:rgba(52,211,153,.1); }.diff-delete { background:rgba(251,113,133,.1); }.diff-equal { color:var(--muted); }

@media (max-width: 1050px) { .chat-layout,.grid-2 { grid-template-columns:1fr; } .answer-panel { min-height:auto; } }
@media (max-width: 900px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed;left:0;top:0;z-index:50;width:min(var(--sidebar-w),88vw);transform:translateX(-105%);transition:transform .2s ease; }
  .sidebar.open { transform:translateX(0); }
  .mobile-nav-toggle { display:inline-flex; }
  .content { padding:1rem; }
  .topbar { padding:.75rem 1rem; }
  .hero { padding:1.5rem 0 1rem; }
  .composer-footer { align-items:flex-end; }
  .composer-footer span { display:none; }
}
