:root {
  --navy: #14264a;
  --navy-soft: #22386a;
  --teal: #17756f;
  --teal-soft: #e3f1ef;
  --paper: #f6f4ee;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #5b6475;
  --line: #dcd8cc;
  --amber: #8a5a00;
  --amber-soft: #fff3d6;
  --good: #1d6b3a;
  --good-soft: #e2f3e8;
  --radius: 14px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #0e1a33;
    --navy-soft: #8fb0ff;
    --teal: #4cc2b9;
    --teal-soft: #15302e;
    --paper: #0f1522;
    --card: #182033;
    --ink: #e8ebf2;
    --muted: #a3adc2;
    --line: #2a3450;
    --amber: #f2c66d;
    --amber-soft: #3a2f12;
    --good: #7ad39a;
    --good-soft: #14301f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.banner { background: var(--navy); color: #fff; text-align: center; font-size: 14px; padding: 8px 16px; }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: #fff; font-family: var(--serif); font-weight: 700; letter-spacing: .5px; }
.brand-name { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.brand-name span { font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 20px; color: var(--muted); font-size: 15px; }

.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; padding: 40px 0 56px; align-items: start; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--teal); margin: 0 0 10px; }
h1 { font-family: var(--serif); font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 14px; color: var(--ink); }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 28px; }
.small-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { font: inherit; font-size: 14px; text-align: left; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--teal); background: var(--teal-soft); }

.contact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: 15px; }
.contact p { margin: 0; }

.chat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20, 38, 74, .08); display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - 80px); }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-family: var(--serif); font-size: 20px; margin: 0; }
.chat-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.reset { font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.reset:hover { background: var(--teal-soft); }

.log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; max-width: 92%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 12px 16px; border-radius: 16px; overflow-wrap: anywhere; }
.bubble p { margin: 0; white-space: pre-wrap; }
.user .bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.bot .bubble { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 4px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge.high, .badge.medium { background: var(--good-soft); color: var(--good); }
.badge.low, .badge.flag { background: var(--amber-soft); color: var(--amber); }

.notice { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 14px; }
.notice strong { display: block; }

.sources { margin-top: 10px; font-size: 14px; }
.sources summary { cursor: pointer; color: var(--teal); font-weight: 600; }
.source { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--teal); background: var(--teal-soft); border-radius: 0 8px 8px 0; }
.source b { display: block; }
.source small { color: var(--muted); display: block; margin-top: 4px; }
.tag-archived { color: var(--amber); font-weight: 600; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { display: flex; gap: 10px; padding: 14px 20px 6px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; font: inherit; resize: none; max-height: 140px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.composer button { font: inherit; font-weight: 600; padding: 0 22px; border-radius: 12px; border: 0; background: var(--teal); color: #fff; cursor: pointer; }
.composer button:disabled { opacity: .55; cursor: not-allowed; }
.fine { margin: 0; padding: 4px 20px 16px; font-size: 12px; color: var(--muted); }

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

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .nav { display: none; }
  .chat { max-height: none; min-height: 520px; }
  .msg { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .typing i { animation: none; opacity: .6; }
}
