:root {
  --bg: #f5f6f8; --surface: #fff; --ink: #141824; --muted: #5b6474; --line: #e2e5ea;
  --accent: #0071c5; --accent-ink: #fff; --ok: #1f7a3d; --warn: #9a5b00; --bad: #b42318; --chip: #eef1f5;
  --radius: 10px; --gap: 1rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1017; --surface: #151a24; --ink: #e8ebf1; --muted: #9aa3b2; --line: #273041; --accent: #4ea3ff; --accent-ink: #06121f; --ok: #5cc27d; --warn: #e0a84a; --bad: #ff7b72; --chip: #1f2633; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
h1, h2, h3, button { text-wrap: balance; }
p { text-wrap: pretty; }
.top { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: .6rem .75rem; padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #0071c5, #8ac243); flex: none; }
.pills { display: flex; gap: .4rem; flex-wrap: wrap; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; background: var(--chip); font-size: .8rem; white-space: nowrap; }
.pill.ok::before, .pill.bad::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.bad::before { background: var(--bad); }
button { font: inherit; border: 0; border-radius: 8px; padding: .55rem 1rem; min-height: 44px; background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap; }
button.secondary { background: var(--chip); color: var(--ink); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button[disabled] { opacity: .55; cursor: default; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.login { display: grid; place-items: center; min-height: 70vh; }
.login form { width: min(100%, 380px); display: grid; gap: .8rem; }
.login h1 { margin: 0; font-size: 1.4rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
input, select { font: inherit; padding: .55rem .7rem; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; }
.error { color: var(--bad); margin: 0; min-height: 1.2em; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 1rem; scrollbar-width: none; }
.tabs button { background: transparent; color: var(--muted); border-radius: 8px 8px 0 0; border-bottom: 3px solid transparent; flex: none; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.count:not(:empty) { vertical-align: .1em; display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 99px; background: var(--bad); color: #fff; font-size: .75rem; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; justify-content: space-between; margin-bottom: .75rem; }
.filter { font-weight: 500; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.event { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; min-width: 0; }
.event.propose, .event.approve { border-left-color: var(--accent); }
.event.execute { border-left-color: var(--ok); }
.event.error, .event.reject, .event.expire { border-left-color: var(--bad); }
.event.think, .event.tool, .event.ask { border-left-color: var(--warn); }
.event header { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.event .kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.event time { font-size: .8rem; color: var(--muted); white-space: nowrap; margin-left: auto; }
.event .title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.event details { margin-top: .3rem; }
.event summary { cursor: pointer; color: var(--muted); font-size: .85rem; min-height: 44px; display: flex; align-items: center; }
.event pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; margin: .4rem 0 0; background: var(--chip); padding: .6rem; border-radius: 8px; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.approval { display: grid; gap: .5rem; margin-bottom: .75rem; }
.approval h3 { margin: 0; font-size: 1rem; }
.approval .reason { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.approval .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .55rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { white-space: nowrap; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
th:first-child, td:first-child { white-space: nowrap; width: 1%; position: sticky; left: 0; background: var(--surface); z-index: 1; }
td.long { overflow-wrap: anywhere; min-width: 14rem; }
td.nowrap { white-space: nowrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0 0 .75rem; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.nw { white-space: nowrap; }
@media (max-width: 720px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; }
  .pills { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 520px) {
  .top { padding: .6rem .75rem; }
  main { padding: .75rem; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
}
