:root {
  --bg: #0b0d10;
  --surface: #14181d;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8ecf1;
  --muted: #8a94a3;
  --accent: #5cc8ff;
  --warn: #ffb547;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input { font: inherit; color: inherit; }
button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; }
button:active { transform: scale(0.98); }
.ghost { background: none; }
[hidden] { display: none !important; }

.login { display: grid; place-items: center; height: 100%; padding: 16px; }
.login form { width: min(360px, 100%); display: grid; gap: 12px; }
.login h1 { font-weight: 600; letter-spacing: 0.04em; margin: 0 0 8px; }
.login input { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.login button { background: var(--accent); color: #001018; border: 0; padding: 12px; border-radius: var(--radius); font-weight: 600; }
.error { color: var(--warn); min-height: 1.2em; margin: 0; }

main { display: flex; flex-direction: column; height: 100%; max-width: 720px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.title { font-weight: 600; letter-spacing: 0.04em; margin-right: auto; }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge[data-state="thinking"] { color: var(--accent); border-color: var(--accent); }
.badge.warn { color: var(--warn); border-color: var(--warn); }

.thread { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: #1d2b36; }
.msg.jarvis { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.system { align-self: center; color: var(--warn); font-size: 14px; }
.card { align-self: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; }
.card h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.card ul { margin: 0 0 8px; padding-left: 18px; }
.card li { margin: 2px 0; }
.card .sub { color: var(--muted); }
.tag { color: var(--accent); font-size: 12px; }

.outbox { position: fixed; inset: auto 0 0 0; max-height: 75%; overflow-y: auto; background: var(--bg);
  border-top: 1px solid var(--line); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.outbox header { display: flex; justify-content: space-between; align-items: center; }
.outbox h2 { font-size: 16px; margin: 0; }
.outbox ol { list-style: none; padding: 0; display: grid; gap: 10px; }
.outbox textarea { width: 100%; min-height: 90px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font: inherit; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.approve { border-color: var(--accent); color: var(--accent); }

.bar { border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.quick { display: flex; gap: 8px; overflow-x: auto; }
.quick button { white-space: nowrap; font-size: 14px; }
.count { color: var(--accent); }
.ask { display: flex; gap: 8px; }
.ask input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; }
.ask button { background: var(--accent); color: #001018; border: 0; width: 44px; }

.card .warn-line { color: var(--warn); font-size: 0.9em; margin-bottom: 6px; }
.card .body { white-space: pre-wrap; margin-top: 8px; line-height: 1.45; }
