:root {
  --bg: #0b0d14; --surface: #13161f; --surface-2: #1a1e2b;
  --border: rgba(255,255,255,.07); --text: #eef0f8; --muted: #7c849e;
  --accent: #6366f1; --red: #f87171; --green: #4ade80; --amber: #fbbf24;
  --radius: 8px; --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
       font-size: 14px; display: flex; min-height: 100vh; }
body.centered { align-items: center; justify-content: center; }

.sidebar { width: 210px; flex: 0 0 210px; background: var(--surface);
           border-right: 1px solid var(--border); padding: 20px 14px;
           display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { font-weight: 600; margin-bottom: 18px; letter-spacing: .02em; }
.sidebar a { color: var(--muted); text-decoration: none; padding: 8px 10px;
             border-radius: var(--radius); }
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a.active { background: var(--surface-2); color: var(--text); }
.sidebar a.foot { margin-top: auto; }

main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: 14px; padding: 32px; width: 100%; max-width: 360px;
        display: flex; flex-direction: column; gap: 10px; }
.card h1 { font-size: 18px; margin-bottom: 8px; }
label { color: var(--muted); font-size: 12px; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px;
}
button { background: var(--accent); border-color: transparent; cursor: pointer; }
button.ghost { background: var(--surface-2); }
button.danger { background: var(--red); }
button:disabled { opacity: .5; cursor: not-allowed; }
.error { color: var(--red); }
.warning { color: var(--amber); }

.toolbar { display: flex; gap: 10px; align-items: center; padding: 12px 18px;
           border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }

#feed { flex: 1; overflow-y: auto; padding: 18px; display: flex;
        flex-direction: column; gap: 12px; }
.msg { max-width: 78ch; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--surface-2);
            padding: 10px 13px; border-radius: var(--radius); }

.tool { border: 1px solid var(--border); border-radius: var(--radius);
        background: var(--surface); max-width: 78ch; }
.tool summary { cursor: pointer; padding: 8px 12px; color: var(--muted); font-size: 13px; }
.tool pre { font-family: var(--mono); font-size: 12px; padding: 10px 12px;
            overflow-x: auto; border-top: 1px solid var(--border);
            white-space: pre-wrap; word-break: break-word; }
.tool.done summary { color: var(--green); }

.approval { border: 1px solid var(--amber); border-radius: var(--radius);
            padding: 14px; max-width: 78ch; display: flex;
            flex-direction: column; gap: 10px; }
.approval pre { font-family: var(--mono); font-size: 12px; background: var(--bg);
                padding: 10px; border-radius: var(--radius); overflow-x: auto;
                white-space: pre-wrap; word-break: break-word; }
.approval .row { display: flex; gap: 8px; align-items: center; }
.approval .countdown { color: var(--amber); margin-left: auto; font-variant-numeric: tabular-nums; }
.approval .reason { color: var(--muted); font-size: 12px; word-break: break-word; }

.composer { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.composer textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 220px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td button + button { margin-left: 6px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px;
         background: var(--surface-2); color: var(--muted); }
.snippet { color: var(--muted); font-size: 12px; margin-top: 4px;
           max-width: 60ch; overflow: hidden; text-overflow: ellipsis;
           white-space: nowrap; }
