﻿html {
  height: 100%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: "Noto Sans", "Segoe UI", "Segoe UI Variable Text", "Segoe UI Symbol", "Helvetica Neue", Arial, "Arial Unicode MS", "DejaVu Sans", "Liberation Sans", sans-serif;
  background: #f5f7fb;
  color: #111827;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
select,
button,
textarea {
  font: inherit;
}

.layout {
  width: min(1400px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 24px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  overflow: visible;
}

.header-meta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}


.header-panel,
.tab-row,
.controls-panel,
.panel-title-row,
.table-wrap,
.results-panel,
.cart-panel,
.saved-quotes-panel,
.header-fields-panel,
.pricing-rules-panel {
  min-width: 0;
}

.header-panel {
  position: relative;
  z-index: 12;
  backdrop-filter: blur(12px);
}

.header-panel > div,
.controls-panel > div,
.controls-panel > .actions,
.header-meta-group {
  min-width: 0;
}

.tab-row {
  position: relative;
  z-index: 11;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.results-panel .table-wrap,
.cart-panel .table-wrap,
.saved-quotes-panel .table-wrap,
.inventory-table-wrap,
.review-panel .table-wrap {
  overflow: auto;
  overflow-y: auto;
  overflow-x: auto;
}

.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #334155;
}

.language-picker select {
  min-width: 84px;
}

.tab-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d7dce5;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.tab-button {
  background: #cbd5e1;
  color: #0f172a;
}

.tab-button.active {
  background: #1d4ed8;
  color: #fff;
}


.tab-row {
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.tab-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.table-wrap {
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}

.tab-panel {
  display: none;
  gap: 20px;
  min-width: 0;
}

.tab-panel.active {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
  scrollbar-gutter: auto;
}

.panel {
  min-width: 0;
  background: #fff;
  border: 1px solid #d7dce5;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}

.header-panel,
.controls-panel,
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.controls-panel {
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}

.field.compact {
  min-width: 240px;
}

.field.grow {
  flex: 1;
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-pill.in-stock {
  background: #dcfce7;
  color: #166534;
}

.stock-pill.out-stock {
  background: #fee2e2;
  color: #991b1b;
}

.row-in-stock td {
  background: rgba(34, 197, 94, 0.06);
}

.model-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compact-gap {
  gap: 4px;
}

.model-note {
  font-size: 12px;
  color: #475569;
}

.header-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  padding: 10px 12px;
  border: 1px solid #c7ced9;
  border-radius: 8px;
  background: #fff;
}

button {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  cursor: pointer;
}

button.secondary {
  background: #475569;
}

.actions,
.cart-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  max-height: 420px;
  position: relative;
  z-index: 1;
}

.inventory-table-wrap {
  max-height: 520px;
}

.depo-table {
  min-width: 1480px;
}

.cart-table {
  min-width: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.35;
}

thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

.meta,
.totals {
  font-size: 14px;
  color: #334155;
}


.pricing-rules-panel {
  border: 1px solid #d7dce5;
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
  margin-bottom: 16px;
}

.pricing-rule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.compact-actions {
  justify-content: flex-start;
}

.brand-discount-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.brand-discount-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 600;
}

.brand-discount-pill button {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.inline-number {
  width: 88px;
  padding: 8px 10px;
}

.qty-input {
  width: 54px;
  min-width: 54px;
}

.discount-input {
  width: 62px;
  min-width: 62px;
}

.compact-select {
  min-width: 118px;
  max-width: 128px;
  padding: 8px 28px 8px 10px;
}

.cart-source-select {
  min-width: 0;
  width: 100%;
  max-width: 132px;
}

.cart-brand-cell,
.cart-model-cell {
  min-width: 0;
}

.cart-description-cell {
  display: table-cell;
  min-width: 0;
}

.desc-note {
  display: block;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}

.cart-table {
  table-layout: fixed;
  width: max(100%, 1516px);
}

.cart-table th[data-col-key] {
  position: sticky;
  top: 0;
}

.cart-table th.is-resizable {
  position: sticky;
  user-select: none;
}

.cart-table th.is-resizable .col-header-label {
  display: inline-block;
  padding-right: 10px;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 4;
}

.col-resizer::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease;
}

.cart-table th.is-resizable:hover .col-resizer::after,
body.is-col-resizing .col-resizer::after {
  background: #cbd5e1;
}

body.is-col-resizing {
  cursor: col-resize;
  user-select: none;
}

.cart-table td {
  height: 84px;
  vertical-align: middle;
}

.cart-main-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-content: center;
}

