:root {
  --portal-accent: #ef3f4d;
  --portal-accent-dark: #cf2635;
  --portal-accent-soft: #fff0f1;
  --portal-ink: #172033;
  --portal-muted: #6f7888;
  --portal-line: #e4e7ec;
  --portal-line-strong: #d4d9e1;
  --portal-surface: #ffffff;
  --portal-canvas: #f3f5f7;
  --portal-sidebar: #161a22;
  --portal-sidebar-soft: #232832;
  --portal-success: #16845b;
  --portal-warning: #a76112;
  --portal-info: #1769aa;
  --portal-radius-sm: 10px;
  --portal-radius: 16px;
  --portal-radius-lg: 24px;
  --portal-shadow-sm: 0 1px 2px rgba(18, 24, 36, 0.05);
  --portal-shadow: 0 18px 48px rgba(18, 24, 36, 0.09);
  --portal-sidebar-width: 264px;
  --portal-transition: 160ms ease;
  --bs-primary: var(--portal-accent);
  --bs-primary-rgb: 239, 63, 77;
  --bs-danger: var(--portal-accent);
  --bs-danger-rgb: 239, 63, 77;
  --bs-link-color: #c82735;
  --bs-link-hover-color: #9f1d28;
}

html {
  min-height: 100%;
  background: var(--portal-canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--portal-ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(239, 63, 77, 0.055), transparent 25rem),
    var(--portal-canvas);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.925rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  color: #fff;
  background: var(--portal-accent);
}

a { text-underline-offset: 0.2em; }

a,
button,
input,
select,
textarea {
  transition:
    color var(--portal-transition),
    background-color var(--portal-transition),
    border-color var(--portal-transition),
    box-shadow var(--portal-transition),
    transform var(--portal-transition);
}

:focus-visible {
  outline: 3px solid rgba(239, 63, 77, 0.2) !important;
  outline-offset: 2px;
}

/* App shell */
.portal-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 26px var(--portal-sidebar-width) !important;
}

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1030;
  display: flex;
  width: var(--portal-sidebar-width);
  flex-direction: column;
  padding: 26px 18px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 0, rgba(239, 63, 77, 0.22), transparent 15rem),
    var(--portal-sidebar);
  box-shadow: 10px 0 40px rgba(18, 24, 36, 0.08);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 0 9px 26px;
  color: #fff;
  text-decoration: none;
}

.portal-brand:hover { color: #fff; }

.portal-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.portal-brand img {
  display: block;
  width: 98px;
  max-width: none;
  height: auto;
}

.portal-brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.portal-brand-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-brand-copy small {
  margin-top: 5px;
  color: #959daa;
  font-size: 0.7rem;
}

.portal-nav-label {
  padding: 0 11px 9px;
  color: #6f7785;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.portal-nav {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.portal-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px !important;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #b7bec9 !important;
  font-size: 0.84rem;
  font-weight: 640;
  line-height: 1.25;
  text-decoration: none;
}

.portal-nav a svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.portal-nav a:hover,
.portal-nav a:focus-visible {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.065);
}

.portal-nav a[aria-current="page"] {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.05);
  background: linear-gradient(110deg, rgba(239, 63, 77, 0.28), rgba(239, 63, 77, 0.12));
  box-shadow: inset 3px 0 0 var(--portal-accent);
}

.portal-nav a[aria-current="page"] svg { color: #ff6874; }

.portal-sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.portal-sidebar-status > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.portal-sidebar-status strong {
  color: #e7eaf0;
  font-size: 0.72rem;
  font-weight: 700;
}

.portal-sidebar-status small {
  margin-top: 4px;
  color: #7f8794;
  font-size: 0.65rem;
}

.portal-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 3px;
  border-radius: 50%;
  background: #36c98f;
  box-shadow: 0 0 0 4px rgba(54, 201, 143, 0.12);
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 11px clamp(22px, 3vw, 46px);
  border-bottom: 1px solid rgba(218, 222, 229, 0.8);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 24px rgba(18, 24, 36, 0.035);
  backdrop-filter: blur(18px);
}

