:root {
  --bg: #0a102a;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --pink: #f472b6;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; }

a { color: var(--blue); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }

.top-badge {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
}

h1 { font-size: 44px; line-height: 1.05; font-weight: 900; max-width: 760px; margin-bottom: 16px; }
.grad { background: linear-gradient(90deg, var(--blue), var(--purple), var(--pink)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sub { color: var(--muted); font-size: 14px; max-width: 720px; line-height: 1.6; margin-bottom: 32px; }

.layout { display: grid; grid-template-columns: 1fr 440px; gap: 24px; max-width: 1280px; }
@media (max-width: 1000px) { .layout { grid-template-columns: 1fr; } h1 { font-size: 32px; } }

.card {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 16px;
  padding: 18px 20px;
}

.right { background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); border-radius: 20px; padding: 24px; height: fit-content; }
.right-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.live { background: var(--green); color: #000; font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 999px; }

.input-wrap { background: rgba(0,0,0,0.4); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.input-wrap input { background: transparent; border: none; color: #fff; font-size: 14px; width: 100%; outline: none; }
.input-wrap.error { border-color: var(--red); box-shadow: 0 0 0 2px rgba(239,68,68,0.2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 10px; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,0.1); border: 1px solid var(--panel-border); cursor: pointer; color: var(--text); }
.chip:hover { background: rgba(96,165,250,0.2); }

.btn { width: 100%; padding: 14px; border-radius: 12px; border: none; font-weight: 800; font-size: 14px; cursor: pointer; margin-top: 12px; transition: all .15s; }
.btn-blue { background: #3b82f6; color: #fff; }
.btn-blue:hover { background: #2563eb; }
.btn-blue:disabled { background: #334155; cursor: not-allowed; }
.btn-ghost { background: rgba(255,255,255,0.08); border: 1px solid var(--panel-border); color: #fff; }

.footnote { font-size: 11px; color: var(--muted-2); margin-top: 12px; text-align: center; line-height: 1.5; }

.result-card { border: 1px solid var(--panel-border); background: rgba(255,255,255,0.04); border-radius: 12px; padding: 14px; margin: 10px 0; }
.result-medium { border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.07); }
.result-low { border-color: rgba(148,163,184,0.3); }

.badge { display: inline-block; font-size: 10px; background: rgba(96,165,250,0.15); border: 1px solid rgba(96,165,250,0.3); color: var(--blue); padding: 4px 8px; border-radius: 999px; margin-right: 6px; margin-bottom: 6px; }
.badge-caveat { background: rgba(251,191,36,0.15); border-color: rgba(251,191,36,0.3); color: var(--amber); }
.badge-green { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.3); color: var(--green); }
.badge-review { background: rgba(248,113,113,0.15); border-color: rgba(248,113,113,0.35); color: var(--red); }
.badge-treatment-pending { background: rgba(148,163,184,0.15); border-color: rgba(148,163,184,0.3); color: var(--muted); }
.corpus-item .caveat { font-size: 11px; color: var(--amber); margin-top: 6px; line-height: 1.5; }

.disclaimer { margin-top: 16px; padding: 12px 14px; background: rgba(96,165,250,0.08); border: 1px solid rgba(96,165,250,0.2); border-radius: 10px; font-size: 12px; color: #cbd5e1; line-height: 1.5; }

.corpus-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.corpus-item h3 { font-size: 14px; margin-bottom: 4px; }
.corpus-item p { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.corpus-item .cite { font-size: 11px; color: var(--blue); font-family: ui-monospace, monospace; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-box { max-width: 380px; margin: 120px auto; text-align: center; }
.login-box input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(0,0,0,0.4); color: #fff; margin-bottom: 12px; font-size: 14px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

nav.enginebar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.search-row { display: flex; gap: 10px; margin-bottom: 20px; }
.search-row input { flex: 1; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(0,0,0,0.4); color: #fff; font-size: 14px; }
.source-block { border: 1px solid var(--panel-border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.source-block h2 { font-size: 13px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; }
.empty-note { color: var(--muted-2); font-size: 13px; padding: 8px 0; }

/* Site navigation (home, engine, login) */
.sitenav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--panel-border); margin-bottom: 24px; }
.sitenav .brand { font-weight: 900; font-size: 16px; color: var(--text); text-decoration: none; margin-right: 16px; padding: 12px 0; }
.navtab { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700; padding: 12px 14px; border-bottom: 2px solid transparent; }
.navtab:hover { color: var(--text); }
.navtab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.navtab.active { color: var(--text); border-bottom-color: var(--blue); }
.nav-logout { width: auto; margin: 0 0 0 auto; padding: 8px 14px; }
.show-sm { display: none; }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .sitenav .brand { margin-right: 4px; font-size: 15px; }
  .navtab { padding: 12px 7px; font-size: 13px; }
  .nav-logout { padding: 5px 8px; font-size: 12px; }
}
.navnote { font-size: 10px; font-weight: 600; color: var(--muted-2); margin-left: 6px; border: 1px solid var(--panel-border); border-radius: 999px; padding: 1px 6px; vertical-align: 1px; }

/* /engine jurisdiction tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--panel-border); margin-bottom: 20px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 700; padding: 10px 16px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tab-active { color: var(--text); border-bottom-color: var(--blue); }
.chip-active { background: rgba(96,165,250,0.25); border-color: rgba(96,165,250,0.5); }
#libraryFilter .chip { font-size: 12px; padding: 6px 12px; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); max-width: 100%; min-width: 0; }
.filter-row select { min-width: 0; max-width: 100%; flex: 1 1 auto; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel-border); background: #111936; color: #fff; font-size: 13px; }
.result-count { font-size: 12px; color: var(--muted-2); margin-bottom: 8px; }
.save-btn { margin-top: 8px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(96,165,250,0.4); background: rgba(96,165,250,0.12); color: var(--blue); cursor: pointer; }
.save-btn:hover:not(:disabled) { background: rgba(96,165,250,0.25); }
.save-btn:disabled { cursor: default; }
.save-btn.saved { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.12); color: var(--green); }
.remove-btn { border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.1); color: var(--red); }
.remove-btn:hover:not(:disabled) { background: rgba(248,113,113,0.2); }
/* Draft tab */
.mode-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mode-switch label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; padding: 8px 12px; border: 1px solid var(--panel-border); border-radius: 10px; cursor: pointer; }
.mode-switch label:has(input:checked) { border-color: rgba(96,165,250,0.6); background: rgba(96,165,250,0.12); }
.manual-summary { cursor: pointer; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.field-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.draft-input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(0,0,0,0.4); color: #fff; font-size: 14px; line-height: 1.5; resize: vertical; }
.draft-source-group + .draft-source-group { margin-top: 8px; }
.draft-source { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 13px; cursor: pointer; }
.draft-source input { margin-top: 3px; flex: none; }
.draft-added-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.draft-added-row .remove-btn { margin-top: 2px; flex: none; padding: 4px 10px; }
.add-case { margin: 6px 0 14px; border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 12px; }
.add-case summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--blue); }
.add-case[open] summary { margin-bottom: 4px; }
.add-case .draft-actions { align-items: center; }
.draft-result { margin-top: 16px; }
.draft-body { font-size: 14px; line-height: 1.7; color: #e2e8f0; }
.draft-body h3, .draft-body h4, .draft-body h5, .draft-body h6 { font-size: 15px; font-weight: 800; margin: 18px 0 6px; color: #fff; }
.draft-body p { margin-top: 8px; }
.draft-body ul, .draft-body ol { margin: 8px 0 0 20px; }
.draft-body li + li { margin-top: 4px; }
.draft-body li.sub { margin-left: 22px; list-style: circle; }
.src-tag { font-family: ui-monospace, monospace; font-size: 11px; text-decoration: none; padding: 1px 4px; border-radius: 4px; background: rgba(96,165,250,0.15); color: var(--blue); }
.src-bad { background: rgba(248,113,113,0.2); color: var(--red); }
.draft-warn { border: 1px solid rgba(251,191,36,0.4); background: rgba(251,191,36,0.08); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 12px; color: #fde68a; line-height: 1.5; overflow-wrap: anywhere; }
.draft-warn p + p { margin-top: 6px; }
.draft-ok { border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.draft-key { margin: 8px 0 0 22px; font-size: 12px; color: #cbd5e1; line-height: 1.6; }
.draft-key .unused-source { color: var(--muted-2); }
.draft-leads { list-style: none; margin-top: 8px; }
.draft-leads li { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--panel-border); }
.draft-leads .save-btn { margin-top: 0; flex: none; padding: 4px 10px; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Privacy and Terms pages, and the site footer */
.legal { max-width: 820px; padding: 32px; }
.legal h1 { font-size: 32px; margin-bottom: 4px; }
.legal h2 { font-size: 16px; font-weight: 800; margin: 26px 0 8px; }
.legal p, .legal li { font-size: 14px; color: #cbd5e1; line-height: 1.7; }
.legal p + p { margin-top: 10px; }
.legal ul { margin-left: 18px; }
.legal li + li { margin-top: 8px; }
.legal-date { font-size: 12px !important; color: var(--muted-2) !important; margin-bottom: 18px; }
@media (max-width: 600px) { .legal { padding: 20px; } .legal h1 { font-size: 26px; } }
.sitefooter { margin-top: 32px; padding: 16px 0 8px; border-top: 1px solid var(--panel-border); font-size: 12px; color: var(--muted-2); text-align: center; }
.sitefooter a { color: var(--muted); text-decoration: none; }
.sitefooter a:hover { color: var(--text); }

/* About page */
.about-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; max-width: 1280px; }
@media (max-width: 1000px) { .about-grid { grid-template-columns: 1fr; } }
.about-section { margin-bottom: 16px; padding: 24px; }
.about-section h2 { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.about-section h3 { font-size: 14px; font-weight: 800; margin: 20px 0 6px; }
.about-section p, .about-list { font-size: 14px; color: #cbd5e1; line-height: 1.65; }
.about-list { margin-left: 18px; }
.about-list li + li { margin-top: 6px; }
.contact-list { display: grid; grid-template-columns: 70px 1fr; gap: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.contact-list dt { color: var(--muted); font-weight: 700; font-size: 12px; padding-top: 2px; }
.contact-list dd { line-height: 1.5; overflow-wrap: anywhere; }
.btn-link { display: block; text-align: center; text-decoration: none; }
.scan-summary p { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.scan-summary .scan-note { color: var(--amber); }
.scan-matched { font-size: 12px; color: #e2e8f0; margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.scan-detail { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.scan-clear { list-style: none; margin-top: 8px; }
.scan-clear li { font-size: 13px; padding: 8px 0; border-top: 1px solid var(--panel-border); }
.scan-clear li:first-child { border-top: none; }
.consult-cta { margin: 14px 0 4px; padding: 14px; border-radius: 12px; border: 1px solid rgba(96,165,250,0.35); background: rgba(96,165,250,0.08); }
.consult-cta strong { font-size: 14px; }
.consult-cta p { font-size: 12px; color: #cbd5e1; line-height: 1.5; margin-top: 6px; }
.consult-cta .btn { margin-top: 10px; padding: 11px; }
/* Land the /about#contact jump with the card's heading visible. */
#contact { scroll-margin-top: 16px; }

/* Home page */
#homeTopicFilter { margin-bottom: 4px; }
#homeTopicFilter .chip { font-size: 12px; padding: 6px 12px; }
.scan-intro { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }

.provisions { margin: 8px 0 0 18px; font-size: 12px; color: #cbd5e1; line-height: 1.5; }
.provisions li + li { margin-top: 3px; }
.library-subhead { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--panel-border); }
.source-block > div > .corpus-item + .corpus-item, .corpus-list > div > .corpus-item + .corpus-item { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--panel-border); }
@media (max-width: 600px) { .search-row { flex-wrap: wrap; } .search-row .btn { width: 100% !important; } }