.cart-model-meta {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-description-preview {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  color: #64748b;
  white-space: normal;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  max-height: calc(1.35em * 3);
  word-break: break-word;
}

.cart-description-preview.is-empty {
  color: #94a3b8;
}

.selected-price-cell {
  min-width: 168px;
  white-space: nowrap;
}

.price-edit-button {
  width: 100%;
  text-align: left;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 8px 10px;
  font-weight: 700;
  border: 1px solid #bfdbfe;
}

.price-edit-button.custom-price-active {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.price-edit-note {
  display: none;
}

.line-adjustment-note {
  margin-top: 4px;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
  display: none;
}

.cart-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 88px;
}

.cart-row-actions .secondary {
  min-width: 54px;
}

.compact-icon-actions {
  min-width: 78px;
}

.icon-action-button {
  width: 38px;
  min-width: 38px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.icon-action-button.danger {
  background: #475569;
}

.saved-quotes-panel .table-wrap {
  max-height: 320px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  min-width: 0;
}

.metric-card-label {
  font-size: 11px;
  color: #475569;
}

.metric-card-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.metric-card-rich {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.metric-plain-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
}

.metric-money-stack {
  display: grid;
  gap: 6px;
}

.metric-money-line,
.metric-converted-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.metric-converted-line {
  padding-top: 8px;
  border-top: 1px solid #dbe3ef;
}

.metric-currency-code,
.metric-converted-label {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8eef8;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.metric-money-amount {
  min-width: 0;
  text-align: right;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
}

.metric-empty {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 600;
}

.cost-dialog {
  width: min(760px, calc(100vw - 32px));
  border: none;
  border-radius: 14px;
  padding: 0;
}

.cost-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.cost-dialog-body {
  padding: 20px;
}

.cost-dialog pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Noto Sans Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.release-notes-dialog {
  width: min(860px, calc(100vw - 32px));
}

.release-notes-dialog-body {
  display: grid;
  gap: 16px;
}

.release-notes-body {
  display: grid;
  gap: 12px;
  max-height: min(68vh, 620px);
  overflow: auto;
  padding-right: 4px;
}

.release-note-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.release-note-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.release-note-title {
  color: #0f172a;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
}

.release-note-meta {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.release-note-summary {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.release-note-list {
  margin: 0;
  padding-left: 18px;
  color: #1f2937;
  line-height: 1.5;
}

.release-note-list li + li {
  margin-top: 6px;
}

.manual-item-dialog-body {
  display: grid;
  gap: 16px;
}

.manual-item-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.manual-item-grid .grow {
  grid-column: span 2;
}

.header-fields-panel .panel-title-row {
  margin-bottom: 14px;
}

.money-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.user-badge {
  align-self: stretch;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #d7dce5;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  display: grid;
  gap: 14px;
}

.login-busy-popup {
  position: absolute;
  inset: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(191, 219, 254, 0.9);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(4px);
}

.login-busy-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dbeafe;
  border-top-color: #1d4ed8;
  border-radius: 999px;
  animation: login-spin 0.8s linear infinite;
}

.login-busy-text {
  font-size: 14px;
  font-weight: 700;
  color: #1d4ed8;
  text-align: center;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

.error-text {
  min-height: 20px;
  color: #b91c1c;
  font-size: 13px;
}

#loginHint,
#loginAuthStatus {
  min-height: 18px;
}

#loginAuthStatus {
  color: #1d4ed8;
  font-size: 13px;
}

.list-loading-row td {
  padding: 14px 12px;
  text-align: center;
  font-size: 13px;
  color: #475569;
  background: #f8fafc;
}





.admin-heading-group {
  display: grid;
  gap: 6px;
}

.admin-helper {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}



.admin-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid #d6e0ef;
  border-radius: 18px;
  padding: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
  box-shadow:
    0 12px 30px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(207, 220, 236, 0.7);
}

.admin-card-head h3 {
  margin: 0;
  font-size: 18px;
  color: #0b1b34;
}

.admin-card-head .meta {
  display: inline-block;
  margin-top: 6px;
}





.admin-create-card,
.admin-users-card,
.admin-audit-card,
.admin-roles-card {
  min-height: 100%;
}

.admin-create-head {
  align-items: flex-start;
}

.admin-form-grid {
  grid-template-columns: 1fr;
  align-items: end;
  gap: 14px 16px;
}

.admin-form-grid .field.grow {
  grid-column: 1 / -1;
}

.admin-create-actions {
  display: flex;
  align-items: end;
  justify-content: center;
  grid-column: 1 / -1;
}

.admin-create-actions button {
  min-width: 200px;
}

.admin-role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.admin-role-card {
  height: 100%;
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #d8e3f3;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.admin-role-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-role-name {
  font-weight: 700;
  color: #0f172a;
}

.admin-role-code {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-role-counts {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.admin-role-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
}

.admin-pill-muted {
  background: #f1f5f9;
  color: #475569;
}

.admin-users-card {
  padding-bottom: 16px;
  gap: 16px;
}

.admin-users-head {
  margin-bottom: 4px;
}

.admin-table-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: #ffffff;
  overflow: hidden;
}

.admin-users-table {
  min-width: 1120px;
}

.admin-users-table td {
  vertical-align: top;
}

.admin-user-row td {
  background: #ffffff;
}

.admin-user-row-inactive td {
  background: #f8fafc;
}

.admin-user-identity-cell {
  min-width: 200px;
}

.admin-user-name {
  font-weight: 700;
  color: #0f172a;
}

.admin-user-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.admin-role-badge,
.admin-scope-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.admin-role-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.admin-scope-badge.is-open {
  background: #dcfce7;
  color: #166534;
}

.admin-scope-badge.is-limited {
  background: #fef3c7;
  color: #92400e;
}

.admin-input,
.admin-select {
  width: 100%;
  min-width: 140px;
}

.admin-tab-input {
  min-width: 220px;
}

.admin-active-cell {
  min-width: 126px;
}

.admin-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
}

.admin-date-cell {
  white-space: nowrap;
  color: #475569;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 190px;
  justify-content: flex-start;
}

.admin-empty-row,
.admin-empty-state {
  padding: 18px;
  color: #64748b;
  text-align: center;
}


.compact-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.review-panel {
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.review-panel table {
  min-width: 880px;
}

.review-panel th {
  position: static;
  background: #f8fafc;
}

@media (max-width: 1024px) {
  .header-panel,
  .controls-panel,
  .panel-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-meta-group {
    align-items: stretch;
  }

  .header-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid,
  

  .admin-search-grid {
    grid-template-columns: 1fr;
  }

  

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-form-grid,
  .compact-grid,
  .admin-search-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-audit-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-audit-search-field {
    grid-column: 1 / -1;
  }

  .admin-form-grid .field.grow,
  .admin-create-actions {
    grid-column: 1 / -1;
  }

  .pricing-rule-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .layout {
    padding: 14px;
  }

  .actions,
  .cart-actions,
  .tab-row {
    flex-wrap: wrap;
  }

  .field,
  .field.compact {
    min-width: 100%;
  }

  .admin-form-grid,
  .admin-audit-filter-grid,
  .admin-search-form-grid {
    grid-template-columns: 1fr;
  }

  .language-picker {
    justify-content: space-between;
  }

  th,
  td {
    padding: 8px 10px;
    font-size: 13px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .pricing-rule-grid {
    grid-template-columns: 1fr;
  }

  .inline-number,
  .compact-select,
  .qty-input,
  .discount-input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .admin-form-grid,
  .compact-grid,
  .admin-audit-filter-grid {
    grid-template-columns: 1fr;
  }

  .admin-create-actions button {
    width: min(100%, 320px);
  }

  .admin-role-top {
    grid-template-columns: 1fr;
  }

  .admin-role-counts {
    justify-items: start;
  }

  .admin-actions {
    min-width: 140px;
  }

  .price-edit-button {
    width: 100%;
  }

  .selected-price-cell {
    min-width: 120px;
  }
}


@media (max-width: 640px) {
  .layout {
    padding: 10px;
    gap: 12px;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  .tab-row {
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 4px;
    margin: 0 -2px;
  }

  .tab-button {
    min-width: max-content;
    padding: 9px 12px;
  }

  .header-panel h1,
  .panel-title-row h2 {
    margin: 0;
  }

  .header-panel h1 {
    font-size: 24px;
    line-height: 1.2;
  }

  .panel-title-row h2 {
    font-size: 18px;
  }

  .header-meta-group,
  .actions,
  .cart-actions {
    width: 100%;
  }

  .cart-actions > label,
  .cart-actions > button,
  .actions > button {
    width: 100%;
  }

  .table-wrap {
    max-height: none;
  }

  .cost-dialog {
    width: min(760px, calc(100vw - 12px));
  }

  .cost-dialog-body {
    padding: 14px;
  }
}

/* Header layout stabilization (web hotfix) */
.header-panel .header-meta-group {
  display: grid !important;
  grid-template-columns: auto auto minmax(220px, 1fr) auto auto auto;
  grid-template-areas:
    "version language user security feedback logout"
    "meta meta meta meta meta meta";
  align-items: center;
  gap: 10px 12px;
}

.header-panel .header-version-stack {
  grid-area: version;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.header-panel .language-picker {
  grid-area: language;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.header-panel #currentUserBadge {
  grid-area: user;
  justify-self: stretch;
  min-height: 42px;
}

.header-panel #securityButton {
  grid-area: security;
}

.header-panel #feedbackButton {
  grid-area: feedback;
}

.header-panel #logoutButton {
  grid-area: logout;
}

.header-panel #securityButton,
.header-panel #feedbackButton,
.header-panel #logoutButton {
  justify-self: end;
  min-height: 42px;
  white-space: nowrap;
}

.header-panel #meta-summary {
  grid-area: meta;
  justify-self: end;
  margin-top: 2px;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 1220px) {
  .header-panel .header-meta-group {
    grid-template-columns: auto minmax(220px, 1fr) auto auto auto;
    grid-template-areas:
      "version user user security logout"
      "language language language feedback feedback"
      "meta meta meta meta meta";
  }

  .header-panel .language-picker {
    justify-self: start;
  }

  .header-panel #feedbackButton {
    justify-self: start;
  }
}

@media (max-width: 860px) {
  .header-panel .header-meta-group {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "version version"
      "language language"
      "user user"
      "security logout"
      "feedback feedback"
      "meta meta";
  }

  .header-panel .language-picker,
  .header-panel #securityButton,
  .header-panel #feedbackButton,
  .header-panel #logoutButton,
  .header-panel #meta-summary {
    justify-self: stretch;
    text-align: left;
  }

  .header-panel .language-picker select {
    width: 100%;
    min-width: 0;
  }

  .header-panel #meta-summary {
    white-space: normal;
    word-break: break-word;
  }
}



@media (max-width: 1024px) {
  .cart-table td {
    height: 76px;
  }

  .cart-col-brand { width: 16%; }
  .cart-col-model { width: 20%; }
  .cart-col-description { width: 24%; }
  .cart-col-selected { width: 18%; }
}

@media (max-width: 768px) {
  .cart-table td {
    height: auto;
  }

  .cart-col-brand { width: 18%; }
  .cart-col-model { width: 24%; }
  .cart-col-description { width: 22%; }
  .cart-col-selected { width: 18%; }

  .col-resizer {
    display: none;
  }

  .cart-description-preview.has-tooltip:hover::after {
    width: min(300px, 78vw);
  }
}


.cart-col-brand { width: 14%; }
.cart-col-model { width: 19%; }
.cart-col-description { width: 22%; }
.cart-col-qty { width: 8%; }
.cart-col-discount { width: 10%; }
.cart-col-selected { width: 19%; }
.cart-col-stock { width: 5%; }
.cart-col-actions { width: 3%; }

.cart-table th:nth-child(n+4),
.cart-table td:nth-child(n+4) {
  text-align: center;
}

.cart-table td:not(:first-child) {
  padding-left: 8px;
  padding-right: 8px;
}

.qty-input,
.discount-input,
.price-edit-button,
.compact-icon-actions,
.selected-price-cell,
.cart-table td .stock-pill {
  margin-left: auto;
  margin-right: auto;
}

.selected-price-cell {
  min-width: 0;
}

.price-edit-button {
  max-width: 160px;
}

.compact-icon-actions {
  justify-content: center;
}

.cart-table .stock-pill {
  justify-content: center;
}

@media (max-width: 1200px) {
  .cart-col-brand { width: 16%; }
  .cart-col-model { width: 24%; }
  .cart-col-description { width: 24%; }
  .cart-col-selected { width: 18%; }
  .cart-col-stock { width: 8%; }
  .cart-col-actions { width: 6%; }
}





.security-dialog-body {
  display: grid;
  gap: 14px;
}

.security-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.security-setup-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fbff;
}

.security-secret-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.security-secret,
.security-uri {
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.security-qr-wrap,
.security-recovery-wrap {
  display: grid;
  gap: 10px;
}

.security-qr-image {
  width: 220px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
}

.security-recovery-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.security-recovery-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.admin-totp-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-totp-badge.is-on {
  background: #dcfce7;
  color: #166534;
}

.admin-totp-badge.is-pending {
  background: #fef3c7;
  color: #92400e;
}

.admin-totp-badge.is-off {
  background: #e2e8f0;
  color: #334155;
}

.admin-audit-table {
  min-width: 880px;
}

.admin-log-action {
  font-weight: 700;
  color: #0f172a;
}

.admin-log-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

.toolbar-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  position: relative;
  z-index: 3;
}

