/* =====================================================================
   Panel ARAS — wygląd
   Czerń logo ARAS na akcje i nagłówki, róż satyny baletek na zaznaczenia,
   chłodna jasna szarość jako tło. Kolory statusów tylko dla stanów.
   ===================================================================== */

@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/Barlow-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("/fonts/BarlowSemiCondensed-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("/fonts/BarlowSemiCondensed-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("/fonts/BarlowSemiCondensed-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  /* marka */
  --ink: #231f20;          /* czerń logo ARAS — akcje, nagłówki */
  --ink-2: #3b3638;
  --blush: #f6e3e6;        /* róż satyny baletek — zaznaczenie, aktywne menu */
  --blush-line: #e9c4cb;
  --rose: #b0435a;         /* liczniki, nowe, fokus */
  --rose-soft: #fbeff1;
  /* powierzchnie */
  --bg: #f2f2f4;
  --panel: #ffffff;
  --sunk: #f7f7f9;
  --line: #e4e4e9;
  --line-2: #cfcfd7;
  --text: #231f20;
  --muted: #6c6a72;
  /* stany */
  --ok: #1e7b4f;   --ok-soft: #e6f4ec;   --ok-line: #b5dcc6;
  --warn: #965a00; --warn-soft: #fcf1dc; --warn-line: #ecd29c;
  --bad: #bd2e2e;  --bad-soft: #fcebeb;  --bad-line: #f1c4c4;
  --info: #2f5da8; --info-soft: #eaf0fb; --info-line: #c6d6f1;
  /* zgodność ze starszymi nazwami w kodzie */
  --accent: var(--ink);
  --accent-soft: var(--blush);
  /* kształt */
  --r-lg: 14px; --r: 10px; --r-sm: 7px;
  --radius: var(--r-lg);
  --shadow: 0 1px 2px rgba(35,31,32,.05);
  --lift: 0 12px 32px rgba(35,31,32,.16), 0 2px 6px rgba(35,31,32,.06);
  --side-w: 228px;

  font-family: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); text-underline-offset: 2px; }
h1, h2, h3 { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; letter-spacing: .005em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===================== szkielet: menu boczne + treść ===================== */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100%; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; padding: 18px 12px 12px;
}
.brand { display: flex; align-items: center; }
.brand-btn { border: 0; background: none; padding: 4px 8px 14px; cursor: pointer; border-radius: var(--r-sm); }
.brand-btn:hover .brand-logo { opacity: .78; }
.brand-logo { height: 46px; width: auto; display: block; }
.tabs { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.tabs button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 0; background: none; cursor: pointer; color: var(--muted);
  padding: 9px 10px; border-radius: var(--r); font-size: 15px; font-weight: 500; position: relative;
}
.tabs button svg { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button .lbl { flex: 1; white-space: nowrap; }
.tabs button:hover { background: var(--sunk); color: var(--text); }
.tabs button.active { background: var(--blush); color: var(--ink); font-weight: 600; }
.tabs button.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ink); }
.tabs .sep { height: 1px; background: var(--line); margin: 10px 6px; flex-shrink: 0; }
.badge {
  background: var(--rose); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700;
  min-width: 22px; padding: 1px 7px; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums;
}
.badge:empty { display: none; }
.tabs button.active .badge { background: var(--ink); }

.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; height: 60px; flex-shrink: 0;
  padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 24px; font-weight: 600; line-height: 1; }
.sync { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; flex-shrink: 0; }
.dot.bad { background: var(--bad); }
.dot.spin { background: var(--rose); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
#syncnow { font-size: 17px; line-height: 1; padding: 6px 8px; }

.banner { padding: 10px 24px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-line); font-size: 14px; }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.banner a, .banner button.linkish { color: inherit; font-weight: 600; }

main { flex: 1; min-height: 0; display: flex; }
.empty { margin: auto; color: var(--muted); text-align: center; padding: 48px 24px; max-width: 420px; }

