:root {
  /* Paleta NOVUM (docs/Identyfikacja_wizulana_NOVUM.pdf).
     HERO: ciemny zolty; akcenty: zolty, pomaranczowy, czerwony, limonkowy,
     zielony, fioletowy; neutralne: krem, bialy, granat (tekst). */
  --novum-yellow-dark: #fdc300;
  --novum-yellow: #feec01;
  --novum-orange: #f77f2b;
  --novum-red: #e94f24;
  --novum-lime: #c2ce0f;
  --novum-green: #3d8161;
  --novum-purple: #a978b3;
  --novum-cream: #fff4d4;
  --novum-navy: #24195d;
  --novum-lavender: #ece6f3;

  --primary-color: var(--novum-yellow-dark);
  --primary-dark: #e6b000;
  --secondary-color: var(--novum-navy);
  --accent-color: var(--novum-orange);
  --success-color: var(--novum-green);
  --warning-color: var(--novum-yellow-dark);
  --danger-color: var(--novum-red);
  --info-color: var(--novum-purple);
  --text-color: var(--novum-navy);
  --text-muted: #6b6489;
  --surface-color: #ffffff;
  --bg-color: #fffaeb;
  --border-color: #efe3bf;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(36, 25, 93, 0.06);
  --shadow-md: 0 8px 24px rgba(36, 25, 93, 0.12);
  --sidebar-width: 260px;
  --header-height: 60px;
}

body {
  font-family: "Montserrat", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--text-color);
  background: var(--novum-cream);
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #fffbea;
  border-right: 1px solid var(--border-color);
  color: var(--novum-navy);
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.15s ease, padding 0.15s ease;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Lista modułów przewija się niezależnie od nagłówka paska (marka +
   przycisk zwijania), gdy modułów jest za dużo, żeby zmieścić się na
   mniejszym ekranie — min-height:0 jest tu konieczne, żeby flex child mógł
   się w ogóle skurczyć i pokazać własny scrollbar zamiast wypychać stronę. */
.sidebar nav.nav {
  flex: 1 1 auto;
  /* Bootstrapowe .nav ustawia domyslnie flex-wrap:wrap — w polaczeniu z
     ukladem pionowym (.flex-column) i przepelnieniem, zawijanie tworzylo
     NOWA KOLUMNE w poziomie zamiast pozwolic liscie rosnac w pion, a ta
     kolumna byla przycinana przez overflow-x:hidden ponizej — wygladalo to
     jak "znikanie"/odrzucanie modulow, ktore sie nie mieszcza. */
  flex-wrap: nowrap;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 25, 93, 0.2) transparent;
}

.sidebar nav.nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar nav.nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar nav.nav::-webkit-scrollbar-thumb {
  background: rgba(36, 25, 93, 0.2);
  border-radius: 3px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  color: var(--novum-navy);
  text-decoration: none;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  color: var(--novum-navy);
}

/* Logo firmy (z Ustawien, jak na kartach technicznych) w miejscu nazwy. */
.sidebar-logo {
  display: block;
  height: 70px;
  max-width: 100%;
  width: auto;
}

/* Zwiniety pasek ma miejsce tylko na przycisk rozwijania. */
html.sidebar-collapsed .sidebar-brand {
  display: none;
}

.sidebar-toggle-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus {
  color: var(--novum-navy);
  background: var(--novum-lavender);
}


.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--novum-navy);
  font-weight: 700;
  padding: 0.4rem 0.45rem;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  /* Linki to elementy flex kontenera nav.nav (pionowy uklad) — bez tego
     domyslnie sie kurcza (flex-shrink:1), zeby zmiescic sie w ograniczonej
     wysokosci, zamiast pozwolic liscie przepelnic sie i przewinac. */
  flex-shrink: 0;
}

.sidebar .nav-link-text {
  /* Dlugie nazwy modulow zawijaja sie do kolejnej linii zamiast byc obcinane. */
  white-space: normal;
  overflow-wrap: break-word;
}

.sidebar-section-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a7fa8;
  padding: 0.85rem 0.5rem 0.35rem;
}

.sidebar-section-label:first-child {
  padding-top: 0.1rem;
}

.sidebar-section-label:hover,
.sidebar-section-label:focus {
  color: var(--novum-navy);
  background: var(--novum-lavender);
  border-radius: var(--radius-sm);
}

