@font-face {
  font-family: Rubik;
  src: url('/rubik.ttf') format('truetype');
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #101010;
  --fg: #f7f5f0;
  --accent: #ff9d00;
  --muted: #aaa7a0;
  --line: #30302e;
  --card: #1a1a19;
  --focus: #ffbd58;
  --attention: #ffb1a3;
  --success: #a9deb9;
  font: 15px/1.55 Rubik, Arial, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
main { width: min(58rem, 100%); margin-inline: auto; padding: clamp(14px, 4vw, 36px); }
.topbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .9rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.wordmark { font: 900 1.35rem/1 Arial, sans-serif; letter-spacing: -.05em; margin: 0 0 .65rem; }
.wordmark span { margin-left: .14rem; padding: .08rem .25rem .12rem; border-radius: .36rem; background: var(--accent); color: var(--bg); }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.2; letter-spacing: -.025em; font-weight: 550; overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.65rem, 4.5vw, 2.25rem); }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.8rem); margin-block: .8rem .55rem; }
h3 { font-size: 1rem; }
nav, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
button, select, textarea { max-width: 100%; font: inherit; color: var(--fg); }
button { min-height: 44px; padding: .55rem .9rem; border: 1px solid #373733; border-radius: 999px; background: #24231f; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
button:hover:not(:disabled) { background: #302d26; }
button:disabled { color: var(--muted); cursor: default; opacity: .7; }
button.primary { background: var(--accent); border-color: var(--accent); color: #14120f; font-weight: 550; }
button.primary:hover:not(:disabled) { background: #ffae2d; }
button.entry { padding-inline: 0; min-height: 38px; border: 0; border-radius: .25rem; background: none; font-weight: 550; }
button.entry:hover:not(:disabled), a { color: var(--focus); background: transparent; }
section, article { min-width: 0; padding: clamp(.85rem, 3vw, 1.25rem); margin-block: .7rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); overflow-wrap: anywhere; }
.chat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: .8rem; }
.chat-grid section { margin: 0; }
.chat-grid h3 { margin-top: .45rem; }
.chat-title::after { content: ' →'; color: var(--accent); }
.chat-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-block: .6rem; }
.chat-metrics div, .chat-metrics .question-tile { min-width: 0; padding: .45rem; background: #22211e; border-radius: .55rem; }
.chat-metrics .question-tile { background: #2b2319; border-color: #93601a; }
.chat-metrics .question-tile strong { color: var(--accent); }
.chat-metrics strong, .chat-metrics small { display: block; }
.chat-metrics strong { font-size: 1.3rem; }
.chat-metrics small, .muted, #status { color: var(--muted); }
p { margin: .4rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
section > :last-child, article > :last-child { margin-bottom: 0; }
.lead { font-size: 1.1rem; }
.state { display: inline-block; color: var(--fg); background: #22211e; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; }
.state.resolved { color: var(--success); }
.warning, #status.error { color: var(--attention); }
#status:empty { display: none; }
#status.error { border-left: 2px solid currentColor; padding-left: .65rem; }
.history { padding-left: 1.1rem; margin: 0; }
.history li { margin-block: .75rem; padding-left: .35rem; }
main:has(.thread-view) { display: flex; flex-direction: column; padding-block: .5rem; }
main:has(.thread-view) > .topbar { display: none; }
main:has(.thread-view) > #status { order: 1; }
.thread-view { height: calc(100vh - 1rem); height: calc(100dvh - 1rem); display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .55rem; }
.thread-view nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
.thread-view details { color: var(--muted); font-size: .9rem; }
.thread-view summary { cursor: pointer; }
.messages { position: relative; display: flex; flex-direction: column; overflow-y: auto; overflow-anchor: none; overscroll-behavior-y: contain; scrollbar-gutter: stable; padding: .35rem .45rem .35rem .15rem; }
.messages article { flex: none; background: #232322; border-color: #44443f; margin: 0 0 .65rem; }
.messages article:first-of-type { margin-top: auto; }
.messages article:last-child { margin-bottom: 0; }
.messages .message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .7rem; margin-bottom: .35rem; }
.messages .message-date { color: #ffcd59; font-weight: 700; }
.messages .message-author { color: #d3cec4; font-weight: 500; }
.messages .message-text { color: #fff; }
article { padding-block: .85rem; }
.messages article.origin { border: 2px solid var(--accent); background: #302619; }
.messages article.origin > strong { display: block; color: var(--focus); }
label { display: grid; gap: .35rem; margin-block: .7rem; }
select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid #454541; border-radius: .55rem; background: var(--bg); }
textarea { min-height: 5rem; resize: vertical; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
::selection { color: var(--bg); background: var(--accent); }
