/* ============================================================
   Analiza rotacji — ciemny motyw, komputer + tablet
   ============================================================ */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --bg: #0e131a;
  --bg-2: #121821;
  --card: #1a222c;
  --card-2: #151c25;
  --card-3: #202a36;
  --ink: #e6edf3;
  --muted: #9aa7b4;
  --muted-2: #77828f;
  --line: #2a3542;
  --line-soft: #222c37;
  --gold: #c9a227;
  --gold-2: #e0b93a;
  --gold-ink: #14181d;
  --ok: #3fb950;
  --ok-bg: rgba(63, 185, 80, .14);
  --miss: #f85149;
  --miss-bg: rgba(248, 81, 73, .14);
  --extra: #d29922;
  --extra-bg: rgba(210, 153, 34, .16);
  --info: #58a6ff;
  --info-bg: rgba(88, 166, 255, .13);
  --pend: #8b949e;
  --pend-bg: rgba(139, 148, 158, .15);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .25);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .3);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(201, 162, 39, .08), transparent 60%),
    radial-gradient(900px 450px at 0% 0%, rgba(63, 185, 80, .05), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(22px, 3vw, 30px); line-height: 1.15; margin-bottom: 6px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin-bottom: 8px; }
h3 { font-size: 15px; margin-bottom: 8px; }
a { color: var(--gold-2); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 16, 22, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold-2), #a9861b);
  color: #151a20;
  box-shadow: 0 3px 12px rgba(201, 162, 39, .28);
  flex: 0 0 auto;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.sync {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 185, 80, .12); }
.sync.off { color: var(--miss); border-color: rgba(248, 81, 73, .4); }
.sync.off .dot { background: var(--miss); box-shadow: 0 0 0 3px rgba(248, 81, 73, .12); }

.icon-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { border-color: #465568; background: rgba(255, 255, 255, .05); }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  min-width: 230px;
  background: #1c2531;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 60;
}
.menu button, .menu form button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.menu button:hover, .menu form button:hover { background: rgba(255, 255, 255, .06); }
.menu .menu-danger { color: var(--miss); }
.menu form { margin: 0; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 4px; }

/* ---------- layout ---------- */
.app-main { max-width: 1240px; margin: 0 auto; padding: 24px 18px 90px; }
.boot { display: grid; place-items: center; gap: 10px; padding: 70px 0; color: var(--muted); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-2);
  margin-bottom: 4px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent 60%), var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 18px; }