.sidebar-section-label-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-section-chevron {
  flex-shrink: 0;
  font-size: 0.65rem;
  margin-left: 0.5rem;
  transition: transform 0.15s ease;
}

.sidebar-section-label[aria-expanded="false"] .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-items {
  flex-shrink: 0;
}

/* W trybie zwinietym (same ikony) etykiety sekcji znikaja, tak samo jak
   nazwy modulow — zostaje ciagla lista ikon bez podzialu wizualnego. */
html.sidebar-collapsed .sidebar-section-label {
  display: none;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  color: var(--novum-navy);
  background: rgba(236, 230, 243, 0.6);
}

.sidebar .nav-link.active {
  color: var(--novum-navy);
  background: #fff0b8;
  font-weight: 800;
}

/* Ikona modulu w zaokraglonym kwadraciku — lawendowym, a w aktywnym module zoltym. */
.sidebar .nav-link i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--novum-lavender);
  color: var(--novum-navy);
  font-size: 1rem;
}

.sidebar .nav-link.active i {
  background: var(--novum-yellow-dark);
}

/* Pasek boczny zwinięty (przełącznik w nagłówku paska) — zostają same ikony,
   zapamiętane w localStorage (patrz inline script w <head> layouts/main.ejs
   i sidebarToggleBtn w app.js), więc stan przetrwa nawigację między stronami. */
html.sidebar-collapsed .sidebar {
  width: 64px;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

html.sidebar-collapsed .sidebar-header {
  justify-content: center;
}

html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .nav-link-text {
  display: none;
}

html.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-height);
  background: #fffbea;
  border-bottom: 4px solid var(--novum-yellow-dark);
  padding: 0 1.5rem;
  /* Belka zawsze na wierzchu przy przewijaniu strony (ponad sticky
     naglowkami tabel, ponizej modali Bootstrapa — z-index 1055). */
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Przyklejone naglowki tabel w tresci zatrzymuja sie pod belka,
   zamiast chowac sie pod nia. */
.page-content .sticky-top {
  top: var(--header-height);
}

/* ...ale w tabeli przewijanej we wlasnym pudelku (.table-scroll, z max-height)
   naglowek przykleja sie do gory tego pudelka — przesuniecie o wysokosc belki
   zsuwaloby go na pierwsze wiersze. (Tabele w .table-responsive z
   overflow:visible przyklejaja sie do strony i zostaja pod belka.) */
.page-content .table-scroll .sticky-top {
  top: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  color: var(--novum-navy);
  text-decoration: none;
}

.topbar-brand:hover,
.topbar-brand:focus {
  color: var(--novum-navy);
}

.topbar-app-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-week-badge {
  background: var(--novum-yellow-dark);
  color: var(--novum-navy);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.75rem;
  white-space: nowrap;
}

.topbar-page-title {
  color: var(--novum-navy);
  font-size: 1.2rem;
  font-weight: 700;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-content {
  padding: 1.5rem;
  flex: 1;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--novum-navy);
}

/* Krotkie zolte podkreslenie pod tytulem strony (jak w makiecie NOVUM). */
.page-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 5px;
  margin-top: 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--novum-yellow-dark);
}

