/* =============================================================================
 * app-core.css - consolidated stylesheet for the Credit Limits application.
 *
 * This file is the SINGLE source of browser-facing styles for the credit-limit
 * app. It contains:
 *   1. The full base stylesheet (formerly main.css): design tokens (:root),
 *      header, forms, tables, modals, badges, buttons, etc.
 *   2. The per-page styles formerly inlined as <style> blocks in:
 *        - forms/credit_limit.php          (confirmation page)
 *        - templates/credit_limit_form_view.php      (application form)
 *        - templates/credit_limit_overview_view.php (dashboard)
 *        - credit_limit_admin.php          (admin panel)
 *        - lib/header.php                    (shared header nav)
 *
 * Sections are appended in the SAME ORDER the browser loaded them before
 * (base stylesheet first, then each page block), so the CSS cascade is
 * preserved exactly - page-specific rules still override the base where they
 * did before.
 *
 * NOT included (by design):
 *   - Email styles (credit_emails.php, mailer.php, credit_reminders.php):
 *     email clients require inline styles; they stay inline.
 *   - login.css: login-page-specific, loaded separately by credit_login.php.
 *   - The base project's modern-ui.css / style.css / viewer.css: that is the
 *     parent project, not the credit-limit app.
 *
 * Main action color is --wb-primary (#0f172a, slate/black). --wb-red is the
 * brand accent only.
 * ========================================================================== */

/* ===== SELF-HOSTED FONT (Open Sans) ====================================== */
/* Open Sans is served from our own server (assets/fonts/) rather than Google
   Fonts - no external dependency, works on restricted networks, better
   privacy. Open Sans is licensed under the SIL Open Font License, which
   permits self-hosting. These are the variable font files (one normal, one
   italic) covering the full weight range 300-800 the app uses.
   font-display: swap shows the fallback system font until Open Sans loads. */
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 300 800;            /* variable weight range */
  font-display: swap;
  src: url("../fonts/OpenSans-Variable.woff2") format("woff2-variations"),
       url("../fonts/OpenSans-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: italic;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/OpenSans-Italic-Variable.woff2") format("woff2-variations"),
       url("../fonts/OpenSans-Italic-Variable.woff2") format("woff2");
}

/* ===== BASE (was main.css) ============================================== */
/* assets/css/app.css - shared styles for authenticated pages.
   Visual language matches the Wienerberger dashboard:
   black primary actions, red as brand accent only, flat
   sections separated by horizontal rules, no card shadows. */

:root {
  /* Brand accent - logo, badges, alerts, notifications */
  --wb-red: #DC1E24;
  --wb-red-dark: #B81820;

  /* Primary action color */
  --wb-primary: #0f172a;
  --wb-primary-hover: #1e293b;
  --wb-primary-active: #020617;

  /* Text */
  --wb-text: #0f172a;
  --wb-text-muted: #64748b;
  --wb-text-label: #334155;
  --wb-text-subtle: #94a3b8;

  /* Surfaces */
  --wb-bg: #ffffff;
  --wb-bg-subtle: #f8fafc;
  --wb-disabled-bg: #f1f5f9;

  /* Borders */
  --wb-border: #e2e8f0;
  --wb-border-strong: #cbd5e1;

  /* Status */
  --wb-error-bg: #fef2f2;
  --wb-error-text: #991b1b;
  --wb-error-border: #fecaca;
  --wb-success-bg: #ecfdf5;
  --wb-success-text: #065f46;
  --wb-success-border: #a7f3d0;
  --wb-warning-bg: #fef9c3;
  --wb-warning-text: #854d0e;
  --wb-warning-border: #fde68a;

  --wb-radius: 0px;
  --wb-radius-lg: 0px;
  --wb-shadow-focus: 0 0 0 3px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

/* Reserve vertical scrollbar space on every page so short pages (admin) and
   tall pages (dashboard) center content at the same width. Without this, the
   scrollbar's ~15px only appears on tall pages, shifting centered content
   horizontally between pages. overflow-y: scroll always reserves the track,
   which is the most broadly reliable fix across browsers. */
html { overflow-y: scroll; }

body.app-page {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  /* Also drive Bootstrap's own font variable to Open Sans, so any raw
     Bootstrap component (which reads --bs-body-font-family) uses the app
     font rather than Bootstrap's default stack. */
  --bs-body-font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
                         Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--wb-text);
  background: var(--wb-bg);
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App header ────────────────────────────────────────────────────────── */
.app-header {
  background: #fff;
  border-bottom: 1px solid var(--wb-border);
  padding: 1rem 0;
  /* Must sit ABOVE the form page's sticky .section-nav (z-index 50), or the
     header dropdown menus render behind it and appear not to open. */
  position: relative;
  z-index: 100;
  /* Self-define typography so the header looks identical on every page,
     including those that also load Bootstrap/Select2 (which change the
     inherited body font-family, font-size, and line-height). */
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: normal;
  box-sizing: border-box;
}
.app-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.app-header-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}
.app-header-logo-link:hover,
.app-header-logo-link:focus { text-decoration: none; }
.app-header-logo { height: 32px; width: auto; display: block; }
.app-header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.app-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--wb-radius);
  color: var(--wb-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease, background .15s ease;
}
.app-header-link:hover {
  color: var(--wb-text);
  background: var(--wb-surface-muted);
  text-decoration: none;
}
.app-header-link.is-active {
  color: var(--wb-text);
  background: var(--wb-surface-muted);
  font-weight: 600;
}
.app-header-link i { font-size: 0.875rem; opacity: 0.85; }
.app-header-menu {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 1rem;
  justify-content: space-between;
}
.app-header-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
}
.app-header-user { color: var(--wb-text); font-weight: 500; }
.app-header-logout {
  color: var(--wb-text-muted);
  text-decoration: none;
  transition: color .15s ease;
}
.app-header-logout:hover { color: var(--wb-text); text-decoration: none; }

/* Hamburger - hidden on desktop, surfaced via media query below */
.app-header-toggle-state { position: absolute; opacity: 0; pointer-events: none; }
.app-header-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  background: #fff;
  color: var(--wb-text);
  cursor: pointer;
  flex-shrink: 0;
}
.app-header-toggle .fa-times { display: none; }
.app-header-toggle-state:checked ~ .app-header-toggle .fa-bars { display: none; }
.app-header-toggle-state:checked ~ .app-header-toggle .fa-times { display: inline-block; }
.app-header-toggle:hover { border-color: var(--wb-border-strong); }
.app-header-toggle:focus-visible {
  outline: none;
  border-color: var(--wb-primary);
  box-shadow: var(--wb-shadow-focus);
}

/* ── Main / page header ────────────────────────────────────────────────── */
.app-main { padding: 2.5rem 0 4rem; }
.app-main .container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 1.5rem; }
/* Pages with wide data tables can opt into a wider container */
.app-main .container.container-wide { max-width: 1320px; }

.page-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--wb-border);
  text-align: left;
}
.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0 0 0.4rem 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.page-subtitle {
  font-size: 0.9375rem;
  color: var(--wb-text-muted);
  margin: 0;
}

/* ── Sections (cards rendered as flat HR-separated blocks) ────────────── */
body.app-page .app-form .card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--wb-border);
}
body.app-page .app-form .card:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}
body.app-page .app-form .card-body { padding: 0; }

.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0 0 1.25rem 0;
  padding: 0;
  border: 0;
  letter-spacing: -0.01em;
}

/* ── Form fields ──────────────────────────────────────────────────────── */
.app-form .form-group { margin-bottom: 1.125rem; }
.app-form .form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--wb-text-label);
  margin-bottom: 0.4rem;
}
.app-form .form-control {
  height: 40px;
  padding: 0 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--wb-text);
  background: #fff;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--wb-radius);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.app-form textarea.form-control {
  height: auto;
  min-height: 88px;
  padding: 0.625rem 0.75rem;
  resize: vertical;
}
.app-form .form-control:hover:not(:disabled):not([readonly]) {
  border-color: var(--wb-text-muted);
}
.app-form .form-control:focus {
  outline: none;
  border-color: var(--wb-primary);
  box-shadow: var(--wb-shadow-focus);
}
.app-form .form-control:disabled,
.app-form .form-control[disabled],
.app-form .form-control[readonly] {
  background: var(--wb-disabled-bg);
  color: var(--wb-text-muted);
  border-color: var(--wb-border);
  cursor: not-allowed;
}
.app-form .form-control[readonly]:focus {
  border-color: var(--wb-border);
  box-shadow: none;
}

/* ── Select2 - visually align with form-control ───────────────────────── */
.app-form .select2-container {
  max-width: 100%;
  width: 100% !important;
}
.app-form .select2-container--default .select2-selection--single {
  height: 40px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--wb-radius);
  background: #fff;
  display: flex;
  align-items: center;
}
.app-form .select2-container--default .select2-selection--single .select2-selection__rendered {
  flex: 1;
  line-height: 1.4;
  padding: 0 0.75rem;
  color: var(--wb-text);
  display: flex;
  align-items: center;
}
.app-form .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 0;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-form .select2-container--default .select2-selection--single .select2-selection__arrow b {
  position: static;
  top: auto;
  left: auto;
  margin: 0;
  border-color: var(--wb-text-muted) transparent transparent transparent;
}
.app-form .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--wb-text-muted) transparent;
}
.app-form .select2-container--default.select2-container--focus .select2-selection,
.app-form .select2-container--default.select2-container--open .select2-selection {
  border-color: var(--wb-primary);
  box-shadow: var(--wb-shadow-focus);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-wb {
  background: var(--wb-primary);
  color: #fff;
  border: 1px solid var(--wb-primary);
  border-radius: var(--wb-radius);
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease,
              box-shadow .15s ease, transform .05s ease;
}
.btn-wb:hover,
.btn-wb:focus {
  background: var(--wb-red);
  border-color: var(--wb-red);
  color: #fff;
  text-decoration: none;
}
.btn-wb:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 30, 36, 0.25);
}
.btn-wb:active {
  background: var(--wb-red-dark);
  border-color: var(--wb-red-dark);
  transform: translateY(1px);
}

.btn-wb.btn-lg,
.btn-wb.big {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  min-width: 180px;
}