.portal-topbar-context {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.portal-topbar-kicker {
  color: var(--portal-accent-dark);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-topbar-title {
  margin-top: 4px;
  color: var(--portal-ink);
  font-size: 0.92rem;
  font-weight: 720;
}

.portal-account { position: relative; }

.portal-user {
  display: inline-flex !important;
  max-width: 260px;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 7px !important;
  border: 1px solid var(--portal-line);
  border-radius: 999px;
  color: var(--portal-ink) !important;
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow-sm);
  font-size: 0.82rem;
  font-weight: 680;
  text-decoration: none;
}

.portal-user::before {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #303745, #161a22);
  content: attr(data-initial);
  font-size: 0.7rem;
  font-weight: 800;
}

.portal-user:hover,
.portal-user[aria-expanded="true"] {
  border-color: var(--portal-line-strong);
  background: #f9fafb;
}

.portal-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-account .dropdown-menu {
  right: 0 !important;
  left: auto !important;
  min-width: 230px;
  margin-top: 10px !important;
}

/* Content hierarchy */
main {
  width: min(100%, 1570px);
  min-height: calc(100vh - 200px);
  margin: 0 auto;
  padding: 34px clamp(22px, 3vw, 46px) 0;
}

main > h1,
main > h2,
main .display-6 {
  color: var(--portal-ink);
  font-size: clamp(1.55rem, 2vw, 2.25rem);
  font-weight: 750;
  letter-spacing: -0.035em;
}

.portal-page-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
  padding-left: 18px;
}

.portal-page-head::before {
  position: absolute;
  inset: 3px auto 3px 0;
  width: 4px;
  border-radius: 99px;
  background: linear-gradient(var(--portal-accent), #ff7984);
  content: "";
}

.portal-page-eyebrow {
  margin-bottom: 5px;
  color: var(--portal-accent-dark);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.portal-page-title {
  margin: 0;
  color: var(--portal-ink);
  font-size: clamp(1.7rem, 2.25vw, 2.55rem);
  font-weight: 770;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.portal-page-description {
  max-width: 720px;
  margin: 9px 0 0;
  color: var(--portal-muted);
  font-size: 0.87rem;
}

.portal-toolbar,
main > .container.text-center,
main > .text-left.mb-1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: none;
  margin: 0 0 18px !important;
  padding: 14px 16px;
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--portal-shadow-sm);
}

main > .container.text-center > .row,
main > .text-left.mb-1 > .row {
  width: 100%;
  margin-right: 0;
  margin-left: 0;
}

.portal-command-card > .row {
  align-items: center;
  justify-content: space-between;
}

.portal-command-card .col-auto {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-order-overview {
  gap: 10px !important;
}

.portal-order-overview > .row + .row {
  padding-top: 12px;
  border-top: 1px solid var(--portal-line);
}

.portal-filter-card .alert {
  margin-bottom: 13px !important;
  padding: 10px 12px !important;
  box-shadow: none;
}

.portal-filter-card select {
  min-width: 210px;
  background-color: #fff8d8 !important;
}

.card,
.modal-content,
.dropdown-menu {
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius) !important;
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow-sm);
}

.dropdown-menu {
  padding: 7px;
  box-shadow: var(--portal-shadow) !important;
}

.dropdown-item {
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--portal-ink);
  font-size: 0.86rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--portal-ink);
  background: #f1f3f6;
}

.dropdown-item:active,
.dropdown-item.active {
  color: #fff;
  background: var(--portal-accent);
}

.alert {
  border: 1px solid transparent;
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-shadow-sm);
  font-size: 0.86rem;
}

.alert-success {
  color: #116142;
  border-color: #cce8db;
  background: #eff9f4;
}

.alert-warning {
  color: #80500f;
  border-color: #f0d6a8;
  background: #fff8e8;
}

.alert-danger {
  color: #9e1d29;
  border-color: #f2c8cd;
  background: #fff1f2;
}

/* Data surfaces */
.table-responsive {
  max-width: 100%;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-lg);
  background: var(--portal-surface);
  box-shadow: 0 8px 28px rgba(18, 24, 36, 0.045);
}

