:root {
  --ink: #16212e;
  --muted: #5b6878;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e2ddd2;
  --navy: #14365d;
  --navy-2: #0e2744;
  --teal: #2f8f83;
  --law: #14365d;
  --guidance: #2f8f83;
  --legislative: #a35a12;
  --other: #6b6f76;
  --brand-a: #ff5a1f;
  --brand-b: #e8115b;
  --brand-deep: #b80d4a;
  --brand-grad: linear-gradient(120deg, var(--brand-a), var(--brand-b));
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

.masthead { background: var(--brand-grad); color: #fff; border-bottom: 3px solid var(--brand-deep); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; gap: 12px; align-items: center; }
.seal { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; flex: none; }
.seal svg { width: 100%; height: 100%; fill: currentColor; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.brand-name { font: 600 20px var(--serif); letter-spacing: 0.2px; }
.brand-sub { font-size: 13px; opacity: 0.8; }
.biennium { font-size: 13px; border: 1px solid rgba(255,255,255,0.35); padding: 4px 10px; border-radius: 999px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; padding-top: 24px; padding-bottom: 24px; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } }

.intro h1 { font: 600 30px/1.2 var(--serif); margin: 8px 0 8px; color: var(--brand-deep); }
.intro p { color: var(--muted); margin: 0 0 14px; max-width: 70ch; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; color: #fff; }
.pill.law { background: var(--law); }
.pill.guidance { background: var(--guidance); }
.pill.legislative { background: var(--legislative); }
.pill.other { background: var(--other); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 10px 0 8px; }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.suggestions button { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.suggestions button:hover { border-color: var(--brand-b); color: var(--brand-deep); }

.messages { display: flex; flex-direction: column; gap: 14px; margin: 10px 0; }
.msg { border-radius: var(--radius); padding: 12px 16px; }
.msg.user { align-self: flex-end; background: var(--brand-grad); color: #fff; max-width: 85%; white-space: pre-wrap; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); }
.msg.assistant h3 { font: 600 16px var(--serif); color: var(--brand-deep); margin: 12px 0 4px; }
.msg.assistant p { margin: 6px 0; }
.msg.assistant ul { margin: 6px 0; padding-left: 20px; }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
.notice { background: #fff6e6; border: 1px solid #f0d199; color: #6b4700; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin-top: 8px; }
.cite { display: inline-block; min-width: 20px; padding: 0 5px; margin: 0 1px; border-radius: 5px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: #fff; text-decoration: none; vertical-align: 1px; }
.cite.current_law { background: var(--law); }
.cite.agency_guidance { background: var(--guidance); }
.cite.legislative { background: var(--legislative); }
.cite.other_official { background: var(--other); }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.composer { display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--paper); padding: 10px 0; }
.composer textarea { flex: 1; resize: vertical; min-height: 52px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font: inherit; background: #fff; }
.composer textarea:focus { outline: none; border-color: var(--brand-b); box-shadow: inset 0 0 0 1px var(--brand-b); }
.composer button { background: var(--brand-grad); color: #fff; border: 0; border-radius: var(--radius); padding: 0 22px; font: 600 15px var(--sans); cursor: pointer; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); }
.composer button:disabled { opacity: 0.6; cursor: wait; }
.fineprint { font-size: 12px; color: var(--muted); margin: 0; }

.sources { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; align-self: start; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.sources h2 { font: 600 18px var(--serif); margin: 0 0 8px; color: var(--brand-deep); }
.source-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; margin: 14px 0 6px; }
.source-group.current_law h3 { color: var(--law); }
.source-group.agency_guidance h3 { color: var(--guidance); }
.source-group.legislative h3 { color: var(--legislative); }
.source { border-left: 3px solid var(--line); padding: 4px 0 6px 10px; margin-bottom: 8px; font-size: 14px; }
.source.current_law { border-color: var(--law); }
.source.agency_guidance { border-color: var(--guidance); }
.source.legislative { border-color: var(--legislative); }
.source a { color: var(--navy); font-weight: 600; text-decoration: none; }
.source a:hover { text-decoration: underline; }
.source .s-meta { font-size: 12px; color: var(--muted); }
.source.unused { opacity: 0.6; }

.footer { border-top: 1px solid var(--line); padding: 14px 0 24px; font-size: 13px; color: var(--muted); }
.footer p { margin: 4px 0; }

/* Embedded (popup panel) mode: /assistant?embed=1 inside widget.js */
.panel-close, .panel-btn { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: 0.85; flex: none; }
.panel-btn:hover { opacity: 1; }
.panel-btn:focus-visible { outline: 2px solid #ffd23f; outline-offset: 2px; border-radius: 4px; }
#panel-resize { font-size: 22px; margin-left: 4px; }
#clear-chat { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; margin-left: 8px; border-radius: 6px; }
#clear-chat svg { width: 20px; height: 20px; fill: currentColor; }
#clear-chat:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
#clear-chat:disabled { opacity: 0.4; cursor: default; }
html.embed, html.embed body { height: 100%; }
html.embed body { display: flex; flex-direction: column; font-size: 15px; background: var(--paper); }
html.embed .wrap { padding: 0 14px; }
html.embed .masthead-inner { padding-top: 10px; padding-bottom: 10px; gap: 10px; }
html.embed .seal { width: 34px; height: 34px; }
html.embed .masthead-inner { padding-left: 26px; } /* room for the widget's resize grip */
html.embed .brand-name { font-size: 17px; white-space: nowrap; }
html.embed .brand-sub { display: none; }
html.embed .biennium { font-size: 11.5px; padding: 2px 8px; white-space: nowrap; }
html.embed .layout { display: flex; flex: 1; min-height: 0; padding: 0 14px; max-width: none; }
html.embed .conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding-top: 12px; }
html.embed .intro h1 { font-size: 21px; }
html.embed .intro p { font-size: 14px; }
html.embed .suggestions { grid-template-columns: 1fr; gap: 8px; }
html.embed .suggestions button { padding: 8px 10px; font-size: 13.5px; }
html.embed .composer { margin-top: auto; padding: 10px 0 6px; }
html.embed .composer textarea { min-height: 44px; max-height: 50vh; resize: vertical; padding: 10px; }
html.embed .composer button { padding: 0 16px; }
html.embed .fineprint { padding-bottom: 8px; font-size: 11.5px; }
html.embed .sources, html.embed .footer { display: none; }
html.embed .msg.user { max-width: 92%; }
html.embed .brand { min-width: 0; margin-right: auto; }
html.embed .brand > div { min-width: 0; }
html.embed .brand-name { overflow: hidden; text-overflow: ellipsis; }
html.embed .panel-close { flex: none; }
@media (max-width: 480px) { html.embed .biennium { display: none; } html.embed .masthead-inner { justify-content: space-between; } }
/* The popup is already full-screen on phones, so the resize button only matters with a mouse. */
@media (max-width: 480px) and (pointer: coarse) { html.embed #panel-resize { display: none; } }
/* Short panels (e.g. 1366×768 laptops): tighten the welcome screen so it fits without scrolling */
@media (max-height: 700px) {
  html.embed .conversation { padding-top: 6px; }
  html.embed .intro p { margin-bottom: 10px; }
  html.embed .suggestions { gap: 5px; }
  html.embed .suggestions button { padding: 6px 10px; }
}
.msg-sources { margin-top: 8px; font-size: 13px; }
.msg-sources summary { cursor: pointer; color: var(--brand-deep); font-weight: 600; }
.msg-sources .source { font-size: 13px; }
