:root {
  --bg: #f3f4f7; --card: #fff; --line: #e3e6ec; --text: #1f2937; --muted: #6b7280;
  --blue: #2f5bd3; --blue-soft: #e8eefc; --green: #2f855a; --red: #d93025; --orange: #c2410c;
  --radius: 10px; --side: 230px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 19px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
code { background: #f1f3f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .light { font-weight: 400; color: var(--muted); margin-left: 6px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }

/* --- pasek górny --- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 18px;
  background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -.3px; }
.brand span { color: var(--blue); } .brand:hover { text-decoration: none; }
.brand-big { font-size: 26px; text-align: center; margin-bottom: 18px; }
.search { flex: 1; max-width: 640px; }
.search input { width: 100%; height: 36px; border-radius: 18px; padding: 0 16px; border: 1px solid var(--line); background: #fafbfc; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 7px 10px; border-radius: 7px; color: var(--text); font-weight: 500; }
.topnav a:hover { background: var(--bg); text-decoration: none; }
.logout { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 600; }
.who { font-weight: 500; }

/* --- układ i menu statusów --- */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: var(--side); flex: none; background: #fff; border-right: 1px solid var(--line); padding: 10px 0; }
.side-item { display: flex; align-items: center; gap: 8px; padding: 6px 14px; color: var(--text); font-size: 13px; }
.side-item:hover { background: var(--bg); text-decoration: none; }
.side-item.active { background: #e4e7ee; font-weight: 600; }
.count { display: inline-block; min-width: 26px; padding: 0 5px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700;
  text-align: center; line-height: 18px; text-shadow: 0 0 2px rgba(0,0,0,.35); }
.count-all { background: #64748b; }
.side-add { display: block; padding: 10px 14px; margin-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.content { flex: 1; min-width: 0; padding: 18px 22px 40px; }

/* --- karty, nagłówki --- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.head-actions, .btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.card-highlight { border-color: var(--blue); background: var(--blue-soft); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cols-3 .card { margin-bottom: 14px; }
@media (max-width: 1100px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } .topnav { display: none; } }

/* --- przyciski i pola --- */
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfd5df; border-radius: 7px; padding: 6px 9px; background: #fff; }
input[type=color] { padding: 2px; width: 40px; height: 32px; }
input[type=checkbox] { width: 15px; height: 15px; vertical-align: middle; }
textarea { width: 100%; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid #c9d1de; background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f6fa; text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #2549b0; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--red); border-color: #f1c4c0; }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12px; }
form.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-label, .check { display: inline-flex; gap: 6px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.stack input { height: 38px; }

/* --- komunikaty --- */
.flash { padding: 9px 13px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash-ok { background: #ecf8f0; border-color: #b7e2c6; color: #1d6b3f; }
.flash-error { background: #fdeeed; border-color: #f4c3bf; color: #9b1c13; }

/* --- lista zamówień --- */
.filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.check-all { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; }
.pager { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: #4b5563; font-weight: 600;
  padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
th small { display: block; text-transform: none; font-weight: 400; color: var(--muted); letter-spacing: 0; }
td { padding: 9px 8px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
tbody tr:hover { background: #fafbfd; }
.num { text-align: right; }
.col-check { width: 28px; }
.order-no { font-weight: 600; }
.client { font-weight: 500; }
.client a { color: var(--text); }
.note-star { color: var(--red); font-size: 15px; margin-right: 4px; line-height: 1; }
.src { display: inline-block; background: #9aa3b2; color: #fff; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; }
.items div { margin-bottom: 2px; font-size: 12px; }
.items i { color: var(--muted); margin-right: 2px; }
.amount { border-bottom: 1px dotted #9aa3b2; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase;
  text-shadow: 0 0 2px rgba(0,0,0,.3); margin: 0 3px 3px 0; }
.badge-cancel { background: var(--red); }
.delivery { color: var(--blue); font-size: 12px; max-width: 200px; }
.icons { white-space: nowrap; }
.ico { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 3px; border-radius: 4px; font-size: 10px; font-weight: 800; color: #fff; margin-right: 2px; }
.ico-paid { background: var(--green); } .ico-unpaid { background: #c4cad4; } .ico-fv { background: #1e40af; } .ico-cod { background: var(--orange); }
.dates { white-space: nowrap; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

/* --- szczegóły zamówienia --- */
.products td, .products th { font-size: 12.5px; }
.paid-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 5px; font-weight: 700; font-size: 12px; background: #e5e7eb; color: var(--text); }
.pill-paid { background: var(--green); color: #fff; } .pill-unpaid { background: #fde2e1; color: #9b1c13; }
.pill-cod { background: #ffedd5; color: var(--orange); } .pill-fv { background: #dbe4ff; color: #1e3a8a; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 3px; background: var(--blue-soft); color: var(--blue); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid #edf0f4; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.status-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.status-row .lbl { color: var(--muted); width: 142px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.dot-blue { background: var(--blue); border-radius: 50%; width: 8px; height: 8px; }
.comment { background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--muted); }
.comment-text { white-space: pre-wrap; }
.comment-on { background: #fff5f5; border-color: #f5c2c0; color: var(--text); }
.comment-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.note-form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; margin-bottom: 6px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 5px 0; border-bottom: 1px solid #f0f2f5; }
.history .when { color: var(--muted); font-size: 12px; margin-right: 8px; }

/* --- integracje, reguły, statusy --- */
.account { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.account-warn { border-color: #f4c3bf; background: #fffafa; } .account-off { opacity: .7; }
.account-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rule-form { display: flex; flex-direction: column; gap: 10px; }
.rule-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rule-line label { display: inline-flex; gap: 6px; align-items: center; }
.kw { display: inline-block; width: 42px; font-weight: 800; color: var(--blue); }
.row-off td { opacity: .5; }
.list td { vertical-align: middle; }

/* --- magazyn --- */
.tabs { display: flex; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--blue); }
.flash-warn { background: #fff8e6; border-color: #f3d58a; color: #7a5300; }
.card-error { border-color: #f4c3bf; background: #fffafa; } .card-ok { border-color: #b7e2c6; background: #f6fcf8; }
.thumb { width: 52px; }
.thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.stock { display: inline-block; min-width: 34px; padding: 1px 7px; border-radius: 5px; font-weight: 700; background: #e7f6ec; color: #1d6b3f; text-align: center; }
.stock-low { background: #fff3d6; color: #8a5a00; } .stock-zero { background: #fde2e1; color: #9b1c13; }
.stock-big { font-size: 34px; font-weight: 700; color: #1d6b3f; margin-bottom: 10px; display: inline-block; padding: 0; background: none; }
.stock-big small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stock-big.stock-zero { color: var(--red); background: none; }
.product-img { float: right; width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 10px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 12px; color: var(--muted); }
.grid-form input, .grid-form select { color: var(--text); font-size: 13px; }
.grid-form .span2 { grid-column: span 2; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.map-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 12px; }
.neg { color: var(--red); font-weight: 600; } .pos { color: var(--green); font-weight: 600; }
input.wide { min-width: 300px; }
.narrow { max-width: 560px; }
progress { width: 320px; height: 12px; vertical-align: middle; }
.item-warn { color: #8a5a00; font-size: 11px; font-weight: 600; }

/* --- karta produktu jak w Base --- */
.card-tabs { padding-top: 0; }
.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 -18px 18px; padding: 0 18px; flex-wrap: wrap; }
.ptabs a { padding: 13px 16px; color: var(--text); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.ptabs a:hover { text-decoration: none; background: #f7f8fb; }
.ptabs a.active { border-bottom-color: var(--blue); font-weight: 600; }
.tabcount { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 4px; background: #e8eaef; font-size: 11px; text-align: center; }
.tabpanel h3 { font-size: 15px; margin: 22px 0 10px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.grid-form .span3 { grid-column: span 3; }
@media (max-width: 900px) { .g3 { grid-template-columns: 1fr 1fr; } .grid-form .span3 { grid-column: span 2; } }
.hint { font-weight: 400; color: var(--muted); font-size: 11px; }
.unit-input { display: flex; }
.unit-input input { flex: 1; min-width: 0; border-radius: 7px 0 0 7px; }
.unit-input i { font-style: normal; display: grid; place-items: center; padding: 0 10px; border: 1px solid #cfd5df; border-left: 0;
  border-radius: 0 7px 7px 0; background: #f6f7f9; color: var(--muted); font-size: 12px; }
.vat-row { display: flex; gap: 0; align-items: stretch; }
.vat-row .unit-input { width: 110px; margin-right: 6px; }
.vat-btn { border: 1px solid #cfd5df; background: #fff; padding: 0 12px; cursor: pointer; font: inherit; margin-left: -1px; }
.vat-btn:first-of-type { border-radius: 7px 0 0 7px; } .vat-btn:last-of-type { border-radius: 0 7px 7px 0; }
.vat-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.form-footer { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); margin: 18px -18px -16px; padding: 14px 18px; background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }
.block { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.cbm-info { align-self: end; padding-bottom: 8px; }
.dropzone { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 2px dashed #cfd5df; border-radius: 24px; padding: 12px 18px; margin-bottom: 16px; }
.dz-label { cursor: pointer; color: var(--blue); font-weight: 600; }
.dz-label input { display: block; margin-top: 4px; font-weight: 400; color: var(--text); }
.dz-url { margin-left: auto; display: flex; gap: 6px; }
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 1100px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gslot { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: #f3f4f7; overflow: hidden; }
.gslot.filled { background: #fff; }
.gslot img { width: 100%; height: 100%; object-fit: contain; }
.gnum { position: absolute; top: 8px; left: 8px; min-width: 26px; padding: 1px 8px; border-radius: 12px; border: 1px solid #c9d1de; background: #fff; font-size: 12px; text-align: center; z-index: 1; }
.gactions { position: absolute; bottom: 6px; left: 6px; right: 6px; display: flex; justify-content: space-between; gap: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 16px; background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--blue); font-size: 12px; }
/* lista produktów */
.pname { font-weight: 600; color: var(--text); text-transform: uppercase; }
.noimg { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 6px; background: #f3f4f7; font-size: 20px; }
.badge-inv { background: #7cb342; } .badge-allegro { background: #5b6fc7; }
.btn-green { background: #2e7d32; border-color: #2e7d32; color: #fff; } .btn-green:hover { background: #256628; }
.cbm-badge { padding: 6px 12px; border-radius: 16px; background: #eef6ff; color: #1e3a8a; font-size: 12px; }
select.mapped { border-color: #7cb342; background: #f6fbf0; }
.warn-check { background: #fff8e6; padding: 6px 10px; border-radius: 6px; }

/* --- logowanie --- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-card h2 { justify-content: center; }
.steps { padding-left: 18px; color: var(--muted); }
.qr { display: grid; place-items: center; margin: 10px 0; }
.secret { display: inline-block; word-break: break-all; user-select: all; }
.secret.big { font-size: 14px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); }