.toolbar-field span {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.toolbar-field-primary {
  min-width: 320px;
}

.toolbar-field-wide {
  min-width: 320px;
}

.toolbar-field-currency {
  min-width: 148px;
}

.toolbar-select {
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  min-height: 44px;
}

.toolbar-select-price {
  min-width: 300px;
  font-weight: 700;
}

.price-source-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.price-source-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.price-source-pill {
  appearance: none;
  border: 1px solid #c7ced9;
  background: #ffffff;
  color: #334155;
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 42px;
  font-weight: 700;
}

.price-source-pill.is-active {
  border-color: #1d4ed8;
  background: #dbeafe;
  color: #1e3a8a;
}

.price-source-pill:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.toolbar-select-currency {
  min-width: 124px;
}

.toolbar-help {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.panel-title-row-proforma {
  align-items: flex-start;
}

.proforma-toolbar {
  flex: 1;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.proforma-toolbar-group {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.proforma-toolbar-priority {
  flex: 1 1 500px;
  justify-content: flex-end;
}

.proforma-toolbar-actions {
  flex: 0 0 auto;
}

.cart-actions {
  align-items: flex-end;
}

.cart-actions > .toolbar-field {
  align-self: stretch;
}

.proforma-toolbar-actions > button {
  min-height: 44px;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .panel-title-row-proforma {
    flex-direction: column;
    align-items: stretch;
  }

  .proforma-toolbar {
    justify-content: stretch;
  }

  .proforma-toolbar-priority {
    justify-content: stretch;
    flex-basis: auto;
  }
}

@media (max-width: 900px) {
  .toolbar-field-primary,
  .toolbar-field-wide {
    min-width: min(100%, 260px);
  }

  .toolbar-select-price {
    min-width: 0;
  }

  .price-source-switch {
    gap: 6px;
  }

  .price-source-pill {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }
}



.led-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.led-form-grid,
.led-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.led-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.led-selected-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.led-strategy-grid,
.led-recommendation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.led-strategy-card,
.led-recommendation-card,
.led-warning-card {
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.led-recommendation-card.is-active,
.led-strategy-card.is-active {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(29, 78, 216, 0.16);
  background: #eff6ff;
}

.led-card-title-row,
.led-bom-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.led-card-title {
  font-weight: 700;
  color: #0f172a;
}

.led-card-subtitle,
.led-card-meta,
.led-card-note {
  font-size: 13px;
  color: #475569;
}

.led-status-badge,
.led-group-badge,
.led-warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.led-status-badge.ok,
.led-warning-badge.info {
  background: #dbeafe;
  color: #1d4ed8;
}

.led-status-badge.warn,
.led-warning-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.led-status-badge.critical,
.led-warning-badge.critical {
  background: #fee2e2;
  color: #b91c1c;
}

.led-group-badge {
  background: #e2e8f0;
  color: #334155;
}

.led-summary-card {
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.led-summary-label {
  font-size: 13px;
  color: #475569;
}

.led-summary-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.led-warning-stack {
  display: grid;
  gap: 10px;
}

.led-warning-card p,
.led-recommendation-card p,
.led-strategy-card p {
  margin: 0;
}

.led-add-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .led-layout-grid {
    grid-template-columns: 1fr;
  }
}
.warning-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #f5d08a;
  background: #fff7e6;
  color: #7c2d12;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.warning-bar-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}
.warning-bar-message {
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
}
.warning-bar-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: inherit;
  cursor: pointer;
}
.saved-quote-revision-badge,
.cart-line-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}
.manual-badge {
  margin-left: 8px;
  background: #fef3c7;
  color: #92400e;
}
.saved-quote-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cart-reset-price {
  margin-top: 6px;
}
.icon-action-button.subtle {
  background: #e2e8f0;
  color: #334155;
}
.export-summary-grid {
  display: grid;
  gap: 10px;
}
.export-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
}
.export-summary-label {
  color: #475569;
  font-size: 13px;
}
.export-summary-value {
  color: #0f172a;
  font-weight: 700;
}
.export-summary-note {
  margin: 2px 2px 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
}
.admin-audit-filter-grid {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: end;
}

.admin-audit-search-field {
  grid-column: 1 / -1;
}

.admin-audit-filter-grid .field,
.admin-audit-filter-grid .field.compact,
.admin-audit-filter-grid .field.grow {
  min-width: 0;
}

.admin-audit-filter-grid input,
.admin-audit-filter-grid select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.admin-audit-search-field {
  grid-column: 1 / -1;
}
.cart-table.is-compact .cart-model-meta {
  display: none;
}
.cart-table.is-compact .cart-description-preview {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.cart-table.is-compact th,
.cart-table.is-compact td {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Header compact layout override */
.header-panel {
  padding: 16px 18px;
  align-items: center;
}

.header-panel > div:first-child {
  flex: 1 1 420px;
  display: grid;
  gap: 8px;
  align-content: center;
}

.header-panel > div:first-child p {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  color: #334155;
}

.header-meta-group {
  flex: 1 1 760px;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 10px 12px;
}

.header-meta-group > * {
  min-width: 0;
}

.language-picker {
  justify-self: end;
  font-size: 13px;
}

.language-picker select {
  min-width: 72px;
  padding: 8px 36px 8px 12px;
  border-radius: 14px;
}

.user-badge {
  align-self: center;
  min-height: 44px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#securityButton,
#logoutButton {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  white-space: nowrap;
}

#meta-summary {
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: 2px;
  text-align: right;
  font-size: 13px;
  line-height: 1.35;
  color: #475569;
}

@media (max-width: 1280px) {
  .header-meta-group {
    grid-template-columns: auto minmax(220px, 1fr) auto auto;
  }
}

@media (max-width: 1024px) {
  .header-panel {
    align-items: stretch;
  }

  .header-meta-group {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .language-picker {
    justify-self: stretch;
  }

  .user-badge,
  #meta-summary {
    grid-column: 1 / -1;
  }

  #meta-summary {
    justify-self: stretch;
    text-align: left;
  }
}


/* LED tab cleanup */
.led-panel {
  gap: 12px;
}

.led-panel .panel-title-row {
  align-items: center;
}

.led-panel .panel-title-row h2 {
  margin: 0;
}

.led-panel .cart-actions {
  gap: 10px;
}

.led-panel .cart-actions button {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
}

.led-form-grid {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px 12px;
}

.led-form-grid .field,
.led-form-grid .field.compact {
  min-width: 0;
}

.led-form-grid label,
.led-config-grid label,
.led-selected-row label {
  font-size: 13px;
  color: #475569;
}

.led-form-grid input,
.led-form-grid select,
.led-config-grid input,
.led-config-grid select,
.led-selected-row select {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
}

.led-form-grid .checkbox-inline {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
}

.led-layout-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.led-selected-row {
  grid-template-columns: minmax(0, 1fr);
}

.led-layout-grid > .led-panel {
  min-width: 0;
}

.led-summary-card {
  padding: 10px 12px;
}

.led-summary-value {
  font-size: 18px;
}

.led-recommendation-card,
.led-strategy-card,
.led-warning-card {
  padding: 12px;
}

@media (max-width: 1280px) {
  .led-form-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}

@media (max-width: 900px) {
  .led-form-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  .led-form-grid {
    grid-template-columns: 1fr;
  }

  .led-panel .cart-actions {
    width: 100%;
  }

  .led-panel .cart-actions button {
    width: 100%;
  }
}


.admin-users-table th,
.admin-audit-table th {
  background: #f6f9ff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-users-table td,
.admin-audit-table td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.admin-user-row td + td {
  border-left: 1px solid #f1f5f9;
}

.admin-audit-card .admin-table-wrap {
  max-height: 720px;
}

.admin-audit-card .admin-card-head,
.admin-users-card .admin-card-head {
  margin-bottom: 14px;
}

.admin-audit-card .meta,
.admin-users-card .meta,
.admin-create-card .meta,
.admin-roles-card .meta {
  color: #64748b;
}

@media (max-width: 1280px) {
  
}

/* Admin stats horizontal layout */




.admin-stats .metric-card {
  min-height: 92px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.admin-stats .metric-card-label {
  font-size: 13px;
}

.admin-stats .metric-card-value {
  margin-top: 6px;
  font-size: 18px;
}

@media (max-width: 1024px) {
  
}

@media (max-width: 640px) {
  
}


/* LED tab i18n/layout refresh */
.led-brand-groups {
  display: grid;
  gap: 16px;
}

.led-brand-group {
  display: grid;
  gap: 12px;
}

.led-brand-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.led-brand-group-header h3 {
  margin: 0;
  font-size: 18px;
  color: #0f172a;
}

.led-price-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}


.led-config-grid {
  display: block;
}

.led-config-shell {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fe 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  align-self: start;
}

.led-config-primary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.led-config-extra-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #dbe3ef;
}

.led-config-shell .field,
.led-config-shell .field.compact {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.led-config-shell label {
  font-size: 13px;
  color: #475569;
}

.led-config-shell input,
.led-config-shell select {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
}

.led-config-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: #334155;
  font-size: 14px;
}

.led-config-toggle input {
  min-height: 0;
}

.led-price-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.led-price-label {
  font-size: 12px;
  color: #64748b;
}

.led-price-value {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

.led-card-meta {
  line-height: 1.35;
}

@media (max-width: 900px) {
  .led-price-grid {
    grid-template-columns: 1fr;
  }

  .led-config-primary-row,
  .led-config-extra-grid {
    grid-template-columns: 1fr;
  }
}

.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
}


.catalog-description-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-search-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}

.admin-search-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.admin-search-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.admin-search-form-grid {
  grid-template-columns: 1fr;
  align-items: end;
}

.admin-search-form-grid .field,
.admin-search-form-grid .field.compact,
.admin-search-form-grid .field.grow {
  min-width: 0;
}

.admin-search-form-grid input,
.admin-search-form-grid select {
  width: 100%;
  max-width: 100%;
}

.admin-search-insights-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-search-test-meta {
  min-height: 20px;
}

.admin-search-test-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.admin-search-result-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d7dce5;
  border-radius: 12px;
  background: #f8fbff;
}

