/* Inwentaryzacja – jeden arkusz stylów. Mobile-first; panel rozszerza układ na desktopie. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --text: #1c2630;
  --muted: #5d6b78;
  --line: #d9dfe5;
  --brand: #1d4f73;
  --brand-ink: #ffffff;
  --ok: #1e7b3a;
  --ok-bg: #e5f4ea;
  --err: #b42318;
  --err-bg: #fdecea;
  --warn-bg: #fff4d6;
  --info-bg: #e8f1f8;
  --radius: 10px;
  --tap: 48px;
  --brand-dark: #163e5b;
  --nav-bg: #12324a;
  --nav-text: #cfdeea;
  --accent: #f2b705;
  --hover-bg: #eaf2f8;
  --hover-line: #8fb0c9;
  --radius-card: 14px;
  --shadow-card: 0 2px 10px rgba(16, 38, 56, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
code { font-family: ui-monospace, Consolas, monospace; }

/* --- Pasek górny (ciemny z żółtą linią) -------------------------------------------------- */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--nav-bg); color: #fff; border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.brand-logo {
  width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--accent); color: var(--nav-bg);
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-weight: 500; color: #8eabc2; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.brand-sub:empty { display: none; }
.topnav { display: flex; align-items: center; gap: 12px; flex: none; }
.topbar-pill {
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(242, 183, 5, .5); color: var(--accent);
  font-weight: 600; font-size: .9rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}
.topbar-pill:hover { background: rgba(242, 183, 5, .14); border-color: var(--accent); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff; border: 2px solid var(--accent); font-weight: 700; font-size: .82rem;
}
.who { display: flex; flex-direction: column; line-height: 1.15; }
.who b { font-size: .9rem; }
.who small { font-size: .75rem; color: #a9c0d3; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  background: transparent; color: #cfdeea; border: 1px solid rgba(255, 255, 255, .2);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); color: var(--accent); border-color: rgba(242, 183, 5, .6); }
.icon-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.linklike { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
form.inline { display: inline; margin: 0; }
@media (max-width: 760px) { .who, .brand-sub { display: none; } }
@media (max-width: 480px) {
  .topbar { padding: 8px 12px; }
  .topbar-pill { display: none; }
  .topnav { gap: 8px; }
}

/* --- Układ ------------------------------------------------------------------------------- */
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--surface); border: 0; border-radius: var(--radius-card);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-card);
}
.card.narrow { max-width: 440px; margin: 24px auto; }
.eyebrow { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .25rem; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

/* --- Przyciski --------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap);
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn {
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover {
  background: var(--hover-bg); border-color: var(--hover-line);
  box-shadow: 0 3px 10px rgba(29, 79, 115, .2); transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
/* Telefony nie mają „najechania” – stan :hover potrafi „przykleić się” po dotknięciu, więc tam bez uniesienia. */
@media (hover: none) { .btn:hover { transform: none; box-shadow: none; } }
.btn:focus-visible, .sidenav a:focus-visible, .linklike:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #2a6b9b; border-color: #2a6b9b; box-shadow: 0 4px 12px rgba(29, 79, 115, .4); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #d1392b; border-color: #d1392b; box-shadow: 0 4px 12px rgba(180, 35, 24, .4); }
.btn-block { display: flex; width: 100%; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-confirm {
  min-height: 72px; font-size: 1.25rem; background: var(--ok); border-color: var(--ok); color: #fff;
  margin: 8px 0;
}
.btn-confirm:hover { background: #26944a; border-color: #26944a; box-shadow: 0 4px 14px rgba(30, 123, 58, .45); }

/* --- Komunikaty i stany ------------------------------------------------------------------ */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 8px; background: var(--info-bg); }
.msg-success { background: var(--ok-bg); color: var(--ok); }
.msg-error { background: var(--err-bg); color: var(--err); }
.msg-warning { background: var(--warn-bg); }
.state { padding: 16px; border-radius: var(--radius); font-size: 1.05rem; }
.state .big { font-size: 1.3rem; font-weight: 700; }
.state-ok { background: var(--ok-bg); color: var(--ok); border: 2px solid var(--ok); }
.state-error { background: var(--err-bg); color: var(--err); border: 2px solid var(--err); }
.state-neutral { background: var(--warn-bg); }

/* --- Dane sprzętu ------------------------------------------------------------------------ */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.facts .strong { font-weight: 700; font-size: 1.1rem; }

/* --- Formularze -------------------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 4px; }
.field fieldset { border: 0; padding: 0; margin: 0; }
.field input[type=text], .field input[type=password], .field input[type=search], .field input[type=date],
.field select, .field textarea, .search input, .filters input, .filters select {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
.field textarea { min-height: 96px; }
.field ul, .field div[id] > div { list-style: none; padding: 0; margin: 0; }
.field input[type=radio], .field input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; margin-right: 8px; }
.field li label, .field div[id] label { font-weight: 400; display: flex; align-items: center; min-height: 40px; }
.help { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.error { color: var(--err); margin: 4px 0 0; font-size: .9rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--err); }
.search { display: flex; gap: 8px; }
.search input { flex: 1; }

/* --- Listy ------------------------------------------------------------------------------- */
.plain-list, .result-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.result-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.group { color: var(--muted); }
.progress { width: 100%; height: 14px; margin-top: 8px; accent-color: var(--ok); }
.progress-text { margin: 4px 0 8px; }

/* Wyraźne zaznaczenie aktywnego pola formularza (w całej aplikacji). */
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .filters input:focus, .filters select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 79, 115, .15);
}

