:root{
  --bg:#FFFFFF; --panel:#F6F7FB; --ink:#101828; --muted:#5B6474;
  --blue:#1226B8; --deep:#0A1E8C; --red:#D42B1E; --border:#E2E6EF;
  --blue-soft:#EEF1FF; --red-soft:#FDF0EF;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--ink);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:16px;line-height:1.6;-webkit-text-size-adjust:100%}
a{color:var(--blue)}
h1,h2{font-family:Georgia,"Times New Roman",Times,serif;font-weight:700;line-height:1.15;letter-spacing:-.01em}
.topbar-accent{height:4px;background:linear-gradient(90deg,var(--blue) 0%,var(--blue) 55%,var(--red) 55%,var(--red) 100%)}
.topbar{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid var(--border)}
.topbar-inner{max-width:1120px;margin:0 auto;padding:10px 20px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:var(--ink)}
.brand img{height:44px;width:auto;display:block}
.brand-name{font-weight:800;font-size:19px;letter-spacing:-.01em;line-height:1.1}
.brand-name small{display:block;font-weight:600;font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.badge{margin-left:auto;font-size:12.5px;font-weight:700;color:var(--red);background:var(--red-soft);
  border:1px solid #F3C2BE;border-radius:999px;padding:6px 12px;white-space:nowrap}
.hero{max-width:920px;margin:32px auto 0;padding:56px 32px 44px;text-align:center}
.hero-logo{width:168px;max-width:60vw;height:auto;display:block;margin:0 auto 6px}
.hero h1{font-size:clamp(38px,6vw,58px);margin:0 0 14px}
.hero h1 .accent{color:var(--blue)}
.hero p.sub{max-width:640px;margin:0 auto 26px;color:var(--muted);font-size:18px;line-height:1.55}
.askbox{display:flex;gap:8px;align-items:center;background:#fff;border:2px solid var(--border);border-radius:999px;padding:8px 8px 8px 22px;box-shadow:0 14px 40px rgba(16,24,40,.10);text-align:left}
.askbox:focus-within{border-color:var(--blue);box-shadow:0 0 0 4px var(--blue-soft),0 14px 40px rgba(16,24,40,.10)}
.askbox input{flex:1;min-width:0;border:0;outline:0;font:inherit;font-size:17px;padding:12px 12px;color:var(--ink);background:transparent}
.askbox input::placeholder{color:#98A1B3}
.btn{flex:0 0 auto;width:52px;height:52px;border:0;border-radius:50%;padding:0;background:var(--blue);color:#fff;display:grid;place-items:center;cursor:pointer}
.btn svg{width:22px;height:22px;display:block}
.btn:hover:not(:disabled){background:var(--deep)}
.btn:disabled{opacity:.55;cursor:wait}
.btn-mic{flex:0 0 auto;width:48px;height:48px;border:1px solid var(--border);border-radius:50%;background:#fff;cursor:pointer;display:grid;place-items:center;color:var(--blue)}
.btn-mic:hover{border-color:var(--blue)}
.btn-mic[aria-pressed="true"]{background:var(--red);border-color:var(--red);color:#fff}
.btn-mic svg{width:22px;height:22px;display:block}
.btn-mic.hidden{display:none}
.privacy-note{margin:14px 0 0;font-size:13px;color:var(--muted)}
main{max-width:1120px;margin:0 auto;padding:0 20px 30px}
.thread{max-width:880px;margin:28px auto 0;display:grid;gap:28px}
.empty-hint{border:1.5px dashed var(--border);border-radius:16px;padding:26px;text-align:center;color:var(--muted);background:var(--panel)}
.msg{scroll-margin-top:88px;min-width:0}
.msg.user{display:flex;justify-content:flex-end}
.msg .bubble{background:var(--blue-soft);border-radius:18px;padding:10px 16px;max-width:82%;font-weight:600;line-height:1.5;overflow-wrap:break-word}
.msg.assistant h3{font-family:Georgia,"Times New Roman",Times,serif;font-size:24px;margin:0 0 8px;line-height:1.25}
.msg.assistant p{margin:0 0 12px;color:#2A3242}
.msg.assistant p:last-of-type{margin-bottom:0}
.msg.assistant.error{background:var(--red-soft);border-radius:16px;padding:20px 22px}
.msg.assistant.error h3{margin-top:0}
.sources-title{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:20px 0 10px}
.sources-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.source-card{border:1px solid var(--border);border-radius:12px;padding:14px 16px;background:var(--panel)}
.source-card strong{display:block;font-size:15px;margin-bottom:2px}
.source-card small{display:block;color:var(--muted);font-size:13px;line-height:1.45}
.source-card a{display:inline-block;margin-top:8px;font-size:14px;font-weight:700;text-decoration:none}
.source-card a:hover{text-decoration:underline}
.disclaimer{margin:18px 0 0;padding-top:14px;border-top:1px solid var(--border);font-size:12.5px;color:var(--muted)}
.thinking{display:flex;align-items:center;gap:10px;color:var(--muted);font-weight:600;padding:8px 0 2px}
.dots{display:inline-flex;gap:5px}
.dots i{width:8px;height:8px;border-radius:50%;background:var(--blue);animation:bounce 1s infinite ease-in-out}
.dots i:nth-child(2){animation-delay:.15s}.dots i:nth-child(3){animation-delay:.3s}
@keyframes bounce{0%,100%{transform:translateY(0);opacity:.4}50%{transform:translateY(-5px);opacity:1}}
@media (prefers-reduced-motion:reduce){.dots i{animation:none;opacity:1}html{scroll-behavior:auto}}
.clear-row{max-width:880px;margin:16px auto 0;text-align:right}
.clear-btn{border:0;background:none;color:var(--muted);font:inherit;font-size:14px;cursor:pointer;text-decoration:underline;padding:6px}
.clear-btn:hover{color:var(--red)}
.section{max-width:1120px;margin:56px auto 0;scroll-margin-top:76px}
.section h2{font-size:clamp(26px,3.5vw,34px);margin:0 0 8px}
.section .lead{color:var(--muted);margin:0 0 22px;max-width:720px}
.topics-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.topic{display:block;border:1px solid var(--border);border-radius:14px;padding:18px;background:#fff;text-align:left;text-decoration:none;color:var(--ink);transition:transform .12s ease,border-color .12s ease}
.topic:hover{border-color:var(--blue);transform:translateY(-2px)}
.topic b{display:block;font-size:16px;margin-bottom:5px}
.topic span{color:var(--muted);font-size:13.5px;line-height:1.45}
.how-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.how-card{border:1px solid var(--border);border-radius:14px;padding:20px;background:var(--panel)}
.how-card .num{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--blue);color:#fff;font-weight:800;font-size:14px;margin-bottom:10px}
.how-card b{display:block;font-size:16px;margin-bottom:5px}
.how-card p{margin:0;color:var(--muted);font-size:14.5px}
.source-list{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.source-list a{border:1px solid var(--border);border-radius:12px;padding:13px 15px;text-decoration:none;color:var(--ink);background:#fff;display:block}
.source-list a:hover{border-color:var(--blue)}
.source-list b{display:block;font-size:14.5px}
.source-list span{display:block;font-size:12.5px;color:var(--muted);line-height:1.4;margin-top:2px}
.about-card{border:1px solid var(--border);border-radius:16px;padding:26px;background:var(--panel)}
.about-card p{margin:0 0 12px;color:#2A3242;max-width:820px}
.about-card p:last-child{margin-bottom:0}
footer{background:#fff;border-top:1px solid var(--border);margin-top:64px}
.footer-inner{max-width:880px;margin:0 auto;padding:48px 20px 36px;text-align:center}
.footer-wordmark{font-family:Georgia,"Times New Roman",Times,serif;font-size:clamp(34px,5vw,48px);font-weight:700;line-height:1.1;letter-spacing:-.01em;color:var(--ink);margin:0 0 20px}
.footer-nav{display:flex;flex-wrap:wrap;gap:10px 28px;justify-content:center;margin:0 0 24px}
.footer-nav a{font-family:Georgia,"Times New Roman",Times,serif;font-size:19px;color:var(--ink);text-decoration:none}
.footer-nav a:hover{color:var(--blue);text-decoration:underline}
.footer-note{font-size:13px;color:var(--muted);line-height:1.7;margin:0}
/* ---- Sidebar layout ---- */
.menu-btn{display:none;border:1px solid var(--border);background:#fff;border-radius:10px;width:42px;height:42px;place-items:center;cursor:pointer;color:var(--ink);padding:0}
.menu-btn svg{width:22px;height:22px;display:block;margin:auto}
.sidebar{background:#fff;display:flex;flex-direction:column;z-index:40;transition:transform .25s ease}
.side-brand{display:flex;align-items:center;gap:10px;padding:16px 18px 12px;flex-shrink:0}
.side-brand img{height:40px;width:auto;display:block}
.side-new{margin:14px 14px 16px;border:0;border-radius:11px;padding:12px;background:var(--blue);color:#fff;font:inherit;font-weight:700;font-size:15px;cursor:pointer;text-align:left}
.side-new:hover{background:var(--deep)}
.sidebar nav.side-scroll{padding:8px 14px 14px;overflow-y:auto;flex:1}
.side-label{font-size:11.5px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin:22px 6px 6px}
.side-topic,.side-link{display:block;width:100%;text-align:left;border:0;background:none;font:inherit;font-size:14.5px;color:var(--ink);padding:8px 10px;border-radius:9px;cursor:pointer;text-decoration:none}
.side-topic:hover:not(:disabled),.side-link:hover{background:var(--blue-soft);color:var(--blue)}
.side-topic:disabled{opacity:.55;cursor:wait}
.side-foot{margin:0;padding:20px 20px 18px;font-size:12px;color:var(--muted);line-height:1.5}
.overlay{position:fixed;inset:0;background:rgba(16,24,40,.45);z-index:30}
body.no-scroll{overflow:hidden}
@media (min-width:1024px){
  .sidebar{position:fixed;top:0;left:0;bottom:0;width:272px}
  .content{margin-left:272px}
  .topbar .brand{display:none}
  .overlay{display:none}
}
@media (max-width:1023px){
  .menu-btn{display:grid}
  .sidebar{position:fixed;top:0;left:0;bottom:0;width:288px;max-width:84vw;transform:translateX(-105%);transition:transform .22s ease}
  .sidebar.open{transform:none;box-shadow:0 20px 50px rgba(16,24,40,.25)}
}
@media (prefers-reduced-motion:reduce){.sidebar{transition:none}}
.source-group{margin-bottom:26px}
.source-group:last-child{margin-bottom:0}
.source-group h3{font-family:Georgia,"Times New Roman",Times,serif;font-size:20px;margin:0 0 12px}
.source-group[hidden]{display:none}
.source-list a[hidden]{display:none}
.source-count{color:var(--muted);font-size:14px;margin:0 0 14px}
.source-filter{width:100%;max-width:460px;font:inherit;font-size:15px;padding:11px 14px;border:1.5px solid var(--border);border-radius:11px;margin-bottom:22px;color:var(--ink);background:#fff}
.source-filter:focus{outline:3px solid var(--blue);outline-offset:2px;border-color:var(--blue)}
.no-match{color:var(--muted);font-size:15px}
.gov-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 22px}
.gov-chip{border:1px solid var(--border);border-radius:999px;padding:7px 14px;text-decoration:none;color:var(--ink);font-size:14px;font-weight:600;background:#fff}
.gov-chip:hover{border-color:var(--blue);color:var(--blue)}
.gov-link{margin:0 0 18px;font-size:15px}
.gov-link a{font-weight:700}
.source-group{scroll-margin-top:76px}
.side-sub{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:14px 10px 4px}
.close-bar{display:flex;width:100%;align-items:center;gap:10px;padding:14px 18px;border:0;background:transparent;font:inherit;font-size:15px;font-weight:700;color:var(--ink);cursor:pointer;text-align:left;flex-shrink:0}
.close-bar:hover{background:var(--blue-soft)}
.close-bar span{font-size:22px;line-height:1;color:var(--muted)}
.side-nav{padding:12px 14px 8px;display:grid;gap:2px}
.side-nav a{display:block;padding:9px 10px;border-radius:9px;text-decoration:none;color:var(--ink);font-size:15px;font-weight:600}
.side-nav a:hover{background:var(--blue-soft);color:var(--blue)}
.side-nav a[aria-current="page"]{background:var(--blue-soft);color:var(--blue)}
main.page{max-width:1120px;margin:0 auto;padding:0 20px 40px}
.page-head{max-width:820px;padding:48px 0 26px}
.page-head h1{font-size:clamp(34px,5vw,50px);margin:0 0 10px}
.page-head .lead{color:var(--muted);font-size:18px;line-height:1.55;margin:0}
@media (min-width:1024px){
  .content{transition:margin-left .25s ease}
  body.sidebar-closed .sidebar{transform:translateX(-105%)}
  body.sidebar-closed .content{margin-left:0}
  body.sidebar-closed .menu-btn{display:grid}
  body.sidebar-closed .topbar-inner .brand{display:flex}
}
:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (max-width:820px){
  .topics-grid{grid-template-columns:repeat(2,1fr)}
  .how-grid{grid-template-columns:1fr}
  .source-list{grid-template-columns:repeat(2,1fr)}
  .sources-grid{grid-template-columns:1fr}
  .badge{margin-left:0;font-size:11.5px;padding:4px 10px}
}
@media (max-width:520px){
  .hero{padding:52px 20px 32px}
  .askbox{padding:6px 6px 6px 16px}
  .askbox input{font-size:16px;padding:10px 8px}
  .btn{width:46px;height:46px}
  .btn-mic{width:44px;height:44px}
  .brand-name{font-size:16px;white-space:nowrap}
  .topbar-inner{flex-wrap:nowrap;gap:8px;padding:10px 12px}
  .brand img{height:32px}
  .badge{margin:0 0 0 auto;font-size:10px;padding:4px 8px;line-height:1.3;text-align:center;white-space:normal;max-width:150px;min-width:0}
  .brand{gap:8px;flex-shrink:0}
  .menu-btn{flex-shrink:0}
  .hero p.sub{margin-bottom:20px;font-size:17px}
  .thread{margin-top:20px}
  .empty-hint{border:0;background:none;padding:10px 6px;font-size:14.5px;margin:0}
  .topics-grid{grid-template-columns:1fr}
  .source-list{grid-template-columns:1fr}
  .footer-nav{flex-direction:column;gap:8px}
  .hero-note{margin-top:22px}
  .hero h1{line-height:1.12}
  .topics-grid{gap:24px}
  .source-list{gap:24px}
  .source-list a{padding:18px}
  .source-list a span{margin-top:6px}
  main{padding:0 20px 16px}
  footer{margin-top:16px}
}

/* ---- Single-thread chat (home): composer docks at the bottom once
   chatting starts; the hero collapses so the thread is the page. ---- */
.composer-slot{max-width:880px;margin:22px auto 0}
body.chatting .composer-slot{position:sticky;bottom:0;z-index:10;background:linear-gradient(rgba(255,255,255,0),#fff 32%);padding:26px 0 14px}
body.chatting .hero{margin:0;padding:0 20px}
body.chatting .hero h1,body.chatting .hero .sub{display:none}
body.chatting .thread{margin-top:8px}
@media (max-width:520px){
  .thread{gap:22px}
  .msg .bubble{max-width:88%}
  body.chatting .composer-slot{padding:20px 0 10px}
}