.admin-search-result-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-search-result-desc {
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.admin-search-column .admin-table-wrap,
.admin-search-insights-card .admin-table-wrap {
  max-height: 360px;
}

@media (max-width: 1240px) {
  .admin-search-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-search-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .admin-search-form-grid,
  .admin-search-test-results {
    grid-template-columns: 1fr;
  }
}

.search-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.search-pill-reason {
  background: rgba(59, 91, 219, 0.12);
  color: #2c45a7;
}

.search-pill-category {
  background: rgba(56, 161, 105, 0.12);
  color: #256447;
}

.madrix-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.madrix-shell-header {
  align-items: start;
  gap: 18px;
}

.madrix-shell-head {
  display: grid;
  gap: 8px;
}

.madrix-shell-actions {
  display: flex;
  justify-content: flex-end;
  align-self: stretch;
}

.madrix-subtitle {
  margin: 0;
  color: var(--muted-text, #5f6f89);
  max-width: 860px;
  line-height: 1.55;
}

.madrix-link {
  text-decoration: none;
}

.madrix-input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.madrix-column,
.madrix-lists-grid {
  display: grid;
  gap: 16px;
}

.madrix-lists-grid {
  grid-template-columns: 1fr 1fr;
}

.madrix-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.madrix-column-header h3,
.madrix-panel h3 {
  margin: 0;
}

.madrix-card {
  border: 1px solid rgba(133, 153, 189, 0.28);
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(245, 248, 255, 0.9), rgba(255, 255, 255, 0.98));
  display: grid;
  gap: 12px;
}

.madrix-result-card {
  background: linear-gradient(180deg, rgba(236, 244, 255, 0.95), rgba(248, 251, 255, 0.98));
}

.madrix-card-title {
  font-weight: 700;
  color: #1c2740;
}

.madrix-inline-grid {
  display: grid;
  gap: 12px;
}

.madrix-inline-grid-2 {
  grid-template-columns: 1fr;
}

.madrix-inline-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.madrix-inline-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.madrix-inline-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.madrix-inline-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-text, #5f6f89);
  font-size: 0.92rem;
}

.madrix-result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.madrix-result-metric {
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.madrix-result-license {
  background: linear-gradient(180deg, rgba(227, 235, 255, 0.9), rgba(245, 248, 255, 0.96));
}

.madrix-result-label {
  font-size: 0.9rem;
  color: var(--muted-text, #5f6f89);
}

.madrix-result-value {
  margin-top: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #111b34;
}

.madrix-license-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.madrix-license-card {
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.92);
}

.madrix-license-card.is-qualifies {
  border-color: rgba(93, 121, 255, 0.35);
}

.madrix-license-card.is-match {
  border-color: rgba(66, 96, 230, 0.6);
  box-shadow: 0 0 0 2px rgba(66, 96, 230, 0.12);
  background: linear-gradient(180deg, rgba(235, 241, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.madrix-license-title {
  font-weight: 800;
  color: #111b34;
}

.madrix-license-metric {
  margin-top: 8px;
  color: #44536f;
}

.madrix-remove-button {
  min-width: 72px;
}

@media (max-width: 1180px) {
  .madrix-input-grid,
  .madrix-lists-grid,
  .madrix-license-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .madrix-inline-grid-5,
  .madrix-inline-grid-4,
  .madrix-inline-grid-3,
  .madrix-inline-grid-2,
  .madrix-result-grid {
    grid-template-columns: 1fr;
  }

  .madrix-inline-hint,
  .madrix-column-header {
    flex-direction: column;
    align-items: stretch;
  }
}
/* Header layout fix */
.header-meta-group {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
}
.header-version-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
#versionBadge {
  justify-self: start;
}
#dbVersionBadge {
  justify-self: start;
}
#logoutButton {
  justify-self: end;
}
#meta-summary {
  grid-column: 1 / -1;
  justify-self: end;
  white-space: nowrap;
  font-size: 12px;
}
@media (max-width: 1024px) {
  .header-meta-group {
    grid-template-columns: 1fr 1fr;
  }
  #meta-summary {
    justify-self: start;
  }
}

/* Catalog search row */
.controls-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: end;
}
.controls-panel .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.controls-panel .field label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6b87;
}
.controls-panel .field input,
.controls-panel .field select {
  height: 40px;
  border-radius: 10px;
  background: #f7faff;
  border: 1px solid #d7deea;
}
.controls-panel .field input:focus,
.controls-panel .field select:focus {
  border-color: #3a5ee6;
  box-shadow: 0 0 0 3px rgba(58, 94, 230, 0.18);
}
@media (max-width: 980px) {
  .controls-panel {
    grid-template-columns: 1fr;
  }
  .controls-panel .actions {
    justify-content: stretch;
  }
}


.madrix-link-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.led-systems-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px;
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(242, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.led-systems-tab-button {
  min-width: 170px;
}

.led-quote-panel {
  display: grid;
  gap: 16px;
}

.led-quote-top-grid {
  grid-template-columns: minmax(280px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(120px, 0.8fr) minmax(190px, 1fr);
  gap: 12px;
}

.led-quote-section {
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.9), rgba(255, 255, 255, 0.95));
  padding: 12px;
}

.led-quote-pricing-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.led-quote-pricing-grid .field,
.led-quote-pricing-grid .field.compact,
.led-quote-pricing-grid .field.grow {
  width: 100%;
  min-width: 0;
}

.led-quote-pricing-grid label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.led-quote-pricing-grid input,
.led-quote-pricing-grid select {
  width: 100%;
  min-width: 0;
}

.led-quote-extras-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.led-quote-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
}

.led-quote-display-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
}

.led-quote-source-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.led-quote-source-block {
  border: 1px solid rgba(133, 153, 189, 0.24);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(241, 246, 255, 0.85), rgba(255, 255, 255, 0.96));
  padding: 10px;
}

.led-quote-source-table {
  max-height: 260px;
}

.led-quote-metric-card {
  border: 1px solid rgba(133, 153, 189, 0.24);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(241, 246, 255, 0.9), rgba(255, 255, 255, 0.98));
  padding: 10px 12px;
}

.led-quote-metric-label {
  font-size: 0.8rem;
  color: #4f6280;
  margin-bottom: 6px;
}

.led-quote-metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: #223554;
}

.led-quote-table-wrap {
  max-height: min(58vh, 620px);
}

.led-quote-table-wrap table th,
.led-quote-table-wrap table td {
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .led-quote-top-grid {
    grid-template-columns: 1fr 1fr;
  }
  .led-quote-pricing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .led-quote-extras-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .led-quote-metrics {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .led-quote-display-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .led-quote-source-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .led-quote-top-grid,
  .led-quote-pricing-grid,
  .led-quote-extras-grid,
  .led-quote-metrics,
  .led-quote-display-grid {
    grid-template-columns: 1fr;
  }
}

.madrix-inner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px;
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(242, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.madrix-inner-pane {
  display: none;
  gap: 18px;
}

.madrix-inner-pane.active {
  display: grid;
}

.madrix-planner-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(360px, 0.9fr);
  gap: 18px;
}

.madrix-planner-summary-card {
  background: linear-gradient(180deg, rgba(232, 239, 255, 0.95), rgba(248, 251, 255, 0.98));
}

.madrix-helper-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted-text, #5f6f89);
}

.madrix-warning-box {
  display: none;
  border-radius: 18px;
  border: 1px solid rgba(232, 87, 87, 0.24);
  background: linear-gradient(180deg, rgba(255, 237, 237, 0.96), rgba(255, 247, 247, 0.98));
  color: #7d1f1f;
  padding: 16px 18px;
}

.madrix-warning-box.has-items {
  display: grid;
  gap: 10px;
}

.madrix-warning-entry {
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(232, 87, 87, 0.18);
}

.madrix-warning-box ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.madrix-warning-title {
  font-weight: 800;
}

.madrix-planner-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.madrix-device-grid {
  display: grid;
  gap: 14px;
}
.madrix-device-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.88);
}

