:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eff4ff;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; text-decoration: none; }
p { margin: 0 0 10px; }
strong { font-weight: 650; }

/* ---------- Nagłówek ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 8px;
  padding-top: max(6px, env(safe-area-inset-top));
  min-height: 58px;
}

.topbar-back:empty,
.topbar-action:empty { display: none; }

.topbar-back,
.topbar-action { flex: 0 0 auto; }

.topbar-title { flex: 1 1 auto; min-width: 0; padding: 0 4px; }

.topbar-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: var(--text);
  background: transparent;
  border: 0;
  font-size: 22px;
  cursor: pointer;
}

.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.primary { background: var(--primary); color: #fff; font-size: 26px; font-weight: 400; }
.icon-btn.primary:active { background: var(--primary-dark); }
.icon-btn.ghost { width: 36px; height: 36px; font-size: 22px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; }

.text-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  border-radius: 9px;
}

/* ---------- Układ strony ---------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px 96px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 4px 8px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title:first-child { margin-top: 4px; }
.row-between { justify-content: space-between; }
.row-between a { color: var(--primary); text-transform: none; letter-spacing: 0; font-size: 13px; }

.link-small { font-size: 13px; color: var(--primary); font-weight: 600; }

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e9ebef;
  color: #4b5563;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

/* ---------- Nawigacja dolna ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 720px;
  margin: 0 auto;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 7px 2px 6px;
  font-size: 10.5px;
  font-weight: 550;
  color: var(--muted);
}

.tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--primary); }

/* ---------- Karty, listy ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.card-pad { padding: 15px; }
.list { padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
}

.row:last-child { border-bottom: 0; }
a.row:active { background: #f9fafb; }

.row-main { flex: 1; min-width: 0; display: block; }
.row-title { font-size: 15.5px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.row-meta { flex-shrink: 0; text-align: right; font-size: 13px; color: var(--muted); }

.row-button { border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.row-button:last-child { border-bottom: 0; }

.qty-meta { font-size: 15px; font-weight: 650; color: var(--text); white-space: nowrap; }
.qty-meta span { font-size: 11.5px; font-weight: 500; color: var(--muted); }

.chev { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: #9ca3af; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Statystyki i szybkie akcje ---------- */

.stats { margin-bottom: 6px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.stat {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.stat-value { font-size: 27px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid;
  margin: 10px 0 4px;
  font-size: 14px;
}

.notice .chev { width: 18px; height: 18px; }
.notice-amber { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }
.notice-red { background: var(--red-soft); border-color: #fecaca; color: #7f1d1d; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.quick {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 74px;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.quick-title { font-size: 14.5px; font-weight: 650; line-height: 1.25; }
.quick-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.25; }

/* ---------- Formularze ---------- */

.field { margin-bottom: 14px; }

.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--red); }

input[type="text"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="number"],
input[type="email"],
textarea,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.3;
}

textarea { min-height: 86px; resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: 3px solid var(--primary-soft);
  border-color: var(--primary);
}

input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafafa;
  font-size: 14px;
  color: var(--muted);
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.hint.center { text-align: center; margin: 10px 0; }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form select { flex: 1; min-width: 0; }
.inline-form .btn { flex-shrink: 0; }

.search { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.search input { flex: 1; min-width: 0; }
.search .btn { flex-shrink: 0; }

.filter-row { margin-bottom: 12px; }

.filter-body .field:last-of-type { margin-bottom: 10px; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { flex: 1; }

.filters { margin-bottom: 12px; }
.filters summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: " ▾"; float: right; color: #9ca3af; }
.filters[open] summary { border-radius: 10px 10px 0 0; border-bottom-color: transparent; }
.filters[open] summary::after { content: " ▴"; }
.filters[open] .filter-body { border-radius: 0 0 12px 12px; border-top: 0; margin-bottom: 0; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  font-size: 14.5px;
  line-height: 1.35;
  cursor: pointer;
}
.check input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--primary); margin: 1px 0 0; }
.check em { color: var(--muted); font-style: normal; font-size: 12px; }