/* Secondary action - black filled button (replaces the old outline look) */
.btn-wb-outline {
  background: transparent;
  color: var(--wb-text);
  border: 1px solid var(--wb-border-strong, #cbd5e1);
  border-radius: var(--wb-radius);
  font-weight: 500;
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-wb-outline:hover {
  background: var(--wb-primary);
  border-color: var(--wb-primary);
  color: #fff;
  text-decoration: none;
}
.btn-wb-outline:focus {
  outline: none;
  box-shadow: var(--wb-shadow-focus);
  border-color: var(--wb-primary);
  color: var(--wb-text);
}
.btn-wb-outline:disabled,
.btn-wb-outline[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Pulse - subtle dark instead of red */
.btn-wb.pulse { animation: wb-pulse 2.4s infinite; }
@keyframes wb-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(15, 23, 42, 0.40); }
  70%  { box-shadow: 0 0 0 14px rgba(15, 23, 42, 0);    }
  100% { box-shadow: 0 0 0 0    rgba(15, 23, 42, 0);    }
}
.btn-wb.pulse:hover,
.btn-wb.pulse:focus { animation: none; }

/* ── Form actions / errors / messages ─────────────────────────────────── */
.form-actions,
.form-send {
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.form-error:not(:empty) {
  background: var(--wb-error-bg);
  color: var(--wb-error-text);
  border: 1px solid var(--wb-error-border);
  border-radius: var(--wb-radius);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.mailresult:not(:empty) {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--wb-radius);
  font-size: 0.875rem;
  border: 1px solid transparent;
}
.mailresult.success,
.mailresult:not(:empty):not(.error) {
  background: var(--wb-success-bg);
  color: var(--wb-success-text);
  border-color: var(--wb-success-border);
}
.mailresult.error {
  background: var(--wb-error-bg);
  color: var(--wb-error-text);
  border-color: var(--wb-error-border);
}

/* ── Status badges (pill) ─────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--wb-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-status-warning {
  background: var(--wb-warning-bg);
  color: var(--wb-warning-text);
  border-color: var(--wb-warning-border);
}
.badge-status-error {
  background: var(--wb-error-bg);
  color: var(--wb-error-text);
  border-color: var(--wb-error-border);
}
.badge-status-success {
  background: var(--wb-success-bg);
  color: var(--wb-success-text);
  border-color: var(--wb-success-border);
}
.badge-status-neutral {
  background: var(--wb-bg-subtle);
  color: var(--wb-text-muted);
  border-color: var(--wb-border);
}

/* ── Access-denied card (kept as a contained box, not a flat section) ─── */
.card-denied {
  max-width: 480px;
  margin: 3rem auto;
  background: #fff;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-lg);
  box-shadow: none;
}
.card-denied .card-body { padding: 2.25rem 1.75rem; }

/* ── Products list ────────────────────────────────────────────────────── */
.ispis-proizvoda {
  font-size: 0.9375rem;
  color: var(--wb-text);
  line-height: 1.6;
  white-space: pre-line;
}
.ispis-proizvoda table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}
.ispis-proizvoda th,
.ispis-proizvoda td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--wb-border);
  text-align: left;
  font-size: 0.875rem;
}
.ispis-proizvoda th {
  font-weight: 600;
  color: var(--wb-text-label);
  background: var(--wb-bg-subtle);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Search panel (gray-tinted block matching dashboard reference) ─────── */
.search-panel {
  background: var(--wb-bg-subtle);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.search-panel-header {
  margin-bottom: 1.25rem;
}
.search-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.01em;
}
.search-panel-subtitle {
  font-size: 0.875rem;
  color: var(--wb-text-muted);
  margin: 0;
}
.search-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--wb-border);
}
.search-panel-actions-spacer { flex: 1; }
.search-panel-actions .btn {
  font-size: 0.875rem;
}

/* ── Red primary CTA (used inside search panel and modals) ─────────────── */
.btn-wb-danger {
  background: var(--wb-red);
  color: #fff;
  border: 1px solid var(--wb-red);
  border-radius: var(--wb-radius);
  font-weight: 600;
  padding: 0.5625rem 1.25rem;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn-wb-danger:hover,
.btn-wb-danger:focus {
  background: var(--wb-red-dark);
  border-color: var(--wb-red-dark);
  color: #fff;
  text-decoration: none;
}
.btn-wb-danger:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 30, 36, 0.20);
}

/* Outline variant of danger (for "Obriši otpremnicu" in modals) */
.btn-wb-danger-outline {
  background: transparent;
  color: var(--wb-red);
  border: 1px solid var(--wb-red);
  border-radius: var(--wb-radius);
  font-weight: 500;
  padding: 0.5625rem 1.25rem;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn-wb-danger-outline:hover,
.btn-wb-danger-outline:focus {
  background: var(--wb-red);
  color: #fff;
  text-decoration: none;
}

/* ── Results panel ─────────────────────────────────────────────────────── */
.results-panel { margin-top: 1.5rem; }
.results-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.results-panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0;
  letter-spacing: -0.01em;
}

/* ── Pager bar - bottom of table only, custom HTML we control ─────────── */
.pager-bar {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--wb-border);
  font-size: 0.875rem;
  color: var(--wb-text-muted);
}

/* Row 1 - page navigation */
.pager-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.pager-pages a,
.pager-pages .pager-current,
.pager-pages .pager-nav,
.pager-pages .pager-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.625rem;
  border-radius: 4px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.pager-pages a {
  color: var(--wb-text);
  border: 1px solid var(--wb-border);
  background: #fff;
  transition: background .12s ease, border-color .12s ease;
}
.pager-pages a:hover {
  background: var(--wb-bg-subtle);
  border-color: var(--wb-border-strong);
  text-decoration: none;
}
.pager-pages .pager-current {
  background: var(--wb-primary);
  color: #fff;
  border: 1px solid var(--wb-primary);
  font-weight: 600;
}
.pager-pages .pager-disabled {
  color: var(--wb-text-subtle);
  border: 1px solid var(--wb-border);
  background: var(--wb-bg-subtle);
  cursor: not-allowed;
}
.pager-pages .pager-ellipsis {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 0.25rem;
  color: var(--wb-text-muted);
}

/* Row 2 - controls (rows-per-page + summary text) */
.pager-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.pager-controls label {
  margin: 0;
  font-weight: 400;
  color: var(--wb-text-muted);
}
.pager-controls select {
  height: 32px;
  padding: 0 1.75rem 0 0.625rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--wb-text);
  background: #fff;
  border: 1px solid var(--wb-border);
  border-radius: 4px;
  cursor: pointer;
}
.pager-controls select:hover { border-color: var(--wb-border-strong); }
.pager-controls select:focus {
  outline: none;
  border-color: var(--wb-primary);
  box-shadow: var(--wb-shadow-focus);
}
.pager-summary {
  margin-left: auto;
  color: var(--wb-text-muted);
}
.pager-summary strong {
  color: var(--wb-text);
  font-weight: 600;
}
.pager-link {
  display: inline-block;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  color: var(--wb-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--wb-surface);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.pager-link:hover {
  border-color: var(--wb-border-strong);
  color: var(--wb-primary);
  text-decoration: none;
}
.pager-status {
  color: var(--wb-text-muted);
  font-size: 0.875rem;
  padding: 0 0.5rem;
}

/* ── Table (override .data-table to match dashboard) ──────────────────── */
.app-page .table-responsive,
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-page table.data-table,
table.data-table {
  width: 100%;
  min-width: 1020px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
}
.app-page table.data-table thead tr,
table.data-table thead tr {
  border-top: 1px solid var(--wb-border);
  border-bottom: 2px solid var(--wb-border-strong);
}
.app-page table.data-table th,
table.data-table th {
  font-weight: 700;
  color: var(--wb-text);
  text-align: left;
  padding: 0.75rem 0.875rem;
  background: var(--wb-bg-subtle);
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--wb-border);
}

/* Sortable column header link */
.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--wb-text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}
.sort-link:hover {
  color: var(--wb-primary);
  text-decoration: none;
}
.sort-link.is-active {
  color: var(--wb-primary);
}
.sort-arrow {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--wb-text-muted);
}
.sort-link.is-active .sort-arrow {
  color: var(--wb-primary);
  font-weight: 700;
}
.sort-arrow-inactive {
  opacity: 0.5;
}
.app-page table.data-table td,
table.data-table td {
  padding: 0.6875rem 0.875rem;
  border-bottom: 1px solid var(--wb-border);
  color: var(--wb-text);
  vertical-align: middle;
  font-size: 0.875rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
/* Allow long company names / reasons to wrap, but keep numeric and action cells tight */
.app-page table.data-table td.cell-num,
table.data-table td.cell-num,
.app-page table.data-table td .btn-link-action,
table.data-table td .btn-link-action,
.app-page table.data-table td .badge-status,
table.data-table td .badge-status {
  white-space: nowrap;
}
.app-page table.data-table tbody tr:hover,
table.data-table tbody tr:hover {
  background: var(--wb-bg-subtle);
}
table.data-table tr:last-child td { border-bottom: 0; }

/* Row tints - soft tint plus a colored left bar.
   The bar sits inside the first cell so it doesn't conflict with hover. */
table.data-table tbody tr.row-success td { background: rgba(16, 185, 129, 0.08); }
table.data-table tbody tr.row-warning td { background: rgba(245, 158, 11, 0.10); }
table.data-table tbody tr.row-error   td { background: rgba(220, 38, 38, 0.07);  }

table.data-table tbody tr.row-success td:first-child { box-shadow: inset 3px 0 0 var(--wb-success-text); }
table.data-table tbody tr.row-warning td:first-child { box-shadow: inset 3px 0 0 #b45309; }
table.data-table tbody tr.row-error   td:first-child { box-shadow: inset 3px 0 0 var(--wb-error-text); }

/* Hover keeps the tint but slightly deepens it */
table.data-table tbody tr.row-success:hover td { background: rgba(16, 185, 129, 0.14); }
table.data-table tbody tr.row-warning:hover td { background: rgba(245, 158, 11, 0.18); }
table.data-table tbody tr.row-error:hover   td { background: rgba(220, 38, 38, 0.12);  }

.cell-bold {
  font-weight: 600;
  color: var(--wb-text);
}
.cell-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cell-empty {
  color: var(--wb-text-subtle);
  text-align: center;
  font-size: 1.125rem;
  line-height: 1;
}
.cell-empty span { cursor: help; }

/* Column widths via <colgroup> - gives predictable proportions */
table.data-table col.col-datum      { width: 110px; }
table.data-table col.col-broj       { width: 110px; }
table.data-table col.col-firma      { width: auto;  } /* takes remaining space */
table.data-table col.col-action     { width: 110px; }
table.data-table col.col-razlog     { width: 200px; }
table.data-table col.col-vrijednost { width: 140px; }
table.data-table col.col-ispunio    { width: 150px; }
table.data-table col.col-status     { width: 160px; }
.data-table-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--wb-text-muted);
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
}
.empty-state-icon {
  font-size: 1.75rem;
  color: var(--wb-text-subtle);
  margin-bottom: 0.25rem;
}
.empty-state-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wb-text);
}
.empty-state-help {
  margin: 0;
  font-size: 0.875rem;
  color: var(--wb-text-muted);
}