.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.auth-container {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-footer {
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.75rem 1.5rem;
}

.footer__credit {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Link autora — kolor marki sksystem (niebieski), niezależny od palety NOVUM. */
.footer__credit a {
  color: #17b2e2;
  font-weight: 600;
  text-decoration: none;
}

.footer__credit a:hover,
.footer__credit a:focus {
  color: #128fb6;
  text-decoration: underline;
}

.module-config-example {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.dashboard-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.dashboard-shortcut-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  text-align: center;
  color: var(--text-color);
  background: linear-gradient(150deg, #ffffff 0%, #f8fafc 70%, #eef2ff 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-shortcut-tile:hover,
.dashboard-shortcut-tile:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #c7d2fe;
}

.dashboard-shortcut-tile--inactive {
  opacity: 0.72;
}

.dashboard-shortcut-tile--inactive:hover,
.dashboard-shortcut-tile--inactive:focus {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.dashboard-shortcut-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #334155;
  background: #e2e8f0;
  margin-bottom: 0.55rem;
}

.dashboard-shortcut-name {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
  text-align: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.7em;
}

.dashboard-shortcut-url {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Wariant dla /admin/narzedzia — szersze kafelki z pełnym (zawijanym) opisem
   narzędzia zamiast ucinanej jednej linii. */
.dashboard-shortcuts-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.dashboard-shortcuts-grid--wide .dashboard-shortcut-tile {
  padding: 1.1rem 1rem;
}

.dashboard-shortcuts-grid--wide .dashboard-shortcut-name {
  min-height: 0;
  margin-bottom: 0.35rem;
}

.dashboard-shortcuts-grid--wide .dashboard-shortcut-url {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

.shortcut-icon-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
}

.shortcut-icon-trigger__preview {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  color: #334155;
  font-size: 18px;
}

/* ==========================================================================
   Operations flow chart (production order details modal)
   Each operation renders as exactly one tile, grouped into columns by
   dependency depth. Real operation -> operation relations (incl. several
   operations feeding a single one) are drawn as SVG connector lines
   overlaid after layout, so no tile is ever duplicated.
   ========================================================================== */

.op-tree-chart {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 12px;
}

.op-tree-chart-scroll {
  position: relative;
  display: inline-block;
  min-width: 100%;
}

.op-tree-connectors {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.op-tree-columns {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 56px;
}

.op-tree-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.op-tree-node-wrap {
  position: relative;
  z-index: 1;
  transition: opacity .15s ease, transform .15s ease;
  cursor: pointer;
}

.op-tree-node-wrap.op-tree-active {
  transform: scale(1.04);
}

.op-tree-node-wrap.op-tree-active .op-tree-node {
  box-shadow: 0 0 0 2px var(--primary-color), var(--shadow-md);
}

.op-tree-node-wrap.op-tree-dim {
  opacity: .25;
}

.op-tree-node-wrap.op-tree-pinned .op-tree-node {
  box-shadow: 0 0 0 2px var(--accent-color), var(--shadow-md);
}

.op-tree-node-wrap.op-tree-pinned::before {
  content: "📌";
  position: absolute;
  top: -8px;
  right: -6px;
  z-index: 2;
  font-size: .7rem;
  line-height: 1;
  background: var(--surface-color);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.op-tree-node {
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease;
}

.op-tree-path {
  transition: opacity .15s ease, stroke-width .15s ease;
}

.op-tree-path-active {
  opacity: 0.95 !important;
  stroke-width: 3 !important;
}

.op-tree-path-dim {
  opacity: 0.08 !important;
}


.shortcut-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 0.55rem;
}

.shortcut-icon-grid__item {
  height: 52px;
  font-size: 22px;
}

.shortcut-icon-grid__item.active {
  border-color: var(--primary-color);
  background: #e0e7ff;
  color: #1f2937;
}

.js-sortable-shortcut-row {
  cursor: move;
}

.js-sortable-shortcut-row.is-dragging {
  opacity: 0.45;
}

.js-sortable-shortcuts.is-drag-over .js-sortable-shortcut-row {
  transition: background-color 0.12s ease;
}

@media (max-width: 991.98px) {
  .sidebar {
    display: none;
  }

  .page-content {
    padding: 1rem;
  }
}

.product-photo-box {
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  overflow: hidden;
}

.product-photo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

.product-photo-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.product-photo-box:hover .product-photo-edit-btn,
.product-photo-edit-btn:focus {
  opacity: 1;
}

.product-photo-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background-color: transparent;
  border: 2px dashed #ced4da;
  border-radius: 0.5rem;
  color: #6c757d;
}

.product-photo-empty:hover {
  background-color: #f1f3f5;
  border-color: #adb5bd;
}

.product-photo-dropzone {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  border: 2px dashed #ced4da;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.product-photo-dropzone.is-dragover {
  border-color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.06);
}

.product-photo-dropzone img#productPhotoPreview {
  max-height: 260px;
  max-width: 100%;
  border-radius: 0.375rem;
}

.product-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.product-photo-lightbox-scroll {
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  cursor: default;
}

.product-photo-lightbox-scroll img {
  display: block;
}

.product-photo-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
}

.product-photo-lightbox-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Reusable UI components
   Generic building blocks meant to be shared across pages as the portal
   layout is redesigned in stages. Anything specific to a single module
   belongs in that module's .ejs file, not here.
   ========================================================================== */

/* Icon chip — small rounded icon avatar, used for module/entity icons.
   Default is 38px; use a size modifier for other contexts. */
.icon-chip {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(102, 126, 234, .12);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.icon-chip-sm { width: 34px; height: 34px; font-size: 1rem; }
.icon-chip-lg { width: 46px; height: 46px; font-size: 1.4rem; border-radius: var(--radius-md); }
.icon-chip-xl { width: 52px; height: 52px; font-size: 1.5rem; border-radius: var(--radius-md); }

/* Status dot — small colored indicator dot, e.g. next to a status label. */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: .35rem; }
.status-dot-success { background: var(--success-color); }
.status-dot-info { background: var(--info-color); }
.status-dot-muted { background: var(--text-muted); }

/* List/detail layout — a selectable list on one side, a detail panel on the
   other (only the panel matching the selected list item is shown). */
.list-detail { display: flex; gap: 1.25rem; align-items: flex-start; }
/* Lista przyklejona pod gorna belka, z wlasnym przewijaniem — przewija sie
   niezaleznie od szczegolow (te ida razem ze strona). Wysokosc miesci sie
   miedzy belka a przyklejonym na dole paskiem akcji (.sticky-action-bar). */
.list-detail-list {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  max-height: calc(100vh - var(--header-height) - 7rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: .35rem;
}
.list-detail-content { flex: 1; min-width: 0; }

.entity-list-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  cursor: pointer;
  margin-bottom: .5rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.entity-list-item:hover { border-color: var(--primary-color); }
.entity-list-item.active {
  border-color: var(--primary-color);
  background: rgba(102, 126, 234, .07);
  box-shadow: var(--shadow-sm);
}
.entity-list-item-title { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.entity-list-item-subtitle { font-size: .74rem; color: var(--text-muted); }
.entity-list-item-chevron { color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

.detail-panel { display: none; }
.detail-panel.active { display: block; }

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  margin-bottom: 1rem;
}

/* Settings section — a titled card grouping related setting rows. */
.settings-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.settings-section-title { font-weight: 600; margin-bottom: .1rem; }
.settings-section-sub { color: var(--text-muted); font-size: .85rem; margin-bottom: 1rem; }

/* Setting row — icon + label + description + control, inside a settings-section. */
.setting-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: .6rem;
}
.setting-row:last-child { margin-bottom: 0; }
.setting-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setting-row-label { font-weight: 600; font-size: .9rem; }
.setting-row-desc { font-size: .8rem; color: var(--text-muted); }
.setting-row-control { margin-left: auto; flex-shrink: 0; align-self: center; }
.setting-row-control select { min-width: 190px; }

/* Info banner — dismissible-style inline notice (hidden by default, toggle
   with .show), e.g. to flag non-default settings. */
.info-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(33, 147, 176, .1);
  border: 1px solid rgba(33, 147, 176, .25);
  font-size: .85rem;
  margin-bottom: 1rem;
}
.info-banner.show { display: flex; }

/* Sticky action bar — form footer with Save/Cancel that stays in view. */
.sticky-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  padding: .9rem 0;
  margin-top: 1.25rem;
}