.section { margin-bottom: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

/* ---------- przyciski / pola ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: #465568; background: rgba(255, 255, 255, .06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-ghost { background: rgba(255, 255, 255, .03); }
.btn-danger-ghost { background: transparent; color: var(--miss); border-color: rgba(248, 81, 73, .35); }
.btn-danger-ghost:hover { background: var(--miss-bg); }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { min-height: 47px; padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .select {
  min-height: 42px;
  width: 100%;
  padding: 9px 11px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.field input:focus, .field select:focus, .select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, .14);
}
.field input::placeholder { color: var(--muted-2); }

/* ciemne listy rozwijane (zamiast białych systemowych) */
select {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239aa7b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 11px 7px;
  padding-right: 32px !important;
  color: var(--ink);
  cursor: pointer;
}
select:hover { border-color: #465568; }
select:disabled { opacity: .55; cursor: not-allowed; }
select option,
select optgroup {
  background: #1a222c;
  color: var(--ink);
}
select optgroup { font-style: normal; font-weight: 700; color: var(--muted); }
input[type="date"], input[type="datetime-local"], input[type="time"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.72); cursor: pointer; }
input[type="number"] { color-scheme: dark; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- historia ---------- */
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.hist-card { position: relative; padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; }
.hist-card:hover { border-color: #43536a; transform: translateY(-1px); }
.hist-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hist-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; word-break: break-word; }
.hist-date { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.hist-files { color: var(--muted); font-size: 12px; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-stats { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.hist-stat b { display: block; font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hist-stat small { color: var(--muted); font-size: 11px; }
.hist-del {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 0;
  background: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 15px;
  padding: 5px 7px;
  border-radius: 7px;
}
.hist-del:hover { color: var(--miss); background: var(--miss-bg); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-icon { font-size: 40px; margin-bottom: 8px; opacity: .7; }

/* ---------- kreator ---------- */
.wizard { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.wizard .step-card { overflow: hidden; }
.step-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 0; }
.step-num {
  width: 28px; height: 28px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 700; font-size: 14px;
}
.step-head h2 { font-size: 16px; margin: 1px 0 2px; }
.step-head p { margin: 0; font-size: 13px; color: var(--muted); }
.step-body { padding: 14px 18px 18px; }

.dropzone {
  border: 1.5px dashed #3b4a5e;
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, .015);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: rgba(201, 162, 39, .06); }
.dropzone:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .18); }
.dropzone.filled { border-style: solid; border-color: rgba(63, 185, 80, .45); background: rgba(63, 185, 80, .05); }
.dropzone .dz-icon { font-size: 26px; margin-bottom: 4px; opacity: .8; }
.dropzone .dz-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.dropzone .dz-hint { font-size: 12px; color: var(--muted); }
.dropzone .dz-file { font-size: 13px; color: var(--ok); font-weight: 600; word-break: break-all; }
.dz-actions { margin-top: 10px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

.mapping { margin-top: 14px; }
.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.map-row { display: flex; flex-direction: column; gap: 4px; }
.map-row > span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.map-row select { min-height: 36px; font-size: 13px; padding: 6px 8px; }
.map-row.req > span::after { content: " *"; color: var(--gold-2); }
.mapping-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.map-extra { margin-top: 8px; }
.map-extra summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 4px 0; user-select: none; }
.map-extra summary:hover { color: var(--ink); }
.map-extra .mapping-grid { margin-top: 6px; }

.sample-wrap { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 180px; }
.sample-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.sample-table th { background: var(--card-3); color: var(--muted); text-align: left; padding: 7px 9px; position: sticky; top: 0; font-weight: 600; white-space: nowrap; }
.sample-table td { padding: 6px 9px; border-top: 1px solid var(--line-soft); white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.sample-table tr.hl td { background: rgba(201, 162, 39, .07); }

.options-card { margin-top: 16px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.opt-grid .field { margin-bottom: 0; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-opt {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-2);
  min-height: 42px;
}
.radio-opt input { accent-color: var(--gold); }
.radio-opt input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}
.radio-opt input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
}
.radio-opt.active { border-color: rgba(201, 162, 39, .6); background: rgba(201, 162, 39, .08); }
.radio-opt small { color: var(--muted); display: block; font-size: 11px; }

.compare-bar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.compare-bar .ready { font-size: 13px; color: var(--muted); }
.compare-bar .ready b { color: var(--ok); }

/* ---------- KPI ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  position: relative;
  overflow: hidden;
}
.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: clamp(20px, 2.4vw, 27px);
  font-weight: 700;
  line-height: 1.15;
  margin-top: 4px;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-hint { color: var(--muted); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.ok .stat-value { color: var(--ok); }
.stat.extra .stat-value { color: var(--extra); }
.stat.missing .stat-value { color: var(--miss); }
.stat.gold .stat-value { color: var(--gold-2); }
.stat.info .stat-value { color: var(--info); }
.stat .mini-bar { height: 5px; border-radius: 999px; background: var(--line); margin-top: 8px; overflow: hidden; }
.stat .mini-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2f9e44, #51cf66); }

/* ---------- taby / filtry ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--gold-2); border-bottom-color: var(--gold); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.search-box { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-box input { width: 100%; min-height: 40px; padding: 9px 12px 9px 36px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font: inherit; font-size: 14px; }
.search-box input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .14); }
.search-box::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 18px; }
.toolbar select { min-height: 40px; max-width: 210px; }
.dir-btn { min-height: 40px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.chip b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.chip:hover { border-color: #465568; color: var(--ink); }
.chip.active { background: var(--extra-bg); border-color: rgba(201, 162, 39, .5); color: var(--gold-2); }
.chip.active b { color: var(--gold-2); }
.chip.miss.active { background: var(--miss-bg); border-color: rgba(248, 81, 73, .45); color: var(--miss); }
.chip.miss.active b { color: var(--miss); }
.chip.ok.active { background: var(--ok-bg); border-color: rgba(63, 185, 80, .45); color: var(--ok); }
.chip.ok.active b { color: var(--ok); }

/* ---------- tabela ---------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 70vh;
  background: var(--card-2);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #202a36;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { color: var(--ink); }
.data-table thead th .arrow { color: var(--gold-2); margin-left: 4px; font-size: 10px; }
.data-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.data-table tbody tr.row { cursor: pointer; }
.data-table tbody tr.row:hover td { background: rgba(255, 255, 255, .025); }
.data-table tbody tr.expanded td { background: rgba(201, 162, 39, .05); }
.data-table .cell-index { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.data-table .cell-name { max-width: 380px; }
.name-text { display: block; color: var(--ink); }
.name-meta { display: block; color: var(--muted-2); font-size: 11.5px; margin-top: 2px; }
.cell-qty { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.cell-qty small { color: var(--muted); font-weight: 400; margin-left: 3px; }
.cell-locs { min-width: 230px; }
.locs { display: flex; flex-wrap: wrap; gap: 4px; }
.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--ink);
  white-space: nowrap;
}
.loc-chip b { color: var(--gold-2); font-weight: 600; }
.loc-chip .wh { color: var(--muted); font-size: 10px; }
.loc-more { color: var(--muted); font-size: 11.5px; padding: 2px 4px; }
.cell-status { white-space: nowrap; }
.cell-days { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.cell-days b { color: var(--ink); }
.cell-flag { color: var(--extra); font-size: 11px; margin-left: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-extra { color: var(--extra); background: var(--extra-bg); }
.badge-missing { color: var(--miss); background: var(--miss-bg); }
.badge-pending { color: var(--pend); background: var(--pend-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }

.detail-row > td { background: #121a23; padding: 14px 16px 16px !important; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-grid h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.detail-list { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.detail-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.detail-list li:last-child { border-bottom: 0; }
.detail-list .q { font-family: var(--mono); font-weight: 600; color: var(--gold-2); }
.detail-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.detail-actions { margin-top: 10px; }

.table-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.table-foot b { color: var(--ink); }

/* ---------- lokalizacje / strefy ---------- */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 10px; }
.zone-toggle { display: flex; justify-content: center; margin-bottom: 14px; }
.zone-card { padding: 13px 14px; cursor: pointer; }
.zone-card:hover { border-color: #43536a; }
.zone-card.active { border-color: rgba(201, 162, 39, .6); box-shadow: 0 0 0 1px rgba(201, 162, 39, .18); }
.zone-name { font-family: var(--mono); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.zone-name span { color: var(--gold-2); }
.zone-bar { height: 7px; border-radius: 999px; background: var(--line); margin: 9px 0 7px; overflow: hidden; }
.zone-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #b8860b, var(--gold-2)); }
.zone-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.zone-meta b { color: var(--ink); font-weight: 600; }

.loc-list { display: flex; flex-direction: column; }
.loc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.loc-row:last-child { border-bottom: 0; }
.loc-row .l-name { font-family: var(--mono); min-width: 110px; }
.loc-row .l-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.loc-row .l-bar > span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.loc-row .l-qty { min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold-2); font-weight: 600; }

/* ---------- problemy ---------- */
.issue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.issue-card { padding: 16px; }
.issue-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.issue-head h3 { margin: 0; font-size: 15px; }
.issue-count { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.issue-card p { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.issue-items { display: flex; flex-direction: column; gap: 5px; max-height: 300px; overflow: auto; }
.issue-item { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line-soft); border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.issue-item:hover { border-color: #43536a; }
.issue-item .ii-index { font-family: var(--mono); font-weight: 600; }
.issue-item .ii-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.issue-item .ii-qty { color: var(--gold-2); font-variant-numeric: tabular-nums; }

/* ---------- komunikaty ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13px;
  margin-bottom: 12px;
  border: 1px solid;
}
.alert-warn { background: var(--extra-bg); border-color: rgba(210, 153, 34, .35); color: #f0d58a; }
.alert-info { background: var(--info-bg); border-color: rgba(88, 166, 255, .3); color: #b9d7ff; }
.alert-error { background: var(--miss-bg); border-color: rgba(248, 81, 73, .35); color: #ffb4ae; }
.alert b { color: inherit; }

/* ---------- toast / overlay ---------- */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  background: #22303f;
  border: 1px solid #3a4c60;
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--miss); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(5, 8, 12, .72); backdrop-filter: blur(3px); padding: 20px; }
.overlay-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 32px; text-align: center; min-width: 240px; box-shadow: var(--shadow); }
.overlay-box p { margin: 12px 0 4px; font-weight: 600; }
.overlay-box small { color: var(--muted); }

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--gold-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: min(400px, 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 18px; }
.login-brand strong { display: block; font-size: 18px; }
.login-brand small { color: var(--muted); font-size: 12px; }
.login-card { padding: 22px; }
.login-card h1 { font-size: 21px; }
.login-error { background: var(--miss-bg); border: 1px solid rgba(248, 81, 73, .35); color: #ffb4ae; border-radius: 8px; padding: 9px 11px; font-size: 13px; }
.login-foot { text-align: center; color: var(--muted-2); font-size: 12px; margin-top: 14px; }

body.busy { cursor: progress; }
body.busy .app-main { pointer-events: none; }

/* ---------- zbiórka ---------- */
.pick-progress { padding: 14px 16px; margin-bottom: 12px; }
.pick-progress-top { display: flex; gap: 16px; align-items: center; }
.pick-percent { flex: 0 0 auto; text-align: center; min-width: 92px; }
.pick-percent b { display: block; font-size: 30px; line-height: 1; color: var(--gold-2); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pick-percent span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pick-bar-wrap { flex: 1; min-width: 0; }
.pick-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pick-bar span { display: block; height: 100%; background: linear-gradient(90deg, #2f9e44, #51cf66); border-radius: 999px; transition: width .25s; }
.pick-progress-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 7px; }
.pick-progress-meta b { color: var(--ink); }

.pick-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.pick-search { flex: 1 1 320px; }
.pick-search input { min-height: 46px; font-size: 15px; }
.pick-chips { margin-bottom: 14px; }
.pick-chip.active b { color: var(--gold-2); }

.pick-zone { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; background: var(--card-2); }
.pick-zone-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--card-3);
  border: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.pick-zone-head:hover { background: #26323f; }
.pick-zone-name { font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; color: var(--gold-2); font-weight: 700; white-space: nowrap; }
.pick-zone-meta { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.pick-chev { color: var(--muted); width: 16px; text-align: center; flex: 0 0 auto; }
.pick-zone-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; }

.pick-loc { border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; background: var(--card); }
.pick-loc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .025);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.pick-loc-name { font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.pick-loc-wh { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.pick-loc-meta { color: var(--muted); font-size: 12px; }
.pick-loc-all { margin-left: auto; }

.pick-task {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 108px 116px 128px 54px;
  grid-template-areas: "chk main plan qty pallet zero";
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
}
.pick-loc-head + .pick-task { border-top: 0; }
.pick-task.st-done { border-left-color: var(--ok); background: rgba(63, 185, 80, .035); }
.pick-task.st-partial { border-left-color: var(--extra); background: rgba(210, 153, 34, .045); }
.pick-task.st-missing { border-left-color: var(--miss); background: rgba(248, 81, 73, .045); }

.pick-check { grid-area: chk; position: relative; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; cursor: pointer; }
.pick-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick-box { width: 24px; height: 24px; border: 2px solid #465568; border-radius: 6px; display: block; position: relative; transition: background .12s, border-color .12s; }
.pick-check input:checked + .pick-box { background: var(--ok); border-color: var(--ok); }
.pick-check input:checked + .pick-box::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #10210f;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.pick-check input:focus-visible + .pick-box { box-shadow: 0 0 0 3px rgba(201, 162, 39, .28); }

.pick-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pick-index { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.pick-name { font-size: 13px; color: var(--ink); }
.pick-note { font-size: 11.5px; color: var(--extra); }
.pick-plan { grid-area: plan; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.pick-plan span { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pick-plan b { font-size: 17px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pick-plan small { color: var(--muted); font-size: 10.5px; }

.pick-field { display: flex; flex-direction: column; gap: 2px; }
.pick-field span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pick-field input {
  min-height: 36px;
  width: 100%;
  padding: 5px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.pick-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 162, 39, .15); }
.pick-field.pick-pallet input { text-transform: uppercase; }
.pick-zero {
  grid-area: zero;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(248, 81, 73, .35);
  background: transparent;
  color: var(--miss);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pick-zero:hover { background: var(--miss-bg); }

.pick-task.pick-flash { animation: pickFlash 1.8s ease-out; }
@keyframes pickFlash {
  0%, 35% { background: rgba(201, 162, 39, .22); }
  100% { background: transparent; }
}

.pick-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.pick-review { margin-top: 16px; }
.pick-review-item .badge { flex: 0 0 auto; }

/* ---------- responsywność ---------- */
@media (max-width: 900px) {
  .wizard { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .pick-task {
    grid-template-columns: 40px minmax(0, 1fr) 92px;
    grid-template-areas:
      "chk main plan"
      "chk qty zero"
      "chk pallet pallet";
    row-gap: 8px;
    padding: 10px;
  }
  .pick-check { width: 38px; height: 38px; align-self: start; }
  .pick-box { width: 26px; height: 26px; }
  .pick-zero { align-self: end; min-height: 36px; }
  .pick-zone-body { padding: 8px; }
  .pick-loc-head { gap: 8px; }
  .pick-loc-name { font-size: 15px; }
  .pick-loc-all { margin-left: 0; order: 5; }
}

@media (max-width: 760px) {
  .app-main { padding: 16px 12px 90px; }
  .topbar-inner { padding: 8px 12px; }
  .brand-text small { display: none; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 11px 12px; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 21px; }
  .mapping-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .toolbar select { max-width: none; flex: 1 1 140px; }
  .search-box { flex-basis: 100%; }

  /* tabela -> karty */
  .table-wrap { border: 0; background: none; overflow: visible; max-height: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tbody tr.row {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 9px;
    padding: 11px 13px 9px;
  }
  .data-table tbody tr.row:hover td { background: none; }
  .data-table tbody tr.expanded { border-color: rgba(201, 162, 39, .45); }
  .data-table tbody td { border: 0; padding: 2px 0; }
  .data-table tbody td::before {
    content: attr(data-label);
    float: right;
    color: var(--muted-2);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-left: 10px;
    padding-top: 2px;
  }
  .data-table td.cell-index { font-size: 15px; padding-bottom: 1px; }
  .data-table td.cell-index::before { display: none; }
  .data-table td.cell-name { max-width: none; padding-bottom: 8px; }
  .data-table td.cell-name::before { display: none; }
  .data-table td.cell-name .name-meta { font-size: 12px; }
  .data-table td.cell-qty { text-align: left; font-size: 17px; }
  .data-table td.cell-qty::before { padding-top: 6px; }
  .data-table td.cell-locs { min-width: 0; }
  .data-table td.cell-locs::before { display: none; }
  .data-table td.cell-status { padding-top: 5px; }
  .data-table td.cell-status::before { display: none; }
  .data-table td.cell-days::before { padding-top: 4px; }
  .data-table tbody tr.detail-row {
    margin: -6px 0 10px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: #131b24;
  }
  .data-table tr.detail-row > td { padding: 12px 13px !important; }
  .data-table tr.detail-row > td::before { display: none; }

  .hist-stats { gap: 10px; }
  .tabs { gap: 0; }
  .tab { padding: 10px 10px; font-size: 13px; }
  .zone-grid { grid-template-columns: 1fr 1fr; }
  .toast-wrap { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (max-width: 430px) {
  .zone-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hist-card { padding: 13px; }
  .pick-progress-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .pick-percent { display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .pick-percent b { font-size: 26px; }
  .pick-loc-all { width: 100%; order: 9; }
  .pick-review-item .ii-name { display: none; }
}

@media print {
  body { background: #fff !important; color: #111 !important; }
  .topbar, .tabs, .toolbar, .chips, .page-actions, .toast-wrap, .overlay, .compare-bar { display: none !important; }
  .app-main { max-width: none; padding: 0; }
  .card, .stat, .table-wrap, .data-table tbody tr.row { background: #fff !important; border-color: #bbb !important; box-shadow: none !important; }
  .data-table { font-size: 10px; }
  .data-table thead th { background: #eee !important; color: #111 !important; position: static; }
  .data-table tbody td { border-color: #ddd; }
  .data-table tbody tr.row { break-inside: avoid; }
  .stat-value, .zone-meta b { color: #111 !important; }
  .badge { border: 1px solid #999; color: #111 !important; background: #fff !important; }
  .loc-chip { background: #f4f4f4; color: #111; border-color: #ccc; }
  .loc-chip b { color: #111; }
  .detail-row { display: none !important; }
  a { color: #111; text-decoration: none; }
}