.madrix-device-card.is-primary {
  border-color: rgba(66, 96, 230, 0.42);
  box-shadow: 0 0 0 2px rgba(66, 96, 230, 0.08);
  background: linear-gradient(180deg, rgba(241, 246, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.madrix-device-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.madrix-device-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #111b34;
}

.madrix-device-meta {
  margin-top: 4px;
  color: var(--muted-text, #5f6f89);
}

.madrix-device-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(66, 96, 230, 0.12);
  color: #2842a4;
}

.madrix-device-note {
  color: #44536f;
  font-size: 0.92rem;
}

.madrix-price-grid {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.madrix-price-row,
.madrix-price-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.madrix-price-row {
  font-size: 0.92rem;
}

.madrix-price-subrow {
  font-size: 0.82rem;
  color: var(--muted-text, #5f6f89);
  margin: -2px 0 2px;
}

.madrix-price-empty {
  color: var(--muted-text, #5f6f89);
  font-size: 0.92rem;
}

@media (max-width: 1180px) {
  .madrix-planner-grid,
  .madrix-planner-sections,
  .madrix-engineering-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .madrix-link-group {
    justify-content: flex-start;
  }

  .madrix-inner-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }
}


.madrix-planner-stack {
  display: grid;
  gap: 18px;
}

.madrix-planner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.madrix-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.madrix-transfer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

.madrix-planner-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.madrix-engineering-header {
  align-items: stretch;
}

.madrix-section-head {
  display: grid;
  gap: 10px;
}

.madrix-section-note {
  margin: 0;
  max-width: 820px;
  color: var(--muted-text, #5f6f89);
  line-height: 1.55;
}

.madrix-engineering-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.madrix-engineering-card {
  display: grid;
  gap: 16px;
  min-height: 100%;
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(244, 248, 255, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.madrix-engineering-card-title {
  font-size: 1.05rem;
  color: #111b34;
}

.madrix-engineering-metrics {
  display: grid;
  gap: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(133, 153, 189, 0.18);
}

.madrix-engineering-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 10px 0;
}

.madrix-engineering-row + .madrix-engineering-row {
  border-top: 1px solid rgba(133, 153, 189, 0.16);
}

.madrix-engineering-label {
  color: #5a6b87;
  line-height: 1.45;
}

.madrix-engineering-value {
  text-align: right;
  color: #111b34;
  white-space: nowrap;
}

.madrix-engineering-foot {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(233, 240, 252, 0.55);
  border: 1px solid rgba(133, 153, 189, 0.16);
}

.madrix-engineering-foot-row {
  display: grid;
  gap: 6px;
}

.madrix-engineering-foot-row + .madrix-engineering-foot-row {
  padding-top: 10px;
  border-top: 1px solid rgba(133, 153, 189, 0.16);
}

.madrix-engineering-foot-row-note {
  align-content: start;
}

.madrix-engineering-meta-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c7d98;
}

.madrix-engineering-meta-value {
  color: #22304d;
}

.madrix-engineering-meta-note {
  margin: 0;
  color: #31405c;
  line-height: 1.55;
}

.madrix-bom-header {
  align-items: end;
}

.madrix-bom-wrap {
  max-height: 520px;
  border: 1px solid rgba(133, 153, 189, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.madrix-bom-table {
  min-width: 1600px;
}

.madrix-bom-table td {
  vertical-align: top;
}

.madrix-bom-line-name {
  display: grid;
  gap: 8px;
}

.madrix-bom-line-title {
  color: #111b34;
  line-height: 1.45;
}

.madrix-bom-line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: #586886;
}

.madrix-bom-line-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.madrix-bom-line-meta span + span::before {
  content: "|";
  color: #94a3b8;
  margin-right: 2px;
}

.madrix-bom-line-description {
  color: #425270;
  line-height: 1.5;
}

.madrix-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(66, 96, 230, 0.1);
  color: #2842a4;
  font-size: 0.78rem;
}

.madrix-chip.manual {
  background: rgba(245, 158, 11, 0.16);
  color: #9a5a00;
}

.madrix-chip.is-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #9a5a00;
}

.madrix-bom-note-stack {
  display: grid;
  gap: 8px;
  min-width: 240px;
}

.madrix-bom-note-primary {
  color: #31405c;
  line-height: 1.5;
}

.madrix-bom-note-secondary {
  color: #64748b;
  font-size: 0.84rem;
  line-height: 1.55;
}

.madrix-bom-input {
  min-width: 110px;
  width: 100%;
  padding: 8px 10px;
  background: #fff;
}

.madrix-bom-actions {
  display: grid;
  gap: 8px;
}

.madrix-bom-actions button {
  padding: 8px 10px;
  min-width: 92px;
}

.madrix-device-card.is-selected {
  border-color: rgba(29, 78, 216, 0.5);
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12);
  background: linear-gradient(180deg, rgba(237, 244, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.madrix-device-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.madrix-device-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1d4ed8;
}

.madrix-totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.madrix-total-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(133, 153, 189, 0.22);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
}

.madrix-total-card h4 {
  margin: 0;
  font-size: 0.95rem;
}

.madrix-total-values {
  display: grid;
  gap: 4px;
}

.madrix-total-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.madrix-total-line strong {
  color: #111b34;
}

.madrix-total-normalized {
  margin-top: 2px;
  font-size: 0.82rem;
  color: #5a6c8d;
}

.madrix-empty-state {
  color: #64748b;
  font-size: 0.92rem;
}

.madrix-option-note {
  font-size: 0.86rem;
  color: #52627f;
}

@media (max-width: 900px) {
  .madrix-transfer-meta,
  .madrix-form-actions,
  .madrix-device-actions {
    justify-content: flex-start;
  }

  .madrix-bom-table {
    min-width: 1120px;
  }
}

.admin-tabs-cell {
  min-width: 260px;
}

.admin-tabs-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  min-height: 54px;
  border: 1px solid #cfd8e6;
  border-radius: 14px;
  background: #f8fbff;
}

.admin-tabs-checklist-inline {
  min-width: 240px;
}

.admin-tab-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  color: #334155;
  font-size: 13px;
  line-height: 1;
}

.admin-tab-check input {
  margin: 0;
  width: 15px;
  height: 15px;
}

body,
body *,
body *::before,
body *::after {
  font-weight: 400 !important;
}



.resizable-grid-table {
  table-layout: fixed;
}

.resizable-grid-table th[data-col-key] {
  position: sticky;
  top: 0;
}

.resizable-grid-table th.is-resizable {
  position: sticky;
  user-select: none;
}

.resizable-grid-table td {
  min-width: 0;
}

.inventory-panel-actions {
  align-items: flex-end;
  gap: 12px;
}

.inventory-updated-at {
  white-space: nowrap;
  align-self: center;
  color: #64748b;
}

.search-debug-button {
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 12px;
}

.search-debug-content {
  display: grid;
  gap: 16px;
}

.search-debug-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.search-debug-card {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #f8fbff;
  padding: 14px;
}

.search-debug-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.search-debug-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.search-debug-score {
  color: #475569;
}

@media (max-width: 900px) {
  .search-debug-grid {
    grid-template-columns: 1fr;
  }

  .inventory-panel-actions {
    align-items: stretch;
  }

  .inventory-updated-at {
    align-self: flex-start;
  }
}


@media (max-width: 760px) {
  .madrix-engineering-grid {
    grid-template-columns: 1fr;
  }

  .madrix-engineering-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .madrix-engineering-value {
    text-align: left;
  }
}



/* Admin users table visual tighten */
.admin-tabs-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 320px;
}

.admin-tabs-checklist-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tab-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.2;
  color: #1f2937;
  white-space: nowrap;
}

.admin-tab-check input {
  width: 14px;
  height: 14px;
}

.admin-tab-with-subtabs {
  display: grid;
  gap: 6px;
}

.admin-subtab-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 22px;
}

.admin-subtab-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #dbe3ef;
  background: #f8fbff;
  font-size: 12px;
  color: #334155;
}

.admin-subtab-check input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.admin-subtab-checklist.is-disabled {
  opacity: 0.55;
}

.admin-actions {
  min-width: 170px;
  align-items: stretch;
}

.admin-actions button {
  font-size: 12px;
  padding: 8px 10px;
}

.admin-users-table td {
  vertical-align: top;
}

.admin-users-card .admin-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.admin-users-table {
  min-width: 980px;
}

.admin-users-card .admin-table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.admin-users-card .admin-table-wrap::-webkit-scrollbar-thumb {
  background: #cfd8e3;
  border-radius: 999px;
}

.admin-users-card .admin-table-wrap {
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.admin-users-card .admin-table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.admin-users-card .admin-table-wrap::-webkit-scrollbar-thumb {
  background: #c7d2e0;
  border-radius: 999px;
}


.feedback-dialog-body {
  display: grid;
  gap: 16px;
}

.feedback-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.feedback-form-grid .grow {
  grid-column: span 2;
}

.feedback-list {
  display: grid;
  gap: 12px;
}

.feedback-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #f8fafc;
}

.feedback-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.feedback-item-title {
  font-weight: 600;
}

.feedback-item-meta {
  font-size: 12px;
  color: #64748b;
}

.feedback-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-feedback-card textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
}

@media (max-width: 640px) {
  .feedback-form-grid {
    grid-template-columns: 1fr;
  }
  .feedback-form-grid .grow {
    grid-column: span 1;
  }
}

.admin-header-row button {
  justify-self: end;
}

.feedback-alert {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}


.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-content: start;
  width: 100%;
  box-sizing: border-box;
  padding: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(244, 247, 255, 0.9) 100%);
  border-radius: 22px;
}

.admin-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.admin-header-row button {
  justify-self: end;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 4px;
  justify-items: stretch;
}
.admin-stats .metric-card {
  min-height: 92px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.admin-stats .metric-card-label { font-size: 13px; }
.admin-stats .metric-card-value { margin-top: 6px; font-size: 18px; }

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}
.admin-lower-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .admin-header-row { grid-template-columns: 1fr; }
  .admin-header-row button { justify-self: start; }
  .admin-stats { grid-template-columns: 1fr; }
}

/* Admin header alignment hotfix */
.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
}
.admin-header-row button {
  margin-left: auto;
}


/* Project user: hide non-project price columns */
body.project-user #catalogResultsTable col[data-col-key="list1"],
body.project-user #catalogResultsTable col[data-col-key="list2"],
body.project-user #catalogResultsTable col[data-col-key="dealer"],
body.project-user #catalogResultsTable th[data-col-key="list1"],
body.project-user #catalogResultsTable th[data-col-key="list2"],
body.project-user #catalogResultsTable th[data-col-key="dealer"],
body.project-user #catalogResultsTable td[data-col-key="list1"],
body.project-user #catalogResultsTable td[data-col-key="list2"],
body.project-user #catalogResultsTable td[data-col-key="dealer"] {
  display: none;
}