/* Date column split */
.cell-datum-date {
  display: block;
  font-weight: 500;
  color: var(--wb-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cell-datum-time {
  display: block;
  font-size: 0.75rem;
  color: var(--wb-text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.125rem;
}

/* Filter chips above the table */
.filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem 0;
  padding: 0.625rem 0;
  font-size: 0.8125rem;
}
.filter-chips-label {
  color: var(--wb-text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  background: var(--wb-bg-subtle);
  border: 1px solid var(--wb-border);
  border-radius: 999px;
  color: var(--wb-text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background .12s ease, border-color .12s ease;
}
.filter-chip:hover {
  background: var(--wb-error-bg);
  border-color: var(--wb-error-border);
  color: var(--wb-error-text);
  text-decoration: none;
}
.filter-chip-x {
  font-size: 1rem;
  line-height: 1;
  color: var(--wb-text-muted);
  font-weight: 600;
}
.filter-chip:hover .filter-chip-x {
  color: var(--wb-error-text);
}
.filter-chips-clear {
  margin-left: 0.25rem;
  color: var(--wb-text-muted);
  font-size: 0.8125rem;
  text-decoration: underline;
}
.filter-chips-clear:hover {
  color: var(--wb-text);
  text-decoration: underline;
}

/* Small button variant */
.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

/* Inline link-style action button (table cells) */
.btn-link-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: transparent;
  border: 0;
  padding: 0.25rem 0;
  color: var(--wb-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s ease;
}
.btn-link-action:hover {
  color: var(--wb-red);
  text-decoration: none;
}
.btn-link-action i { color: var(--wb-text-muted); }

/* ──────────────────────────────────────────────────────────────────────────
   Modal redesign - soft chrome, generous whitespace, typographic hierarchy.
   Replaces a Bootstrap-default look with a calmer, more modern palette.
   ────────────────────────────────────────────────────────────────────────── */

/* Modal chrome: flat card, hairline border, no rounded corners */
.modal-content {
  border: 1px solid var(--wb-border);
  border-radius: 0;
  box-shadow: 0 16px 32px -16px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.modal-dialog {
  margin: 1.75rem auto;
}

@media (min-width: 992px) {
  .modal-lg { max-width: 760px; }
}

/* Header - clean separator, focus on the title */
.modal-header {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--wb-border);
  align-items: center;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--wb-text);
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.modal-header .close {
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  color: var(--wb-text-muted);
  opacity: 0.7;
  text-shadow: none;
  padding: 0.25rem;
  margin: -0.25rem -0.5rem -0.25rem auto;
  transition: opacity .15s ease, color .15s ease;
}

.modal-header .close:hover,
.modal-header .close:focus {
  opacity: 1;
  color: var(--wb-text);
  outline: none;
}

/* Body */
.modal-body {
  padding: 1.5rem;
}

/* Footer - flat, hairline separator */
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--wb-border);
  background: transparent;
  gap: 0.5rem;
  justify-content: flex-end;
}

.modal-footer > * { margin: 0; }

/* ── Tabs - flat underline style, no pills ───────────────────────────── */
.modal-tabs {
  border: none;
  border-bottom: 1px solid var(--wb-border);
  background: transparent;
  padding: 0 1.5rem;
  margin: 0;
  display: flex;
  gap: 0;
}

.modal-tabs .nav-item { margin: 0; }

.modal-tabs .nav-link {
  display: inline-block;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--wb-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}

.modal-tabs .nav-link:hover {
  color: var(--wb-text);
  background: transparent;
  text-decoration: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.modal-tabs .nav-link.active {
  background: transparent;
  color: var(--wb-text);
  border: none;
  border-bottom: 2px solid var(--wb-text);
  margin-bottom: -1px;
  font-weight: 600;
  box-shadow: none;
}

/* Push first tab content slightly off the tabs border */
.modal-tabs + .modal-body {
  padding-top: 1.25rem;
}

/* ── Detail grid - stacked label/value pairs, 2 across ────────────────── */
/* Pattern matches modern data summaries (Stripe, Linear, etc.):
   each cell is a self-contained block where the small uppercase label
   sits above the value, and pairs flow into a 2-column grid. */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
  row-gap: 1.5rem;
  margin: 0;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Each <div class="detail-pair"> wraps a dt+dd, becoming one grid cell */
.detail-grid > .detail-pair {
  display: block;
  min-width: 0;
}

.detail-grid dt {
  display: block;
  margin: 0 0 0.375rem;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wb-text);
  line-height: 1.4;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

.detail-grid dd {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--wb-text);
  line-height: 1.45;
  word-break: break-word;
}

.detail-grid dd em {
  color: var(--wb-text-muted);
  font-style: normal;
}

.detail-grid dd p { margin: 0 0 0.25rem; line-height: 1.45; }
.detail-grid dd p:last-child { margin-bottom: 0; }
.detail-grid dd p + p { margin-top: 0; }

.detail-grid dd a {
  color: var(--wb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.detail-grid dd a:hover { color: var(--wb-primary-hover); }

/* Disabled inputs render as plain text matching surrounding values */
.detail-grid dd .form-control:disabled,
.detail-grid dd .form-control[disabled] {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  line-height: inherit !important;
  font: inherit !important;
  color: inherit !important;
  font-weight: 400 !important;
  box-shadow: none !important;
  width: 100%;
  display: block;
}

.detail-grid dd .form-control:disabled:focus {
  background: var(--wb-bg-subtle) !important;
  outline: none;
}

/* Pair spans full width inside the grid (e.g., long product list) */
.detail-grid > .detail-pair-full,
.detail-grid > .detail-row-full {
  grid-column: 1 / -1;
}

/* Backwards-compat: any leftover .detail-row-half class */
.detail-grid > .detail-row-half {
  grid-column: span 1;
}

/* Mobile: single column, tighter row gap */
@media (max-width: 575px) {
  .detail-grid {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 1.25rem;
  }
}

/* Section divider inside modal body */
.modal-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--wb-border);
}
.modal-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Section heading - heavy uppercase, full text color.
   Strong visual stops at section breaks; field labels stay subtle in
   contrast, so structure reads clearly without competing with content. */
.modal-section-title {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wb-text);
  margin: 0 0 1rem;
  padding: 0;
  border: none;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

/* ── Approval grid (4 cards in 2x2 layout) ────────────────────────────── */
.approval-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--wb-border);
}

.approval-card {
  background: transparent;
  border: none;
  border-right: 1px solid var(--wb-border);
  border-bottom: 1px solid var(--wb-border);
  border-radius: 0;
  padding: 0.875rem 1rem;
}

/* Remove redundant outer borders */
.approval-grid > .approval-card:nth-child(2n) { border-right: none; }
.approval-grid > .approval-card:nth-last-child(-n+2) { border-bottom: none; }

.approval-card-title {
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wb-text);
  margin: 0 0 0.5rem;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

.approval-card-empty {
  color: var(--wb-text-muted);
  font-style: normal;
  font-size: 0.875rem;
}

@media (max-width: 575px) {
  .approval-grid { grid-template-columns: 1fr; }
  .approval-grid > .approval-card { border-right: none; }
  .approval-grid > .approval-card:nth-last-child(1) { border-bottom: none; }
  .approval-grid > .approval-card:nth-last-child(2) { border-bottom: 1px solid var(--wb-border); }
}

/* ── Action modal: disabled inputs styled as plain text ───────────────── */
.modal-body .form-control:disabled {
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.25rem 0;
  height: auto;
  min-height: 0;
  color: var(--wb-text);
  font-weight: 500;
  cursor: text;
  user-select: text;
  font-size: 0.9375rem;
  box-shadow: none;
}

.modal-body .form-control:disabled:focus {
  background-color: var(--wb-bg-subtle);
  border-color: var(--wb-border);
  outline: none;
  padding: 0.375rem 0.625rem;
}

/* Field labels above active inputs inside modals */
.modal-body .form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--wb-text);
  margin-bottom: 0.375rem;
}

/* Labels above PREVIEW (disabled) inputs */
.modal-body .form-group:has(.form-control:disabled) label,
.modal-body label.preview-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wb-text-muted);
  margin-bottom: 0.125rem;
}

.modal-body .form-group {
  margin-bottom: 1rem;
}
.modal-body .form-row {
  margin-bottom: 0.25rem;
}
.modal-body .form-row > [class*="col-"] {
  padding-bottom: 0.25rem;
}

.modal-help {
  margin: 1rem 0 0.25rem;
  color: var(--wb-text-muted);
  font-size: 0.8125rem;
}

