:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #111;
  --muted: #6a6a6a;
  --accent: #0b67ff;
  --border: #e3e3e3;
  --card: #fafafa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --fg: #ececec;
    --muted: #9b9b9b;
    --accent: #6aa0ff;
    --border: #1f1f22;
    --card: #131316;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--fg);
  min-height: 100vh;
}
main { padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); }
.auth-card { max-width: 420px; margin: 8vh auto; padding: 24px; }
h1 { margin-top: 0; }
input[type=text], textarea {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--fg);
}
button {
  margin-top: 12px; padding: 12px 16px; font-size: 16px;
  background: var(--accent); color: white; border: 0; border-radius: 8px;
  min-height: 44px; min-width: 88px;
}
.error { color: #c8362d; min-height: 1.2em; }
.hint, .loading, .muted { color: var(--muted); }
.session-list { list-style: none; padding: 0; margin: 0; }
.session-list li {
  padding: 12px 8px; border-bottom: 1px solid var(--border); min-height: 44px;
}
.composer {
  position: sticky; bottom: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: stretch;
}
.composer textarea { flex: 1; resize: none; }
.composer button { margin: 0; }
.app-header {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.app-header > a { font-weight: 700; text-decoration: none; color: var(--fg); }
.app-header nav { display: flex; gap: 12px; flex: 1; }
.app-header nav a { color: var(--muted); text-decoration: none; min-height: 44px; display: flex; align-items: center; }
.app-header nav a:hover { color: var(--fg); }
.session-list a { display: flex; flex-direction: column; gap: 2px; color: var(--fg); text-decoration: none; }
.session-list .sess-id { font-family: ui-monospace, monospace; font-size: 0.85em; color: var(--muted); }
.session-view { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; }
.msg { margin: 0 0 8px 0; padding: 8px 12px; border-radius: 8px; max-width: 90%; word-wrap: break-word; }
.msg-user { background: var(--accent); color: white; margin-left: auto; }
.msg-assistant { background: var(--card); }
.msg-info, .msg-system { color: var(--muted); font-style: italic; font-size: 0.9em; }
.task-list, .token-list { list-style: none; padding: 0; }
.task-list li, .token-list li { padding: 8px 12px; border-bottom: 1px solid var(--border); }
