:root { --bg:#14130f; --ink:#f1ead8; --card:#1d1b16; --line:#3a362c; --muted:#a59d88; --accent:#6f86ff; --accent-ink:#0d0c0a; --warn:#f0b43c; --ok:#4fbf7a; --radius:14px; --pill:999px;
  font-family: 'Helvetica Neue', Helvetica, Arial, Thonburi, 'Sukhumvit Set', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, sans-serif; }
:root[data-theme="light"] { --bg:#f6f1e4; --ink:#1b1a16; --card:#fffdf7; --line:#d9d1bd; --muted:#6c6553; --accent:#3a55e0; --accent-ink:#fff; --warn:#a86a00; --ok:#1f8a4c; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font-size:16px; line-height:1.55; }
:lang(th) { letter-spacing: normal !important; }
a { color: var(--accent); }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path: inset(50%); }
.top { display:flex; justify-content:space-between; align-items:center; padding:14px 24px; border-bottom:1px solid var(--line); }
.brand { color:var(--ink); text-decoration:none; font-weight:700; }
.theme { background:none; border:1px solid var(--line); color:var(--ink); border-radius:var(--pill); width:36px; height:36px; cursor:pointer; }
.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 48px; }
h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 0 0 12px; }
.lede { font-size: 18px; margin: 0 0 12px; }
.notice { font-size: 14px; color: var(--muted); border-left: 3px solid var(--warn); padding: 4px 0 4px 12px; margin: 0 0 28px; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.msg { max-width: 100%; }
.msg.user { justify-self: end; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--radius) var(--radius) 4px var(--radius); max-width: 85%; white-space: pre-wrap; }
.msg.bot { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.msg.bot.urgent { border-color: var(--warn); border-width: 2px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul { margin: 0 0 8px; padding-left: 20px; }
.sources { margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 6px; font-size: 13px; list-style: none; }
.sources li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pub { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 8px; border-radius: var(--pill); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pub.cdc { border-color: var(--accent); color: var(--accent); }
.pub.wanda { border-color: var(--ok); color: var(--ok); }
.upd { color: var(--muted); }
.ask { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.ask button { font: inherit; font-size: 14px; background: none; color: var(--ink); border: 1px solid var(--line); border-radius: var(--pill); padding: 8px 14px; cursor: pointer; min-height: 40px; }
.ask button:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; }
.composer textarea { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; resize: vertical; min-height: 48px; }
.composer textarea:focus-visible, .ask button:focus-visible, .composer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.composer button { font: inherit; font-weight: 700; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--pill); padding: 0 22px; cursor: pointer; min-height: 48px; }
.composer button:disabled { opacity: .5; cursor: progress; }
.status { grid-column: 1 / -1; font-size: 13px; color: var(--muted); min-height: 1em; }
#ts-box { grid-column: 1 / -1; }
.foot { margin-top: 32px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.thinking::after { content: '…'; animation: dots 1.2s steps(3) infinite; }
@keyframes dots { 0% { content: '.'; } 50% { content: '..'; } 100% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .thinking::after { animation: none; } }