.modal-label-note {
  font-weight: 400;
  color: var(--wb-text-muted);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.modal-title-badge {
  font-size: 0.75rem;
  vertical-align: middle;
}

/* Legacy classes kept for compat */
.modal-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--wb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0.875rem 0 0.25rem 0;
}
.modal-value {
  font-size: 0.9375rem;
  color: var(--wb-text);
  margin: 0;
  font-weight: 400;
  line-height: 1.45;
}
.modal-value-block { white-space: pre-line; }
.modal-value-html { font-size: 0.9375rem; color: var(--wb-text); }
.modal-value-html p { margin: 0 0 0.375rem 0; line-height: 1.45; }
.modal-value-html p:last-child { margin-bottom: 0; }
.modal-value-html p + p { margin-top: 0; }
.modal-value-html a {
  color: var(--wb-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modal-value-html a:hover { color: var(--wb-primary-hover); }
.modal-value-html ul, .modal-value-html ol {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding: 0;
}
.modal-value-html li { margin-bottom: 0.125rem; }

/* ── Flash variants ───────────────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-radius: var(--wb-radius);
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
  line-height: 1.4;
}
.flash i {
  flex: 0 0 auto;
  margin-top: 0.125rem;
}
.flash-success {
  background: var(--wb-success-bg);
  color: var(--wb-success-text);
  border-color: var(--wb-success-border);
}
.flash-warning {
  background: var(--wb-warning-bg);
  color: var(--wb-warning-text);
  border-color: var(--wb-warning-border);
}
.flash-error {
  background: var(--wb-error-bg);
  color: var(--wb-error-text);
  border-color: var(--wb-error-border);
}
.flash-neutral {
  background: var(--wb-surface-muted);
  color: var(--wb-text);
  border-color: var(--wb-border);
}

/* ── Generic data table (kept for other pages, redefined cleaner above) ── */
.app-form table.data-table { /* fallback for pages that namespace via .app-form */ }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* The header has 3 parts (logo / nav / meta) and only a few nav links, so
     instead of a hamburger we stack them cleanly: logo+meta on the top row,
     nav centered on its own row below. Readable and tap-friendly. */
  .app-header-inner {
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }
  .app-header-nav {
    order: 3;
    flex: 0 0 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--wb-border);
  }
  .app-header-meta {
    margin-left: auto;       /* logo left, meta right on the top row */
    gap: 0.875rem;
  }
  .app-header-link,
  .app-header-nav-link {
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 600px) {
  .app-header-inner { padding: 0 1rem; }
  .app-main { padding: 1.5rem 0 2.5rem; }
  body.app-page .app-form .card { padding: 1.25rem 0; }
  .page-title { font-size: 1.5rem; }
  .page-header { padding-bottom: 1rem; margin-bottom: 1.25rem; }
  .btn-wb.btn-lg, .btn-wb.big { width: 100%; min-width: 0; }
}

/* ── Company-facing povrat form ─────────────────────────────────────────── */
.form-section {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--wb-border);
}
.form-section:last-of-type { border-bottom: 0; }
.form-section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0 0 0.25rem 0;
}
.form-section-help {
  font-size: 0.875rem;
  color: var(--wb-text-muted);
  margin: 0 0 1.25rem 0;
}
.required-mark {
  color: var(--wb-error-text);
  font-weight: 600;
}
.form-help {
  display: block;
  font-size: 0.8125rem;
  color: var(--wb-text-muted);
  margin-top: 0.25rem;
}

/* Reason-for-change description panel (shown under the reason dropdown) */
.reason-description {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--wb-text, #0f172a);
  background: var(--wb-subtle-bg, #f8fafc);
  border-left: 3px solid var(--wb-primary, #0f172a);
}

/* Pending-request warning (shown under the company picker) */
.pending-warning {
  margin-top: 0.625rem;
  padding: 0.75rem 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left-width: 3px;
}
.pending-warning-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.pending-warning-body { margin-bottom: 0.5rem; }
.pending-warning-confirm {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 500;
}
.pending-warning-confirm input { margin-top: 0.2rem; }
.pending-warning-confirm.is-invalid,
.pending-warning input.is-invalid { outline: 2px solid #dc2626; }

/* Validation error styling */
.form-error-msg {
  display: block;
  font-size: 0.8125rem;
  color: var(--wb-error-text);
  margin-top: 0.25rem;
  font-weight: 500;
}
.app-form .form-control.is-invalid,
.app-form input.is-invalid,
.app-form select.is-invalid,
.app-form textarea.is-invalid {
  border-color: var(--wb-error-text) !important;
  background-color: var(--wb-error-bg);
}
.app-form .form-control.is-invalid:focus,
.app-form input.is-invalid:focus,
.app-form select.is-invalid:focus,
.app-form textarea.is-invalid:focus {
  border-color: var(--wb-error-text) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.form-check.is-invalid {
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--wb-error-text);
  background: var(--wb-error-bg);
  border-radius: var(--wb-radius);
}
.legal-note {
  font-size: 0.8125rem;
  color: var(--wb-text-muted);
  line-height: 1.55;
  margin: 1rem 0 0 0;
}

/* Multi-row product entry */
.proizvodi-wrapper {
  margin-bottom: 1rem;
}
.proizvod-row {
  padding: 0.875rem;
  margin-bottom: 0.625rem;
  background: var(--wb-bg-subtle);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
}
.proizvod-row:last-child { margin-bottom: 0; }
.proizvod-row .form-row { margin-bottom: 0; }
.proizvod-row .form-group { margin-bottom: 0.25rem; }
.proizvod-row-actions { text-align: right; }
.proizvod-row-actions .btn {
  margin-top: 1.5rem; /* aligns with input baseline on desktop */
}
@media (max-width: 768px) {
  .proizvod-row-actions { text-align: left; }
  .proizvod-row-actions .btn { margin-top: 0.25rem; }
}

/* GDPR checkbox row */
.form-section .form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0;
}
.form-section .form-check input[type="checkbox"] {
  margin-top: 0.25rem;
  flex: 0 0 auto;
}
.form-section .form-check label {
  margin: 0;
  font-weight: 400;
  color: var(--wb-text);
  font-size: 0.9375rem;
  line-height: 1.45;
}

/* Select2 product result with sifra subtitle */
.select2-result-product {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
/* Select2 result rows in the otpremnica/product dropdowns -
   stack broj on top, datum on a new line below as muted metadata. */
.select2-result-row {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.125rem 0;
}
.select2-result-name {
  font-weight: 500;
  color: var(--wb-text);
}
.select2-result-meta {
  display: block;
  font-size: 0.8125rem;
  color: var(--wb-text-muted);
  line-height: 1.3;
}

/* Form actions alignment */
.form-actions-end {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.5rem;
}

/* Prominent full-width submit/CTA button */
.btn-cta {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn-cta i { margin-right: 0.5rem; }
.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(220, 30, 36, 0.22);
}
.btn-cta:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.btn-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 30, 36, 0.28);
}
/* When a CTA is the only child of form-actions-end, let it stretch full-width */
.form-actions-end > .btn-cta:only-child { flex: 1; }

/* ── Success page ─────────────────────────────────────────────────────── */
.success-hero {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}
.success-hero-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--wb-success-bg);
  color: var(--wb-success-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.success-hero .page-title { margin-bottom: 0.5rem; }
.success-hero .page-subtitle {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.success-summary {
  margin-top: 1rem;
}
.success-summary .results-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.success-meta {
  font-size: 0.875rem;
  color: var(--wb-text-muted);
}
.success-meta strong {
  color: var(--wb-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.success-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2rem;
  padding: 1.25rem 0;
}
.success-summary-block-full { grid-column: 1 / -1; }

.success-summary-h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wb-text-muted);
  margin: 0 0 0.625rem 0;
}

.success-dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1rem;
  row-gap: 0.5rem;
  font-size: 0.9375rem;
}
.success-dl dt {
  color: var(--wb-text-muted);
  font-weight: 400;
}
.success-dl dd {
  margin: 0;
  color: var(--wb-text);
  font-weight: 500;
  word-break: break-word;
}

.success-prose {
  font-size: 0.9375rem;
  color: var(--wb-text);
  margin: 0;
  line-height: 1.5;
}

.success-actions {
  border-top: 1px solid var(--wb-border);
  padding-top: 1.25rem;
}