/* ==========================================================================
   NOVUM — nadpisania Bootstrapa (kolory, font, ksztalty)
   Zolte tla zawsze z granatowym tekstem (pary kolorow z ksiegi znaku,
   kontrast > 4.5); bialy tekst tylko na granacie, zieleni i czerwieni.
   ========================================================================== */
:root {
  --bs-body-font-family: "Montserrat", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--novum-navy);
  --bs-body-color-rgb: 36, 25, 93;
  --bs-body-bg: var(--novum-cream);
  --bs-emphasis-color: var(--novum-navy);
  --bs-secondary-color: #6b6489;
  --bs-border-color: var(--border-color);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-md);
  --bs-link-color: var(--novum-navy);
  --bs-link-color-rgb: 36, 25, 93;
  --bs-link-hover-color: #3b2c8a;
  --bs-link-hover-color-rgb: 59, 44, 138;
  --bs-primary: var(--novum-navy);
  --bs-primary-rgb: 36, 25, 93;
  --bs-success: var(--novum-green);
  --bs-success-rgb: 61, 129, 97;
  --bs-warning: var(--novum-yellow-dark);
  --bs-warning-rgb: 253, 195, 0;
  --bs-danger: var(--novum-red);
  --bs-danger-rgb: 233, 79, 36;
  --bs-info: var(--novum-purple);
  --bs-info-rgb: 169, 120, 179;
  --bs-focus-ring-color: rgba(253, 195, 0, 0.45);
}