/* ===================== przyciski i pola ===================== */
.btn {
  border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--r-sm);
  padding: 8px 14px; cursor: pointer; white-space: nowrap; font-weight: 500; color: var(--text);
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { padding: 5px 10px; font-size: 13.5px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 5px 7px; border-radius: var(--r-sm); color: var(--muted); }
.icon-btn:hover { background: var(--sunk); color: var(--text); }
.link { border: 0; background: none; color: var(--info); font-weight: 600; cursor: pointer; padding: 0 4px; text-decoration: underline; }
input[type=search], input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 11px; background: var(--panel); min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--blush); }
textarea { resize: vertical; width: 100%; }
input[type=checkbox] { accent-color: var(--ink); }

/* ===================== listy + szczegóły ===================== */
.split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; flex: 1; min-height: 0; }
.list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.detail-pane { overflow-y: auto; min-height: 0; padding: 24px 28px 48px; }
.toolbar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: center; background: var(--panel); }
.toolbar input[type=search] { flex: 1 1 180px; }
.toolbar.sticky { position: sticky; top: 0; z-index: 2; }
.list { overflow-y: auto; flex: 1; }
.list-foot { padding: 10px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

.row {
  display: flex; gap: 12px; width: 100%; text-align: left; border: 0; background: none;
  padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start;
}
.row:hover { background: var(--sunk); }
.row.selected { background: var(--blush); box-shadow: inset 3px 0 var(--ink); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 2px; }
.row-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.row.unread .row-title::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--rose); border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sunk); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; color: var(--muted); flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.thumb { width: 52px; height: 52px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); flex-shrink: 0; }

.pill { display: inline-block; font-size: 12.5px; padding: 1px 9px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; font-weight: 600; border: 1px solid var(--line); line-height: 1.6; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.pill.info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.pill.accent { background: var(--rose-soft); color: var(--rose); border-color: var(--blush-line); }

.back { display: none; margin-bottom: 12px; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head h2 { margin: 0 0 2px; font-size: 26px; font-weight: 600; line-height: 1.15; }
.detail-head .grow { flex: 1; min-width: 200px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; color: var(--text); }
.card p { margin: 3px 0; }
.card.note { background: var(--warn-soft); border-color: var(--warn-line); }
table.items { width: 100%; border-collapse: collapse; }
table.items th, table.items td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.items th { font-size: 13px; color: var(--muted); font-weight: 600; }
table.items td.num, table.items th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.items tfoot td { font-weight: 700; border-bottom: 0; }
.status-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===================== rozmowy ===================== */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chat-head .grow { flex: 1; min-width: 160px; }
.chat-orders { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chat-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(640px, 85%); padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--panel); border: 1px solid var(--line); }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--blush); border-color: var(--blush-line); border-radius: 16px 16px 4px 16px; }
.msg.admin { align-self: center; background: var(--info-soft); border-color: var(--info-line); border-radius: 12px; }
.msg .meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.msg .subj { font-weight: 600; margin-bottom: 4px; }
.msg .att { font-size: 13px; margin-top: 6px; color: var(--muted); }
.chat-reply { border-top: 1px solid var(--line); background: var(--panel); padding: 14px 24px; display: flex; flex-direction: column; gap: 8px; }
.chat-reply .row2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-reply .row2 input { width: 180px; }
.chat-reply .row2 .grow { flex: 1; }
.chat-reply .row2 select { max-width: 340px; }
.detail-pane.chat-pane { padding: 0; overflow: hidden; }