@media (max-width: 720px) {
  .success-summary-grid { grid-template-columns: 1fr; }
  .success-dl {
    grid-template-columns: 1fr;
    row-gap: 0.125rem;
  }
  .success-dl dt { margin-top: 0.375rem; }
}
/* ──────────────────────────────────────────────────────────────────────────
   Stat-card grid - summary metrics row used on admin overview pages.
   Used by: mailer_tracker.php (and any future admin page that needs cards).
   ────────────────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0 0 1.5rem;
  border: 1px solid var(--wb-border, #e2e8f0);
  background: #fff;
}
.stat-card {
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--wb-border, #e2e8f0);
}
.stat-card:last-child { border-right: none; }

.stat-card-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wb-text-muted, #64748b);
  margin: 0 0 0.5rem;
}
.stat-card-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--wb-text, #0f172a);
  line-height: 1.1;
  margin: 0 0 0.25rem;
}
.stat-card-meta {
  font-size: 0.8125rem;
  color: var(--wb-text-muted, #64748b);
}

@media (max-width: 767px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  /* 2x2 grid: remove right border on the right column, bottom border on top row */
  .stat-card:nth-child(2) { border-right: none; }
  .stat-card:nth-child(1),
  .stat-card:nth-child(2) { border-bottom: 1px solid var(--wb-border, #e2e8f0); }
}

/* ──────────────────────────────────────────────────────────────────────────
   Muted "empty value" cell text - used inline in data-table cells where a
   value is technically null but we want to render a discreet placeholder.
   ────────────────────────────────────────────────────────────────────────── */
.cell-zero {
  color: var(--wb-text-muted, #94a3b8);
  font-size: 0.875rem;
}

/* ──────────────────────────────────────────────────────────────────────────
   Subtle in-line note next to the result count (e.g. "· N rows excluded").
   ────────────────────────────────────────────────────────────────────────── */
.results-count-note {
  color: var(--wb-text-muted, #64748b);
  font-size: 0.8125rem;
}

/* ===== APPLICATION FORM (was inline <style> in templates/credit_limit_form_view.php) =====
   Scoped to .page-form so per-page rules (e.g. .container width) don't
   collide with other pages' blocks merged into this same file. */
        /* ====================================================================
           Page-specific styles. Uses tokens from main.css; only adds layout
           primitives this page needs that the shared stylesheet doesn't have.
           ==================================================================== */


        /* CRITICAL - main.css's .form-control inherits width:100% from
           Bootstrap. This page deliberately doesn't load Bootstrap, so we
           set the width explicitly to make inputs fill their column. */
        .app-form .form-control { width: 100%; }

        /* Numeric / money fields: right-aligned tabular figures. Removes the
           browser spinner arrows so number inputs read like ordinary text. */
        .app-form .form-control.is-numeric {
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        .app-form input[type="number"]::-webkit-outer-spin-button,
        .app-form input[type="number"]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        .app-form input[type="number"] { -moz-appearance: textfield; }

        /* Suffix inside an input (e.g. "EUR"). Sits flush right, doesn't
           steal clicks, reserves padding inside the input on the same side. */
        .input-affix { position: relative; }
        .input-affix .form-control { padding-right: 3.25rem; }
        .input-affix-suffix {
            position: absolute;
            right: 0.75rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--wb-text-muted);
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            pointer-events: none;
            text-transform: uppercase;
        }

        /* Aggressive red border only AFTER user has interacted - avoids
           lighting up every required field on first paint. */
        .app-form .form-control:user-invalid {
            border-color: var(--wb-error-text);
        }
        .app-form .form-control.is-invalid {
            border-color: var(--wb-error-text);
            background: var(--wb-error-bg);
        }

        /* Two- and three-column field grids */
        .field-grid-2,
        .field-grid-3 {
            display: grid;
            column-gap: 1.25rem;
        }
        .field-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .field-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        @media (max-width: 640px) {
            .field-grid-2, .field-grid-3 { grid-template-columns: 1fr; }
        }

        /* Sub-section heading within a card (e.g. "Security Guarantees"
           inside Financial Data). Smaller, uppercase, with a top divider. */
        .subsection-label {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--wb-text-muted);
            margin: 1.5rem 0 0.875rem 0;
            padding-top: 1.25rem;
            border-top: 1px solid var(--wb-border);
        }
        /* First child of a card-body has nothing above it - no divider needed. */
        .card-body > .subsection-label:first-child {
            margin-top: 0;
            padding-top: 0;
            border-top: 0;
        }

        /* Short prose directly under a section heading */
        .section-help {
            font-size: 0.875rem;
            color: var(--wb-text-muted);
            margin: -0.75rem 0 1.25rem 0;
        }

        /* Inline error text below a field */
        .field-error-msg {
            display: none;
            font-size: 0.8125rem;
            color: var(--wb-error-text);
            margin-top: 0.375rem;
            font-weight: 500;
        }
        .field-error-msg.is-visible { display: block; }

        /* ── Delta display ────────────────────────────────────────────────
           Replaces the old "Change" + "Change %" twin readonly inputs.
           Shows the absolute delta and percentage in one calm strip with a
           color cue. The two hidden inputs immediately below this element
           carry the actual values for backend POST. */
        .delta-display {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            padding: 0 1rem;
            height: 40px;
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            margin-top: 1rem;
        }
        .delta-display-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--wb-text-muted);
        }
        .delta-display-value {
            display: flex;
            align-items: baseline;
            gap: 0.5rem;
            font-variant-numeric: tabular-nums;
        }
        .delta-display-amount {
            font-size: 1rem;
            font-weight: 700;
            color: var(--wb-text);
        }
        .delta-display-percent {
            font-size: 0.8125rem;
            color: var(--wb-text-muted);
            font-weight: 500;
        }
        .delta-display.is-positive .delta-display-amount,
        .delta-display.is-positive .delta-display-percent { color: var(--wb-success-text); }
        .delta-display.is-negative .delta-display-amount,
        .delta-display.is-negative .delta-display-percent { color: var(--wb-error-text); }

        /* ── Monthly forecast table ────────────────────────────────────── */
        .monthly-forecast {
            width: 100%;
            border-collapse: collapse;
        }
        .monthly-forecast th,
        .monthly-forecast td {
            padding: 0.625rem 0.5rem;
            border-bottom: 1px solid var(--wb-border);
            vertical-align: middle;
        }
        .monthly-forecast th {
            background: var(--wb-bg-subtle);
            color: var(--wb-text-label);
            font-weight: 700;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            text-align: right;
            white-space: nowrap;
        }
        .monthly-forecast th:first-child { text-align: left; }
        .monthly-forecast td:first-child {
            font-weight: 700;
            color: var(--wb-text-label);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            width: 110px;
            white-space: nowrap;
        }
        .monthly-forecast tr:last-child td { border-bottom: 0; }
        .monthly-forecast .form-control {
            text-align: right;
            font-variant-numeric: tabular-nums;
        }
        @media (max-width: 640px) {
            .monthly-forecast th.col-m3,
            .monthly-forecast td.col-m3 { display: none; }
        }

        /* App-header title tweak */
        .app-header-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--wb-text);
            letter-spacing: -0.005em;
        }

        /* Final submit area - clearly the end of the form */
        .form-submit-bar {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--wb-border);
        }

        /* Consent legal note - visually deemphasized prose block */
        .consent-text {
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            padding: 0.875rem 1rem;
            margin: 0 0 1rem 0;
            font-size: 0.8125rem;
            line-height: 1.55;
            color: var(--wb-text-muted);
        }

        /* ── Select2 visual tweaks ──────────────────────────────────────────
           Make select2's default chrome match main.css's form-control style:
           same height, same border, same radius (none), same focus ring. */
        .select2-container .select2-selection--single {
            height: 40px;
            border: 1px solid var(--wb-border-strong);
            border-radius: var(--wb-radius);
            background: var(--wb-bg);
            font-family: inherit;
        }
        .select2-container--default .select2-selection--single .select2-selection__rendered {
            line-height: 38px;
            padding-left: 0.75rem;
            color: var(--wb-text);
        }
        .select2-container--default .select2-selection--single .select2-selection__arrow {
            height: 38px;
        }
        .select2-container--default.select2-container--focus .select2-selection--single,
        .select2-container--default.select2-container--open .select2-selection--single {
            border-color: var(--wb-primary);
            box-shadow: var(--wb-shadow-focus);
        }
        .select2-dropdown {
            border: 1px solid var(--wb-border-strong);
            border-radius: var(--wb-radius);
        }
        .select2-search--dropdown .select2-search__field {
            border: 1px solid var(--wb-border);
            padding: 0.375rem 0.625rem;
            font-family: inherit;
        }
        .select2-container--default .select2-results__option--highlighted[aria-selected] {
            background-color: var(--wb-primary);
            color: #fff;
        }
        .select2-result-company__sap {
            font-size: 0.75rem;
            color: var(--wb-text-muted);
            margin-left: 0.5rem;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        }

        /* ── Approval Path indicator ────────────────────────────────────────
           Sits below the New Credit Limit input. Updates live as the amount
           changes - JS reads tier descriptors from the panel's data attribute,
           computes the right tier, swaps the label and the role list. */
        .approval-path {
            margin-top: 1rem;
            padding: 0.875rem 1rem;
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            display: flex;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .approval-path-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--wb-text-muted);
            white-space: nowrap;
        }
        .approval-path-tier {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.875rem;
            color: var(--wb-text);
        }
        .approval-path-tier-badge {
            display: inline-block;
            background: var(--wb-text);
            color: #fff;
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            padding: 0.125rem 0.5rem;
        }
        .approval-path-roles {
            font-size: 0.8125rem;
            color: var(--wb-text-muted);
        }
        .approval-path-roles strong {
            color: var(--wb-text);
            font-weight: 600;
        }
        .approval-path-arrow {
            display: inline-block;
            margin: 0 0.375rem;
            color: var(--wb-text-subtle);
            font-weight: 400;
        }

        /* ── Sticky section nav ─────────────────────────────────────────────
           Sits below the header (which scrolls off normally). When the user
           scrolls past the header, the nav becomes the new top strip. */
        html { scroll-behavior: smooth; }

        .section-nav {
            position: sticky;
            top: 0;
            z-index: 50;
            background: var(--wb-bg);
            border-bottom: 1px solid var(--wb-border);
        }
        .section-nav-inner {
            max-width: 960px;
            margin: 0 auto;
            padding: 0 1.5rem;
            display: flex;
            gap: 0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }
        .section-nav-inner::-webkit-scrollbar { display: none; }

        .section-nav-link {
            display: inline-flex;
            align-items: center;
            padding: 0.875rem 1rem;
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--wb-text-muted);
            text-decoration: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            white-space: nowrap;
            transition: color .15s ease, border-color .15s ease;
        }
        .section-nav-link:hover {
            color: var(--wb-text);
            text-decoration: none;
        }
        .section-nav-link.is-active {
            color: var(--wb-text);
            border-bottom-color: var(--wb-text);
            font-weight: 700;
        }

        /* Sections targeted by the nav: leave room above so hash-jumps don't
           hide the section title behind the sticky nav bar. */
        .card[id^="sec-"] { scroll-margin-top: 70px; }