.text-muted,
.text-body-secondary {
  color: var(--text-muted) !important;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--novum-navy);
  font-weight: 700;
}

.card {
  background: var(--surface-color);
}

/* Przyciski — ksztalt pigulki, glowna akcja zolta z granatowym tekstem. */
.btn,
.btn-sm {
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.btn-primary {
  --bs-btn-color: var(--novum-navy);
  --bs-btn-bg: var(--novum-yellow-dark);
  --bs-btn-border-color: var(--novum-yellow-dark);
  --bs-btn-hover-color: var(--novum-navy);
  --bs-btn-hover-bg: #ffcf2e;
  --bs-btn-hover-border-color: #ffcf2e;
  --bs-btn-active-color: var(--novum-navy);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-disabled-color: var(--novum-navy);
  --bs-btn-disabled-bg: var(--novum-yellow-dark);
  --bs-btn-disabled-border-color: var(--novum-yellow-dark);
  --bs-btn-focus-shadow-rgb: 253, 195, 0;
}

.btn-outline-primary {
  --bs-btn-color: var(--novum-navy);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #d9cfa6;
  --bs-btn-hover-color: var(--novum-navy);
  --bs-btn-hover-bg: var(--novum-cream);
  --bs-btn-hover-border-color: var(--novum-yellow-dark);
  --bs-btn-active-color: var(--novum-navy);
  --bs-btn-active-bg: var(--novum-yellow-dark);
  --bs-btn-active-border-color: var(--novum-yellow-dark);
  --bs-btn-focus-shadow-rgb: 253, 195, 0;
}

.btn-outline-secondary {
  --bs-btn-color: var(--novum-navy);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: #d9d3e8;
  --bs-btn-hover-color: var(--novum-navy);
  --bs-btn-hover-bg: var(--novum-lavender);
  --bs-btn-hover-border-color: #c9bedd;
  --bs-btn-active-color: var(--novum-navy);
  --bs-btn-active-bg: #ddd3ea;
  --bs-btn-active-border-color: #c9bedd;
}

.btn-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--novum-navy);
  --bs-btn-border-color: var(--novum-navy);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #34278a;
  --bs-btn-hover-border-color: #34278a;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1b1347;
  --bs-btn-active-border-color: #1b1347;
}

.btn-warning {
  --bs-btn-color: var(--novum-navy);
  --bs-btn-bg: var(--novum-yellow-dark);
  --bs-btn-border-color: var(--novum-yellow-dark);
  --bs-btn-hover-color: var(--novum-navy);
  --bs-btn-hover-bg: #ffcf2e;
  --bs-btn-hover-border-color: #ffcf2e;
  --bs-btn-active-color: var(--novum-navy);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
}

.btn-success {
  --bs-btn-bg: var(--novum-green);
  --bs-btn-border-color: var(--novum-green);
  --bs-btn-hover-bg: #336e52;
  --bs-btn-hover-border-color: #336e52;
  --bs-btn-active-bg: #2b5d45;
  --bs-btn-active-border-color: #2b5d45;
}

.btn-outline-success {
  --bs-btn-color: var(--novum-green);
  --bs-btn-border-color: var(--novum-green);
  --bs-btn-hover-bg: var(--novum-green);
  --bs-btn-hover-border-color: var(--novum-green);
  --bs-btn-active-bg: var(--novum-green);
  --bs-btn-active-border-color: var(--novum-green);
}

.btn-danger {
  --bs-btn-bg: var(--novum-red);
  --bs-btn-border-color: var(--novum-red);
  --bs-btn-hover-bg: #d1441c;
  --bs-btn-hover-border-color: #d1441c;
}

.btn-outline-danger {
  --bs-btn-color: var(--novum-red);
  --bs-btn-border-color: var(--novum-red);
  --bs-btn-hover-bg: var(--novum-red);
  --bs-btn-hover-border-color: var(--novum-red);
}

/* Formularze — zaokraglone pola, zolty pierscien fokusa. */
.form-control,
.form-select {
  border-radius: var(--radius-pill);
  border-color: #ddd3b3;
  color: var(--novum-navy);
  /* Bootstrap bierze tlo pol z --bs-body-bg (u nas kremowe tlo strony). */
  background-color: #fff;
}