/* ===================== asortyment ===================== */
.offers-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.offers-wrap .list { padding: 0; }
.offer-row { display: grid; grid-template-columns: 60px 1fr 110px 90px 90px 120px; gap: 12px; align-items: center; padding: 9px 20px; border-bottom: 1px solid var(--line); }
.offer-row:hover { background: var(--sunk); }
.offer-row.head { font-size: 13px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.offer-row.head:hover { background: var(--panel); }
.offer-row .name { font-weight: 500; }
.offer-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.low { color: var(--bad); font-weight: 700; }

/* ===================== ustawienia ===================== */
.settings { max-width: 820px; margin: 0 auto; padding: 24px 20px 64px; width: 100%; overflow-y: auto; }
.settings > h2 { display: none; }
.settings > p.muted { margin-top: 0; }
.settings .card { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
.code-box { font-family: "Barlow Semi Condensed", sans-serif; font-size: 32px; font-weight: 700; letter-spacing: .14em; background: var(--blush); color: var(--ink); padding: 8px 18px; border-radius: var(--r); display: inline-block; margin: 6px 0; }
.lan { font-family: "Barlow Semi Condensed", sans-serif; font-size: 24px; font-weight: 700; user-select: all; }
ol.steps { padding-left: 20px; margin: 6px 0; }
ol.steps li { margin: 5px 0; }
.print-box { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.print-box ol { margin: 6px 0 0; padding-left: 18px; }
.ok-t { color: var(--ok); font-weight: 600; }
.warn-t { color: var(--warn); }
.warn-box { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--r-sm); padding: 9px 12px; margin: 6px 0; }
.warn-box code { background: #fff; padding: 1px 5px; border-radius: 4px; }
.pkg-row { display: grid; grid-template-columns: 1fr 70px 70px 70px 70px 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.pkg-row.head { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.pkg-row input { width: 100%; }
.rule-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.rule-row .rc { width: 140px; } .rule-row .rmin, .rule-row .rmax { width: 70px; }
.wh-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wh-name { font-weight: 500; }
.wh-place { font-size: 13px; font-weight: 700; white-space: nowrap; }
.wh-place.other { color: var(--rose); } .wh-place.unknown { color: var(--warn); } .wh-place.main { color: var(--ok); }
.wh-row select { max-width: 220px; }

.side-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 12px 6px 2px; margin-top: 8px; }
.sf-user { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.sf-user b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
#login.overlay { place-items: center; padding: 16px; }
#login .login-card { align-self: center; height: auto; }
.login-logo { height: 52px; width: auto; align-self: flex-start; margin-bottom: 4px; }
.login-card input.pw { font-size: 17px; text-align: left; letter-spacing: 0; }
.login-card #lname { font-size: 17px; text-align: left; letter-spacing: 0; }
#my-acc .dims label, #uform label { flex-direction: column; align-items: flex-start; }
#my-acc .dims input, #uform input[type=text], #uform input[type=password] { width: 200px; }
#uform .chk { flex-direction: row; align-items: center; align-self: flex-end; padding-bottom: 9px; }
#uform .chk input { width: auto; }
#my-acc .dims, #uform { align-items: flex-end; }

details.fold > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding-right: 30px; position: relative; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { margin: 0; }
details.fold > summary::after { content: ""; position: absolute; right: 4px; top: 6px; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); top: 10px; }
details.fold[open] > summary { margin-bottom: 10px; }

/* ===================== nakładki ===================== */
.overlay { position: fixed; inset: 0; background: rgba(35,31,32,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; padding: 28px; box-shadow: var(--lift); }
.login-card h2 { margin: 0; font-size: 26px; }
.login-card input { font-size: 24px; text-align: center; letter-spacing: .25em; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(140px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r); transition: transform .22s; z-index: 60; max-width: 90vw; box-shadow: var(--lift); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }

.modal { background: var(--panel); border-radius: 18px; width: 100%; max-width: 900px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--lift); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.modal-head h2 { margin: 0; font-size: 26px; font-weight: 600; }
.modal-tools { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; padding: 6px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-body { overflow-y: auto; padding: 10px 22px; flex: 1; background: var(--sunk); }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot > .grow { min-width: 200px; }
.modal-foot .pill { margin-top: 4px; }
#pm-msgs > * { margin-top: 4px; }
.tg { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ===================== pakowanie ===================== */
.pack { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pack-body { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 40px; }
.qlist { background: var(--panel); }
.qrow { display: flex; gap: 14px; align-items: flex-start; padding: 13px 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qrow:hover { background: var(--sunk); }
.qrow.on { background: var(--blush); }
.qcheck { display: flex; align-items: center; padding-top: 2px; }
.qcheck input { width: 20px; height: 20px; cursor: pointer; }
.qmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.qhead { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.qitems, .pm-items { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 14.5px; }
.pm-order { display: flex; gap: 14px; align-items: flex-start; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 10px 0; transition: background .15s, border-color .15s; }
.pm-order.ok { border-color: var(--ok-line); background: var(--ok-soft); }
.pm-order.done { opacity: .82; }
.pm-order.fail { border-color: var(--bad-line); background: var(--bad-soft); }
.pm-left { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 78px; flex-shrink: 0; }
.pm-one { width: 100%; }
.pm-check { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); cursor: pointer; padding-top: 2px; }
.pm-check input { width: 26px; height: 26px; accent-color: var(--ok); cursor: pointer; }
.pm-note { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 5px 9px; font-size: 14px; margin: 4px 0; }
.pm-ship { width: 270px; display: flex; flex-direction: column; gap: 6px; }
.pm-ship select { width: 100%; }
.pm-res { min-height: 1.2em; }
.pm-items { flex-direction: column; gap: 6px; margin: 6px 0; }
.pm-item { display: flex; align-items: center; gap: 10px; }
.pm-item img { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); }
.ship-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.waybill { font-family: Consolas, ui-monospace, monospace; font-size: 15px; letter-spacing: .02em; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: var(--r); padding: 7px 12px; cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--blush); box-shadow: inset 0 0 0 1px var(--ink); }
.dims { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.dims label { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--muted); }
.dims input { width: 72px; }
.ho-seg { display: inline-flex; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; gap: 2px; }
.ho-seg button { border: 0; background: none; padding: 5px 11px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); font-size: 14px; white-space: nowrap; }
.ho-seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(35,31,32,.12); }
.ho-seg button:disabled { cursor: default; }
.pm-ship .ho-seg { align-self: stretch; }
.pm-ship .ho-seg button { flex: 1; }
.pickup-row { background: var(--info-soft); color: var(--info); }
.pickup-row input[type=date] { padding: 5px 8px; }

/* produkty: zdjęcia, SKU, linki */
.pimg-stack, .qimg-stack { position: relative; display: flex; flex-shrink: 0; }
.pimg, .qimg { width: 52px; height: 52px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); flex-shrink: 0; }
.qimg { width: 64px; height: 64px; }
.pimg-stack .pimg + .pimg, .qimg-stack .qimg + .qimg { margin-left: -30px; box-shadow: -2px 0 0 #fff; }
.pimg.empty-img, .qimg.empty-img { background: var(--sunk); }
.pimg.sm { width: 36px; height: 36px; }
.pimg-stack .more, .qimg-stack .more { position: absolute; right: -4px; bottom: -4px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; }
.prod { display: flex; gap: 12px; align-items: center; }
.prod-img { width: 64px; height: 64px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); flex-shrink: 0; display: block; }
.sku { display: inline-block; font-family: Consolas, ui-monospace, monospace; font-size: 12.5px; font-weight: 700; background: var(--sunk); border: 1px solid var(--line); color: var(--ink); border-radius: 5px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }
.sku.none { font-family: inherit; font-weight: 500; color: var(--muted); }
.offer-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--line-2); }
.offer-link:hover { color: var(--rose); border-bottom-color: var(--rose); }
.offer-link .ext { font-size: 12px; color: var(--rose); }

/* inny pokój (magazyny) */
.room-box { border: 2px solid var(--rose); background: var(--rose-soft); border-radius: var(--r-lg); padding: 14px 16px; margin: 8px 0 12px; }
.room-box.ok { border: 1px solid var(--ok-line); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.room-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 17px; margin-bottom: 6px; }
.room-list { display: flex; flex-direction: column; }
.room-item { display: grid; grid-template-columns: 44px 70px 1fr; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px dashed var(--blush-line); }
.room-item:first-child { border-top: 0; }
.room-item img, .room-item > span:first-child { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--line); }
.room-q { font-family: "Barlow Semi Condensed", sans-serif; font-size: 24px; font-weight: 700; }
.room-size { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; border-radius: 6px; padding: 0 7px; margin-left: 4px; }
.room-item.unk { background: var(--warn-soft); }
.room-strip { background: var(--rose-soft); border-bottom: 1px solid var(--blush-line); padding: 9px 20px; font-size: 14px; color: var(--rose); }

/* ===================== start ===================== */
.start { flex: 1; overflow-y: auto; min-height: 0; }
.st-wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; }
.kpi:first-child { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi:first-child .k-title, .kpi:first-child .k-unit, .kpi:first-child .muted { color: #c9c4c6; }
.kpi:first-child .chg.up { color: #8fdcb3; } .kpi:first-child .chg.down { color: #f2a3a3; }
.k-title { font-size: 15px; color: var(--muted); font-weight: 600; }
.k-val { font-family: "Barlow Semi Condensed", sans-serif; font-size: 58px; font-weight: 700; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.k-unit { font-family: "Barlow", sans-serif; font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.k-rev { font-size: 16px; font-weight: 600; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.kd { font-size: 13px; }
.chg { font-weight: 700; }
.chg.up { color: var(--ok); }
.chg.down { color: var(--bad); }
.chg.flat { color: var(--muted); }
.st-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.st-side { display: flex; flex-direction: column; gap: 12px; }
.c-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.c-head h3, .st-side h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.st-side h3 { margin-bottom: 10px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.cur { background: var(--ink); }
.sw.ly { background: #cfcfd7; }
.chart { width: 100%; overflow: hidden; }
.chart svg { display: block; }
.chart .grid { stroke: #ececf0; stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11.5px; font-family: "Barlow", sans-serif; }
.chart .b-cur { fill: var(--ink); }
.chart .b-ly { fill: #cfcfd7; }
.chart .b-cur.today { fill: var(--rose); }
.chart .hov.b-cur { fill: #5a5357; }
.chart .hov.b-ly { fill: #a9a9b3; }
.tip { position: fixed; display: none; z-index: 70; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.5; padding: 8px 11px; border-radius: var(--r-sm); pointer-events: none; box-shadow: var(--lift); }
.tip .muted { color: #c9c4c6; }
.tip .sw.ly { background: #8d8a93; } .tip .sw.cur { background: #fff; }
.mini { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.m-num { font-family: "Barlow Semi Condensed", sans-serif; font-size: 34px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.link-card { cursor: pointer; font: inherit; color: inherit; transition: border-color .12s; }
.link-card:hover { border-color: var(--ink); }
table.toptbl { width: 100%; border-collapse: collapse; }
table.toptbl th { font-size: 13px; color: var(--muted); text-align: left; font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
table.toptbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.toptbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.toptbl .rank { font-family: "Barlow Semi Condensed", sans-serif; color: var(--muted); font-weight: 700; font-size: 18px; width: 28px; }
.qbar { height: 4px; background: #ececf0; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.qbar span { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.low-row { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.low-row:last-child { border-bottom: 0; }
.meth { margin-bottom: 10px; font-size: 14px; }
.meth-l { display: flex; justify-content: space-between; gap: 8px; }
.hint-bar { padding: 10px 24px; background: var(--info-soft); color: var(--info); font-size: 14px; border-bottom: 1px solid var(--info-line); }

/* ===================== reklamacje i zwroty ===================== */
.iss-ico { display: grid; place-items: center; font-size: 22px; }
.iss-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.iss-desc { white-space: pre-wrap; background: var(--sunk); border-radius: var(--r-sm); padding: 8px 11px; }
.att-link { display: inline-block; font-size: 13.5px; margin: 2px 8px 2px 0; }
.decide { border-top: 1px solid var(--warn-line); background: var(--warn-soft); padding: 12px 24px; display: flex; flex-direction: column; gap: 6px; }
.dec-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dec-row select { flex: 1; min-width: 220px; }
.file-btn { cursor: pointer; }
.inv { display: inline-block; font-size: 12.5px; font-weight: 700; border-radius: 6px; padding: 0 8px; white-space: nowrap; line-height: 1.6; }
.inv-yes { background: var(--rose-soft); color: var(--rose); border: 1px solid var(--blush-line); }
.inv-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.inv-no, .inv-unk { background: var(--sunk); color: var(--muted); font-weight: 500; border: 1px solid var(--line); }
.inv-box { border-radius: var(--r-lg); padding: 14px 18px; font-size: 15px; border: 2px solid; }
.inv-box .inv-h { font-family: "Barlow Semi Condensed", sans-serif; font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.inv-box.yes { background: var(--rose-soft); border-color: var(--rose); color: #7d2537; }
.inv-box.warn { background: var(--warn-soft); border-color: #dcae55; color: var(--warn); }
.inv-box.no, .inv-box.unk { background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.ret-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ret-item:last-child { border-bottom: 0; }
.ret-item .num { font-weight: 600; white-space: nowrap; }
.link-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: var(--r-lg); padding: 11px 16px; margin-bottom: 10px; border: 1px solid; }
.link-banner.ret { background: var(--rose-soft); border-color: var(--blush-line); }
.link-banner.iss { background: var(--bad-soft); border-color: var(--bad-line); }

/* ===================== oceny ===================== */
.rat { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.rat .toolbar input[type=search] { width: 260px; flex: 0 1 260px; }
.rat-body { flex: 1; overflow-y: auto; min-height: 0; }
.rat-wrap { max-width: 1040px; margin: 0 auto; padding: 20px 24px 56px; display: flex; flex-direction: column; gap: 12px; }
.rat-kpis { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.rat-kpis .kpi { gap: 6px; text-align: left; }
.rat-kpis .rat-main { background: var(--ink); color: #fff; border-color: var(--ink); }
.rat-kpis .rat-main .k-title, .rat-kpis .rat-main .k-unit, .rat-kpis .rat-main .kd { color: #c9c4c6; }
.rat-kpis .rat-main .stars { color: #5b5557; }
.rat-kpis .rat-main .stars-on { color: #fff; }
.rat-split { display: flex; gap: 22px; align-items: baseline; }
.rat-split span { color: var(--muted); }
.rat-split .m-num { color: var(--text); margin-right: 4px; }
.neg-t, .rat-split .m-num.neg-t, .m-num.neg-t { color: var(--bad); }
.rate { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r-lg); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.rate.neg { border-left-color: var(--bad); }
.rate.pos { border-left-color: var(--ok); }
.rate.is-new { box-shadow: 0 0 0 2px var(--blush-line); }
.rate-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rate-comment { font-size: 15.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rate-prods { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.rate-prod { display: flex; gap: 8px; align-items: center; }
.rate-answer { background: var(--blush); border-radius: var(--r); padding: 9px 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.rate-reply { display: flex; flex-direction: column; gap: 6px; }
.cnt.low { color: var(--bad); font-weight: 700; }
.rate > .link { align-self: flex-start; padding: 0; }
.rate > .pill { align-self: flex-start; }
.rate-rm summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.rate-rm summary:hover { color: var(--text); }
.rate-rm[open] { background: var(--sunk); border-radius: var(--r); padding: 10px 12px; }
.rate-rm textarea { margin-top: 8px; }
.stars { position: relative; display: inline-block; width: max-content; align-self: flex-start; font-size: 15px; line-height: 1; color: #d6d6dd; letter-spacing: 1px; white-space: nowrap; }
.stars::before { content: "★★★★★"; }
.stars-on { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--ink); }
.stars-on::before { content: "★★★★★"; }
.rstar { color: var(--ink); font-weight: 700; }
.sizebar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: #ececf0; margin: 6px 0 2px; }
.sizebar span { display: block; height: 100%; }
.sizebar .s-fit { background: var(--ink); }
.sizebar .s-small, .sizebar .s-big { background: #dcae55; }
.pr-list { padding: 0; overflow: hidden; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 190px 170px; gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pr-row:last-child { border-bottom: 0; }
.pr-row.has-low { background: var(--bad-soft); }
.pr-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.pr-avg { display: flex; flex-direction: column; gap: 3px; }
.pr-avg .m-num { font-size: 30px; }
.pr-dist { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.dist-r { display: grid; grid-template-columns: 22px 1fr 28px; gap: 6px; align-items: center; }
.dbar { height: 6px; background: #ececf0; border-radius: 4px; overflow: hidden; }
.dbar span { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.dbar span.lowbar { background: var(--bad); }
.dn { text-align: right; font-variant-numeric: tabular-nums; }
.pr-size { font-size: 13px; display: flex; flex-direction: column; gap: 2px; }

/* ===================== faktury ===================== */
.fk-n { color: var(--muted); font-weight: 500; }
.ho-seg button.on .fk-n { color: var(--ink); }
.fk-row { align-items: center; }
.fk-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; max-width: 52%; }
.fk-st { font-size: 13px; padding: 5px 8px; max-width: 220px; }
.fk-num { font-family: "Barlow Semi Condensed", sans-serif; font-weight: 700; font-size: 17px; }
.fk-confirm { flex-basis: 100%; }
.fk-order { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fk-order .fk-confirm { margin-top: 8px; }
.amount { color: var(--text); }

/* ===================== telefon / wąski ekran ===================== */
@media (max-width: 1100px) {
  :root { --side-w: 76px; }
  .side { padding: 14px 8px; align-items: center; }
  .brand-btn { padding: 0 0 12px; }
  .brand-logo { height: 24px; }
  .tabs button { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; text-align: center; }
  .tabs button .lbl { flex: none; }
  .tabs button .badge { position: absolute; top: 2px; right: 4px; font-size: 10.5px; min-width: 18px; padding: 0 5px; }
  .tabs button.active::before { left: -8px; }
  .side-foot { flex-direction: column; padding: 10px 0 0; } .sf-user { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side { min-width: 0; }
  .side { flex-direction: row; align-items: center; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  .brand-btn { padding: 0 4px; }
  .brand-logo { height: 26px; }
  .tabs { flex-direction: row; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .tabs .sep { display: none; }
  .side-foot { display: none !important; }
  .tabs button { width: auto; padding: 6px 9px; flex-shrink: 0; }
  .tabs button.active::before { display: none; }
  .topbar { height: 48px; padding: 0 14px; }
  .topbar h1 { font-size: 20px; }
  .sync-txt { display: none; }
  .split { grid-template-columns: 1fr; }
  .split .detail-pane { display: none; }
  .split.has-detail .list-pane { display: none; }
  .split.has-detail .detail-pane { display: block; }
  .split.has-detail .detail-pane.chat-pane { display: flex; flex-direction: column; }
  .back { display: inline-block; }
  .chat-head .back { margin: 0; }
  .detail-pane { padding: 16px 14px 40px; }
  .offer-row { grid-template-columns: 44px 1fr 74px 54px; gap: 8px; padding: 8px 12px; }
  .offer-row .thumb { width: 44px; height: 44px; }
  .offer-row .hide-m { display: none; }
  .chat-reply .row2 input { width: 120px; }
  .qrow { padding: 10px 12px; }
  .overlay { padding: 0; place-items: stretch; }
  .modal { max-height: 100vh; border-radius: 0; }
  .pm-order { flex-wrap: wrap; }
  .pm-ship { width: 100%; }
  .modal-foot #pm-info, .modal-foot > .grow { flex-basis: 100%; }
  .pkg-row { grid-template-columns: 1fr 52px 52px 52px 52px 26px; }
  .fk-row { flex-wrap: wrap; } .fk-side { max-width: none; flex-basis: 100%; justify-content: flex-start; padding-left: 34px; }
  #fk-st { overflow-x: auto; flex: 1 1 100%; min-width: 0; scrollbar-width: none; } #fk-st button { white-space: nowrap; flex: 0 0 auto; }
  .pack .toolbar .grow { display: none; }
  .qimg { width: 48px; height: 48px; } .prod-img { width: 48px; height: 48px; }
}
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, 1fr); } .st-grid { grid-template-columns: 1fr; }
  .rat-kpis { grid-template-columns: 1fr 1fr; } .rat-kpis .rat-main { grid-column: 1 / -1; }
  .pr-row { grid-template-columns: minmax(0, 1fr) 110px; } .pr-dist, .pr-size { grid-column: span 1; } }
@media (max-width: 820px) { .rat .toolbar input[type=search] { flex: 1 1 100%; width: auto; } .rat .toolbar .grow { display: none; } .rat-wrap { padding: 12px; } }
@media (max-width: 520px) { .rat-kpis { grid-template-columns: 1fr; } .pr-row { grid-template-columns: 1fr 1fr; gap: 10px 14px; } .pr-row .prod { grid-column: 1 / -1; } }
@media (max-width: 520px) { .k-val { font-size: 42px; } .st-wrap { padding: 12px; } .kpi { padding: 14px; } }
