/* Layout: top nav (views), filter bar, then horizontally scrolling kanban columns.
   Kolorystyka: „czerń + chłodne szarości” (makieta A) dla całej aplikacji, bez przełączania jasny/ciemny.
   Ekran logowania nadpisuje tokeny klasą .theme-light (makieta C). Kolory statusów, priorytetów i agenta są standardowe. */
:root {
  --bg: #0a0b0d; --surface: #16191c; --surface-2: #101214; --raise: #1d2125;
  --ink: #eceef1; --muted: #9ba3ad; --line: #2a2f35; --line-soft: #23272c;
  --accent: #eceef1; --accent-ink: #0a0b0d; --link: #8fb4ff;
  --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);
  --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: dark;
}
.theme-light {
  --bg: #edecea; --surface: #ffffff; --surface-2: #f6f5f3; --raise: #efeeec;
  --ink: #1f1e1c; --muted: #5f5b55; --line: #c9c5bf; --line-soft: #d6d3ce;
  --accent: #262523; --accent-ink: #ffffff; --link: #1f1e1c;
  --bad: #bd3328; --bad-bg: #fbe5e2;
  --shadow: 0 1px 2px rgba(31,30,28,.06), 0 4px 16px rgba(31,30,28,.05);
  color-scheme: light;
}
* { 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(--link); }
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(--link); outline-offset: 2px; }

/* Header: marka, widoki, konto */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 14px 24px; border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.views { display: flex; flex-wrap: wrap; gap: 4px; }
.views a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.views a:hover { color: var(--ink); background: var(--raise); }
.views a[aria-current="page"] { color: var(--ink); background: var(--raise); font-weight: 600; }
.me { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; }
.me a { color: var(--muted); text-decoration: none; }
.me a:hover { color: var(--ink); }
.me form { margin: 0; }
.pillbtn { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.pillbtn:hover { background: var(--raise); }

.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(--raise); }
.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 12px; align-items: center; }
.fgroup { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.fgroup .lbl { margin-right: 4px; }
.fsep { width: 1px; height: 22px; background: var(--line); }
.chip-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font-size: 13px; color: var(--ink); text-decoration: none; background: var(--surface); }
.chip-btn:hover { background: var(--raise); }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Tablica główna: nagłówek z wyborem projektu, filtry, pasek kolejki agenta */
.boardbar { padding: 18px 24px 12px; display: grid; gap: 12px; }
.bb-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.bb-head h1 { font-size: 26px; font-weight: 600; }
.bb-head p { margin: 2px 0 0; }
.projpick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.projpick select { min-height: 40px; min-width: min(100%, 260px); max-width: 100%; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.projpick .btn { min-height: 40px; padding: 0 16px; }
.queuebar { margin: 0 24px; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--surface); }
.queuebar summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 14px; cursor: pointer; list-style: none; }
.queuebar summary::-webkit-details-marker { display: none; }
.qb-title { font-weight: 600; }
.qb-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qb-count b { color: var(--ink); font-weight: 600; }
.qb-count.bad, .qb-count.bad b { color: var(--bad); }
.qb-toggle { margin-left: auto; font-size: 13px; color: var(--muted); }
.qb-toggle::after { content: "Rozwiń ▼"; }
.queuebar[open] .qb-toggle::after { content: "Zwiń ▲"; }
.qb-body { padding: 0 14px 12px; display: grid; gap: 8px; }
.queuebar .qrow { background: var(--surface-2); }
.projtag { font-family: var(--font-mono); font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink); }
.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: 16px 24px 32px; scroll-snap-type: x mandatory; scroll-padding: 24px; align-items: flex-start; }
.col { flex: 0 0 min(84vw, 300px); scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line-soft); 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(--raise); 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: #7ea2ee; } .k-app { --kc: #3fc4c4; } .k-wp { --kc: #6fb0d8; } .k-frontend { --kc: #d585e3; } .k-infra { --kc: #a3a8b0; } .k-docs { --kc: #f0a24b; } .k-other { --kc: #a3a8b0; }
.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(--raise); 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; } }

/* Review: instrukcja, lista poprawek, dodawanie kolejnych */
.review { margin-bottom: 14px; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.review-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; max-width: 80ch; }
.review-steps b { color: var(--ink); }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note { border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 6px; }
.note-draft { border-style: dashed; border-left-style: solid; border-left-color: var(--muted); }
.note-done { border-left-color: var(--ok); }
.note-withdrawn { border-left-color: var(--line); opacity: .75; }
.note-done .note-text, .note-withdrawn .note-text { color: var(--muted); }
.note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.note-num { font-family: var(--font-mono); font-weight: 500; }
.note-meta { font-size: 12px; color: var(--muted); }
.note-text { margin: 0; overflow-wrap: anywhere; }
.note-reply { margin: 0; font-size: 13px; padding: 6px 10px; border-radius: 6px; background: var(--agent-bg); color: var(--ink); }
.note-reply .who { font-family: var(--font-mono); font-size: 11.5px; color: var(--agent); margin-right: 6px; }
.note-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.note-actions form { margin: 0; }
.note-form { max-width: 80ch; }
.note-send { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.note-send .muted { margin: 0; }
.note-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }

/* Logowanie (makieta C): grafitowy panel z opisem, jasny formularz; na telefonie jeden pod drugim */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-aside { flex: 1 1 380px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px; background: #262523; color: #f3f1ee; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.minib { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: start; max-width: 420px; }
.minib-col { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 3px solid var(--sc); }
.minib-col.s-idea { --sc: var(--s-idea); } .minib-col.s-todo { --sc: var(--s-todo); } .minib-col.s-in_progress { --sc: var(--s-in_progress); }
.minib-col.s-review { --sc: var(--s-review); } .minib-col.s-done { --sc: var(--s-done); }
.minib i { display: block; height: 30px; border-radius: 5px; background: #f3f1ee; opacity: .92; }
.minib i.short { height: 22px; } .minib i.tall { height: 38px; }
.minib i.p1 { border-left: 3px solid #e5ac3f; } .minib i.p0 { border-left: 3px solid #ff7f72; }
.auth-copy { display: grid; gap: 10px; max-width: 46ch; }
.auth-copy h1 { font-size: 32px; font-weight: 600; line-height: 1.15; }
.auth-copy p { margin: 0; color: #bdb8b0; }
.auth-main { flex: 1 1 380px; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.auth-form { width: 100%; max-width: 360px; display: grid; gap: 16px; padding: 28px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; box-shadow: var(--shadow); }
.auth-form h2 { font-size: 24px; font-weight: 600; }
.auth-form .field input:not([type=checkbox]) { min-height: 44px; }
.btn.big { min-height: 44px; justify-content: center; font-weight: 600; }
.form-error { margin: 0; padding: 9px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 13px; }
.auth-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.auth-note a { color: var(--ink); }
@media (max-width: 600px) {
  .auth-aside { padding: 28px 20px; gap: 24px; }
  .auth-copy h1 { font-size: 26px; }
  .top, .boardbar { padding-left: 16px; padding-right: 16px; }
  .queuebar { margin: 0 16px; }
  .me { margin-left: 0; }
}
