/* Layout: top nav (views + projects), page header, then horizontally scrolling kanban columns. */
:root {
  --bg: #eceff3; --surface: #ffffff; --surface-2: #f5f7f9; --ink: #142030; --muted: #5a6779; --line: #d3d9e1;
  --accent: #1f5ad1; --accent-ink: #ffffff; --agent: #a85a06; --agent-bg: #fbeedc;
  --ok: #1b7543; --ok-bg: #e2f3e9; --warn: #9a6200; --warn-bg: #fdf1d6; --bad: #bd3328; --bad-bg: #fbe5e2;
  --s-idea: #7f74c6; --s-todo: #1f5ad1; --s-in_progress: #0f8585; --s-review: #9d45ad; --s-done: #1b7543;
  --shadow: 0 1px 2px rgba(20,32,48,.06), 0 2px 8px rgba(20,32,48,.05);
  --font-display: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b; --surface: #16202a; --surface-2: #1c2833; --ink: #e5ebf1; --muted: #93a0af; --line: #2a3644;
    --accent: #6d9dff; --accent-ink: #0b1220; --agent: #f0a24b; --agent-bg: #3a2914;
    --ok: #52c283; --ok-bg: #143224; --warn: #e5ac3f; --warn-bg: #3a2c10; --bad: #ff7f72; --bad-bg: #3d1a17;
    --s-idea: #a59cf0; --s-todo: #6d9dff; --s-in_progress: #3fc4c4; --s-review: #d585e3; --s-done: #52c283;
    --shadow: 0 1px 2px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font-body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: .86em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 0; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.brand h1 { font-size: 22px; font-weight: 700; }
.brand h1 a { color: inherit; text-decoration: none; }
.brand .me { font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.brand .me form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 13px; }
.scroller { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.scroller::-webkit-scrollbar { display: none; }
.ptab { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; display: inline-flex; gap: 8px; align-items: center; color: var(--ink); text-decoration: none; }
.ptab .k { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ptab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ptab.on .k { color: inherit; opacity: .75; }
.ptab.view { font-weight: 600; }
.navsep { flex: none; width: 1px; background: var(--line); margin: 4px; }

.page { padding: 14px 16px 40px; display: grid; gap: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 600; }
.page-head p, .muted { color: var(--muted); font-size: 14px; margin: 2px 0 0; max-width: 68ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.panel h2 { font-size: 18px; font-weight: 600; }
.panel > p { margin: 0; color: var(--muted); font-size: 14px; max-width: 68ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.messages { list-style: none; margin: 12px 16px 0; padding: 0; display: grid; gap: 6px; }
.messages li { padding: 9px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.messages .success { border-color: var(--ok); }
.messages .error { border-color: var(--bad); color: var(--bad); }
.messages .warning { border-color: var(--warn); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 13px; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.stat b { font-weight: 600; }
.stat.agent { background: var(--agent-bg); border-color: transparent; color: var(--agent); }
.stat.bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }

.projbar { margin: 12px 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.pb-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pb-head h2 { font-size: 20px; font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.fgroup { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.fgroup .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.chip-btn { border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; font-size: 13px; color: var(--ink); text-decoration: none; background: var(--surface); }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.repochips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.repochip { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }

/* Board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 14px 16px 28px; scroll-snap-type: x mandatory; scroll-padding: 16px; align-items: flex-start; }
.col { flex: 0 0 min(84vw, 300px); scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 140px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { padding: 10px 12px 8px; border-top: 4px solid var(--sc); border-radius: var(--r) var(--r) 0 0; }
.col-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.col-title h2 { font-size: 16px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-weight: 400; }
.addbtn { color: var(--muted); font-size: 20px; line-height: 1; width: 28px; height: 28px; border-radius: 6px; text-decoration: none; display: grid; place-items: center; }
.addbtn:hover { background: var(--surface); color: var(--ink); }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; min-height: 40px; }
.empty { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 8px; border: 1px dashed var(--line); border-radius: 8px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 9px 36px 10px 10px; display: grid; gap: 6px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card.p0 { border-left-color: var(--bad); }
.card.p1 { border-left-color: var(--warn); }
.card.dragging { opacity: .45; }
.card-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.tid { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.prio { margin-left: auto; font-family: var(--font-mono); font-size: 11px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); }
.prio.p0 { color: var(--bad); border-color: currentColor; }
.prio.p1 { color: var(--warn); border-color: currentColor; }
.card h3 { font-family: var(--font-body); font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.tag.agent { background: var(--agent-bg); color: var(--agent); border-color: transparent; font-weight: 600; }
.tag.ready { background: var(--agent); color: var(--surface); border-color: transparent; font-weight: 600; }
.tag.human { color: var(--muted); }
.tag.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.kind { font-size: 11px; font-weight: 600; }
.kind::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; background: var(--kc, var(--muted)); }
.k-backend { --kc: #3c6fd8; } .k-app { --kc: #0f8585; } .k-wp { --kc: #2f74a0; } .k-frontend { --kc: #9d45ad; } .k-infra { --kc: #7a7f88; } .k-docs { --kc: #a85a06; } .k-other { --kc: #8a8f99; }
.gitrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; padding-top: 6px; border-top: 1px dashed var(--line); }
.branch { font-family: var(--font-mono); font-size: 11.5px; overflow-wrap: anywhere; }
.steps { display: inline-flex; gap: 3px; }
.steps i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--s-in_progress); }
.steps.merged i.on { background: var(--ok); }
.steps.changes i.on { background: var(--warn); }
.gstate { color: var(--muted); }
.next { position: absolute; right: 4px; top: 6px; z-index: 1; margin: 0; }
.next button { width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.next button:hover { background: var(--surface-2); color: var(--ink); }

/* Overview */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.pcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pcard-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pcard h3 { font-size: 17px; font-weight: 600; }
.minibar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.minibar i { display: block; height: 100%; background: var(--sc); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--sc); margin-right: 5px; }
.qlist { display: grid; gap: 6px; }
.qrow { display: grid; grid-template-columns: 1.6em 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; }
.qrow:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.qrow .t { font-weight: 600; font-size: 14px; min-width: 0; }
.qrow .sub { grid-column: 2 / 4; font-size: 12px; color: var(--muted); display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; }
.qrow .num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: right; }
.qsec { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }

/* Repos */
.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; align-content: start; box-shadow: var(--shadow); }
.rcard h3 { font-family: var(--font-mono); font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tblwrap { overflow-x: auto; }
pre.code { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Task form */
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .task-layout { grid-template-columns: 1fr; } }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.field .help { font-size: 12px; color: var(--muted); }
.field .errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .grid3, .grid2 { grid-template-columns: 1fr 1fr; } }
fieldset.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; margin: 0; }
fieldset.box legend { font-family: var(--font-display); font-weight: 600; padding: 0 6px; }
.claimbox { padding: 9px 10px; border-radius: 8px; background: var(--agent-bg); color: var(--agent); font-size: 13px; display: grid; gap: 6px; }
.log { display: grid; gap: 8px; font-size: 13px; }
.log .row { display: grid; grid-template-columns: max-content 1fr; gap: 8px; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.log .who { font-family: var(--font-mono); font-size: 11.5px; color: var(--agent); margin-right: 4px; }
.log .who.human { color: var(--muted); }
.log .who.github { color: var(--accent); }
.flash { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.flash.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .flash { transition: none; } }

.login { max-width: 360px; margin: 10vh auto; }
