
/* Layout: sticky header with category tabs; list of tender rows on the left, detail sheet on the right (stacked on phones). */
:root {
  --bg: #EDEFF0; --surface: #FFFFFF; --surface-2: #F6F7F8; --ink: #1A2025; --muted: #5B666E; --line: #D4D9DC;
  --accent: #C24E17; --accent-ink: #FFFFFF; --accent-soft: #FBE9DF;
  --red: #B3332A; --red-soft: #F8E1DE; --amber: #9A6510; --amber-soft: #F6ECD6; --green: #2B7449; --green-soft: #DDEFE3; --blue: #2C5F86; --blue-soft: #DEE9F2;
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121619; --surface: #1A2024; --surface-2: #20272C; --ink: #E5E9EB; --muted: #95A0A7; --line: #2D353A;
  --accent: #EE7B3F; --accent-ink: #1A1006; --accent-soft: #3A2417;
  --red: #F07467; --red-soft: #3B1F1C; --amber: #E2AA52; --amber-soft: #392D17; --green: #63C38B; --green-soft: #19301F; --blue: #7EAFD6; --blue-soft: #1B2B38;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #121619; --surface: #1A2024; --surface-2: #20272C; --ink: #E5E9EB; --muted: #95A0A7; --line: #2D353A;
  --accent: #EE7B3F; --accent-ink: #1A1006; --accent-soft: #3A2417;
  --red: #F07467; --red-soft: #3B1F1C; --amber: #E2AA52; --amber-soft: #392D17; --green: #63C38B; --green-soft: #19301F; --blue: #7EAFD6; --blue-soft: #1B2B38;
  color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-body); }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1440px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 14px 10px; }
.brand h1 { font: 800 20px/1.1 var(--f-display); letter-spacing: -0.01em; margin: 0; display: flex; align-items: center; gap: 10px; }
.brand h1 .mark { width: 22px; height: 22px; background: repeating-linear-gradient(-45deg, var(--accent) 0 5px, var(--ink) 5px 10px); border-radius: 3px; flex: none; }
.brand .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 10px 12px 11px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab .n { font: 500 11.5px var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; color: var(--muted); }
.tab .sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-block: 14px; }
.toolbar input[type=search] { flex: 1 1 240px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.toolbar label.chk { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; padding-block: 0 40px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer; }
.row:hover { border-color: var(--muted); }
.row[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.due { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 4px; background: var(--surface-2); padding: 6px 2px; line-height: 1.1; }
.due b { font: 700 20px var(--f-display); font-variant-numeric: tabular-nums; }
.due span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.due.hot { background: var(--red-soft); color: var(--red); } .due.hot span { color: var(--red); }
.due.warm { background: var(--amber-soft); color: var(--amber); } .due.warm span { color: var(--amber); }
.due.past { opacity: .55; }
.row .t { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .o { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.pill { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.pill.s-obserwuje { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.pill.s-zlecone { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.pill.s-gotowe { color: var(--green); background: var(--green-soft); border-color: transparent; }
.pill.s-oferta { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.pill.s-odrzucony { text-decoration: line-through; }
.pill.s-brak { color: var(--red); background: var(--red-soft); border-color: transparent; }
.light { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.light.zielony { background: var(--green); } .light.zolty { background: var(--amber); } .light.czerwony { background: var(--red); }
.fit { display: inline-flex; align-items: center; gap: 5px; font: 11.5px var(--f-mono); color: var(--muted); }
.fit i { display: block; width: 36px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.fit i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--accent); }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 28px; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--ink); font: 700 16px var(--f-display); }

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 112px); max-height: calc(100vh - 130px); overflow: auto; }
.d-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.d-head .eyebrow { font: 500 11.5px var(--f-mono); color: var(--muted); letter-spacing: .02em; display: flex; gap: 10px; flex-wrap: wrap; }
.d-head h2 { font: 700 19px/1.3 var(--f-display); margin: 6px 0 4px; text-wrap: balance; }
.d-head .org { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 12px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.back { display: none; }
section.blk { padding: 16px 20px; border-bottom: 1px solid var(--line); }
section.blk:last-child { border-bottom: 0; }
section.blk h3 { font: 700 12px var(--f-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
dl.kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.opis { color: var(--ink); white-space: pre-line; max-width: 72ch; }
.note { width: 100%; min-height: 70px; resize: vertical; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface-2); }
.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r); background: var(--surface-2); }
.verdict.zielony { background: var(--green-soft); } .verdict.zolty { background: var(--amber-soft); } .verdict.czerwony { background: var(--red-soft); }
.verdict .light { margin-top: 6px; width: 12px; height: 12px; }
.verdict b { display: block; }
.risks { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.risks li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.lvl { font: 600 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .04em; padding: 2px 0; text-align: center; border-radius: 3px; align-self: start; }
.lvl.wysokie { color: var(--red); background: var(--red-soft); } .lvl.srednie { color: var(--amber); background: var(--amber-soft); } .lvl.niskie { color: var(--green); background: var(--green-soft); }
.risks small { color: var(--muted); display: block; }
ul.plain { margin: 0; padding-left: 18px; } ul.plain li { margin: 2px 0; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.k { border-collapse: collapse; width: 100%; font-size: 13px; }
table.k th, table.k td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.k th { font-weight: 600; color: var(--muted); background: var(--surface-2); font-size: 12px; }
table.k td.n, table.k th.n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.k tr.sum td { font-weight: 600; border-bottom: 0; }
.totals { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.totals div span { display: block; color: var(--muted); font-size: 12px; }
.totals div b { font: 700 20px var(--f-display); font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px; }
.timeline time { font: 12px var(--f-mono); color: var(--muted); }
.path { font: 12px var(--f-mono); background: var(--surface-2); padding: 2px 6px; border-radius: 3px; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 13px; }
.banner { margin-top: 10px; padding: 10px 12px; border-radius: var(--r); font-size: 13px; }
.banner.info { background: var(--blue-soft); color: var(--ink); } .banner.err { background: var(--red-soft); color: var(--ink); }
.toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--r); font-size: 13px; z-index: 20; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 900px) {
  main.grid { grid-template-columns: minmax(0, 1fr); }
  .detail { position: static; max-height: none; }
  main.grid.has-sel .list, main.grid.has-sel + .x { display: none; }
  main.grid:not(.has-sel) .detail { display: none; }
  .back { display: inline-flex; }
  .brand .meta { margin-left: 0; }
}
@media (prefers-reduced-motion: no-preference) { .row, .btn { transition: border-color .12s, box-shadow .12s; } }

/* --- logowanie i wersja www --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login form { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { font: 800 22px var(--f-display); margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.login h1 .mark { width: 22px; height: 22px; background: repeating-linear-gradient(-45deg, var(--accent) 0 5px, var(--ink) 5px 10px); border-radius: 3px; }
.login label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.login input { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.login .err { color: var(--red); font-size: 13px; min-height: 1em; }
.dl { margin-top: 8px; }