:root {
  --tblr-font-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 2000; padding: 12px 18px; background: var(--tblr-bg-surface); border: 2px solid var(--tblr-primary); border-radius: var(--tblr-border-radius); }
:is(a, button):focus-visible { outline: 3px solid var(--tblr-primary); outline-offset: 3px; }
#main:focus { outline: none; }
.erp-brand { display: flex; align-items: center; gap: 12px; color: var(--tblr-body-color); text-decoration: none; font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.erp-brand:hover { color: var(--tblr-body-color); text-decoration: none; }
.erp-brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.erp-brand-caption { display: block; font-size: 11px; font-weight: 400; letter-spacing: .1px; color: var(--tblr-secondary); margin-top: 5px; }
.erp-sidebar-note { margin: auto 1rem 1rem; padding: 1rem; border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius-lg); }
.erp-topbar { min-height: 68px; }
.erp-welcome { overflow: hidden; background: linear-gradient(115deg, color-mix(in oklab, var(--tblr-primary) 6%, var(--tblr-bg-surface)), var(--tblr-bg-surface) 75%); }
.erp-welcome-title { font-size: clamp(1.7rem, 2.6vw, 2.5rem); line-height: 1.2; letter-spacing: -.8px; font-weight: 650; margin-bottom: 1.25rem; }
.erp-welcome-description { max-width: 31rem; font-size: 1rem; line-height: 1.75; }
.erp-welcome-image { width: 100%; height: auto; max-width: 340px; }
.erp-steps li { display: flex; gap: 14px; padding: 14px 0; }
.erp-steps li:first-child { padding-top: 0; }
.erp-steps li:last-child { padding-bottom: 0; }
.erp-steps li + li { border-top: 1px solid var(--tblr-border-color); }
.erp-steps .avatar { flex-shrink: 0; }
.erp-steps p { line-height: 1.6; }
.badge.bg-blue-lt { color: #075da9 !important; }
.badge.bg-green-lt { color: #166534 !important; }
.badge.bg-secondary-lt { color: var(--tblr-body-color) !important; }
.alert-info { color: var(--tblr-body-color); }
[data-bs-theme="dark"] .badge.bg-blue-lt { color: #93c5fd !important; }
[data-bs-theme="dark"] .badge.bg-green-lt { color: #86efac !important; }

@media (min-width: 992px) {
  .navbar-vertical .navbar-brand { padding-top: 1.5rem; padding-bottom: 1rem; }
  .navbar-vertical .navbar-collapse { min-height: calc(100dvh - 110px); }
}
@media (max-width: 991.98px) {
  .erp-welcome-image { max-width: 250px; }
  .erp-welcome .card-body { padding: 1.5rem; }
  .erp-brand { font-size: 21px; }
  .erp-brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .erp-topbar { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* Katalog i receptury magazynu. */
.erp-wrap, .erp-breadcrumb-current { overflow-wrap: anywhere; min-width: 0; }
.erp-product-name { min-width: 200px; max-width: 460px; white-space: normal; overflow-wrap: anywhere; }
.erp-recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, .45fr) auto; align-items: start; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--tblr-border-color); }
.erp-recipe-row[hidden] { display: none; }
.erp-recipe-delete { padding-top: 36px; }
.form-control[aria-invalid="true"], .form-select[aria-invalid="true"] { border-color: var(--tblr-danger); }
.errorlist { margin-bottom: 0; padding-left: 1.25rem; }
@media (max-width: 767.98px) {
  .erp-recipe-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .erp-recipe-delete { padding-top: 0; }
}

/* Keep positioned, visually hidden table labels inside their scroll container. */
.table-responsive { position: relative; }
@media (max-width: 575.98px) {
  .erp-catalog-summary .card-body { padding: 12px; }
  .erp-catalog-summary .subheader { min-height: 2.8em; font-size: 10px; overflow-wrap: anywhere; }
  .erp-catalog-summary .h1 { font-size: 1.5rem; }
}

.erp-receipt-row[hidden], [data-sheet-dimension][hidden] { display: none; }
/* Pojedynczy wybór zachowuje wysokość także przy długiej nazwie i utracie fokusu. */
.ts-wrapper.single .ts-control { flex-wrap: nowrap; }
.ts-wrapper.single .ts-control > .item { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-catalog-summary .h2 { overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .erp-catalog-summary .h2 { font-size: 1rem; } }

.erp-details > summary { cursor: pointer; list-style: none; }
.erp-details > summary::-webkit-details-marker { display: none; }
.erp-details > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; flex-shrink: 0; border-bottom: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
.erp-details[open] > summary::after { transform: rotate(225deg); }

/* Realizacja: stałe miejsce podglądu i równe kolumny numerów oraz statusów. */
.erp-order-realization-cell { min-width: 240px; }
.erp-order-realization { display: grid; grid-template-columns: minmax(0, 1fr) 2rem; gap: 1rem; align-items: start; }
.erp-order-parts { display: grid; gap: .375rem; }
.erp-order-parts > li { display: grid; grid-template-columns: 1.75rem max-content; gap: .5rem; align-items: center; }
.erp-order-part-number { border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius-sm); color: var(--tblr-secondary); font-size: .75rem; line-height: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.erp-order-preview { width: 2rem; height: 2rem; padding: 0; margin-top: -.125rem; }
.erp-order-preview .icon { width: 1.125rem; height: 1.125rem; }

/* Kolory etapów: wspólne znaczenie na liście, kartach i w podglądach. */
.erp-status-badge { --erp-status-bg: #f1f5f9; --erp-status-fg: #475569; color: var(--erp-status-fg); background-color: var(--erp-status-bg); border: 1px solid color-mix(in srgb, var(--erp-status-fg) 20%, transparent); }
.erp-status-confirmed { --erp-status-bg: #eff6ff; --erp-status-fg: #1d4ed8; }
.erp-status-in_production { --erp-status-bg: #fff7ed; --erp-status-fg: #9a3412; }
.erp-status-ready { --erp-status-bg: #f0fdf4; --erp-status-fg: #166534; }
.erp-status-packing { --erp-status-bg: #faf5ff; --erp-status-fg: #7e22ce; }
.erp-status-to_ship { --erp-status-bg: #ecfeff; --erp-status-fg: #0e7490; }
.erp-status-shipped { --erp-status-bg: #1e3a8a; --erp-status-fg: #ffffff; }
.erp-status-cancelled { --erp-status-bg: #fef2f2; --erp-status-fg: #b91c1c; }
[data-bs-theme="dark"] .erp-status-badge { --erp-status-bg: #293343; --erp-status-fg: #cbd5e1; }
[data-bs-theme="dark"] .erp-status-confirmed { --erp-status-bg: #1e3a5f; --erp-status-fg: #bfdbfe; }
[data-bs-theme="dark"] .erp-status-in_production { --erp-status-bg: #5a2d14; --erp-status-fg: #fed7aa; }
[data-bs-theme="dark"] .erp-status-ready { --erp-status-bg: #163e2a; --erp-status-fg: #bbf7d0; }
[data-bs-theme="dark"] .erp-status-packing { --erp-status-bg: #452065; --erp-status-fg: #e9d5ff; }
[data-bs-theme="dark"] .erp-status-to_ship { --erp-status-bg: #134454; --erp-status-fg: #a5f3fc; }
[data-bs-theme="dark"] .erp-status-shipped { --erp-status-bg: #1e40af; --erp-status-fg: #ffffff; }
[data-bs-theme="dark"] .erp-status-cancelled { --erp-status-bg: #581c26; --erp-status-fg: #fecaca; }

.erp-vip-badge { color: #78633f; background-color: #f5f2eb; border: 0; padding: .125rem .3rem; vertical-align: middle; font-size: .625rem; font-weight: 500; line-height: 1.1; letter-spacing: .02em; }
.erp-vip-badge[hidden] { display: none; }
[data-bs-theme="dark"] .erp-vip-badge { color: #d5c4a0; background-color: #302d26; }

.erp-external-orders .erp-product-name { min-width: 130px; max-width: 230px; }
.erp-external-orders td:nth-child(6) { min-width: 175px; }
.erp-external-orders td:last-child { min-width: 145px; }

.erp-status-delivered { --erp-status-bg: #14532d; --erp-status-fg: #ffffff; }
[data-bs-theme="dark"] .erp-status-delivered { --erp-status-bg: #166534; --erp-status-fg: #ffffff; }

/* Shared Tabler section navigation: a clear selected state and separate counters. */
.erp-section-nav .nav-link {
  color: var(--tblr-body-color);
  min-height: 2.75rem;
  border-radius: var(--tblr-border-radius);
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.erp-section-nav .nav-link:hover {
  color: var(--tblr-primary);
  background-color: rgba(var(--tblr-primary-rgb), .08);
}
.erp-section-nav .nav-link.active,
.erp-section-nav .nav-link.active:hover {
  color: #fff;
  background-color: var(--tblr-primary);
}
.erp-section-nav .nav-link:focus-visible {
  outline: 3px solid rgba(var(--tblr-primary-rgb), .4);
  outline-offset: 2px;
}
.erp-section-nav .erp-nav-count {
  background: var(--tblr-bg-surface-secondary);
  color: var(--tblr-body-color);
  min-width: 1.6rem;
  font-size: .75rem;
  font-weight: 600;
}
.erp-section-nav .erp-nav-count-zero { color: var(--tblr-secondary); }
.erp-section-nav .active .erp-nav-count {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}
.erp-section-nav .active .erp-nav-count-zero { opacity: .75; }
.erp-section-nav .erp-nav-overview { position: relative; margin-right: .75rem; }
.erp-section-nav .erp-nav-overview::after {
  content: '';
  position: absolute;
  right: -.5rem;
  top: 25%;
  height: 50%;
  border-right: 1px solid var(--tblr-border-color);
}
@media (prefers-reduced-motion: reduce) {
  .erp-section-nav .nav-link { transition: none; }
}

.erp-integration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; }
.erp-integration-card { min-width: 0; height: 100%; }
.erp-integration-name { min-width: 0; overflow-wrap: anywhere; }
.erp-integration-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 767px) {
  .erp-integration-facts { grid-template-columns: 1fr; }
  .erp-integration-card > .card-body > .d-flex { flex-wrap: wrap; }
  .erp-integration-card .status { margin-left: 3.5rem; }
}
@media (prefers-reduced-motion: reduce) { .erp-integration-card .status-dot-animated { animation: none; } }

/* Sekcje natywnego opisu Allegro zachowują kolejność i dwie kolumny. */
.erp-offer-description { overflow-wrap: anywhere; }
.erp-offer-description img { max-width:100%; height:auto; }
.erp-offer-description .offer-description-row { display:flex; gap:1rem; margin-bottom:1rem; }
.erp-offer-description .offer-description-row > div { flex:1; min-width:0; }
@media (max-width:575.98px) { .erp-offer-description .offer-description-row { flex-direction:column; } }

/* Bootstrap d-flex nie może odsłaniać pytania przed zakończeniem importu. */
[data-offer-review][hidden] { display: none !important; }

/* Menu konta i długie, łączone role pozostają czytelne na telefonie. */
.erp-topbar .dropdown-menu { max-width: calc(100vw - 1rem); }
.erp-topbar .dropdown-header { white-space: normal; overflow-wrap: anywhere; }