.table {
  width: 100%;
  margin-bottom: 0;
  color: var(--portal-ink);
  font-size: 0.82rem;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: 0.78rem 0.72rem;
  border-bottom-color: #edf0f3;
  background: transparent;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #667082;
  background: #f8f9fb;
  font-size: 0.68rem;
  font-weight: 790;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table thead tr:nth-child(2) th {
  top: 42px;
  padding-top: 0.5rem;
  padding-bottom: 0.65rem;
  background: #fbfcfd;
}

.table tbody tr { transition: background-color var(--portal-transition); }
.table tbody tr:hover > * { background: #fafbfc; }
.table tbody tr:last-child > * { border-bottom: 0; }

.table a:not(.btn) {
  color: var(--portal-accent-dark);
  font-weight: 720;
  text-decoration: none;
}

.table a:not(.btn):hover { text-decoration: underline; }

.form-control,
.form-select {
  min-height: 42px;
  border-color: var(--portal-line-strong);
  border-radius: var(--portal-radius-sm);
  color: var(--portal-ink);
  background-color: var(--portal-surface);
  box-shadow: none;
  font-size: 0.88rem;
}

.form-control-sm,
.form-select-sm {
  min-height: 35px;
  border-radius: 9px;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(239, 63, 77, 0.7);
  box-shadow: 0 0 0 3px rgba(239, 63, 77, 0.1);
}

.form-control::placeholder { color: #9aa2af; }

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

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  padding: 0.48rem 0.92rem;
  font-size: 0.83rem;
  font-weight: 690;
  letter-spacing: 0.004em;
  box-shadow: none;
}

.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.72rem;
  font-size: 0.77rem;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary,
.btn-danger,
.btn-bd-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--portal-accent);
  --bs-btn-border-color: var(--portal-accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--portal-accent-dark);
  --bs-btn-hover-border-color: var(--portal-accent-dark);
  --bs-btn-active-bg: #ad1e2b;
  --bs-btn-active-border-color: #ad1e2b;
  --bs-btn-focus-shadow-rgb: 239, 63, 77;
}

.btn-success {
  --bs-btn-bg: #197655;
  --bs-btn-border-color: #197655;
  --bs-btn-hover-bg: #115d42;
  --bs-btn-hover-border-color: #115d42;
}

.btn-outline-primary {
  --bs-btn-color: var(--portal-accent-dark);
  --bs-btn-border-color: #e8aeb3;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--portal-accent);
  --bs-btn-hover-border-color: var(--portal-accent);
}

.btn-outline-info {
  --bs-btn-color: #1769aa;
  --bs-btn-border-color: #a9cde7;
  --bs-btn-hover-bg: #1769aa;
  --bs-btn-hover-border-color: #1769aa;
}

.btn-outline-secondary,
.btn-secondary {
  --bs-btn-color: #4e596b;
  --bs-btn-border-color: #cbd2dc;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #465163;
  --bs-btn-hover-border-color: #465163;
}

.badge {
  border-radius: 999px !important;
  padding: 0.42em 0.68em;
  font-weight: 700;
}

.bg-primary,
.text-bg-primary,
.bg-danger,
.text-bg-danger { background-color: var(--portal-accent) !important; }
.bg-primary-subtle { background-color: var(--portal-accent-soft) !important; }

.modal-backdrop.show { opacity: 0.48; }

.modal-content {
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.modal-header,
.modal-footer {
  padding: 16px 20px;
  border-color: var(--portal-line);
  background: #fafbfc;
}

.modal-body { padding: 20px; }
.modal-title { color: var(--portal-ink); font-weight: 720; }

.pagination { gap: 4px; }
.page-link {
  min-width: 34px;
  border-color: var(--portal-line);
  border-radius: 8px !important;
  color: var(--portal-ink);
  text-align: center;
}
.page-link:hover { color: var(--portal-accent-dark); background: var(--portal-accent-soft); }
.active > .page-link,
.page-link.active { border-color: var(--portal-accent); background: var(--portal-accent); }

.bd-mode-toggle {
  right: 22px !important;
  bottom: 22px !important;
  z-index: 1040;
}

.bd-mode-toggle > .btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--portal-line);
  border-radius: 50%;
  color: var(--portal-ink);
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow);
}
.bd-mode-toggle > .btn::after { display: none; }

.portal-footer {
  width: min(100%, 1570px);
  margin: 46px auto 0;
  padding: 22px clamp(22px, 3vw, 46px) 6px;
  border-top: 1px solid var(--portal-line);
}