/* --- Ekrany logowania (podzielony ekran; na telefonie nagłówek + karta) ------------------------ */
.auth-body { background: var(--bg); }
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-side {
  /* Treść jako kolumna (max 540 px) wyśrodkowana w lewym panelu – bez pustej przestrzeni na szerokich monitorach. */
  position: relative; overflow: hidden; color: #fff;
  padding: 56px max(64px, calc((100% - 540px) / 2));
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background:
    radial-gradient(circle at 15% 20%, rgba(242, 183, 5, .18), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255, 255, 255, .08), transparent 45%),
    linear-gradient(160deg, var(--brand), #0f2b40);
}
.auth-brand { display: flex; align-items: center; gap: 14px; font-weight: 700; font-size: 1.2rem; }
.auth-logo {
  width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--accent); color: var(--nav-bg);
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
}
.auth-logo svg { width: 32px; height: 32px; }
.auth-hero h2 { font-size: 2.3rem; line-height: 1.15; margin: 0 0 16px; max-width: 520px; }
.auth-hero p { color: #cfdeea; max-width: 460px; margin: 0; }
.auth-features { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 12px; color: #e6eef5; }
.auth-features i {
  width: 34px; height: 34px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, .12);
  display: grid; place-items: center; font-style: normal; font-weight: 700; color: var(--accent);
}
.auth-legal { color: #8eabc2; }
.auth-main { display: grid; place-items: center; padding: 32px; position: relative; z-index: 1; }
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 36px;
  box-shadow: 0 10px 40px rgba(16, 38, 56, .12);
}
.auth-card h1 { font-size: 1.6rem; margin: 0; }
.auth-sub { color: var(--muted); margin: 6px 0 10px; }
.auth-label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
.auth-input { position: relative; }
.auth-input svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  color: #7a8b99; pointer-events: none;
}
.auth-input input {
  width: 100%; height: 50px; padding: 0 14px 0 44px; border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; background: #fff; color: var(--text); transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(29, 79, 115, .15); }
.auth-input:focus-within svg { color: var(--brand); }
.auth-input.has-error input { border-color: var(--err); }
.auth-card .field input { height: 50px; border-width: 1.5px; border-radius: 12px; }
.auth-submit { min-height: 52px; margin-top: 22px; border-radius: 12px; font-size: 1.05rem; box-shadow: 0 6px 16px rgba(29, 79, 115, .3); }
.auth-help { margin: 18px 0 0; font-size: .88rem; color: var(--muted); text-align: center; }
.auth-help strong { color: var(--text); }
.auth-logout { margin-top: 14px; text-align: center; font-size: .88rem; color: var(--muted); }
.auth-steps { padding-left: 20px; color: var(--muted); font-size: .92rem; }
.auth-card .messages { margin-bottom: 10px; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 28px 22px 70px; gap: 0; }
  .auth-hero h2 { font-size: 1.5rem; margin: 22px 0 6px; }
  .auth-features, .auth-legal { display: none; }
  .auth-main { padding: 0 16px 24px; margin-top: -48px; place-items: start center; }
  .auth-card { padding: 26px 22px; }
}

/* --- Zdjęcia zgłoszeń -------------------------------------------------------------------- */
.field input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; min-height: var(--tap); }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-preview img, img.thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
img.thumb { width: 64px; height: 64px; }