body.project-user #madrixPlannerBomTable col[data-col-key="list1"],
body.project-user #madrixPlannerBomTable col[data-col-key="list2"],
body.project-user #madrixPlannerBomTable col[data-col-key="dealer"],
body.project-user #madrixPlannerBomTable th[data-col-key="list1"],
body.project-user #madrixPlannerBomTable th[data-col-key="list2"],
body.project-user #madrixPlannerBomTable th[data-col-key="dealer"],
body.project-user #madrixPlannerBomTable td[data-col-key="list1"],
body.project-user #madrixPlannerBomTable td[data-col-key="list2"],
body.project-user #madrixPlannerBomTable td[data-col-key="dealer"] {
  display: none;
}

body.project-user #ledTab thead th:nth-child(8),
body.project-user #ledTab thead th:nth-child(9),
body.project-user #ledTab thead th:nth-child(10),
body.project-user #ledBomBody td:nth-child(8),
body.project-user #ledBomBody td:nth-child(9),
body.project-user #ledBomBody td:nth-child(10) {
  display: none;
}

body.project-user #madrixPlannerBomTable thead th:nth-child(8),
body.project-user #madrixPlannerBomTable thead th:nth-child(9),
body.project-user #madrixPlannerBomTable thead th:nth-child(10),
body.project-user #madrixPlannerBomBody td:nth-child(8),
body.project-user #madrixPlannerBomBody td:nth-child(9),
body.project-user #madrixPlannerBomBody td:nth-child(10) {
  display: none;
}


.admin-panel,
.admin-grid,
.admin-lower-grid,
.admin-card,
.admin-users-card,
.admin-audit-card {
  min-width: 0;
}

.admin-users-card,
.admin-audit-card {
  overflow: visible;
}

.admin-users-card .admin-table-wrap,
.admin-audit-card .admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
}

.admin-users-table {
  min-width: 1320px;
  width: max-content;
}

.admin-audit-table {
  min-width: 920px;
  width: max-content;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 148px;
}

.admin-inline-country {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.admin-inline-country label {
  font-size: 12px;
  color: #64748b;
}

.admin-country-card {
  display: grid;
  gap: 16px;
}

.admin-country-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  gap: 12px;
  align-items: end;
}

.admin-country-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-country-pane {
  display: grid;
  gap: 14px;
}

.admin-country-checklist {
  max-width: none;
}

.admin-country-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-country-results {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #f8fbff;
}

.admin-country-result {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dde6f2;
  border-radius: 12px;
  background: #ffffff;
}

.admin-country-result-title {
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 4px;
}

.admin-selection-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #f8fbff;
}

.admin-selection-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #d7e2ef;
  background: #ffffff;
  max-width: 100%;
}

.admin-selection-pill span {
  font-size: 12px;
  color: #1f2937;
}

.admin-selection-pill button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  cursor: pointer;
}

.admin-user-filter-dialog {
  width: min(980px, calc(100vw - 32px));
}

.admin-user-filter-dialog-body {
  display: grid;
  gap: 16px;
}

.admin-user-filter-head {
  align-items: end;
}

@media (max-width: 1200px) {
  .admin-country-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-country-toolbar,
  .admin-country-search-row {
    grid-template-columns: 1fr;
  }
}


/* Final admin layout lock */
.admin-panel {
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.admin-panel > * {
  min-width: 0;
}

.admin-header-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  justify-content: stretch !important;
  gap: 16px !important;
  width: 100% !important;
  margin: 0 !important;
}

.admin-heading-group {
  min-width: 0;
}

.admin-header-row button {
  justify-self: end !important;
  align-self: start !important;
  margin-left: 0 !important;
}

.admin-grid,
.admin-lower-grid,
#adminSearchSection {
  width: 100%;
  min-width: 0;
}

.admin-card {
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.admin-users-card .admin-table-wrap,
.admin-audit-card .admin-table-wrap,
.admin-search-column .admin-table-wrap,
.admin-search-insights-card .admin-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: auto !important;
  max-height: 70vh;
}

.admin-users-table {
  min-width: 1480px;
  width: max-content;
}

.admin-audit-table {
  min-width: 1040px;
  width: max-content;
}

.admin-actions {
  min-width: 180px;
}

@media (max-width: 1024px) {
  .admin-header-row {
    grid-template-columns: 1fr !important;
  }

  .admin-header-row button {
    justify-self: start !important;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }
}

/* Continue web UI refresh v1.2.0.96 */
.layout {
  width: min(1780px, calc(100vw - 24px));
}

.catalog-controls-panel,
.catalog-results-panel {
  width: 100%;
}

#catalogResultsTable col[data-col-key="actions"] {
  width: 184px;
}

#catalogResultsTable th:last-child,
#catalogResultsTable td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #ffffff;
  box-shadow: -14px 0 18px -16px rgba(15, 23, 42, 0.45);
}

#catalogResultsTable thead th:last-child {
  z-index: 4;
  background: #f8fafc;
}

#catalogResultsTable .cart-actions {
  min-width: 148px;
  align-items: stretch;
}

#catalogResultsTable .cart-actions button {
  width: 100%;
}

.admin-subtab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-subtab-button {
  border: 1px solid #d7dce5;
  background: #e8eef8;
  color: #1e293b;
  border-radius: 12px;
  padding: 10px 14px;
  line-height: 1;
}

.admin-subtab-button.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

#adminTab .admin-panel {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

#adminTab .admin-header-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  gap: 16px !important;
  width: 100% !important;
}

#adminTab .admin-header-row > * {
  min-width: 0;
}

#adminTab .admin-header-row button {
  justify-self: end !important;
  align-self: start !important;
  margin-left: 0 !important;
}

#adminTab .admin-grid,
#adminTab .admin-lower-grid,
#adminTab #adminCountrySection,
#adminTab #adminSearchSection {
  width: 100%;
  min-width: 0;
}

#adminTab .admin-card {
  width: 100%;
  min-width: 0;
}

#adminTab .admin-users-card .admin-table-wrap,
#adminTab .admin-audit-card .admin-table-wrap,
#adminTab .admin-search-column .admin-table-wrap,
#adminTab .admin-search-insights-card .admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

#adminTab .admin-country-card {
  width: 100%;
}

.admin-country-brand-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #f8fbff;
}

.admin-country-brand-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-country-brand-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-country-brand-search-row {
  align-items: end;
}

.admin-country-brand-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  padding: 4px;
}

.admin-country-brand-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #ffffff;
}

.admin-country-brand-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .layout {
    width: min(100%, calc(100vw - 20px));
  }

  .admin-country-brand-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .admin-subtab-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  #adminTab .admin-header-row {
    grid-template-columns: 1fr !important;
  }

  #adminTab .admin-header-row button {
    justify-self: start !important;
  }
}

