:root {
  color-scheme: light dark;
  --bg: #111315;
  --surface: #181b1e;
  --surface-2: #202428;
  --border: #343a40;
  --text: #f2f0eb;
  --muted: #a8adb2;
  --accent: #e5b85c;
  --danger: #ef7d79;
  --ok: #72c69a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { border: 1px solid var(--accent); background: var(--accent); color: #17130a; padding: .62rem .9rem; cursor: pointer; font-weight: 650; }
button:hover { filter: brightness(1.08); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.quiet { color: var(--muted); border-color: var(--border); background: transparent; padding: .4rem .6rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.25rem max(1rem, calc((100vw - 1280px) / 2)); border-bottom: 1px solid var(--border); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .15rem; font-size: 1.45rem; letter-spacing: .04em; }
h2 { margin-bottom: .25rem; font-size: 1.15rem; }
.topbar p, .section-head p { color: var(--muted); margin-bottom: 0; }
.connection { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .9rem; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--danger); }
.dot.online { background: var(--ok); }
main { width: min(1280px, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); background: var(--surface); }
.summary div { padding: 1rem 1.15rem; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: .2rem; }
.summary div:last-child { border-right: 0; }
.summary strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.summary span { color: var(--muted); font-size: .82rem; }
.tabs { display: flex; gap: 1.25rem; margin-top: 1.5rem; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; padding: .65rem .1rem; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel { margin-top: 1.35rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.task-list { display: grid; gap: .65rem; }
.task { display: grid; grid-template-columns: minmax(14rem, 1.2fr) minmax(12rem, 1fr) auto; gap: 1rem; padding: .95rem 1rem; border: 1px solid var(--border); background: var(--surface); }
.task h3 { font-size: 1rem; margin: 0 0 .35rem; }
.meta, .scopes, .task p { color: var(--muted); font-size: .86rem; }
.scopes { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-content: start; }
.scope { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--text); }
.state { align-self: start; font-size: .77rem; text-transform: uppercase; letter-spacing: .05em; border-left: 3px solid var(--border); padding-left: .55rem; }
.state-running, .state-done { border-color: var(--ok); }
.state-blocked, .state-failed { border-color: var(--danger); }
.state-review, .state-proposed { border-color: var(--accent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .88rem; }
th, td { text-align: left; padding: .75rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.message-list { list-style: none; padding: 0; display: grid; gap: .65rem; }
.message-list li { padding: .85rem 1rem; border-left: 3px solid var(--border); background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; }
.message-list header { color: var(--muted); font-size: .78rem; margin-bottom: .45rem; }
.empty { border: 1px dashed var(--border); padding: 2rem; display: flex; flex-direction: column; align-items: center; color: var(--muted); gap: .35rem; }
dialog { width: min(640px, calc(100vw - 2rem)); border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 1.25rem; }
dialog::backdrop { background: rgb(0 0 0 / .7); }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .38rem; color: var(--muted); font-size: .86rem; }
input, textarea, select { width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text); padding: .65rem .7rem; }
input:user-invalid, textarea:user-invalid, select:user-invalid { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--bg)); }
textarea { resize: vertical; min-height: 5rem; }
.actions { display: flex; justify-content: end; gap: .65rem; }
.actions [data-close] { background: transparent; border-color: var(--border); color: var(--text); }
.hint { color: var(--muted); font-size: .8rem; margin-bottom: 0; }
.error { color: var(--danger); min-height: 1.1rem; margin-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
@media (max-width: 760px) {
  .topbar, .section-head { align-items: flex-start; }
  .topbar { flex-direction: column; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary div:nth-child(2) { border-right: 0; }
  .summary div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .task { grid-template-columns: 1fr; }
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f3ef; --surface: #fff; --surface-2: #eceae4; --border: #d3d0c8; --text: #232323; --muted: #686b6c; --accent: #a86e05; --danger: #b23b38; --ok: #247b4d; }
  button { color: #fff; }
}