/* ===== CONFIRMATION PAGE (was inline <style> in forms/credit_limit.php) ===== */
/* ====================================================================
           Submission confirmation page - designed standalone (the user lands
           here after a POST). Uses tokens from main.css; adds the page-specific
           hero + badge + next-steps language.
           ==================================================================== */
        body.app-page { padding-top: 0; }

        /* Container kept tight - confirmation is a focused page, not a dashboard */

        /* ── 1. Hero ──────────────────────────────────────────────────────
           The "what just happened" zone. Replaces the small success banner.
           Big company name + amount + tier/status pills. Subtle ✓ icon. */
        .conf-hero {
            background: var(--wb-bg);
            border: 1px solid var(--wb-border);
            border-left: 4px solid var(--wb-success-text, #166534);
            padding: 1.5rem 1.75rem 1.75rem;
            margin: 1.5rem 0 1.25rem;
            display: flex;
            gap: 1.25rem;
            align-items: flex-start;
        }
        .conf-hero-icon {
            flex: 0 0 auto;
            width: 36px; height: 36px;
            border-radius: 50%;
            background: var(--wb-success-bg, #dcfce7);
            color: var(--wb-success-text, #166534);
            display: flex; align-items: center; justify-content: center;
            font-size: 1.25rem;
            font-weight: 700;
            margin-top: 0.125rem;
        }
        .conf-hero-body { flex: 1 1 auto; min-width: 0; }
        .conf-hero-eyebrow {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--wb-success-text, #166534);
            margin-bottom: 0.375rem;
        }
        .conf-hero-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--wb-text);
            margin: 0 0 0.25rem;
            line-height: 1.2;
            word-break: break-word;
        }
        .conf-hero-amount {
            font-size: 1.125rem;
            color: var(--wb-text-muted);
            margin: 0 0 0.875rem;
            font-variant-numeric: tabular-nums;
        }
        .conf-hero-amount strong {
            color: var(--wb-text);
            font-weight: 700;
        }
        .conf-hero-pills {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .pill {
            display: inline-flex;
            align-items: center;
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            padding: 0.25rem 0.625rem;
            border: 1px solid transparent;
        }
        .pill-tier {
            background: var(--wb-text);
            color: #fff;
        }
        .pill-pending {
            background: #fef3c7;
            color: #92400e;
            border-color: #fde68a;
        }

        /* ── 2. Next-steps panel ──────────────────────────────────────────
           Explains what happens after submission. Conservative styling so
           it doesn't compete with the hero. */
        .next-steps {
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            padding: 1rem 1.25rem 1.125rem;
            margin: 0 0 1.5rem;
        }
        .next-steps-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--wb-text-muted);
            margin-bottom: 0.5rem;
        }
        .next-steps p {
            margin: 0 0 0.5rem;
            font-size: 0.9375rem;
            line-height: 1.55;
            color: var(--wb-text);
        }
        .next-steps p:last-child { margin-bottom: 0; }
        .next-steps strong { font-weight: 700; }
        .next-steps ul {
            margin: 0.375rem 0 0.5rem;
            padding-left: 1.25rem;
            font-size: 0.9375rem;
            color: var(--wb-text);
        }
        .next-steps ul li {
            line-height: 1.55;
            margin-bottom: 0.125rem;
        }

        /* ── 3. Section cards ─────────────────────────────────────────────
           Each subsection (Applicant, Financial Data, etc.) gets a card
           with a small label header. The grid is 2-col with right-aligned
           numeric values where appropriate. */
        .conf-section {
            border: 1px solid var(--wb-border);
            margin: 0 0 1rem;
            background: var(--wb-bg);
        }
        .conf-section-title {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--wb-text-muted);
            padding: 0.625rem 1.25rem;
            border-bottom: 1px solid var(--wb-border);
            background: var(--wb-bg-subtle);
            margin: 0;
        }
        .conf-grid { display: grid; grid-template-columns: 1fr 1fr; }
        @media (max-width: 640px) { .conf-grid { grid-template-columns: 1fr; } }
        .conf-item {
            padding: 0.875rem 1.25rem;
            border-bottom: 1px solid var(--wb-border);
            border-right: 1px solid var(--wb-border);
            min-width: 0;
        }
        .conf-item:nth-child(even) { border-right: none; }
        .conf-item.full           { grid-column: 1 / -1; border-right: none; }
        .conf-grid > .conf-item:nth-last-child(-n+2):not(.full) { border-bottom: none; }
        .conf-grid > .conf-item.full:last-child { border-bottom: none; }
        .conf-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--wb-text-muted);
            margin-bottom: 0.25rem;
        }
        .conf-value {
            font-size: 0.9375rem;
            color: var(--wb-text);
            font-variant-numeric: tabular-nums;
            word-break: break-word;
        }
        .conf-value.numeric { font-variant-numeric: tabular-nums; }
        .conf-value.featured {
            font-size: 1.5rem;
            font-weight: 700;
        }
        .change-positive { color: var(--wb-success-text, #166534); font-weight: 600; }
        .change-negative { color: var(--wb-error-text,   #991b1b); font-weight: 600; }

        /* ── 4. Monthly forecast table ────────────────────────────────────
           Tabular figures, subtle row stripes, totals column emphasized. */
        .conf-table-wrap { padding: 0; }
        .conf-table {
            width: 100%;
            border-collapse: collapse;
            margin: 0;
        }
        .conf-table th, .conf-table td {
            padding: 0.75rem 1.25rem;
            text-align: right;
            font-variant-numeric: tabular-nums;
            font-size: 0.9375rem;
            border-bottom: 1px solid var(--wb-border);
        }
        .conf-table tbody tr:last-child th, .conf-table tbody tr:last-child td {
            border-bottom: none;
        }
        .conf-table th {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--wb-text-muted);
            background: var(--wb-bg-subtle);
        }
        .conf-table th:first-child, .conf-table td:first-child {
            text-align: left;
            font-weight: 600;
            color: var(--wb-text);
        }
        .conf-table .col-total {
            font-weight: 700;
            background: var(--wb-bg-subtle);
        }

        /* ── 5. Comment ──────────────────────────────────────────────────── */
        .conf-comment {
            padding: 1rem 1.25rem;
            font-size: 0.9375rem;
            line-height: 1.6;
            white-space: pre-wrap;
            color: var(--wb-text);
        }

        /* ── 6. Actions footer ────────────────────────────────────────────
           Primary action (Review Dashboard) is bolder; secondary (New
           Application) is the outline button. */
        .conf-actions {
            display: flex;
            gap: 0.625rem;
            margin: 2rem 0 3rem;
            justify-content: center;
            flex-wrap: wrap;
        }

        /* ── 7. Error states ──────────────────────────────────────────────
           Smaller treatment - just enough hierarchy to read clearly. */
        .missing-list {
            display: flex;
            flex-wrap: wrap;
            gap: 0.375rem;
            margin-top: 0.5rem;
        }
        .missing-pill {
            font-size: 0.75rem;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            background: var(--wb-error-bg);
            border: 1px solid var(--wb-error-border);
            color: var(--wb-error-text);
            padding: 0.125rem 0.5rem;
        }

        /* ── 8. Print stylesheet ──────────────────────────────────────────
           Confirmation pages frequently get printed for filing. Drop the
           colored hero accent and action buttons; collapse to plain B&W
           rendering with clean section breaks. */
        @media print {
            body.app-page { background: #fff; color: #000; }
            .conf-hero {
                border-color: #000;
                border-left-width: 1px;
                padding: 0.75rem 0;
            }
            .conf-hero-icon { display: none; }
            .pill { border: 1px solid #000 !important; background: #fff !important; color: #000 !important; }
            .next-steps { border: 1px solid #000; background: #fff; }
            .conf-section, .conf-section-title, .conf-item, .conf-table th, .conf-table td {
                border-color: #000 !important;
                background: #fff !important;
            }
            .conf-actions { display: none; }
            a { color: #000; text-decoration: none; }
        }

/* ===== DASHBOARD (was inline <style> in templates/credit_limit_overview_view.php) ===== */
/* ── Container override for this wide page */

        /* ── Filter bar above stats */
        .filter-bar {
            display: flex;
            gap: 0.6rem;
            align-items: center;
            flex-wrap: wrap;
            margin: 1.25rem 0 0.75rem;
            padding: 0.5rem 0.75rem;
            background: var(--wb-bg-subtle, #f8fafc);
            border: 1px solid var(--wb-border, #e2e8f0);
        }
        .filter-bar-label {
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            text-transform: uppercase;
            color: var(--wb-text-muted, #64748b);
        }
        .filter-bar-label:not(:first-child) { margin-left: 0.75rem; }
        .filter-bar select {
            font-size: 0.8125rem;
            height: 32px;
            padding: 0 0.5rem;
            border: 1px solid var(--wb-border, #e2e8f0);
            background: #fff;
            color: var(--wb-text, #0f172a);
            min-width: 150px;
        }
        .filter-bar select:focus {
            outline: none;
            border-color: var(--wb-primary, #0f172a);
            box-shadow: 0 0 0 1px var(--wb-primary, #0f172a);
        }
        .filter-bar-label {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--wb-text-muted);
        }
        .filter-bar select {
            height: 36px;
            padding: 0 0.75rem;
            font-size: 0.875rem;
            border: 1px solid var(--wb-border-strong);
            border-radius: var(--wb-radius);
            background: var(--wb-bg);
            color: var(--wb-text);
            font-family: inherit;
        }

        /* ── Tier + status badges */
        .tier-pill {
            display: inline-block;
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            padding: 0.125rem 0.5rem;
            background: var(--wb-text);
            color: #fff;
            white-space: nowrap;
        }
        .status-cell {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }
        .status-cell-badge { align-self: flex-start; }
        .status-cell-progress {
            font-size: 0.75rem;
            color: var(--wb-text-muted);
            line-height: 1.3;
        }

        /* ── Charts */
        .charts-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1rem;
            margin: 1.5rem 0;
        }
        @media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
        .chart-card {
            background: var(--wb-bg);
            border: 1px solid var(--wb-border);
            padding: 1.25rem 1.25rem 0.875rem;
            min-width: 0;              /* let the card shrink inside the grid */
        }
        .chart-card canvas { max-width: 100%; }
        .chart-card-title {
            font-size: 0.75rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--wb-text-muted);
            margin: 0 0 1rem;
        }
        .chart-wrap { position: relative; height: 240px; }

        /* Mobile: charts get more vertical room (they're full-width now) and the
           cards use less side padding so the plot area keeps its width. */
        @media (max-width: 640px) {
            .chart-card { padding: 1rem 0.75rem 0.75rem; }
            .chart-wrap { height: 280px; }
        }
        @media (max-width: 400px) {
            .chart-wrap { height: 300px; }
        }

        /* ── DataTables chrome (kept from prior page, minor tweaks) */
        .table-card {
            background: transparent;
            border: 0;
        }

        /* Table action bar (above the DataTables top bar) - holds the
           'Waiting on me' filter checkbox. Slim, left-aligned, semantic
           color to match other filter chrome. */
        .table-actions {
            display: flex;
            align-items: flex-start;
            gap: 1rem;
            margin-bottom: 0.625rem;
            padding: 0;
            flex-wrap: wrap;
        }
        .table-actions .form-check {
            margin: 0;
            padding-left: 1.625rem;
            align-self: center;
        }
        .table-actions .form-check-input {
            margin-left: -1.625rem;
            margin-top: 0.2rem;
        }
        .table-actions .form-check-label {
            font-size: 0.8125rem;
            color: var(--wb-text-muted);
            cursor: pointer;
            user-select: none;
        }
        .table-actions .form-check-input:checked ~ .form-check-label {
            color: var(--wb-text);
            font-weight: 500;
        }
        /* Excel export control - spans the row so the entity pair can grow */
        .table-actions .export-control {
            margin-left: auto;
            text-align: right;
            flex: 1 1 100%;
            min-width: 0;
        }
        .export-form {
            display: flex;
            align-items: center;
            gap: 0.4rem 0.6rem;
            justify-content: flex-end;
            flex-wrap: wrap;
        }
        /* Keep each label glued to its own control so wrapping never orphans a
           label or the button - they break as tidy label+field pairs. */
        .export-form .export-pair {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            white-space: nowrap;
        }
        /* The FIRST pair (Export + entity picker) grows to fill the empty space,
           pushing From/To and the button right; it wraps only when out of room. */
        .export-form .export-pair:first-child {
            flex: 1 1 260px;
            min-width: 220px;
        }
        .export-label {
            font-size: 0.8125rem;
            color: var(--wb-text-muted);
            font-weight: 500;
        }
        .export-select {
            font-size: 0.8125rem;
            height: 32px;
            padding: 0 0.5rem;
            border: 1px solid var(--wb-border, #e2e8f0);
            background: #fff;
            color: var(--wb-text, #0f172a);
            flex: 1 1 auto;
            min-width: 0;
        }
        .export-date {
            font-size: 0.8125rem;
            height: 32px;
            padding: 0 0.5rem;
            border: 1px solid var(--wb-border, #e2e8f0);
            background: #fff;
            color: var(--wb-text, #0f172a);
            font-family: inherit;
        }
        .export-label-date { margin-left: 0; }

        /* ── Export entity multi-select (Select2) - match the design system ── */
        #exportEntity + .select2-container { flex: 1 1 auto; min-width: 200px; width: auto !important; }
        #exportEntity + .select2-container .select2-selection--multiple {
            min-height: 32px;
            border: 1px solid var(--wb-border, #e2e8f0);
            border-radius: 0;                /* sharp, like the rest of the app */
            background: #fff;
            padding: 1px 4px;
        }
        #exportEntity + .select2-container.select2-container--focus .select2-selection--multiple,
        #exportEntity + .select2-container.select2-container--open  .select2-selection--multiple {
            border-color: var(--wb-primary, #0f172a);
            box-shadow: 0 0 0 1px var(--wb-primary, #0f172a);
            outline: none;
        }
        /* Placeholder + typed search text */
        #exportEntity + .select2-container .select2-search--inline .select2-search__field {
            font-size: 0.8125rem;
            color: var(--wb-text, #0f172a);
            margin-top: 4px;
        }
        #exportEntity + .select2-container .select2-selection__placeholder {
            color: var(--wb-text-muted, #64748b);
            font-size: 0.8125rem;
        }
        /* Selected tag "chips" - slate theme, sharp corners */
        #exportEntity + .select2-container .select2-selection__choice {
            background: var(--wb-primary, #0f172a);
            border: 1px solid var(--wb-primary, #0f172a);
            border-radius: 0;
            color: #fff;
            font-size: 0.75rem;
            padding: 1px 6px 1px 4px;
            margin: 3px 3px 0 0;
        }
        #exportEntity + .select2-container .select2-selection__choice__remove {
            color: #cbd5e1;
            margin-right: 4px;
            font-weight: 700;
        }
        #exportEntity + .select2-container .select2-selection__choice__remove:hover {
            color: var(--wb-red, #DC1E24);
            background: transparent;
        }
        /* Dropdown menu */
        .select2-dropdown {
            border: 1px solid var(--wb-primary, #0f172a);
            border-radius: 0;
        }
        .select2-container .select2-results__option--highlighted[aria-selected] {
            background: var(--wb-primary, #0f172a);
        }
        .select2-container .select2-results__option[aria-selected="true"] {
            background: var(--wb-bg-subtle, #f8fafc);
            color: var(--wb-text, #0f172a);
        }

        .export-btn {
            font-size: 0.8125rem;
            font-weight: 600;
            padding: 0.35rem 0.85rem;
            border: 1px solid var(--wb-primary, #DC1E24);
            background: var(--wb-primary, #DC1E24);
            color: #fff;
            cursor: pointer;
            white-space: nowrap;
        }
        .export-btn:hover,
        .export-btn:focus {
            background: var(--wb-red);
            border-color: var(--wb-red);
            color: #fff;
        }
        .export-hint {
            font-size: 0.6875rem;
            color: var(--wb-text-subtle, #94a3b8);
            margin-top: 0.3rem;
            line-height: 1.4;
            white-space: nowrap;
        }
        @media (max-width: 720px) {
            .table-actions { flex-wrap: wrap; }
            .table-actions .export-control { margin-left: 0; text-align: left; width: 100%; }
            .export-form { justify-content: flex-start; flex-wrap: wrap; }
            .export-hint { max-width: none; white-space: normal; }
        }
        .dataTables_wrapper { font-family: inherit; font-size: 0.875rem; color: var(--wb-text); }
        .dataTables_wrapper .dt-top {
            display: flex; align-items: center; justify-content: space-between;
            flex-wrap: wrap; gap: 0.75rem;
            padding: 0.875rem 1.25rem;
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            border-bottom: none;
        }
        .dataTables_wrapper .dt-bottom {
            display: flex; align-items: center; justify-content: space-between;
            flex-wrap: wrap; gap: 0.75rem;
            margin-top: 1.5rem; padding: 1.25rem 0 0 0;
            background: transparent;
            border-top: 1px solid var(--wb-border);
        }
        .dataTables_wrapper .dt-top    .dataTables_length,
        .dataTables_wrapper .dt-top    .dataTables_filter,
        .dataTables_wrapper .dt-bottom .dataTables_info,
        .dataTables_wrapper .dt-bottom .dataTables_paginate {
            padding: 0; margin: 0; float: none;
        }
        .dataTables_wrapper .dataTables_length label,
        .dataTables_wrapper .dataTables_filter label {
            margin: 0; color: var(--wb-text-muted); font-weight: 400;
            display: flex; align-items: center; gap: 0.5rem;
            font-size: 0.8125rem;
        }
        .dataTables_wrapper .dataTables_length select,
        .dataTables_wrapper .dataTables_filter input {
            height: 32px; padding: 0 0.625rem;
            font-size: 0.875rem; font-family: inherit;
            color: var(--wb-text); background: var(--wb-bg);
            border: 1px solid var(--wb-border-strong);
            border-radius: var(--wb-radius);
            outline: none;
        }
        .dataTables_wrapper .dataTables_filter input { min-width: 240px; }
        .dataTables_wrapper .dataTables_length select:focus,
        .dataTables_wrapper .dataTables_filter input:focus {
            border-color: var(--wb-primary);
            box-shadow: var(--wb-shadow-focus);
        }
        .dataTables_wrapper .dataTables_info { color: var(--wb-text-muted); font-size: 0.8125rem; }
        .dataTables_wrapper .pagination { margin: 0; }
        .dataTables_wrapper .dataTables_paginate .page-link {
            color: var(--wb-text);
            border: 1px solid var(--wb-border);
            background: var(--wb-bg);
            font-size: 0.875rem; font-weight: 500;
            border-radius: 0;
        }
        .dataTables_wrapper .dataTables_paginate .page-link:hover {
            background: var(--wb-bg-subtle);
            border-color: var(--wb-border-strong);
            color: var(--wb-text);
        }
        .dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
            background: var(--wb-primary); border-color: var(--wb-primary); color: #fff;
        }
        .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
            color: var(--wb-text-subtle); background: var(--wb-bg-subtle);
        }
        .dataTables_wrapper .dt-scroll {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            border: 1px solid var(--wb-border);
            border-top: none;
            background: var(--wb-bg);
        }
        table.data-table.dataTable { margin: 0 !important; min-width: 1020px; }
        table.data-table tbody tr { cursor: pointer; }
        .data-empty { text-align: center; padding: 2.5rem 1rem; color: var(--wb-text-muted); }

        /* ── Mobile: stacked-card table ───────────────────────────────────
           On narrow screens the 8-column table won't fit, so each row
           becomes a labeled card (Company: …, Entity: …) - everything
           visible, readable, no horizontal scroll. data-label on each <td>
           supplies the field name. */
        @media (max-width: 640px) {
            .dataTables_wrapper .dt-scroll { overflow-x: visible; border: 0; }
            table.data-table,
            table.data-table.dataTable {
                min-width: 0;
                width: 100%;
                table-layout: auto;
                display: block;
            }
            table.data-table thead { display: none; }
            table.data-table tbody { display: block; }
            table.data-table tbody tr {
                display: block;
                margin: 0 0 0.75rem;
                border: 1px solid var(--wb-border);
                border-left-width: 3px;
                background: #fff;
            }
            table.data-table tbody tr.row-success { border-left-color: var(--wb-success-text); }
            table.data-table tbody tr.row-warning { border-left-color: #b45309; }
            table.data-table tbody tr.row-error   { border-left-color: var(--wb-error-text); }
            table.data-table tbody tr td:first-child { box-shadow: none !important; }
            table.data-table tbody tr td {
                display: flex;
                justify-content: space-between;
                align-items: baseline;
                gap: 1rem;
                width: auto !important;
                padding: 0.5rem 0.875rem;
                border: 0;
                border-bottom: 1px solid var(--wb-border-subtle, #f1f5f9);
                text-align: right;
                white-space: normal;
            }
            table.data-table tbody tr td:last-child { border-bottom: 0; }
            table.data-table tbody tr td::before {
                content: attr(data-label);
                font-weight: 600;
                color: var(--wb-text-label, #334155);
                text-align: left;
                flex: 0 0 auto;
                white-space: nowrap;
            }
            table.data-table tbody tr td .status-cell { align-items: flex-end; }
        }

        /* ── Modal: decision matrix table */
        #reviewModal .modal-body { padding: 1.5rem; }
        .decision-matrix {
            width: 100%;
            border-collapse: collapse;
            margin: 0.5rem 0 0;
            font-size: 0.875rem;
        }
        .decision-matrix th, .decision-matrix td {
            text-align: left;
            padding: 0.5rem 0.75rem;
            border-bottom: 1px solid var(--wb-border);
        }
        .decision-matrix th {
            font-size: 0.6875rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.06em;
            color: var(--wb-text-muted);
            background: var(--wb-bg-subtle);
            border-bottom: 1px solid var(--wb-border);
        }
        .decision-matrix .dm-empty { color: var(--wb-text-muted); font-style: italic; }
        .decision-matrix .dm-approved { color: var(--wb-success-text); font-weight: 600; }
        .decision-matrix .dm-declined { color: var(--wb-error-text);   font-weight: 600; }
        .decision-matrix .dm-waiting  { color: var(--wb-text-muted);   font-style: italic; }
        .decision-matrix .dm-future-state { color: var(--wb-text-subtle); font-style: italic; }

        /* Stage heading row */
        .decision-matrix .dm-stage-row td {
            background: var(--wb-bg-subtle);
            padding: 0.5rem 0.75rem;
            font-size: 0.8125rem;
            border-bottom: 1px solid var(--wb-border);
        }
        .decision-matrix .ds-state {
            display: inline-block;
            margin-left: 0.5rem;
            padding: 0.0625rem 0.5rem;
            font-size: 0.6875rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        .decision-matrix .ds-state-past    { background: var(--wb-success-bg,#dcfce7); color: var(--wb-success-text); }
        .decision-matrix .ds-state-current { background: #fef3c7;                       color: #92400e; }
        .decision-matrix .ds-state-future  { background: var(--wb-bg-subtle);           color: var(--wb-text-subtle); }

        /* Dim future stage rows */
        .decision-matrix tr.dm-future td:not(.dm-future-state) { color: var(--wb-text-subtle); }

        /* ── Modal: my-decision action panel */
        .my-decision-panel {
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            border-left: 4px solid var(--wb-primary);
            padding: 1rem 1.25rem;
            margin: 1.25rem 0 0;
        }
        .my-decision-panel-label {
            font-size: 0.6875rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.07em;
            color: var(--wb-text-muted);
            margin-bottom: 0.5rem;
        }
        .my-decision-panel-info {
            background: var(--wb-bg-subtle);
            border: 1px solid var(--wb-border);
            padding: 1rem 1.25rem;
            margin: 1.25rem 0 0;
            font-size: 0.875rem;
            color: var(--wb-text-muted);
        }
        .my-decision-panel .form-group { margin: 0 0 0.75rem; }

/* ===== ADMIN PANEL - uses the app design system (tokens, .card, .app-form,
   .btn-wb). Scoped under .page-admin where page-specific. ================= */

/* Admin sections are <section class="card"> that WRAP a form (the base
   .card rule only styles cards inside .app-form, so these need their own).
   Render them as distinct bordered cards with clear spacing between, so
   "Create new user" and "Manage existing user" read as separate panels. */
.page-admin .app-main .card {
  background: var(--wb-bg);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  padding: 1.5rem 1.5rem;
  margin: 0 0 1.5rem;
}
.page-admin .app-main .card:last-of-type { margin-bottom: 0; }

/* Card heading inside admin sections (matches page-title scale, smaller) */
.page-admin .card-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--wb-text);
  margin: 0 0 1.125rem;
  letter-spacing: -0.01em;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--wb-border);
}

/* Action row under a form: button + helper text aligned */
.page-admin .admin-actions {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Grouped user picker: select + button on one line */
.page-admin .admin-picker {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-admin .admin-picker .form-group {
  flex: 1 1 420px;          /* grow to fill the row - more room to search */
  min-width: 260px;
  margin-bottom: 0;
}
/* Load user button stays its natural width, aligned to the field baseline */
.page-admin .admin-picker .btn-wb {
  flex: 0 0 auto;
}
/* Select2 box follows the (now wider) field; its dropdown + search match it */
.page-admin .admin-picker .select2-container { width: 100% !important; }
/* The type-filter group spans the full row so the dropdown drops below it */
.page-admin .admin-picker .user-type-filter-group {
  flex: 1 1 100%;
}
/* Segmented control: All / Internal / Company */
.page-admin .user-type-filter {
  display: inline-flex;
  border: 1px solid var(--wb-border-strong, #cbd5e1);
  border-radius: var(--wb-radius);
  overflow: hidden;
}
.page-admin .utf-btn {
  appearance: none;
  border: 0;
  border-left: 1px solid var(--wb-border-strong, #cbd5e1);
  background: transparent;
  color: var(--wb-text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.page-admin .utf-btn:first-child { border-left: 0; }
.page-admin .utf-btn:hover { background: var(--wb-bg-subtle, #f8fafc); }
.page-admin .utf-btn.is-active {
  background: var(--wb-primary);
  color: #fff;
}
.page-admin .utf-btn.is-active:hover { background: var(--wb-primary); }

/* Entity checkbox group */
.page-admin .ent-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 1.75rem;
  margin-bottom: 1.25rem;
}
.page-admin .ent-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--wb-text);
  cursor: pointer;
}
.page-admin .ent-check input { width: 16px; height: 16px; accent-color: var(--wb-primary); }

/* Role matrix table - flat, token-based, matches the dashboard tables */
.page-admin .role-matrix-wrap { overflow-x: auto; margin-bottom: 0.75rem; }
.page-admin .role-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.page-admin .role-matrix th,
.page-admin .role-matrix td {
  border: 1px solid var(--wb-border);
  padding: 0.5rem 0.65rem;
  text-align: center;
  vertical-align: middle;
}
.page-admin .role-matrix thead th {
  background: var(--wb-bg-subtle);
  font-weight: 600;
  color: var(--wb-text-label);
  white-space: nowrap;
}
.page-admin .role-matrix th:first-child,
.page-admin .role-matrix td:first-child {
  text-align: left;
  white-space: nowrap;
  font-weight: 500;
}
.page-admin .role-matrix tbody input { width: 16px; height: 16px; accent-color: var(--wb-primary); }

/* Empty-state note */
.page-admin .admin-empty {
  color: var(--wb-text-muted);
  font-style: italic;
  margin: 0;
}

/* Test-receiver list: checkbox rows with name + email */
.page-admin .test-receiver-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
  max-height: 360px;
  overflow-y: auto;
}
.page-admin .test-receiver-row {
  align-items: center;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--wb-border-subtle, #f1f5f9);
}
.page-admin .test-receiver-row:last-child { border-bottom: 0; }
.page-admin .test-receiver-row span { display: flex; flex-direction: column; line-height: 1.35; }
.page-admin .test-receiver-email {
  font-size: 0.8125rem;
  color: var(--wb-text-muted);
}

/* Flash confirmation modal (native <dialog>) - replaces the inline banner.
   Shown after create/profile/entity/role saves. */
.flash-modal {
  width: min(440px, calc(100vw - 2rem));
  border: 1px solid var(--wb-border);
  border-top: 4px solid var(--wb-border-strong, #cbd5e1);
  border-radius: var(--wb-radius);
  padding: 0;
  background: var(--wb-bg);
  color: var(--wb-text);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
}
.flash-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.flash-modal-success { border-top-color: var(--wb-success-text); }
.flash-modal-error   { border-top-color: var(--wb-red, #dc2626); }
.flash-modal-body {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.5rem 1.5rem 0.5rem;
}
.flash-modal-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
.flash-modal-success .flash-modal-icon { background: var(--wb-success-bg); color: var(--wb-success-text); }
.flash-modal-error   .flash-modal-icon { background: var(--wb-error-bg);   color: var(--wb-error-text); }
.flash-modal-title {
  margin: 0 0 0.25rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--wb-text);
}
.flash-modal-msg {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--wb-text-muted);
}
.flash-modal-actions {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
}

/* ===== TEST-MODE WARNING BANNER ======================================== */
/* Shown on every authenticated page while single-approver test mode is on.
   Deliberately loud so it can never be silently left enabled. */
.cl-testmode-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--wb-red, #dc2626);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    padding: 0.6rem 1rem;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

/* ===== SHARED HEADER NAV (was inline <style> in lib/header.php) ===== */
/* Self-contained nav styles for the header partial. Designed to slot
       into the existing .app-header-inner flex container. */
    .app-header-nav {
        display: flex;
        gap: 0.25rem;
        margin: 0 auto 0 1.5rem;
        flex: 1 1 auto;
        min-width: 0;
    }
    .app-header-nav-link {
        display: inline-flex;
        align-items: center;
        padding: 0.375rem 0.875rem;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--wb-text-muted, #64748b);
        text-decoration: none;
        border-bottom: 2px solid transparent;
        transition: color 0.15s, border-color 0.15s;
        white-space: nowrap;
    }
    .app-header-nav-link:hover,
    .app-header-nav-link:focus {
        color: var(--wb-text, #0f172a);
        border-bottom-color: var(--wb-border, #e2e8f0);
        outline: none;
    }
    .app-header-nav-link.is-active {
        color: var(--wb-text, #0f172a);
        font-weight: 600;
        border-bottom-color: var(--wb-primary, #DC1E24);
    }
    .app-header-nav-link.is-active:hover,
    .app-header-nav-link.is-active:focus {
        border-bottom-color: var(--wb-primary, #DC1E24);
    }

    /* Mobile: collapse the nav into a horizontal scroll strip below the
       row. Pragmatic - we don't have many links so a hamburger isn't worth
       the JS cost. */
/* ===== SHARED UTILITIES (replace repeated inline style="") ============== */

/* Amber warning ribbon - used for the Coface shortfall notice in the
   dashboard modal and as the resubmission/attachment notices. */
.cl-warn-ribbon {
    border: 1px solid var(--wb-warning-border, #fde68a);
    background: var(--wb-warning-bg, #fffbeb);
    color: var(--wb-warning-text, #92400e);
    border-radius: var(--wb-radius, 0px);
    padding: 0.75rem 0.95rem;
    margin-bottom: 1rem;
}
.cl-warn-ribbon-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.cl-warn-ribbon-body { font-size: 0.8125rem; margin-top: 0.35rem; color: #78350f; }
.cl-warn-ribbon-note { font-size: 0.8125rem; margin-top: 0.5rem; }

/* Generic small muted note */
.cl-muted-note { color: var(--wb-text-muted); font-size: 0.8125rem; }

/* ── Header dropdowns (admin menu + language picker) ─────────────────────── */
.app-header-dd { position: relative; display: inline-flex; align-items: center; }
.app-header-nav, .app-header-meta, .app-header-inner { overflow: visible; }
.app-header-dd-toggle {
  background: none; border: 0; cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; gap: 0.25rem;
  position: relative; z-index: 1; pointer-events: auto;
}
.app-header-dd-caret { font-size: 0.7em; line-height: 1; opacity: 0.7; pointer-events: none; }
.app-header-dd-menu {
  position: absolute; top: 100%; left: 0; z-index: 120; min-width: 190px;
  background: #fff; border: 1px solid var(--wb-border, #e2e8f0);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10); padding: 0.25rem 0;
}
.app-header-dd-menu-right { left: auto; right: 0; min-width: 150px; }
.app-header-dd-menu[hidden] { display: none; }
/* The class wins over any stylesheet that ignores [hidden]. */
.app-header-dd-menu.is-open { display: block !important; }
.app-header-dd-item {
  display: block; padding: 0.45rem 0.9rem; font-size: 0.8125rem;
  color: var(--wb-text, #0f172a); text-decoration: none; white-space: nowrap;
}
.app-header-dd-item:hover { background: var(--wb-bg-subtle, #f8fafc); }
.app-header-dd-item.is-active { font-weight: 600; color: var(--wb-primary, #0f172a); }
.app-header-lang-toggle {
  background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 0.8125rem; color: var(--wb-text-muted, #64748b);
  display: inline-flex; align-items: center; gap: 0.2rem; padding: 0 0.25rem;
}
.app-header-lang-toggle:hover { color: var(--wb-text, #0f172a); }
