:root {
  color-scheme: dark;
  --bg: #10141b;
  --bar: #151b25;
  --surface: #19212d;
  --field: #121923;
  --line: #2e3949;
  --text: #eef3f8;
  --muted: #b4c0d2;
  --accent: #9ee0df;
  --good: #b8dfa9;
  --warn: #ffd597;
  --red: #ffb9b2;
  font: 16px/1.45 system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
p { margin: 0 0 0.8rem; }
h1 { margin: 0 0 0.6rem; font-size: clamp(1.8rem, 4vw, 2.9rem); line-height: 1.16; letter-spacing: -0.045em; overflow-wrap: anywhere; }
h2 { margin: 0 0 0.8rem; font-size: 1.05rem; letter-spacing: -0.01em; }
small, time { color: var(--muted); font-size: 0.81rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 0.45rem;
  padding: 0.62rem 0.75rem; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); margin: 0; }
label { display: grid; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
input[readonly], code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
button, .button {
  align-items: center; justify-content: center; display: inline-flex; width: fit-content;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 0.45rem;
  text-decoration: none; padding: 0.6rem 0.78rem; cursor: pointer; font-size: 0.865rem; line-height: 1.25; min-height: 2.6rem;
}
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
.primary { color: #102428; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.quiet:hover { border-color: var(--line); color: var(--text); }
.topbar { background: var(--bar); border-bottom: 1px solid var(--line); }
.topbar-inner, main { width: min(100% - 2.4rem, 1220px); margin-inline: auto; }
.topbar-inner { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.brand { color: var(--text); font-size: 1.35rem; font-weight: 900; letter-spacing: -0.035em; }
.brand span { color: var(--accent); }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem; }
nav a { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
nav form { margin: 0; }
main { padding-block: 2.35rem 4rem; }
.auth { width: min(100%, 430px); margin: min(10vh, 5rem) auto 0; }
.intro { margin-bottom: 1.6rem; }
.intro h1 { font-size: 3rem; margin-bottom: 0.45rem; }
.intro p { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 0.75rem; padding: 1.1rem; min-width: 0; }
.panel > :last-child { margin-bottom: 0; }
.compact { padding: 0.95rem; }
.notice { padding: 0.75rem 0.9rem; background: #1c302e; border: 1px solid #416b62; border-radius: 0.55rem; color: var(--accent); }
.notice.error { color: var(--red); background: #342324; border-color: #663e42; }
.warning-text { color: var(--warn); }
.secondary { color: var(--muted); }
.board-layout, .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 19rem); gap: 1.1rem; }
.right-rail, .detail-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.6rem; margin: 0 0 1.2rem; }
.heading h1 { margin: 0; }
.heading p { margin-bottom: 0.35rem; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 1.2rem; }
.summary a { display: grid; gap: 0.15rem; padding: 0.65rem 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 0.55rem; color: var(--text); }
.summary strong { font-size: 1.65rem; line-height: 1; font-variant-numeric: tabular-nums; }
.summary span { color: var(--muted); font-size: 0.8rem; }
.summary .attention strong { color: var(--warn); }
.filters, .inline, .actions { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 0.8rem; }
.filters label:not(.checkbox) { flex: 1 1 8rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; min-height: 1.6rem; }
.filters .checkbox { min-height: 2.6rem; }
.stack { display: grid; gap: 0.75rem; }
.tasklist { border: 1px solid var(--line); border-radius: 0.6rem; background: var(--surface); overflow: clip; }
.task-row {
  display: grid; grid-template-columns: minmax(8rem, 2fr) minmax(5.5rem, 1fr) minmax(4rem, 0.8fr) max-content; align-items: center;
  gap: 0.65rem; padding: 0.72rem 0.8rem; color: var(--text); border-bottom: 1px solid var(--line); min-height: 3.45rem;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover, .task-row:focus-visible { background: #222f3e; text-decoration: none; }
.task-row:focus-visible { outline-offset: -2px; }
.task-row .secondary { font-size: 0.8rem; overflow-wrap: anywhere; }
.task-title { display: flex; align-items: baseline; gap: 0.45rem; font-weight: 650; overflow-wrap: anywhere; }
.id, .helpercount { color: var(--muted); font: 0.8rem ui-monospace, monospace; }
.badge { display: inline-block; font-size: 0.775rem; padding: 0.21rem 0.5rem; background: #263141; color: var(--text); border-radius: 0.32rem; width: fit-content; }
.badge.good { background: #263e33; color: var(--good); }
.badge.warn { background: #3c3023; color: var(--warn); }
.badge.active { background: #234047; color: var(--accent); }
.empty { color: var(--muted); margin: 0; padding: 1rem; }
.event-list, .timeline { list-style: none; padding: 0; margin: 0; }
.event-list li { display: flex; gap: 0.5rem; justify-content: space-between; overflow-wrap: anywhere; }
.event-list .secondary { font-size: 0.8rem; }
.event-list li + li, .timeline li + li { margin-top: 0.5rem; }
.back { display: inline-block; margin: 0 0 0.7rem; }
dl { margin: 0 0 0.8rem; }
dt { color: var(--muted); font-size: 0.8rem; }
dd { margin: 0 0 0.55rem; overflow-wrap: anywhere; }
.handoff { border-top: 1px solid var(--line); padding-top: 0.85rem; }
.timeline { font-size: 0.85rem; }
.timeline time, .run-row small { display: block; }
.metadata { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.note { border-bottom: 1px solid var(--line); margin-bottom: 0.75rem; padding-bottom: 0.75rem; overflow-wrap: anywhere; }
.note p { margin: 0.25rem 0 0; white-space: pre-wrap; }
.run-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.6rem; border-top: 1px solid var(--line); padding: 0.55rem 0; overflow-wrap: anywhere; }
.credentials { border-color: #416b62; }
.credentials label { margin-bottom: 0.7rem; }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; align-items: start; }
.result { margin-top: 0.8rem; }
@media (max-width: 900px) {
  .board-layout, .detail-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 590px) {
  .topbar-inner, main { width: calc(100% - 1.4rem); }
  nav { gap: 0.4rem; justify-content: flex-end; }
  main { padding-top: 1.4rem; }
  .summary, .task-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-row > :nth-child(even) { justify-self: end; text-align: right; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .run-row { grid-template-columns: minmax(0, 1fr) auto; }
}