/* ---------- Przyciski ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 15.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #fecaca; color: var(--red); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 9px; }

.card-pad > form > .btn-block,
.card-pad > .btn-block { margin-top: 4px; }
.page > .btn-block { margin-bottom: 12px; }

/* ---------- Odznaki ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  vertical-align: 1px;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }

/* ---------- Komunikaty ---------- */

.flashes { margin-bottom: 12px; }

.flash {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 14px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.flash-error { background: var(--red-soft); border-color: #fecaca; color: #7f1d1d; }
.flash-success { background: var(--green-soft); border-color: #bbf7d0; color: #14532d; }
.flash-info { background: var(--primary-soft); border-color: #dbe4ff; color: #1e3a8a; }

.empty {
  padding: 30px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.empty-title { font-weight: 650; font-size: 15px; }
.empty-text { font-size: 13px; color: var(--muted); margin-top: 4px; }

.error-message { color: var(--red); font-size: 14.5px; }

.muted-box { color: #374151; font-size: 14px; background: #fbfcfd; }

/* ---------- Szczegóły ---------- */

.kv {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 14.5px;
}

.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv a { color: var(--primary); }

.detail-status { margin-bottom: 12px; }
.detail-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: #374151; white-space: pre-line; }

.text-muted { color: var(--muted); }
.text-warn { color: var(--amber); }
.text-danger { color: var(--red); }
.center { text-align: center; }

.info-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: #374151;
  margin-bottom: 14px;
}

.info-box.warn { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }

.danger-zone { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Zdjęcia ---------- */

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.photo { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #e5e7eb; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo > form { position: absolute; top: 4px; right: 4px; margin: 0; }

.photo-del {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 0;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.photo-upload { margin-top: 4px; }
.photo-upload .btn { margin-top: 8px; }

/* ---------- Paginacja ---------- */

.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 12px 0; }
.pager .btn { justify-self: start; }
.pager .btn:last-child { justify-self: end; }
.pager-info { font-size: 12.5px; color: var(--muted); }

/* ---------- Zakładki ---------- */

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: #e9ebef;
  border-radius: 11px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  min-width: max-content;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.tab-link.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

/* ---------- Konto ---------- */

.account-card { display: flex; align-items: center; gap: 12px; }
.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
}
.account-name { font-weight: 650; font-size: 15.5px; }
.account-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.app-version { text-align: center; font-size: 11.5px; color: #9ca3af; margin: 26px 0 8px; }

/* ---------- Role ---------- */

.role-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}

.role-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.role-name { font-size: 16px; font-weight: 650; }
.role-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.perm-group { padding: 10px 14px 12px; border-bottom: 1px solid var(--line); }
.perm-group:last-child { border-bottom: 0; }
.perm-group-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); padding: 6px 0 2px; }

.save-bar {
  position: sticky;
  bottom: 72px;
  z-index: 15;
  padding: 10px 0 8px;
  margin-top: 12px;
  background: linear-gradient(to top, var(--bg) 72%, rgba(244, 245, 247, 0));
}

/* ---------- Logowanie ---------- */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background: var(--bg);
}

.auth-wrap { width: 100%; max-width: 400px; }

.auth-brand { text-align: center; margin-bottom: 20px; }

.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  font-weight: 700;
}

.auth-brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.public-link { margin-top: 2px; margin-bottom: 14px; }

.demo-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfcfd;
  font-size: 12.5px;
}

.demo-title { font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.demo-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.demo-row span { color: var(--muted); }
.demo-row code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- Magazyn ---------- */

.stock-group .section-title a { color: var(--muted); text-transform: inherit; letter-spacing: inherit; font-size: inherit; }

/* ---------- Większe ekrany ---------- */

@media (min-width: 640px) {
  .page { padding: 20px 20px 100px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .photos { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
  .page { padding-left: 11px; padding-right: 11px; }
  .quick-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
}

/* ---------- Publiczny formularz zgłoszeń ---------- */

[hidden] { display: none !important; }

.public-intro p:last-child { margin-bottom: 0; }

.type-fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.type-fieldset legend { padding: 0; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }

.type-options { display: grid; gap: 8px; }

.type-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.type-option input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.type-option strong { display: block; font-size: 14.5px; line-height: 1.3; }
.type-option small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; margin-top: 1px; }
.type-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.hp {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.success-panel { text-align: center; padding: 30px 18px; }
.success-panel h2 { margin: 0 0 12px; font-size: 20px; }
.success-panel p { margin-bottom: 8px; }
.success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
}
.success-number {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 2px 0 10px;
}
.success-panel .btn { margin-top: 8px; }

/* ---------- Dokument przyjęcia wielopozycyjnego ---------- */

.receipt-step { margin-bottom: 16px; }

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 4px 8px;
}

.step-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.step-title { display: block; font-size: 15px; font-weight: 650; line-height: 1.3; }
.step-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.step-chevron { color: var(--muted); font-size: 14px; line-height: 1; margin-top: 6px; flex-shrink: 0; transition: transform 0.15s; }

.step-number {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.location-step > summary {
  list-style: none;
  cursor: pointer;
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.location-step > summary::-webkit-details-marker { display: none; }
.location-step[open] > summary {
  margin: 0 4px 8px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.location-step[open] .step-chevron { transform: rotate(180deg); }

.receipt-hint { margin-bottom: 12px; }

.receipt-items-scroll {
  max-height: min(42vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
  margin-bottom: 4px;
}

.receipt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 40px;
  gap: 6px;
  align-items: start;
  margin-bottom: 8px;
}

.receipt-item select,
.receipt-item input {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 15px;
}

.receipt-item .item-remove {
  width: 40px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--red);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.receipt-item .item-remove:active { background: var(--red-soft); }

#add-item { margin-top: 2px; }

@media (max-width: 359px) {
  .receipt-item { grid-template-columns: minmax(0, 1fr) 70px 38px; }
  .receipt-item .item-remove { width: 38px; }
  .receipt-item select, .receipt-item input { font-size: 14px; padding-left: 8px; padding-right: 8px; }
}

/* ---------- Minima i maksima materiału ---------- */

.level-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.level-row:last-child { border-bottom: 0; }
.level-row .row-main { flex: 1; min-width: 0; }

.level-inputs {
  display: grid;
  grid-template-columns: 72px 72px;
  gap: 6px;
  flex-shrink: 0;
}
.level-inputs label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}
.level-inputs input {
  min-height: 40px;
  padding: 6px 8px;
  font-size: 15px;
  text-align: right;
}

@media (max-width: 359px) {
  .level-inputs { grid-template-columns: 62px 62px; }
  .level-row { padding-left: 11px; padding-right: 11px; gap: 8px; }
}

/* ---------- Tagi kategorii modeli ---------- */

.category-fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.category-fieldset legend {
  display: block;
  padding: 0;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 4px;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 13.5px;
  cursor: pointer;
}

.tag-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.tag-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ---------- Szybkie filtry urządzeń ---------- */

.quick-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.quick-filter-grid .field { margin-bottom: 0; }
.quick-filter-grid label { font-size: 12px; margin-bottom: 4px; }
.quick-filter-grid select { min-height: 44px; font-size: 15px; }
.quick-filter-wide { grid-column: 1 / -1; }

.quick-filter-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.quick-filter-actions .btn { flex: 1; }

@media (max-width: 359px) {
  .quick-filter-grid { grid-template-columns: 1fr; }
  .quick-filter-wide { grid-column: auto; }
}

/* ---------- Inwentaryzacja ---------- */

.inventory-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.inventory-row:last-child { border-bottom: 0; }
.inventory-row .row-main { flex: 1; min-width: 0; }
.inventory-row input {
  width: 88px;
  flex-shrink: 0;
  min-height: 42px;
  padding: 6px 8px;
  font-size: 16px;
  text-align: right;
}

.inventory-place { margin-bottom: 10px; }
.inventory-place summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
}
.inventory-place summary::-webkit-details-marker { display: none; }
.inventory-place[open] summary {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 0;
}
.inventory-place .card {
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 0;
}

.tabs-wrap {
  flex-wrap: wrap;
  overflow: visible;
}
.tabs-wrap .tab-link { flex: 1 1 auto; }

.stacked-actions { display: grid; gap: 8px; margin-bottom: 12px; }
.stacked-actions .btn { margin-bottom: 0; }
