/* A plain page that works. The look comes from track H: replace this file and templates/, keep the ids and data- hooks. */
:root {
  --bg: #0e1116; --panel: #161b22; --line: #2a313c; --text: #e6e9ee; --muted: #8b94a3;
  --accent: #6aa9ff; --bad: #ff7b72; --warn: #e3b341; --ok: #8b94a3;
  --gap: 12px; --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f7f9; --panel: #fff; --line: #d6dae1; --text: #1b1f24; --muted: #5b6573; --accent: #1f6feb; --bad: #cf222e; --warn: #9a6700; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); display: flex; flex-direction: column; }
button, textarea, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-height: 44px; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button[type=submit], #go { background: var(--accent); border-color: var(--accent); color: #fff; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); padding: 8px var(--gap); border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 1.1rem; margin: 0; }
#health { flex: 1; margin: 0; color: var(--muted); font-size: .9rem; }
#health[data-state=warn] { color: var(--warn); }
#health[data-state=bad] { color: var(--bad); font-weight: 600; }
main { flex: 1; overflow-y: auto; padding: var(--gap); }
.thread { list-style: none; margin: 0 auto; padding: 0; max-width: 72ch; display: flex; flex-direction: column; gap: var(--gap); }
.empty { text-align: center; color: var(--muted); }
.message { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.message[data-dir=out] { border-left: 3px solid var(--accent); }
.message[data-pending] { opacity: .65; }
.message header { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.who { font-weight: 600; }
.text { margin: 6px 0; padding: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.files { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.files img { max-width: 220px; max-height: 160px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.files a { color: var(--accent); overflow-wrap: anywhere; }
.chain { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.chain[data-state=warn] { color: var(--warn); }
.chain[data-state=bad] { color: var(--bad); font-weight: 600; }
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: var(--gap); padding-bottom: calc(var(--gap) + env(safe-area-inset-bottom)); }
.composer > * { max-width: 72ch; margin-left: auto; margin-right: auto; }
.composer textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; resize: vertical; min-height: 3.2em; max-height: 40vh; font-family: var(--mono); font-size: .95rem; white-space: pre-wrap; tab-size: 4; }
.composer[data-drop] textarea { border-color: var(--accent); }
.actions { display: flex; align-items: center; gap: var(--gap); margin-top: 8px; }
.note { flex: 1; font-size: .9rem; color: var(--bad); }
.chips { list-style: none; margin: 0 auto 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background: var(--bg); max-width: 100%; }
.chip[data-state=failed] { border-color: var(--bad); }
.chip .thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.chip .name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .size, .chip .status { color: var(--muted); font-size: .85rem; }
.chip button { min-height: 36px; padding: 4px 10px; }
.gate { max-width: 34rem; margin: 10vh auto 0; text-align: center; }
.gate form { display: flex; flex-direction: column; gap: var(--gap); text-align: left; }
.gate label { display: flex; flex-direction: column; gap: 4px; }
.gate input { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