/* Mobile theme polish v1.2.0.97 */
@media (max-width: 900px) {
  body {
    align-items: stretch;
  }

  .layout {
    width: 100%;
    min-height: 100vh;
    padding: 12px;
    gap: 12px;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .header-panel,
  .panel-title-row,
  .panel-title-row-proforma,
  .madrix-shell-header,
  .madrix-column-header,
  .feedback-item-head,
  .admin-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .header-panel > div:first-child {
    flex: 1 1 auto;
  }

  .header-meta-group {
    width: 100%;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #versionBadge,
  .language-picker,
  .user-badge,
  #securityButton,
  #feedbackButton,
  #logoutButton {
    width: 100%;
    justify-self: stretch;
  }

  .language-picker {
    justify-content: space-between;
  }

  .language-picker select {
    width: 100%;
    min-width: 0;
  }

  #meta-summary {
    grid-column: auto;
    justify-self: stretch;
    text-align: left;
    white-space: normal;
    word-break: break-word;
  }

  .tab-row {
    gap: 8px;
    padding: 8px;
    margin: 0 -2px;
    scroll-padding-inline: 12px;
  }

  .tab-button {
    min-height: 44px;
    padding: 10px 14px;
  }

  .controls-panel,
  .catalog-controls-panel {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .controls-panel .field,
  .controls-panel .actions,
  .field,
  .field.compact {
    width: 100%;
    min-width: 0;
  }

  .controls-panel .actions,
  .actions,
  .cart-actions,
  .proforma-toolbar-actions,
  .inventory-panel-actions,
  .madrix-form-actions,
  .madrix-device-actions,
  .madrix-link-group {
    width: 100%;
    justify-content: stretch;
  }

  .actions > button,
  .actions > label,
  .cart-actions > button,
  .cart-actions > label,
  .proforma-toolbar-actions > button,
  .inventory-panel-actions > button,
  .inventory-panel-actions > label,
  .madrix-form-actions > button,
  .madrix-device-actions > button,
  .madrix-link-group > a {
    width: 100%;
    flex: 1 1 100%;
  }

  .header-grid,
  .header-grid.compact-grid,
  .manual-item-grid,
  .admin-form-grid,
  .admin-audit-filter-grid,
  .admin-user-filter-head,
  .admin-country-grid,
  .led-form-grid,
  .led-config-grid,
  .led-config-extra-grid,
  .led-strategy-grid,
  .led-recommendation-grid,
  .madrix-inline-grid-2,
  .madrix-inline-grid-3,
  .madrix-inline-grid-4,
  .madrix-inline-grid-5,
  .madrix-engineering-grid,
  .madrix-license-grid,
  .madrix-lists-grid,
  .madrix-totals-grid,
  .feedback-form-grid {
    grid-template-columns: 1fr !important;
  }

  .led-layout-grid,
  .admin-grid,
  .admin-lower-grid,
  #adminSearchSection {
    grid-template-columns: 1fr !important;
  }

  .madrix-inline-hint,
  .madrix-device-head,
  .madrix-price-row,
  .madrix-price-subrow,
  .madrix-total-line {
    flex-direction: column;
    align-items: flex-start;
  }

  .madrix-transfer-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-country-brand-toolbar,
  .admin-country-brand-actions {
    width: 100%;
  }

  .admin-country-brand-actions > button {
    width: 100%;
  }

  .admin-country-brand-list {
    max-height: none;
  }

  .results-panel .table-wrap,
  .cart-panel .table-wrap,
  .saved-quotes-panel .table-wrap,
  .inventory-table-wrap,
  .review-panel .table-wrap,
  .admin-users-card .admin-table-wrap,
  .admin-audit-card .admin-table-wrap,
  .admin-search-column .admin-table-wrap,
  .admin-search-insights-card .admin-table-wrap,
  .madrix-bom-wrap {
    margin: 0 -4px;
    padding-bottom: 6px;
  }

  #catalogResultsTable col[data-col-key="actions"] {
    width: 160px;
  }

  #catalogResultsTable .cart-actions {
    min-width: 132px;
  }

  .admin-subtab-row {
    margin: 0 -4px;
    padding: 0 4px 6px;
  }

  .feedback-dialog-body,
  .login-card {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .layout {
    padding: 10px;
    gap: 10px;
  }

  .panel {
    padding: 14px;
    border-radius: 16px;
  }

  .header-panel h1,
  .panel-title-row h2,
  .panel-title-row-proforma h2 {
    font-size: 1.85rem;
    line-height: 1.1;
  }

  .header-panel > div:first-child p,
  .madrix-subtitle,
  .meta,
  #meta-summary {
    font-size: 13px;
  }

  .tab-button {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .table-wrap {
    border-radius: 12px;
  }

  #catalogResultsTable th:last-child,
  #catalogResultsTable td:last-child {
    box-shadow: -10px 0 14px -14px rgba(15, 23, 42, 0.45);
  }

  .stock-pill,
  .admin-pill,
  .admin-tab-check,
  .admin-country-brand-option {
    font-size: 12px;
  }
}

/* Proforma view toggle mobile fix v1.2.0.99 */
@media (max-width: 900px) {
  .proforma-toolbar,
  .proforma-toolbar-priority,
  .proforma-toolbar-actions {
    width: 100%;
  }

  .proforma-toolbar-priority {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 12px;
    flex: 1 1 auto;
  }

  .toolbar-field,
  .toolbar-field-primary,
  .toolbar-field-wide,
  .toolbar-field-view,
  .toolbar-field-currency {
    width: 100%;
    min-width: 0 !important;
  }

  .toolbar-field-view .price-source-switch,
  .toolbar-field-view .price-source-pill,
  .toolbar-field-currency .toolbar-select {
    width: 100%;
  }

  .toolbar-field-view .price-source-switch {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .toolbar-field-view .price-source-pill {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .toolbar-field-view .price-source-pill,
  .toolbar-field-currency .toolbar-select {
    min-height: 44px;
  }
}

/* Layout stabilization overrides for admin and product selection */
#catalogTab .catalog-controls-panel {
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

#catalogTab .catalog-controls-panel .field {
  flex: 1 1 280px;
  min-width: 0;
}

#catalogTab .catalog-controls-panel .actions {
  flex: 0 0 auto;
  margin-left: auto;
}

#resultsTableWrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

#catalogResultsTable {
  min-width: 1320px;
  width: 100%;
}

#catalogResultsTable col[data-col-key="select"] {
  width: 56px;
}

#catalogResultsTable .catalog-select-cell {
  width: 56px;
  min-width: 56px;
  text-align: center;
}

#catalogResultsTable .catalog-select-cell input {
  width: 18px;
  height: 18px;
}

#catalogResultsTable col[data-col-key="actions"] {
  width: clamp(160px, 16vw, 200px);
}

#catalogResultsTable .cart-actions {
  min-width: 0;
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#catalogResultsTable .cart-actions button {
  width: 100%;
  min-height: 38px;
}

.catalog-workspace-panel,
.catalog-results-panel {
  display: grid;
  gap: 16px;
}

.catalog-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.catalog-workspace-card,
.catalog-compare-drawer {
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  padding: 16px;
}

.catalog-search-chip-list,
.catalog-workspace-product-list,
.catalog-compare-grid {
  display: grid;
  gap: 12px;
}

.catalog-search-chip {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d7dce5;
  background: #ffffff;
  color: #1e293b;
}

.catalog-search-chip strong,
.catalog-workspace-product-title strong {
  font-size: 0.96rem;
}

.catalog-search-chip span,
.catalog-workspace-product-title .meta,
.catalog-workspace-product-head .meta {
  color: #64748b;
  font-size: 0.82rem;
}

.catalog-workspace-product-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
}

.catalog-workspace-product-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.catalog-workspace-product-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.catalog-workspace-product-desc {
  color: #334155;
  line-height: 1.45;
  min-height: 42px;
}

.catalog-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.catalog-badge-stock {
  background: #dcfce7;
  color: #166534;
}

.catalog-badge-depo {
  background: #dbeafe;
  color: #1d4ed8;
}

.catalog-badge-campaign {
  background: #fef3c7;
  color: #92400e;
}

.catalog-badge-new {
  background: #ede9fe;
  color: #6d28d9;
}

.catalog-badge-manual {
  background: #e2e8f0;
  color: #334155;
}

.catalog-price-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-price-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1e3a8a;
  font-size: 0.8rem;
}

.catalog-workspace-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-workspace-product-actions button {
  flex: 1 1 180px;
}

.catalog-bulk-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #f8fbff;
}

.catalog-bulk-toolbar-summary {
  display: grid;
  gap: 4px;
}

.catalog-bulk-toolbar-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.catalog-bulk-toolbar-controls .field {
  min-width: 120px;
}

.catalog-bulk-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-toggle-active {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
}

.catalog-empty-state {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #64748b;
  background: #f8fafc;
}

.catalog-compare-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

@media (max-width: 1380px) {
  .catalog-workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .catalog-bulk-toolbar,
  .catalog-bulk-toolbar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .catalog-bulk-toolbar-controls .field,
  .catalog-bulk-toolbar-actions,
  .catalog-bulk-toolbar-actions button,
  .catalog-workspace-product-actions button {
    width: 100%;
  }
}

#adminTab .admin-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

#adminTab .admin-header-row > * {
  min-width: 0;
}

#adminTab .admin-stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

#adminTab .admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

#adminTab .admin-lower-grid {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  align-items: start;
}

#adminTab .admin-card {
  min-width: 0;
}

#adminTab .admin-form-grid,
#adminTab .admin-audit-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

#adminTab .admin-form-grid .field.grow,
#adminTab .admin-audit-filter-grid .field.grow {
  grid-column: 1 / -1;
}

#adminTab .admin-tabs-checklist {
  width: 100%;
  max-width: none;
}

#adminTab .admin-table-wrap {
  max-width: 100%;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

#adminTab .admin-users-table {
  min-width: 1320px;
  width: 100%;
}

#adminTab .admin-audit-table {
  min-width: 920px;
  width: 100%;
}

#adminTab .admin-actions {
  min-width: 0;
  width: 100%;
  flex-direction: column;
}

#adminTab .admin-actions button {
  width: 100%;
}

@media (max-width: 1180px) {
  #catalogTab .catalog-controls-panel .field,
  #catalogTab .catalog-controls-panel .actions {
    flex: 1 1 100%;
    width: 100%;
  }

  #catalogTab .catalog-controls-panel .actions {
    margin-left: 0;
  }

  #adminTab .admin-grid,
  #adminTab .admin-lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #adminTab .admin-stats {
    grid-template-columns: 1fr;
  }
}


/* Final admin layout pass */
#adminTab .admin-lower-grid {
  grid-template-columns: 1fr !important;
}

#adminTab .admin-users-card .admin-table-wrap,
#adminTab .admin-audit-card .admin-table-wrap {
  max-height: min(68vh, 760px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

#adminTab .admin-users-table {
  min-width: 1280px;
  width: 100%;
}

#adminTab .admin-actions {
  flex-direction: column;
}

#resultsTableWrap {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}


/* Final admin layout lock v1.2.0.117 */
#adminTab .admin-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 20px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

#adminTab .admin-header-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
  justify-content: stretch !important;
}

#adminTab .admin-header-row > * {
  min-width: 0 !important;
}

#adminTab .admin-header-row button {
  justify-self: end !important;
  align-self: start !important;
  margin: 0 !important;
}

#adminTab .panel-title-row.admin-header-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
}

#adminTab .admin-grid,
#adminTab .admin-lower-grid,
#adminTab #adminCountrySection,
#adminTab #adminSearchSection {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 20px !important;
  width: 100% !important;
  min-width: 0 !important;
  align-items: start !important;
}