/* --- MFA --------------------------------------------------------------------------------- */
.qr-setup svg { width: 220px; height: 220px; display: block; margin: 8px auto; }
.secret { text-align: center; font-size: 1.05rem; word-spacing: .3em; }
.codes { columns: 2; list-style: none; padding: 0; font-size: 1.15rem; }

/* --- Skanowanie seryjne ------------------------------------------------------------------ */
.scan-page .container { padding-top: 8px; }
.scan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.counter { font-size: 1.6rem; font-weight: 700; }
.banner { padding: 14px; border-radius: var(--radius); margin-bottom: 10px; font-size: 1.05rem; min-height: 72px; }
.banner-info { background: var(--info-bg); }
.banner-pending { background: var(--warn-bg); }
.banner-ok { background: var(--ok); color: #fff; }
.banner-error { background: var(--err); color: #fff; }
.banner a { color: #fff; font-weight: 700; }
.viewfinder { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: 12px; }
.viewfinder video { display: block; width: 100%; max-height: 55vh; object-fit: cover; }
.viewfinder .btn-confirm { margin: 0; border-radius: 0; }
.frame {
  position: absolute; inset: 18% 22%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px;
  pointer-events: none;
}
.small-heading { font-size: 1rem; color: var(--muted); }
.scan-log { list-style: none; padding: 0; margin: 0; }
.scan-log li { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: .95rem; }
.log-ok { background: var(--ok-bg); color: var(--ok); }
.log-info { background: var(--info-bg); }
.log-error { background: var(--err-bg); color: var(--err); }

/* --- Panel administracyjny (desktop) ----------------------------------------------------- */
/* Wariant „zaokrąglone karty”: menu jako pływająca karta, zaznaczona zakładka jako żółta „pigułka”. */
.panel-layout { display: flex; align-items: flex-start; gap: 16px; padding: 14px; min-height: calc(100vh - 48px); }
.sidenav {
  width: 232px; flex: 0 0 232px; padding: 10px 10px 12px; background: var(--nav-bg);
  border-radius: 16px; box-shadow: 0 6px 18px rgba(18, 50, 74, .35);
  position: sticky; top: 14px;
}
.nav-group {
  color: #8eabc2; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 12px 4px;
}
.nav-group:first-child { padding-top: 4px; }
.sidenav a {
  display: block; margin: 2px 0; padding: 9px 14px; border-radius: 999px;
  color: var(--nav-text); text-decoration: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.sidenav a:hover { background: rgba(255, 255, 255, .11); color: #fff; }
.sidenav a.active { background: var(--accent); color: var(--nav-bg); font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.sidenav a:focus-visible { outline-color: #fff; }
table.data tbody tr { transition: background-color .1s ease; }
table.data tbody tr:hover td { background: #f3f8fc; }
.panel-main { flex: 1; min-width: 0; padding: 6px 10px; }
.panel-main .card { padding: 18px 20px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 14px 16px; }
.stat .num { font-size: 1.8rem; font-weight: 700; display: block; }
.stat .lbl { color: var(--muted); font-size: .9rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 2px; }
.filters input, .filters select { min-height: 40px; padding: 6px 10px; width: auto; min-width: 150px; }
.filters .btn { min-height: 40px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.card .table-wrap { box-shadow: none; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table.data tbody tr:last-child td { border-bottom: 0; }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: #f8fafb; font-weight: 600; white-space: nowrap; }
table.data tr.archived td { color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-err { background: var(--err-bg); color: var(--err); }
.tag-warn { background: var(--warn-bg); }
.pagination { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.danger-zone { box-shadow: var(--shadow-card), inset 0 0 0 1px #f1c4bf; }
.inline-forms { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-forms form { margin: 0; }
.qr-preview svg { width: 160px; height: 160px; }
.details-json { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; color: var(--muted); word-break: break-all; }

@media (min-width: 700px) {
  h1 { font-size: 1.6rem; }
}
@media (max-width: 900px) {
  .panel-layout { flex-direction: column; align-items: stretch; padding: 10px; gap: 12px; }
  .sidenav { width: auto; flex: none; position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .nav-group { display: none; }
  .sidenav a { margin: 0; padding: 7px 12px; }
  .panel-main { padding: 4px 2px; }
  .two-col { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .sidenav, .no-print { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:active { transform: none; }
}