textarea.form-control {
  border-radius: var(--radius-md);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--novum-yellow-dark);
  box-shadow: 0 0 0 0.2rem rgba(253, 195, 0, 0.35);
}

.form-check-input {
  --bs-form-check-bg: #fff;
}

.form-check-input:checked {
  background-color: var(--novum-navy);
  border-color: var(--novum-navy);
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
}

/* Tabele — naglowki wersalikami, cieple tlo naglowka. */
.table {
  --bs-table-color: var(--novum-navy);
  --bs-table-hover-bg: rgba(253, 195, 0, 0.08);
}

.table > thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-light {
  --bs-table-bg: #fffbea;
  --bs-table-color: var(--novum-navy);
  --bs-table-border-color: var(--border-color);
}

.table-success {
  --bs-table-bg: #e3f0e9;
  --bs-table-color: var(--novum-navy);
}

.table-warning {
  --bs-table-bg: #fff3c4;
  --bs-table-color: var(--novum-navy);
}

.table-danger {
  --bs-table-bg: #fde3da;
  --bs-table-color: var(--novum-navy);
}

/* Odznaki — pigulki; na zoltym tekst granatowy. */
.badge {
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.badge.bg-warning,
.badge.text-bg-warning {
  color: var(--novum-navy) !important;
}

/* Odznaki "info": fiolet NOVUM (#a978b3) jest za jasny pod mały tekst —
   ciemniejszy odcień fioletu z białym tekstem (kontrast 7,6:1). */
.badge.bg-info,
.badge.text-bg-info {
  background-color: #6f4479 !important;
  color: #fff !important;
}

.modal-content {
  border-radius: var(--radius-lg);
  border: none;
}

.modal-header {
  border-bottom: 3px solid var(--novum-yellow-dark);
}

.progress {
  border-radius: var(--radius-pill);
  background-color: #f1ead3;
}

/* Tabele na bialym tle (body ma kremowe tlo, ktore Bootstrap dziedziczy
   do --bs-table-bg). */
.table {
  --bs-table-bg: #fff;
}

/* Oznaczenie "krytyczne" (bombka) — wspolne dla wszystkich modulow. */
.krytyczne-icon {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
}

/* Przełącznik zakładek (segmented) — wzór: makieta "Zamówienia | Podsumowanie".
   Biała pigułka z obwódką, aktywna zakładka granatowa z białym tekstem. */
.nv-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.nv-tab {
  padding: .45rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.nv-tab:hover { color: var(--novum-navy); background: var(--novum-lavender); }
.nv-tab:focus-visible { outline: 2px solid var(--novum-navy); outline-offset: 2px; }
.nv-tab.is-active,
.nv-tab.is-active:hover { background: var(--novum-navy); color: #fff; }

/* Kafelki serii produkcyjnej (partials/seria-tiles.ejs) — Panel brygadzisty, Produkcja.
   Biała karta z kolorowym paskiem serii z lewej; aktywna z granatową obwódką. */
.seria-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; }
@media (max-width: 991.98px) { .seria-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.seria-tile {
  display: flex; align-items: center; min-height: 72px; padding: .75rem 1.5rem;
  background: var(--surface-color); border: 1px solid var(--border-color); border-left: 6px solid var(--tile-color);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  color: var(--novum-navy); font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; text-transform: uppercase;
  text-decoration: none; transition: box-shadow .15s ease, transform .15s ease;
}
.seria-tile:hover { color: var(--novum-navy); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.seria-tile:focus-visible { outline: 2px solid var(--novum-navy); outline-offset: 2px; }
.seria-tile.is-active { border-color: var(--novum-navy); border-left-color: var(--tile-color); box-shadow: 0 0 0 2px var(--novum-navy), var(--shadow-md); }

/* Linki do wersji jezykowych PDF certyfikatu (partials/certificate-files.ejs). */
.cert-file-links { display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.cert-file-lang {
  display: inline-block; padding: 0 .35rem; border: 1px solid var(--border-color); border-radius: var(--radius-pill);
  font-size: .68rem; font-weight: 800; line-height: 1.5; color: var(--novum-navy); text-decoration: none; background: #fff;
}
.cert-file-lang:hover { background: var(--novum-lavender); color: var(--novum-navy); }