#adminTab .admin-card {
  width: 100% !important;
  min-width: 0 !important;
  overflow: visible !important;
}

#adminTab .admin-subtab-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  gap: 10px !important;
  align-items: center !important;
  padding-bottom: 4px !important;
  scrollbar-gutter: stable both-edges !important;
}

#adminTab .admin-subtab-row::-webkit-scrollbar {
  height: 8px;
}

#adminTab .admin-table-wrap,
#adminTab .admin-users-card .admin-table-wrap,
#adminTab .admin-audit-card .admin-table-wrap,
#adminTab .admin-search-column .admin-table-wrap,
#adminTab .admin-search-insights-card .admin-table-wrap {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: min(68vh, 760px) !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges !important;
}

#adminTab .admin-users-table {
  min-width: 1380px !important;
  width: max-content !important;
}

#adminTab .admin-audit-table {
  min-width: 1040px !important;
  width: max-content !important;
}

#adminTab .admin-actions {
  min-width: 180px !important;
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
}

#adminTab .admin-actions button {
  width: 100% !important;
}

@media (max-width: 1024px) {
  #adminTab .admin-header-row {
    grid-template-columns: 1fr !important;
  }

  #adminTab .admin-header-row button {
    justify-self: start !important;
  }

  #adminTab .admin-stats {
    grid-template-columns: 1fr !important;
  }
}

/* CRM */
#crmTab .crm-panel {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

#crmTab .panel-title-row h2,
#crmTab .panel-title-row h3 {
  color: #0f172a;
  font-weight: 800;
  letter-spacing: 0.01em;
}

#crmTab .panel-title-row h2 {
  font-size: 28px;
}

#crmTab .panel-title-row h3 {
  font-size: 22px;
}

#crmTab .crm-filter-grid,
#crmTab .crm-detail-grid,
#crmTab .crm-activity-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

#crmTab .crm-summary-line {
  margin: 10px 0 6px;
  color: #334155;
  background: #eef3fb;
  border: 1px solid #d3deef;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

#crmTab .crm-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}

#crmTab .crm-stage-column {
  border: 1px solid #cfd8e6;
  border-radius: 12px;
  padding: 12px;
  background: #f6f8fc;
  min-height: 220px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#crmTab .crm-stage-column.is-open {
  background: #f3f6fb;
  border-color: #cfd8e6;
  border-top: 4px solid #94a3b8;
}

#crmTab .crm-stage-column.is-won {
  background: #ecfdf3;
  border-color: #86efac;
  border-top: 4px solid #22c55e;
}

#crmTab .crm-stage-column.is-lost {
  background: #fff1f2;
  border-color: #fda4af;
  border-top: 4px solid #ef4444;
}

#crmTab .crm-stage-column.is-drop-target {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.25);
}

#crmTab .crm-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #0f172a;
  font-weight: 700;
  margin-bottom: 10px;
}

#crmTab .crm-stage-header span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
}

#crmTab .crm-stage-cards {
  display: grid;
  gap: 8px;
}

#crmTab .crm-card {
  width: 100%;
  text-align: left;
  border: 1px solid #cdd8e8;
  border-radius: 10px;
  background: #fff;
  padding: 11px;
  cursor: pointer;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

#crmTab .crm-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
  border-color: #93c5fd;
}

#crmTab .crm-card.is-open {
  background: #ffffff;
}

#crmTab .crm-card.is-watch {
  background: #f8fafc;
  border-color: #94a3b8;
}

#crmTab .crm-card.is-warning {
  background: #fffbeb;
  border-color: #fbbf24;
}

#crmTab .crm-card.is-critical {
  background: #fff7ed;
  border-color: #fb7185;
  box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.18), 0 8px 18px rgba(251, 113, 133, 0.12);
}

#crmTab .crm-card.is-won {
  background: #f0fdf4;
  border-color: #86efac;
}

#crmTab .crm-card.is-lost {
  background: #fff1f2;
  border-color: #fda4af;
}

#crmTab .crm-card.is-dragging {
  opacity: 0.7;
}

#crmTab .crm-card.is-selected {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18), 0 10px 18px rgba(37, 99, 235, 0.12);
}

#crmTab .crm-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

#crmTab .crm-card-meta {
  font-size: 12px;
  color: #475569;
  margin-bottom: 4px;
}

#crmTab .crm-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-top: 6px;
}

#crmTab .crm-priority {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
}

#crmTab .crm-priority.is-low {
  background: #dbeafe;
  color: #1e40af;
}

#crmTab .crm-priority.is-medium {
  background: #e2e8f0;
  color: #334155;
}

#crmTab .crm-priority.is-high {
  background: #fef3c7;
  color: #92400e;
}

#crmTab .crm-priority.is-urgent {
  background: #fee2e2;
  color: #991b1b;
}

#crmTab .crm-stage-empty {
  font-size: 12px;
  color: #64748b;
  padding: 8px;
}

#crmTab .crm-detail-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

@media (max-width: 1280px) {
  #crmTab .crm-board {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 900px) {
  #crmTab .crm-board {
    grid-template-columns: 1fr;
  }

  #crmTab .crm-filter-grid,
  #crmTab .crm-detail-grid,
  #crmTab .crm-activity-grid {
    grid-template-columns: 1fr;
  }
}

.ops-panel {
  margin-top: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(23, 38, 65, 0.06);
}

.ops-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ops-panel-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.ops-help,
.ops-card-meta,
.ops-empty {
  color: #64748b;
  font-size: 0.9rem;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.ops-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  min-width: 0;
}

.ops-card-wide {
  grid-column: span 2;
}

.ops-card-label {
  color: #475569;
  font-size: 0.86rem;
  margin-bottom: 6px;
}

.ops-card-value {
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 700;
}

.ops-actions,
.ops-form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ops-form-grid input,
.ops-card select {
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 10px;
}

.ops-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
}

.ops-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  color: #334155;
  font-size: 0.9rem;
}

.ops-meter {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 8px 0;
}

.ops-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #16a34a);
}

.ops-meter-wide {
  height: 16px;
}

.admin-action-checklist {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
}

.admin-subtab-title {
  color: #64748b;
  font-size: 0.82rem;
  margin-bottom: 5px;
}

@media (max-width: 760px) {
  .ops-card-wide {
    grid-column: span 1;
  }
}

.admin-database-card,
.admin-database-result-card {
  margin-top: 18px;
}

.admin-database-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-database-form-grid {
  align-items: end;
}

.admin-database-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.admin-database-file-meta,
.admin-database-note {
  margin-top: 8px;
}

.admin-database-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.admin-database-result-grid > div,
.admin-database-warning {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #d9e2f3;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}

.admin-database-result-grid strong,
.admin-database-warning strong {
  font-size: 0.82rem;
  color: #64748b;
}

.admin-database-warning {
  grid-column: 1 / -1;
  border-color: #f59e0b;
  background: rgba(254, 243, 199, 0.6);
}

.admin-governance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.admin-governance-inner-card,
.admin-support-card,
.admin-release-card {
  min-width: 0;
}

.admin-governance-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 12px 14px;
}

.admin-governance-form-grid .field,
.admin-governance-form-grid .field.compact,
.admin-governance-form-grid .field.grow {
  width: 100%;
  min-width: 0;
}

.admin-governance-form-grid input,
.admin-governance-form-grid select {
  width: 100%;
  min-width: 0;
}

.admin-governance-form-grid > .field:nth-child(3),
.admin-governance-form-grid > .field:nth-child(4),
.admin-governance-form-grid > .field:nth-child(6) {
  grid-column: 1 / -1;
}

.admin-template-card {
  gap: 10px;
}

.admin-validation-status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.admin-validation-status.is-valid {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.admin-validation-status.is-invalid {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.admin-validation-status ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.admin-support-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-support-preview-card {
  display: grid;
  gap: 8px;
  border: 1px solid #d7dce5;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
}

.admin-release-list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
}

.admin-release-list li + li {
  margin-top: 6px;
}

@media (max-width: 1180px) {
  .admin-governance-grid {
    grid-template-columns: 1fr;
  }
}

.admin-database-progress-dialog {
  width: min(540px, calc(100vw - 32px));
}

.admin-database-progress-dialog-body {
  display: grid;
  gap: 14px;
}

.admin-database-progress-file {
  margin: 6px 0 0;
  word-break: break-word;
}

.admin-database-progress-status-row,
.admin-database-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-database-progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.32);
}

.admin-database-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3252d9 0%, #4f6cf5 100%);
  transition: width 0.18s ease;
}

.admin-database-progress-track.is-processing .admin-database-progress-bar {
  width: 100% !important;
  background: linear-gradient(90deg, #3252d9 0%, #7aa2ff 50%, #3252d9 100%);
  background-size: 220px 100%;
  animation: admin-database-progress-pulse 1.25s linear infinite;
}

.admin-database-progress-note {
  line-height: 1.5;
}

@keyframes admin-database-progress-pulse {
  from {
    background-position: 220px 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (max-width: 760px) {
  .admin-database-actions {
    justify-content: stretch;
  }

  .admin-database-actions > button {
    width: 100%;
  }

  .admin-support-preview-toolbar {
    align-items: stretch;
  }

  .admin-support-preview-toolbar > * {
    width: 100%;
  }
}