.portal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--portal-muted);
  font-size: 0.75rem;
}

.portal-footer a {
  color: #4f5a6c;
  font-weight: 650;
  text-decoration: none;
}
.portal-footer a:hover { color: var(--portal-accent-dark); }

/* Brand rail in the price workspace. */
main > .row[style*="--bs-gutter"] {
  margin-bottom: 7px;
}

main > .row[style*="--bs-gutter"] .card {
  display: grid;
  min-height: 60px;
  place-items: center;
  padding: 8px !important;
  border: 1px solid var(--portal-line) !important;
  background: #fff;
}

main > .row[style*="--bs-gutter"] .card:hover {
  border-color: #ecadb3 !important;
  box-shadow: 0 10px 26px rgba(18, 24, 36, 0.08);
  transform: translateY(-2px);
}

/* Manufacturer logos are reference marks, not controls. */
.portal-brand-rail .card,
.portal-brand-rail .card:hover {
  border-color: var(--portal-line) !important;
  box-shadow: var(--portal-shadow-sm);
  transform: none;
  transition: none;
  pointer-events: none;
  user-select: none;
}

.portal-brand-rail .card img {
  pointer-events: none;
}

/* Full-width price file list. */
.portal-price-files-table {
  width: 100%;
}

.portal-price-files-table .table {
  width: 100%;
  table-layout: fixed;
}

.portal-price-logo-col { width: 92px; }
.portal-price-manufacturer-col { width: 29%; }
.portal-price-date-col { width: 20%; }
.portal-price-file-col { width: auto; }
.portal-price-action-col { width: 132px; }

.portal-price-logo-cell img {
  display: block;
  width: auto;
  max-width: 72px;
  height: 26px;
  object-fit: contain;
}

/* Buyer order pipeline dashboard. */
.portal-order-dashboard {
  margin-bottom: 18px;
  padding: clamp(18px, 2vw, 26px);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(239, 63, 77, 0.07), transparent 25rem),
    var(--portal-surface);
  box-shadow: var(--portal-shadow-sm);
}

