:root {
  color-scheme: light;
  --ink: #172b46;
  --ink-soft: #354a64;
  --muted: #718197;
  --line: #dfe7f0;
  --surface: #ffffff;
  --surface-soft: #f5f8fc;
  --accent: #347fc4;
  --accent-dark: #1f639f;
  --accent-soft: #eaf4fc;
  --brand-navy: #143f78;
  --shipping: #65529c;
  --shipping-soft: #f1eef9;
  --danger: #c33b46;
  --danger-soft: #fff0f1;
  --warning: #a96207;
  --warning-soft: #fff7e6;
  --shadow: 0 1px 2px rgb(20 63 120 / .035), 0 9px 26px rgb(20 63 120 / .055);
  font-family: "Nunito Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f4f7fb;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 90% -10%, #e4f0fb 0, transparent 30rem), #f4f7fb; }
body::before { content: ""; display: block; height: 6px; background: linear-gradient(90deg, var(--brand-navy), #4d8dcc); }
button, input, select { font: inherit; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
.app-shell { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0 56px; }

.app-header { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-bottom: 23px; }
.brand { display: flex; min-width: 0; align-items: center; gap: 18px; }
.brand__logo { display: block; width: 220px; height: 50px; object-fit: contain; object-position: left center; }
.brand__divider { width: 1px; height: 42px; flex: 0 0 auto; background: #cfdae6; }
.brand__copy { min-width: 0; }
.eyebrow, .section-kicker {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.brand h1 { margin-bottom: 0; color: var(--brand-navy); font-size: 1.38rem; letter-spacing: -.025em; white-space: nowrap; }
.sync-block { display: flex; align-items: center; gap: 16px; }
.sync-block__copy { display: flex; align-items: center; gap: 8px; }
.sync-status { max-width: 520px; margin: 0; color: var(--muted); font-size: .83rem; }
.sync-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #26a269; box-shadow: 0 0 0 4px rgb(38 162 105 / .12); }
.sync-dot--error { background: var(--danger); box-shadow: 0 0 0 4px rgb(195 59 70 / .12); }
.sync-dot--working { animation: pulse 1s ease-in-out infinite; }
.account-menu { display: flex; align-items: center; gap: 5px; padding-left: 12px; border-left: 1px solid var(--line); }
.account-menu > span { max-width: 150px; overflow: hidden; color: var(--ink-soft); font-size: .76rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.account-menu form { margin: 0; }
.page-alert { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; font-size: .82rem; font-weight: 750; }
.page-alert--error { color: #a72f3a; background: var(--danger-soft); border: 1px solid #f4cbd0; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  min-height: 104px;
  padding: 16px;
  text-align: left;
  background: rgb(255 255 255 / .92);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.summary-card:hover { transform: translateY(-1px); border-color: #b9cbe0; box-shadow: 0 9px 28px rgb(20 63 120 / .09); }
.summary-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(52 127 196 / .11), var(--shadow); }
.summary-card > span:last-child { display: grid; grid-template-columns: 1fr auto; align-items: baseline; min-width: 0; }
.summary-card small { color: var(--ink-soft); font-size: .79rem; font-weight: 750; }
.summary-card strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; margin-left: 10px; font-size: 1.8rem; letter-spacing: -.04em; }
.summary-card em { color: var(--muted); font-size: .73rem; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-card__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; }
.summary-card__icon svg { width: 20px; height: 20px; stroke-width: 2.25; }
.summary-card__icon--ready { color: var(--accent); background: var(--accent-soft); }
.summary-card__icon--production { color: var(--brand-navy); background: #e8f0fa; }
.summary-card__icon--shipping { color: var(--shipping); background: var(--shipping-soft); }
.summary-card__icon--attention { color: var(--danger); background: var(--danger-soft); }

.filters {
  position: relative;
  z-index: 2;
  margin-bottom: 24px;
  padding: 14px;
  background: rgb(255 255 255 / .96);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.filters__primary { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 12px; align-items: center; }
.search-field { position: relative; display: block; }
.search-field__icon { position: absolute; top: 50%; left: 14px; transform: translateY(-54%); color: var(--muted); font-size: 1.35rem; pointer-events: none; }
.search-field input { height: 44px; padding-left: 42px; border-color: transparent; background: var(--surface-soft); }
.filters__advanced {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 1fr 1fr auto;
  gap: 11px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0f4;
}
label { display: grid; gap: 5px; color: var(--muted); font-size: .72rem; font-weight: 750; }
input, select {
  width: 100%;
  height: 38px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #d5dce5;
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(52 127 196 / .12); }
.filters-toggle { display: none !important; }
.filter-count { display: inline-grid; min-width: 20px; height: 20px; padding: 0 5px; place-items: center; border-radius: 999px; color: #fff; background: var(--accent); font-size: .7rem; }
.filter-count[hidden] { display: none; }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-size: .82rem;
  font-weight: 750;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); box-shadow: 0 5px 14px rgb(52 127 196 / .22); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .6; }
.button > svg { width: 16px; height: 16px; flex: 0 0 auto; stroke-width: 2.35; }
.button-secondary { color: var(--accent); background: #fff; }
.button-ghost { color: var(--ink-soft); background: #fff; border-color: #d5dce5; }
.button-ghost:hover { color: var(--ink); background: var(--surface-soft); border-color: #bcc7d3; box-shadow: none; }
.button-primary { color: #fff; background: var(--accent); }
.button-workflow { color: #fff; background: var(--brand-navy); border-color: var(--brand-navy); }
.button-workflow:hover { background: #0d315e; border-color: #0d315e; }
.button-workflow--packed { background: var(--shipping); border-color: var(--shipping); }
.button-workflow--packed:hover { background: #51407f; border-color: #51407f; }
.button-compact { min-height: 34px; padding: 6px 10px; font-size: .77rem; }
.button-link { min-height: 38px; padding-inline: 7px; color: var(--accent); background: transparent; border-color: transparent; }
.button-link:hover { color: var(--accent-dark); background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.button__icon { font-size: 1rem; line-height: 1; }

.orders-panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 11px; padding: 0 3px; }
.orders-panel__heading h2 { margin-bottom: 0; font-size: 1.18rem; letter-spacing: -.02em; }
.refresh-message { color: var(--muted); font-size: .76rem; }
.orders-list { display: grid; gap: 9px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.pagination[hidden] { display: none; }
.pagination__summary { min-width: 205px; color: var(--muted); font-size: .76rem; text-align: center; }
.order-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(130px, .75fr) minmax(225px, 1.4fr) minmax(120px, .68fr) minmax(150px, .85fr) minmax(205px, .95fr);
  gap: 15px;
  align-items: center;
  min-height: 112px;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .025);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.order-card:hover { z-index: 1; transform: translateY(-1px); border-color: #bfd0e1; box-shadow: 0 8px 24px rgb(20 63 120 / .075); }
.order-card--attention { border-left: 4px solid #e26b74; padding-left: 14px; }
.order-card--production { border-left: 4px solid var(--accent); padding-left: 14px; }
.order-card--shipping { border-left: 4px solid var(--shipping); padding-left: 14px; }
.order-card__identity, .order-card__customer, .order-card__products, .order-card__payment, .order-card__state { min-width: 0; }
.order-card__identity { display: flex; flex-direction: column; align-items: flex-start; }
.source-badge {
  display: inline-flex;
  height: 23px;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  padding: 2px 7px 2px 3px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 800;
}
.source-badge__mark { display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; color: #fff; font-size: .58rem; }
.source-badge--allegro { color: #8f4e07; background: #fff3dd; }
.source-badge--allegro .source-badge__mark { background: #f28c28; }
.source-badge--woocommerce { color: #63358d; background: #f4ebff; }
.source-badge--woocommerce .source-badge__mark { background: #7f54b3; }
.order-number {
  max-width: 100%;
  margin: 0 0 5px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-number:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.identity-meta { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.identity-meta__separator { color: #bcc5cf; }
.card-label { display: block; margin-bottom: 6px; color: #8995a5; font-size: .64rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.order-card__customer strong { display: block; overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.customer-contact { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.product-list { display: grid; gap: 5px; }
.product-list__item { display: flex; min-width: 0; align-items: center; gap: 7px; }
.product-list__name { overflow: hidden; font-size: .79rem; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.quantity-pill { display: inline-flex; flex: 0 0 auto; padding: 2px 6px; border-radius: 6px; color: var(--ink-soft); background: #edf1f5; font-size: .68rem; font-weight: 800; }
.quantity-pill--unknown { color: var(--danger); background: var(--danger-soft); }
.more-items { color: var(--accent); font-size: .69rem; font-weight: 700; }
.order-card__payment { display: flex; flex-direction: column; align-items: flex-start; }
.payment-amount { display: block; margin-bottom: 6px; font-size: .94rem; letter-spacing: -.015em; }
.payment-note { display: block; margin-top: 4px; color: var(--muted); font-size: .64rem; }
.order-card__state { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.order-card__state .card-label { width: 100%; }
.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 800;
  line-height: 1.15;
}
.status-pill__icon { display: inline-flex; flex: 0 0 auto; }
.status-pill__icon svg { width: 13px; height: 13px; stroke-width: 2.5; }
.status-pill--success, .status-pill--complete { color: #18704f; background: #e5f7ee; }
.status-pill--info { color: #246da9; background: #eaf4fc; }
.status-pill--production { color: var(--brand-navy); background: #e8f0fa; }
.status-pill--produced { color: #8a5a10; background: #fff3dc; }
.status-pill--shipping { color: var(--shipping); background: var(--shipping-soft); }
.status-pill--neutral { color: #596675; background: #edf1f4; }
.status-pill--warning { color: var(--warning); background: var(--warning-soft); }
.status-pill--danger, .status-pill--incomplete, .status-pill--missing_reference, .status-pill--not_found, .status-pill--invalid_response, .status-pill--error { color: #a72f3a; background: var(--danger-soft); }
.status-pill--allegro { color: #8f4e07; background: #fff3dd; }
.status-pill--woocommerce { color: #63358d; background: #f4ebff; }
.state-timestamp { width: 100%; color: var(--muted); font-size: .66rem; }
.order-card__actions { display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.print-form { display: grid; margin: 0; }
.blocked-print { display: inline-flex; align-items: center; justify-content: center; gap: 5px; color: var(--danger); font-size: .7rem; font-weight: 750; line-height: 1.25; text-align: center; }
.blocked-print__icon svg { width: 14px; height: 14px; stroke-width: 2.4; }
.error-text { color: var(--danger) !important; }
.muted { color: var(--muted); }

.empty-state { display: grid; min-height: 300px; place-items: center; align-content: center; padding: 40px; text-align: center; background: #fff; border: 1px dashed #ccd5df; border-radius: 15px; }
.empty-state__icon { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 12px; border-radius: 50%; color: var(--muted); background: #edf1f5; font-size: 1.6rem; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { margin-bottom: 16px; color: var(--muted); font-size: .85rem; }
.skeleton-card { pointer-events: none; }
.skeleton-line { display: block; height: 16px; border-radius: 6px; background: linear-gradient(90deg, #edf0f4 25%, #f8f9fb 50%, #edf0f4 75%); background-size: 200% 100%; animation: shimmer 1.35s infinite; }
.skeleton-line:nth-child(2) { width: 78%; }
.skeleton-line:nth-child(4) { width: 88%; }

.order-dialog[open] {
  display: grid;
}
.order-dialog {
  width: min(980px, calc(100% - 32px));
  height: min(820px, calc(100dvh - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 28px 90px rgb(20 63 120 / .24);
}
.order-dialog::backdrop { background: rgb(15 23 42 / .48); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 24px 15px; background: #fbfdff; border-top: 4px solid var(--accent); border-bottom: 1px solid var(--line); }
.dialog-header__copy { min-width: 0; }
.dialog-header h2 { max-width: 820px; margin-bottom: 3px; overflow: hidden; font-size: 1.15rem; text-overflow: ellipsis; white-space: nowrap; }
.dialog-subtitle { margin: 0; color: var(--muted); font-size: .72rem; }
.icon-button { display: inline-flex; width: 34px; height: 34px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 0 0 2px; color: var(--muted); background: #f2f4f7; border: 0; border-radius: 50%; cursor: pointer; font-family: Arial, sans-serif; font-size: 1.55rem; line-height: 1; outline: 0; }
.icon-button:hover { color: var(--ink); background: #e8ecf1; }
.icon-button:focus-visible { box-shadow: 0 0 0 3px rgb(52 127 196 / .25); }
.dialog-content { min-height: 0; padding: 16px 24px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; padding: 11px 14px; background: var(--surface-soft); border: 1px solid #e8ecf1; border-radius: 11px; }
.dialog-status { display: flex; flex-wrap: wrap; gap: 6px; }
.dialog-payment-summary { display: flex; flex: 0 0 auto; align-items: center; gap: 15px; padding-left: 18px; border-left: 1px solid #dfe5eb; }
.dialog-payment-summary__copy { display: grid; text-align: right; }
.dialog-payment-summary__label { color: var(--muted); font-size: .64rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.dialog-payment-summary__amount { font-size: 1.12rem; letter-spacing: -.02em; }
.dialog-payment-summary__status { display: grid; justify-items: start; gap: 3px; min-width: 120px; }
.dialog-payment-summary__status small { max-width: 190px; overflow: hidden; color: var(--muted); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.dialog-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.dialog-section { padding: 14px 15px; background: #fff; border: 1px solid #e3e8ee; border-radius: 11px; }
.dialog-section h3 { margin-bottom: 10px; font-size: .82rem; }
.dialog-info { display: grid; gap: 6px; margin: 0; }
.dialog-info__row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: start; font-size: .73rem; }
.dialog-info dt { color: var(--muted); }
.dialog-info dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 650; }
.dialog-section--products { margin-top: 12px; background: var(--surface-soft); }
.dialog-product { padding: 11px 0; border-top: 1px solid var(--line); }
.dialog-product:first-of-type { padding-top: 0; border-top: 0; }
.dialog-product__heading { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; }
.dialog-product__meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 3px; color: var(--muted); font-size: .68rem; }
.dialog-configuration { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin: 10px 0 0; }
.dialog-configuration__row { display: grid; grid-template-columns: minmax(100px, .9fr) minmax(0, 1.2fr); gap: 8px; padding: 6px 0; border-top: 1px solid #e5e9ee; font-size: .71rem; }
.dialog-configuration dt { color: var(--muted); }
.dialog-configuration dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.dialog-notes { margin-top: 12px; background: #fffaf0; border-color: #f2dfb8; }
.dialog-notes p { margin-bottom: 0; font-size: .78rem; white-space: pre-line; }
.dialog-footer { padding: 12px 24px; background: rgb(255 255 255 / .98); border-top: 1px solid var(--line); box-shadow: 0 -7px 18px rgb(20 63 120 / .04); }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Karta produkcyjna */
.print-body { background: #e8eef6; }
.print-body::before { display: none; }
.print-card { width: min(210mm, calc(100% - 28px)); min-height: 297mm; margin: 20px auto; padding: 14mm 16mm; background: #fff; box-shadow: 0 2px 12px rgb(15 23 42 / .14); }
.print-toolbar { display: flex; justify-content: space-between; margin-bottom: 8mm; }
.print-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8mm; align-items: stretch; padding-bottom: 3mm; border-bottom: 2px solid var(--accent); }
.print-header__brand { display: flex; min-width: 0; flex-direction: column; gap: 4mm; }
.print-brand-logo { display: block; width: 54mm; height: auto; }
.print-header__order { width: 100%; margin-top: auto; padding-top: 3mm; text-align: left; }
.print-header__order .eyebrow { margin-bottom: 1mm; font-size: 7pt; }
.print-header h1 { margin-bottom: 0; color: var(--brand-navy); font-size: 25pt; line-height: 1.05; letter-spacing: -.025em; }
.print-header__aside { display: flex; align-items: flex-start; gap: 5mm; }
.metadata { display: grid; grid-template-columns: auto auto; gap: 2px 9px; margin: 1mm 0 0; font-size: 8.5pt; line-height: 1.3; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; font-weight: 700; text-align: right; }
.print-qr { width: 29mm; }
.print-qr img { display: block; width: 29mm; height: 29mm; margin: 0; }
.print-section { margin-top: 7mm; }
.print-section h2 { margin-bottom: 8px; font-size: 1rem; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.details-grid p { margin-bottom: 6px; }
.print-item { break-inside: avoid; margin-top: 12px; padding: 13px; border: 1px solid #cbd5e1; border-radius: 8px; }
.print-item__heading { display: flex; justify-content: space-between; gap: 12px; }
.print-item h2 { margin: 0; font-size: 1rem; }
.sku { margin: 6px 0; color: var(--muted); font-size: .85rem; }
.configuration { display: grid; grid-template-columns: minmax(150px, 1fr) 2fr; margin: 10px 0 0; border-top: 1px solid #e2e8f0; }
.configuration-row { display: contents; }
.configuration dt, .configuration dd { padding: 6px 0; border-bottom: 1px solid #e2e8f0; }
.configuration dt { color: #475569; font-weight: 650; }
.configuration dd { margin: 0; font-weight: 700; }
.notes p { padding: 10px; background: #fffbeb; border-left: 3px solid #f59e0b; white-space: normal; }
.error-page { width: min(600px, calc(100% - 32px)); margin: 15vh auto; padding: 28px; background: #fff; border-radius: 12px; }

/* Ustawienia */
.settings-shell { width: min(1000px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 60px; }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.settings-brand { display: inline-flex; }
.settings-brand img { display: block; width: 230px; height: auto; }
.settings-empty { display: grid; min-height: 410px; place-items: center; align-content: center; padding: 42px; text-align: center; background: rgb(255 255 255 / .94); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.settings-empty__icon { display: grid; width: 64px; height: 64px; place-items: center; margin-bottom: 20px; border-radius: 18px; color: var(--accent); background: var(--accent-soft); font-size: 1.7rem; }
.settings-empty h1 { margin-bottom: 9px; color: var(--brand-navy); font-size: 1.65rem; }
.settings-empty > p:not(.eyebrow) { max-width: 460px; margin-bottom: 18px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.settings-empty__note { padding: 5px 10px; border-radius: 999px; color: var(--brand-navy); background: #e8f0fa; font-size: .72rem; font-weight: 800; }
.settings-card { margin-bottom: 20px; padding: 28px; background: rgb(255 255 255 / .94); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.settings-card h1, .settings-card h2 { color: var(--brand-navy); }
.settings-card h1 { margin: 4px 0 8px; font-size: 1.65rem; }
.settings-card h2 { margin: 3px 0 0; font-size: 1.2rem; }
.settings-intro { max-width: 700px; color: var(--muted); line-height: 1.55; }
.settings-connection { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; max-width: 760px; margin: 20px 0 0; font-size: .84rem; }
.settings-connection dt { color: var(--muted); font-weight: 750; }
.settings-connection dd { margin: 0; color: var(--brand-navy); overflow-wrap: anywhere; }
.settings-form { display: grid; max-width: 680px; gap: 14px; margin-top: 22px; }
.settings-form label { display: grid; gap: 6px; color: var(--brand-navy); font-size: .78rem; font-weight: 750; }
.settings-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font: inherit; }
.settings-form input:focus { outline: 2px solid rgb(52 127 196 / .2); border-color: var(--accent); }
.settings-form__actions, .settings-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.settings-section-heading { margin-bottom: 10px; }
.settings-table-wrap { overflow-x: auto; margin-top: 18px; }
.settings-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.settings-table th { color: var(--muted); font-size: .68rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.settings-table th, .settings-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.settings-table td small { display: block; margin-top: 4px; color: var(--muted); }
.settings-product-link { color: var(--brand-navy); text-decoration: none; }
.settings-product-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.settings-flash { margin-bottom: 18px; padding: 13px 16px; color: #176849; background: #e5f7ee; border: 1px solid #bde9d3; border-radius: 11px; font-size: .84rem; font-weight: 750; }
.product-detail h1 { margin-bottom: 18px; }
.product-detail__meta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 20px; }
.product-detail__meta > div { min-width: 210px; padding: 12px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.product-detail__meta dt { margin-bottom: 3px; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.product-detail__meta dd { margin: 0; color: var(--brand-navy); font-size: .84rem; font-weight: 800; }
.product-detail__auctions { display: grid; gap: 8px; font-size: .78rem; }
.product-detail__auctions > div { display: flex; flex-wrap: wrap; gap: 6px; }
.product-detail__auction { padding: 4px 8px; color: var(--ink-soft); background: #edf2f7; border-radius: 999px; font-size: .7rem; font-weight: 750; }
.field-order__hint { color: var(--muted); font-size: .72rem; }
.field-order__form { margin-top: 20px; }
.field-order { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.field-order__item {
  display: grid;
  grid-template-columns: 24px 28px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid #dfe6ee;
  border-radius: 11px;
  cursor: grab;
  transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.field-order__item:hover { border-color: #b9ccdf; box-shadow: 0 4px 14px rgb(20 63 120 / .06); }
.field-order__item.is-dragging { opacity: .55; border-color: var(--accent); cursor: grabbing; }
.field-order__handle { color: #91a0b2; font-size: 1.2rem; line-height: 1; }
.field-order__position { display: grid; width: 27px; height: 27px; place-items: center; color: var(--brand-navy); background: #e8f0fa; border-radius: 8px; font-size: .72rem; font-weight: 850; }
.field-order__copy { display: grid; min-width: 0; }
.field-order__copy strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.field-order__copy small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.field-order__visibility { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: .7rem; font-weight: 750; white-space: nowrap; cursor: pointer; }
.field-order__visibility input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.field-order__actions { display: flex; gap: 5px; }
.field-order__move { width: 31px; height: 31px; font-size: 1rem; }
.field-order__move:disabled { cursor: default; opacity: .35; }
.field-order__empty { padding: 22px; color: var(--muted); background: var(--surface-soft); border: 1px dashed #cbd6e2; border-radius: 11px; text-align: center; }
.field-order__footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.users-grid { display: grid; grid-template-columns: minmax(270px, .75fr) minmax(360px, 1.25fr); gap: 28px; align-items: start; margin-top: 20px; }
.user-create-form { margin-top: 0; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.user-create-form h3 { margin-bottom: 2px; font-size: .92rem; }
.user-list { display: grid; gap: 8px; }
.user-row { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.user-row > div:first-child { display: grid; min-width: 0; }
.user-row strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.user-row > div:first-child span { color: var(--muted); font-size: .68rem; }
.user-row__actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.user-row__actions form { margin: 0; }

/* Logowanie */
.login-body { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 0, #dcecfb 0, transparent 27rem), #f2f6fb; }
.login-body::before { display: none; }
.login-shell { width: min(440px, 100%); }
.login-card { padding: 32px; background: rgb(255 255 255 / .97); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 18px; box-shadow: 0 24px 70px rgb(20 63 120 / .14); }
.login-logo { display: block; width: 230px; height: auto; margin-bottom: 34px; }
.login-card h1 { margin: 4px 0 7px; color: var(--brand-navy); font-size: 1.65rem; }
.login-intro { margin-bottom: 22px; color: var(--muted); font-size: .86rem; }
.login-form { display: grid; gap: 14px; }
.login-form label { color: var(--brand-navy); font-size: .76rem; }
.login-form input { height: 44px; }
.login-form .checkbox-label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.checkbox-label input { width: 16px; height: 16px; }
.form-error { margin: -2px 0 0; color: var(--danger); font-size: .76rem; font-weight: 750; }

/* Mobilny ekran obsługi produkcji */
.workflow-body { background: radial-gradient(circle at 90% -10%, #dcecfb 0, transparent 24rem), #f2f6fb; }
.workflow-shell { width: min(680px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 50px; }
.workflow-header { margin-bottom: 16px; padding: 20px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 15px; box-shadow: var(--shadow); }
.workflow-header img { display: block; width: 205px; height: auto; margin-bottom: 22px; }
.workflow-header h1 { margin-bottom: 6px; color: var(--brand-navy); font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.12; overflow-wrap: anywhere; }
.workflow-meta { margin: 0; color: var(--muted); font-size: .78rem; }
.workflow-flash { margin-bottom: 14px; padding: 13px 15px; color: #176849; background: #e5f7ee; border: 1px solid #bde9d3; border-radius: 11px; font-size: .84rem; font-weight: 750; }
.workflow-section { margin-top: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.workflow-section h2 { margin-bottom: 14px; font-size: .98rem; }
.workflow-section__heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.workflow-section__heading span { color: var(--muted); font-size: .7rem; text-align: right; }
.workflow-timeline { position: relative; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.workflow-step { position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 11px; min-height: 66px; color: var(--muted); }
.workflow-step:not(:last-child)::after { position: absolute; top: 31px; bottom: -1px; left: 17px; width: 2px; content: ""; background: #dce4ee; }
.workflow-step.is-complete:not(:last-child)::after { background: #91bce3; }
.workflow-step__dot { position: relative; z-index: 1; display: grid; width: 35px; height: 35px; place-items: center; border: 2px solid #d5dee9; border-radius: 50%; color: #8492a4; background: #fff; }
.workflow-step__dot svg { width: 15px; height: 15px; stroke-width: 2.5; }
.workflow-step.is-complete .workflow-step__dot { color: #fff; background: var(--accent); border-color: var(--accent); }
.workflow-step.is-current .workflow-step__dot { box-shadow: 0 0 0 5px rgb(52 127 196 / .13); }
.workflow-step strong { display: block; padding-top: 3px; color: var(--ink); font-size: .86rem; }
.workflow-step small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.workflow-action { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.workflow-action form { margin: 0; }
.workflow-action__button { width: 100%; min-height: 54px; font-size: .96rem; }
.workflow-done, .workflow-warning { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 11px; }
.workflow-done { color: #176849; background: #e5f7ee; }
.workflow-done > span { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: #fff; background: #2b9b70; border-radius: 50%; font-weight: 900; }
.workflow-done > span svg { width: 16px; height: 16px; stroke-width: 2.75; }
.workflow-action__button svg { width: 17px; height: 17px; stroke-width: 2.5; }
.workflow-done p, .workflow-warning p { margin: 3px 0 0; font-size: .76rem; }
.workflow-warning { color: #8b5c13; background: var(--warning-soft); }
.workflow-products { display: grid; gap: 10px; }
.workflow-product { padding: 13px; background: var(--surface-soft); border: 1px solid #e2e9f1; border-radius: 11px; }
.workflow-product__heading { display: flex; justify-content: space-between; gap: 10px; }
.workflow-product__heading strong { font-size: .84rem; line-height: 1.3; }
.workflow-product__sku { margin: 4px 0 0; color: var(--muted); font-size: .68rem; overflow-wrap: anywhere; }
.workflow-configuration { display: grid; margin: 10px 0 0; }
.workflow-configuration__row { display: grid; grid-template-columns: minmax(110px, .9fr) minmax(0, 1.1fr); gap: 8px; padding: 6px 0; border-top: 1px solid #dfe6ee; font-size: .71rem; }
.workflow-configuration dt { color: var(--muted); }
.workflow-configuration dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 750; }
.workflow-notes { background: #fffaf0; border-color: #f2dfb8; }
.workflow-notes p { margin: 0; white-space: pre-line; font-size: .8rem; }
.workflow-list-link { display: block; margin-top: 20px; color: var(--accent); font-size: .76rem; font-weight: 750; text-align: center; text-decoration: none; }
.workflow-list-link:hover { text-decoration: underline; }
.empty-state__icon svg { width: 28px; height: 28px; stroke-width: 2.1; }

@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

@media (max-width: 1180px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-card { grid-template-columns: minmax(210px, 1fr) minmax(155px, .8fr) minmax(250px, 1.3fr); }
  .order-card__payment, .order-card__state, .order-card__actions { padding-top: 10px; border-top: 1px solid #edf0f3; }
  .filters__advanced { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .app-shell { width: min(100% - 24px, 1420px); padding-top: 20px; }
  .app-header { align-items: flex-start; }
  .brand { gap: 12px; }
  .brand__logo { width: 185px; height: auto; }
  .brand__divider { height: 38px; }
  .brand h1 { font-size: 1.15rem; }
  .sync-block { align-items: flex-end; flex-direction: column; gap: 8px; }
  .account-menu { padding-top: 8px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-toggle { display: inline-flex !important; }
  .filters__advanced { display: none; grid-template-columns: repeat(2, 1fr); }
  .filters__advanced.is-open { display: grid; }
  .order-card { grid-template-columns: 1fr 1fr; }
  .order-card__products { grid-column: 1 / -1; }
  .order-card__actions { grid-column: 1 / -1; }
  .dialog-summary { align-items: flex-start; flex-direction: column; }
  .dialog-payment-summary { width: 100%; justify-content: space-between; padding-top: 10px; padding-left: 0; border-top: 1px solid #dfe5eb; border-left: 0; }
  .dialog-payment-summary__copy { text-align: left; }
}

@media (max-width: 580px) {
  .app-shell { width: min(100% - 16px, 1420px); padding-top: 14px; }
  .app-header { display: block; }
  .brand { gap: 10px; }
  .brand__logo { width: 150px; }
  .brand__divider { height: 32px; }
  .brand .eyebrow { font-size: .57rem; letter-spacing: .07em; }
  .brand h1 { font-size: .98rem; white-space: normal; }
  .sync-block { align-items: stretch; margin-top: 16px; }
  .sync-block__copy { justify-content: flex-start; }
  .sync-block form, .sync-block .button { width: 100%; }
  .summary-grid { gap: 8px; }
  .summary-card { grid-template-columns: 35px 1fr; gap: 9px; min-height: 86px; padding: 12px; }
  .summary-card__icon { width: 34px; height: 34px; border-radius: 9px; }
  .summary-card strong { font-size: 1.35rem; }
  .summary-card em { display: none; }
  .filters { padding: 10px; }
  .filters__primary { grid-template-columns: 1fr auto; }
  .filters__advanced { grid-template-columns: 1fr; }
  .order-card { grid-template-columns: 1fr; gap: 14px; padding: 15px; }
  .order-card__products, .order-card__actions { grid-column: auto; }
  .order-card__customer, .order-card__products, .order-card__payment, .order-card__state { padding-top: 12px; border-top: 1px solid #edf0f3; }
  .order-card__actions { display: grid; grid-template-columns: 1fr 1fr; padding-top: 12px; }
  .order-card__actions .print-form, .order-card__actions .button { width: 100%; }
  .pagination { align-items: stretch; flex-direction: column; gap: 8px; }
  .pagination .button { width: 100%; }
  .pagination__summary { min-width: 0; }
  .order-dialog { width: calc(100% - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); border-radius: 13px; }
  .dialog-header { padding: 15px 16px 13px; }
  .dialog-header h2 { font-size: 1rem; }
  .dialog-content { padding: 12px 14px; }
  .dialog-overview, .dialog-configuration { grid-template-columns: 1fr; }
  .dialog-info__row { grid-template-columns: 100px 1fr; }
  .dialog-footer { padding: 10px 14px; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions .button, .dialog-actions .print-form { width: 100%; }
  .print-card { width: 100%; margin: 0; padding: 20px; }
  .print-header { display: block; }
  .print-header__brand { gap: 14px; margin-bottom: 18px; }
  .print-brand-logo { width: 150px; }
  .print-header__aside { justify-content: space-between; gap: 12px; }
  .details-grid { grid-template-columns: 1fr; }
  .settings-shell { width: min(100% - 24px, 1000px); padding-top: 20px; }
  .settings-header { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .settings-brand img { width: 185px; }
  .settings-empty { min-height: 330px; padding: 28px 20px; }
  .settings-card { padding: 22px 18px; }
  .settings-section-heading { align-items: flex-start; flex-direction: column; }
  .settings-form__actions { align-items: flex-start; flex-direction: column; }
  .users-grid { grid-template-columns: 1fr; gap: 18px; }
  .user-row { align-items: flex-start; flex-direction: column; }
  .user-row__actions { width: 100%; justify-content: space-between; }
  .field-order__item { grid-template-columns: 20px 26px minmax(0, 1fr) auto; gap: 7px; }
  .field-order__visibility { grid-column: 3 / -1; }
  .field-order__actions { grid-column: 3 / -1; justify-content: flex-end; }
  .field-order__footer { align-items: stretch; flex-direction: column-reverse; }
  .field-order__footer .button { width: 100%; }
  .workflow-shell { width: min(100% - 16px, 680px); padding-top: 14px; }
  .workflow-header, .workflow-section { padding: 15px; border-radius: 13px; }
  .workflow-header img { width: 175px; margin-bottom: 18px; }
  .workflow-section__heading { align-items: flex-start; flex-direction: column; gap: 0; }
  .workflow-section__heading span { text-align: left; }
  .login-body { padding: 10px; }
  .login-card { padding: 25px 20px; }
  .login-logo { width: 190px; margin-bottom: 28px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body, .print-body { background: #fff; }
  body::before { display: none; }
  .print-card { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .no-print { display: none !important; }
}
