:root {
  color-scheme: dark;
  --bg: #07111d;
  --panel: #0d1b2a;
  --panel-soft: #122337;
  --line: #233c55;
  --text: #eaf2fb;
  --muted: #8fa7bc;
  --blue: #55a8ff;
  --violet: #a98bff;
  --green: #42d392;
  --amber: #f4b860;
  --red: #ff6b7a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -20%, #17314c, var(--bg) 45%); color: var(--text); }
button, select, textarea, input { font: inherit; }
button, .file-button { border: 1px solid transparent; border-radius: .55rem; background: var(--blue); color: #04111f; font-weight: 700; padding: .65rem .9rem; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
button.secondary, .file-button { background: transparent; border-color: var(--line); color: var(--text); }
button.danger { background: transparent; border-color: var(--red); color: var(--red); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 2vw, 2rem); }
h2 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); background: rgb(7 17 29 / 85%); }
.eyebrow { margin-bottom: .3rem; color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .14em; }
.warning { padding: .6rem 1.5rem; text-align: center; border-bottom: 1px solid #5f4b22; background: #2b2313; color: #f9d89b; font-size: .85rem; }
.health { display: flex; align-items: center; gap: .55rem; color: var(--muted); white-space: nowrap; }
.health-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--muted); }
.health-dot.ready { background: var(--green); box-shadow: 0 0 14px var(--green); }
.health-dot.degraded { background: var(--amber); }
.health-dot.down { background: var(--red); }
.workspace { display: grid; grid-template-columns: minmax(220px, 280px) minmax(360px, 1fr) minmax(260px, 340px); min-height: calc(100vh - 124px); }
.sidebar, .evidence-panel { padding: 1rem; background: rgb(13 27 42 / 78%); }
.sidebar { border-right: 1px solid var(--line); }
.evidence-panel { border-left: 1px solid var(--line); }
aside section { padding: 1rem 0; border-bottom: 1px solid var(--line); }
label { display: block; margin: .75rem 0 .35rem; color: var(--muted); font-size: .8rem; }
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: .55rem; background: #071421; color: var(--text); padding: .7rem; }
.sidebar button { width: 100%; margin-top: .6rem; }
.help { margin: .45rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.metadata { margin: 0; }
.metadata div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .5rem; margin: .45rem 0; }
.metadata dt { color: var(--muted); font-size: .75rem; }
.metadata dd { margin: 0; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, monospace; font-size: .72rem; }
.conversation { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.messages { overflow-y: auto; padding: 1.5rem; }
.message { max-width: 78%; margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel-soft); }
.message.user { margin-left: auto; border-color: #285f91; }
.message.system { color: #c9d8e6; }
.message p { margin-bottom: 0; white-space: pre-wrap; }
.message-label { margin-bottom: .35rem !important; color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.composer { padding: 1rem 1.5rem 1.5rem; border-top: 1px solid var(--line); background: rgb(7 17 29 / 80%); }
.composer-actions { display: flex; align-items: center; gap: .75rem; margin-top: .65rem; }
.composer-actions #send { margin-left: auto; }
#upload { position: absolute; width: 1px; height: 1px; opacity: 0; }
.compact-list, .evidence-list { padding-left: 1.2rem; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.empty { padding: .8rem; border: 1px dashed var(--line); border-radius: .55rem; color: var(--muted); font-size: .8rem; }
.approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .65rem; }
pre { max-height: 14rem; overflow: auto; padding: .75rem; border-radius: .55rem; background: #06101a; color: #9fc2df; font-size: .7rem; white-space: pre-wrap; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 220px 1fr; }
  .evidence-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation { min-height: 70vh; }
  .evidence-panel { display: block; }
  .composer-actions { align-items: flex-start; flex-wrap: wrap; }
  .message { max-width: 95%; }
}