.portal-order-dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.portal-order-dashboard-eyebrow {
  margin-bottom: 4px;
  color: var(--portal-accent-dark);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.portal-order-dashboard h2 {
  margin: 0;
  color: var(--portal-ink);
  font-size: 1.2rem;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.portal-order-dashboard-head p {
  margin: 5px 0 0;
  color: var(--portal-muted);
  font-size: 0.8rem;
}

.portal-order-dashboard-total {
  display: flex;
  min-width: 210px;
  align-items: flex-end;
  flex-direction: column;
  padding: 10px 13px;
  border: 1px solid #b8dfcf;
  border-radius: 12px;
  background: #eff9f4;
}

.portal-order-dashboard-total span {
  color: #39715e;
  font-size: 0.7rem;
  font-weight: 720;
  text-transform: uppercase;
}

.portal-order-dashboard-total strong {
  color: #116142;
  font-size: 1.18rem;
}

.portal-order-progress {
  display: flex;
  height: 9px;
  overflow: hidden;
  margin: 20px 0 14px;
  border-radius: 999px;
  background: #eef1f4;
}

.portal-order-progress-segment {
  min-width: 0;
  transition: filter 160ms ease;
}

.portal-order-progress-ordered { background: #ef3f4d; }
.portal-order-progress-expected { background: #df9a2a; }
.portal-order-progress-warehouse { background: #2589a6; }
.portal-order-progress-shipped { background: #23906a; }

.portal-order-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.portal-order-status-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 142px;
  align-items: stretch;
  flex-direction: column;
  padding: 15px;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  color: var(--portal-ink);
  background: rgba(255, 255, 255, 0.84);
  text-align: left;
  transition: border-color var(--portal-transition), box-shadow var(--portal-transition), transform var(--portal-transition);
}

.portal-order-status-card:hover,
.portal-order-status-card:focus-visible,
.portal-order-status-card.is-active {
  border-color: rgba(239, 63, 77, 0.38);
  box-shadow: 0 12px 28px rgba(18, 24, 36, 0.08);
  transform: translateY(-2px);
}

.portal-order-status-card.is-active::after {
  position: absolute;
  inset: auto 14px 0;
  height: 3px;
  border-radius: 99px 99px 0 0;
  background: var(--portal-accent);
  content: "";
}

.portal-order-status-topline {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: #566174;
  font-size: 0.72rem;
  font-weight: 720;
}

.portal-order-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.portal-order-status-share {
  margin-left: auto;
  color: #7c8695;
  font-variant-numeric: tabular-nums;
}

.portal-order-status-ordered .portal-order-status-dot { color: #ef3f4d; }
.portal-order-status-expected .portal-order-status-dot { color: #df9a2a; }
.portal-order-status-warehouse .portal-order-status-dot { color: #2589a6; }
.portal-order-status-shipped .portal-order-status-dot { color: #23906a; }

.portal-order-status-card > strong {
  margin-top: 12px;
  font-size: 1.55rem;
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1;
}

.portal-order-status-meta,
.portal-order-status-value {
  color: var(--portal-muted);
  font-size: 0.72rem;
}

.portal-order-status-value {
  margin-top: auto;
  padding-top: 11px;
  color: var(--portal-ink);
  font-weight: 720;
}

.portal-order-status-detail {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 2fr) auto;
  width: 100%;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  padding: 13px 15px;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  color: var(--portal-ink);
  background: #f8f9fb;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--portal-transition), background var(--portal-transition), box-shadow var(--portal-transition);
}

.portal-order-status-detail:hover,
.portal-order-status-detail:focus-visible,
.portal-order-status-detail[aria-expanded="true"] {
  border-color: rgba(239, 63, 77, 0.32);
  background: #fff;
  box-shadow: 0 10px 24px rgba(18, 24, 36, 0.07);
}

.portal-order-status-detail > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portal-order-detail-label {
  color: var(--portal-muted);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.portal-order-status-detail p {
  margin: 0;
  color: var(--portal-muted);
  font-size: 0.78rem;
}

.portal-order-detail-end {
  align-items: flex-end;
  white-space: nowrap;
}

.portal-order-detail-end strong {
  color: var(--portal-ink);
  font-size: 1rem;
}

.portal-order-detail-end span {
  color: var(--portal-accent-dark);
  font-size: 0.72rem;
  font-weight: 720;
}

.portal-order-positions {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 16px;
  background: var(--portal-surface);
  box-shadow: 0 16px 34px rgba(18, 24, 36, 0.08);
}

.portal-order-positions[hidden] {
  display: none;
}

.portal-order-positions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--portal-line);
  background: linear-gradient(135deg, rgba(239, 63, 77, 0.045), transparent 46%);
}

.portal-order-positions-head h3 {
  margin: 3px 0 0;
  color: var(--portal-ink);
  font-size: 1.08rem;
  font-weight: 760;
}

.portal-order-positions-head p {
  margin: 4px 0 0;
  color: var(--portal-muted);
  font-size: 0.76rem;
}

.portal-order-positions-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--portal-line);
  border-radius: 50%;
  color: var(--portal-muted);
  background: var(--portal-surface);
  font-size: 1.3rem;
  line-height: 1;
}

.portal-order-positions-close:hover,
.portal-order-positions-close:focus-visible {
  border-color: rgba(239, 63, 77, 0.42);
  color: var(--portal-accent);
}

.portal-order-positions-table-wrap {
  max-height: 610px;
  overflow: auto;
}

.portal-order-positions-table {
  min-width: 1080px;
  margin: 0;
}

.portal-order-positions-table thead {
  position: sticky;
  z-index: 2;
  top: 0;
}

.portal-order-positions-table th {
  padding: 11px 14px;
  border-bottom-color: var(--portal-line);
  color: #667085;
  background: #f8f9fb;
  font-size: 0.66rem;
  font-weight: 780;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.portal-order-positions-table td {
  padding: 13px 14px;
  border-bottom-color: var(--portal-line);
  color: var(--portal-ink);
  font-size: 0.78rem;
  vertical-align: top;
}

.portal-order-positions-table tbody tr:last-child td {
  border-bottom: 0;
}

.portal-order-position-link,
.portal-order-position-part,
.portal-order-position-sum {
  display: block;
  color: var(--portal-ink);
  font-weight: 760;
}

.portal-order-position-link {
  color: var(--portal-accent-dark);
  text-decoration: none;
}

.portal-order-position-link:hover {
  color: var(--portal-accent);
  text-decoration: underline;
}

.portal-order-position-description {
  display: block;
  max-width: 340px;
  margin-top: 3px;
  color: #4c576a;
  line-height: 1.38;
}

.portal-order-position-sub {
  display: block;
  margin-top: 3px;
  color: var(--portal-muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.portal-order-position-quantity {
  font-weight: 760;
  white-space: nowrap;
}

.portal-order-position-timeline {
  display: flex;
  min-width: 170px;
  flex-direction: column;
  gap: 4px;
  color: var(--portal-muted);
  font-size: 0.68rem;
}

.portal-order-position-timeline b {
  color: #4c576a;
  font-weight: 700;
}

.portal-order-position-state {
  width: fit-content;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 720;
}

.portal-order-position-state.is-ordered { color: #9f2430; background: #fff0f2; }
.portal-order-position-state.is-expected { color: #87550a; background: #fff6df; }
.portal-order-position-state.is-warehouse { color: #17657c; background: #e8f7fb; }
.portal-order-position-state.is-shipped { color: #126448; background: #e9f7f1; }

.portal-order-positions-empty {
  height: 120px;
  color: var(--portal-muted) !important;
  text-align: center;
  vertical-align: middle !important;
}

.portal-order-positions-empty.is-error {
  color: var(--portal-accent-dark) !important;
}

.portal-order-positions-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--portal-line);
  background: #fbfcfd;
}

.portal-order-positions-pagination span {
  min-width: 100px;
  color: var(--portal-muted);
  font-size: 0.72rem;
  font-weight: 680;
  text-align: center;
}

@media (max-width: 900px) {
  .portal-order-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-order-status-detail { grid-template-columns: 1fr auto; }
  .portal-order-status-detail p { grid-column: 1 / -1; grid-row: 2; }
  .portal-order-detail-end { grid-column: 2; grid-row: 1; }
}

@media (max-width: 620px) {
  .portal-order-dashboard-head { flex-direction: column; }
  .portal-order-dashboard-total { width: 100%; align-items: flex-start; }
  .portal-order-status-grid { grid-template-columns: 1fr; }
  .portal-order-status-detail { grid-template-columns: 1fr; }
  .portal-order-status-detail p { grid-column: auto; grid-row: auto; }
  .portal-order-detail-end { grid-column: auto; grid-row: auto; align-items: flex-start; }
  .portal-order-positions-head { padding: 15px; }
  .portal-order-positions-pagination { justify-content: space-between; }
}

main > .row[style*="--bs-gutter"] .card img {
  width: 100%;
  max-width: 108px;
  max-height: 34px;
  object-fit: contain;
  filter: saturate(0.88);
}

@media (max-width: 980px) {
  :root { --portal-sidebar-width: 0px; }

  .portal-shell { padding-left: 0 !important; }

  .portal-sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 14px 15px 12px;
  }

  .portal-brand { padding: 0 5px 13px; }
  .portal-brand-mark { width: 38px; height: 38px; }
  .portal-brand-copy small { display: none; }
  .portal-nav-label,
  .portal-sidebar-status { display: none; }

  .portal-nav {
    flex-direction: row;
    gap: 5px;
    margin: 0 -2px;
    padding: 1px 2px 3px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .portal-nav::-webkit-scrollbar { display: none; }

  .portal-nav a {
    min-height: 39px;
    flex: 0 0 auto;
    padding: 8px 10px !important;
    font-size: 0.78rem;
  }

  .portal-nav a svg { width: 17px; height: 17px; }

  .portal-nav a[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--portal-accent);
  }

  .portal-topbar { position: relative; min-height: 62px; }
}

@media (max-width: 767.98px) {
  body { font-size: 0.9rem; }

  .portal-topbar { padding: 9px 14px; }
  .portal-topbar-context { display: none; }
  .portal-account { margin-left: auto; }
  .portal-user { max-width: 180px; }

  main { padding: 24px 14px 0; }

  .portal-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .portal-page-title { font-size: 1.85rem; }

  .portal-toolbar,
  main > .container.text-center,
  main > .text-left.mb-1 {
    padding: 11px;
    border-radius: 14px;
  }

  .table-responsive {
    margin-inline: -14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .table { min-width: 760px; }
  .modal-dialog { margin: 10px; }

  .portal-footer { padding-inline: 14px; }
  .portal-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .bd-mode-toggle { right: 12px !important; bottom: 12px !important; }
}

[data-bs-theme="dark"] {
  --portal-ink: #eff2f6;
  --portal-muted: #a7afbd;
  --portal-line: #343b47;
  --portal-line-strong: #48505e;
  --portal-surface: #1d222c;
  --portal-canvas: #12161d;
  --bs-body-color: #eff2f6;
  --bs-body-bg: #12161d;
}

[data-bs-theme="dark"] body {
  background:
    radial-gradient(circle at 92% 5%, rgba(239, 63, 77, 0.1), transparent 25rem),
    var(--portal-canvas);
}

[data-bs-theme="dark"] .portal-topbar { background: rgba(29, 34, 44, 0.88); }
[data-bs-theme="dark"] .portal-user:hover,
[data-bs-theme="dark"] .portal-user[aria-expanded="true"],
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus { color: #fff; background: #2a303b; }

[data-bs-theme="dark"] .portal-toolbar,
[data-bs-theme="dark"] main > .container.text-center,
[data-bs-theme="dark"] main > .text-left.mb-1 { background: rgba(29, 34, 44, 0.76); }

[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer { color: #b8c0cd; background: #242a34; }
[data-bs-theme="dark"] .table thead tr:nth-child(2) th { background: #202630; }
[data-bs-theme="dark"] .table tbody tr:hover > * { background: #222832; }
[data-bs-theme="dark"] main > .row[style*="--bs-gutter"] .card { background: #fff; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Horizontal application navigation. Keeps the full viewport width available
   for procurement tables while preserving the same links and account actions. */
.portal-shell {
  padding: 0 0 26px !important;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 74px;
  align-items: center;
  gap: 18px;
  padding: 10px clamp(18px, 2.2vw, 34px);
  color: #fff;
  background:
    radial-gradient(circle at 5% -100%, rgba(239, 63, 77, 0.42), transparent 20rem),
    var(--portal-sidebar);
  box-shadow: 0 8px 30px rgba(18, 24, 36, 0.13);
}

.portal-header .portal-brand {
  min-width: 185px;
  gap: 11px;
  padding: 0;
}

.portal-header .portal-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.portal-header .portal-brand img {
  width: 88px;
}

.portal-header .portal-brand-copy strong {
  font-size: 0.75rem;
}

.portal-header .portal-brand-copy small {
  margin-top: 3px;
  font-size: 0.64rem;
}

.portal-header .portal-nav {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: row;
  justify-content: center;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.portal-header .portal-nav::-webkit-scrollbar {
  display: none;
}

.portal-header .portal-nav a {
  min-height: 42px;
  flex: 0 0 auto;
  gap: 8px;
  padding: 9px 10px !important;
  border-radius: 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.portal-header .portal-nav a svg {
  width: 17px;
  height: 17px;
}

.portal-header .portal-nav a[aria-current="page"] {
  background: linear-gradient(110deg, rgba(239, 63, 77, 0.34), rgba(239, 63, 77, 0.14));
  box-shadow: inset 0 -3px 0 var(--portal-accent);
}

.portal-header .portal-account {
  justify-self: end;
}

.portal-header .portal-user {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.13);
  color: #fff !important;
  background: rgba(255, 255, 255, 0.07);
}

.portal-header .portal-user:hover,
.portal-header .portal-user[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12);
}

.portal-header .portal-user::before {
  color: var(--portal-sidebar);
  background: #fff;
}

.portal-header .dropdown-menu {
  color: var(--portal-ink);
  background: var(--portal-surface);
}

.portal-manufacturer-controls {
  display: flex;
  width: 100%;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.portal-filter-field {
  display: flex;
  min-width: 210px;
  flex: 1 1 250px;
  flex-direction: column;
  gap: 5px;
}

.portal-filter-field label,
.portal-filter-or {
  color: var(--portal-muted);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.portal-filter-field .form-control,
.portal-filter-field .form-select {
  min-height: 38px;
  background-color: #fff8d8 !important;
}

.portal-filter-or {
  align-self: center;
  padding-top: 18px;
}

.portal-wide-main {
  width: 100%;
  max-width: none;
}

@media (max-width: 1180px) {
  .portal-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding-inline: 16px;
  }

  .portal-header .portal-brand {
    min-width: 42px;
  }

  .portal-header .portal-brand-copy {
    display: none;
  }

  .portal-header .portal-nav {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .portal-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 8px;
  }

  .portal-header .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .portal-header .portal-account {
    grid-column: 2;
    grid-row: 1;
  }

  .portal-filter-or {
    display: none;
  }
}

[data-bs-theme="dark"] .portal-header .portal-user:hover,
[data-bs-theme="dark"] .portal-header .portal-user[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
}

/* Request overview: separates customer, workflow and delivery information
   from the positions table without changing the table itself. */
.portal-request-summary {
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
  padding: clamp(20px, 2.4vw, 32px);
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-lg);
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow-sm);
}

.portal-request-summary::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--portal-accent), #ff8b73 44%, transparent 88%);
  content: "";
}

.portal-record-back {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 11px;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  color: var(--portal-muted) !important;
  background: var(--portal-canvas);
  font-size: 0.76rem;
  font-weight: 740;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.portal-record-back:hover,
.portal-record-back:focus-visible {
  border-color: rgba(239, 63, 77, 0.42);
  color: var(--portal-accent-dark) !important;
  transform: translateX(-2px);
}

.portal-record-back span {
  font-size: 1rem;
  line-height: 1;
}

.portal-request-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.portal-request-title {
  margin: 4px 0 0;
  color: var(--portal-ink);
  font-size: clamp(1.65rem, 2.6vw, 2.55rem);
  font-weight: 790;
  letter-spacing: -0.045em;
}

.portal-request-project {
  margin-top: 4px;
  color: var(--portal-muted);
  font-size: 0.86rem;
}

.portal-request-project strong { color: var(--portal-ink); }

.portal-request-status {
  display: flex;
  min-width: 150px;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.portal-status-badge,
.portal-status-note,
.portal-vat {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 740;
}

.portal-status-badge {
  color: #87500c;
  background: #fff2d2;
}

.portal-status-badge.is-open {
  color: #0b6846;
  background: #dcf6eb;
}

.portal-status-note,
.portal-vat {
  color: var(--portal-muted);
  background: var(--portal-canvas);
}

.portal-request-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius);
  background: var(--portal-line);
}

.portal-request-parties > div {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 18px;
  background: var(--portal-canvas);
}

.portal-request-parties strong {
  color: var(--portal-ink);
  font-size: 0.92rem;
}

.portal-detail-label {
  display: block;
  color: var(--portal-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.portal-request-parties .portal-detail-label { width: 100%; }

.portal-request-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.portal-order-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-detail-card {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--portal-line);
  border-radius: var(--portal-radius-sm);
  background: var(--portal-surface);
}

.portal-detail-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.portal-detail-card strong,
.portal-detail-card small {
  overflow-wrap: anywhere;
}

.portal-detail-card strong {
  color: var(--portal-ink);
  font-size: 0.86rem;
  font-weight: 710;
}

.portal-detail-card small {
  color: var(--portal-muted);
  font-size: 0.75rem;
}

.portal-detail-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--portal-accent-dark);
  background: var(--portal-accent-soft);
  font-size: 0.72rem;
  font-weight: 820;
}

.portal-detail-wide { grid-column: span 2; }

.portal-request-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--portal-line);
}

@media (max-width: 900px) {
  .portal-request-grid,
  .portal-order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .portal-request-heading { align-items: stretch; flex-direction: column; }
  .portal-request-status { align-items: flex-start; }
  .portal-request-parties,
  .portal-request-grid { grid-template-columns: 1fr; }
  .portal-detail-wide { grid-column: auto; }
}

[data-bs-theme="dark"] .portal-request-summary,
[data-bs-theme="dark"] .portal-detail-card { background: var(--portal-surface); }

[data-bs-theme="dark"] .portal-request-parties > div { background: #191e27; }
