:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #667085;
  --line: #e2e5ea;
  --brand: #1f2a44;
  --accent: #f08c00;
  --accent-dark: #c76f00;
  --ok: #12805c;
  --ok-bg: #e3f6ee;
  --warn-bg: #fff4e0;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #1d5fd1;
  --info-bg: #e8f0fe;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--info); overflow-wrap: anywhere; }
.card { min-width: 0; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }

header.top { background: var(--brand); color: #fff; padding: 10px 16px; display: flex;
  align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; }
header.top .title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
header.top a, header.top button { color: #fff; text-decoration: none; background: none;
  border: 0; padding: 6px; cursor: pointer; font-size: 15px; }
header.top .back { font-size: 22px; line-height: 1; padding: 2px 8px 2px 0; }

main { max-width: 860px; margin: 0 auto; padding: 16px; padding-bottom: 96px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
.muted { color: var(--muted); font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; }
.card.link { display: block; color: inherit; text-decoration: none; }
.card.link:active { background: #fafafa; }

.btn { max-width: 100%; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px;
  padding: 10px 16px; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:active { background: var(--accent-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f1b8b3; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }
.fab { position: fixed; right: 16px; bottom: 20px; z-index: 20; border-radius: 999px;
  padding: 14px 22px; box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: 17px; }

label.field { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid #cfd4dc;
  border-radius: 10px; background: #fff; color: var(--text); font-size: 16px; }
label.field.missing > input, label.field.missing > select { border-color: var(--accent);
  background: var(--warn-bg); }
textarea { min-height: 80px; resize: vertical; }
label.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 12px 0; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip b { margin-left: 4px; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.alert b { color: var(--danger); }
.chip.active.alert b { color: #ffb4ab; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: #eef0f3; color: #344054; white-space: nowrap; }
.badge.nowa { background: var(--info-bg); color: var(--info); }
.badge.zgloszona { background: var(--warn-bg); color: #8a4b00; }
.badge.do_weryfikacji { background: #f3e8ff; color: #6b21a8; }
.badge.zamknieta { background: var(--ok-bg); color: var(--ok); }
.badge.late { background: var(--danger-bg); color: var(--danger); }
.badge.ai { background: #f3e8ff; color: #6b21a8; }

.defect { display: flex; gap: 12px; }
.defect .thumb { width: 84px; height: 84px; flex: none; border-radius: 8px; object-fit: cover;
  background: #e9ecf0; }
.defect .body { min-width: 0; flex: 1; }
.defect .unit { font-weight: 700; }
.defect .desc { margin: 2px 0 6px; overflow-wrap: anywhere; }
.defect.late { border-left: 4px solid var(--danger); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.thumbs .t { position: relative; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }
.thumbs .x { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px;
  border-radius: 50%; border: 0; background: var(--danger); color: #fff; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; }

.mic { background: var(--brand); color: #fff; border-color: var(--brand); }
.mic.recording { background: var(--danger); border-color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(180,35,24,.15); } }
.step { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 4px 0 8px; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.list td.num { text-align: center; }
table.details th { white-space: nowrap; width: 1%; padding-right: 14px; vertical-align: top; }
.scroll-x { overflow-x: auto; }

.notice { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.notice.warn { background: var(--warn-bg); }
.notice.ok { background: var(--ok-bg); }
.notice.err { background: var(--danger-bg); color: var(--danger); }
.notice.info { background: var(--info-bg); }

.timeline { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #1d2433;
  color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,20,30,.55); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center; }
.modal { overflow-x: hidden; background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px 24px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 16px; } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; display: flex;
  align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.login { max-width: 380px; margin: 10vh auto 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* pierwsze kroki */
.steps-list { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 8px; }
.steps-list li.done { color: var(--muted); text-decoration: line-through; }

/* import wykonawców */
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; }
.choice-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-grid .btn.big { font-size: 15px; min-height: 64px; }
@media (max-width: 560px) { .choice-grid { grid-template-columns: minmax(0, 1fr); } }
.imp-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.imp-row.off { opacity: .55; }
.imp-row .check { flex-wrap: wrap; }
.imp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; margin-top: 6px; }
.imp-grid .field { margin-bottom: 8px; }
.imp-grid .wide { grid-column: 1 / -1; }
@media (max-width: 480px) { .imp-grid { grid-template-columns: minmax(0, 1fr); } }
header.top a, header.top button { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 560px) {
  header.top .lbl { display: none; }
  header.top a, header.top button { font-size: 20px; padding: 6px 4px; }
}

/* tabela w panelu testów: na telefonie przewijana w bok zamiast łamać słowa */
.wide-table th, .wide-table td.num, .wide-table td:last-child { white-space: nowrap; }
.wide-table td:first-child { min-width: 190px; }

.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.notice.install .row { gap: 8px; }
