:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8e0e8;
  --blue: #1f55d8;
  --blue-dark: #1742a8;
  --blue-ink: #153a8f;
  --orange: #f59e0b;
  --orange-dark: #d97706;
  --green: #19735a;
  --amber: #b7791f;
  --shadow: 0 18px 46px rgba(16, 24, 40, 0.12);
  --erp-content-max: 1800px;
  --erp-content-padding-x: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: 100%;
  max-width: var(--erp-content-max);
  margin: 0 auto;
  padding: 14px var(--erp-content-padding-x) 24px;
  box-sizing: border-box;
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 26px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-logo {
  width: min(250px, 82%);
  height: auto;
  margin-bottom: 4px;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.login-error {
  margin: 0;
  color: #9f2f24;
  font-weight: 700;
}

.search-band {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
}

.panel-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.panel-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
  flex: 0 0 auto;
}

.panel-brand-lockup .eyebrow {
  margin-bottom: 3px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue-ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: 0;
}

.metric {
  padding: 8px 12px;
  border-radius: 6px;
  background: #f4f7ff;
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}

.global-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 10px;
  margin-bottom: 14px;
}

.global-search input {
  height: 52px;
  padding: 0 18px;
  border: 2px solid #b9c7d5;
  border-radius: 999px;
  outline: none;
  font-size: 1.04rem;
  background: #fff;
}

.global-search input:focus,
.filters input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.search-mode {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 6px;
  margin: -4px 0 14px;
  padding: 4px;
  border-radius: 8px;
  background: #edf3f8;
}

.view-mode {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 6px;
  margin: -8px 0 14px 8px;
  padding: 4px;
  border-radius: 8px;
  background: #edf3f8;
}

.mode-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--blue);
  background: transparent;
}

.mode-button:hover {
  background: #dbeaf5;
}

.mode-button.active {
  color: #fff;
  background: var(--blue);
}

.filters.is-muted {
  opacity: 0.6;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--blue-dark);
}

button.ghost {
  color: var(--blue);
  background: #eaf2f8;
}

button.ghost:hover {
  background: #dbeaf5;
}

button.compact {
  min-height: 34px;
  padding: 8px 12px;
}

button.danger {
  color: #fff;
  background: var(--orange);
}

button.danger:hover {
  background: var(--orange-dark);
}

.app-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-group,
.session-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-box span {
  color: var(--muted);
  font-weight: 700;
}

.session-box button {
  min-height: 38px;
  padding: 0 12px;
}

.tab-button {
  min-height: 40px;
  padding: 0 16px;
  color: var(--blue);
  background: #dfeaf2;
}

.tab-button.active {
  color: #fff;
  background: var(--blue);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.tab-page,
.module-card,
.sales-panel,
.quote-panel,
.cart-panel,
.result-panel,
.inventory-panel,
.management-panel,
.admin-panel,
.dashboard-panel,
.dashboard-tabs,
.dashboard-card,
.dashboard-filters,
.provider-dashboard-panel,
.provider-dashboard-view,
.commercial-brand-analysis,
.commercial-brand-kpis,
.commercial-brand-main-grid,
.commercial-brand-bottom-grid,
.commercial-brand-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.vehicle-context-panel {
  margin-top: 2px;
  border: 1px solid #b8c8dc;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.vehicle-context-panel.is-active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(31, 85, 216, 0.14);
}

.vehicle-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  color: #fff;
  background: var(--blue-dark);
}

.vehicle-context-head div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.vehicle-context-head strong {
  font-size: 0.82rem;
  letter-spacing: 0;
}

.vehicle-context-head span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.82);
}

.vehicle-context-status {
  flex: 0 1 auto;
  max-width: 58%;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  overflow: hidden;
  color: #fff !important;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-context-status.is-empty {
  font-weight: 600;
  opacity: 0.78;
}

.filters {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(130px, 1.2fr) 76px minmax(100px, 0.95fr) 94px minmax(120px, 1.05fr) 104px minmax(112px, 0.9fr) 92px 132px;
  gap: 10px;
  align-items: end;
}

.vehicle-context-form {
  padding: 12px;
}

button.ghost.lookup-button {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange-dark);
}

button.ghost.lookup-button:hover {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
  color: #fff;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.filters input,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

.result-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cart-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quote-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.receipt-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.inventory-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sales-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sales-content-host {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
}

.sales-content-host #catalog-view,
.sales-content-host #quotes-view {
  display: grid;
  gap: 14px;
}

.sales-content-host #catalog-view[hidden],
.sales-content-host #quotes-view[hidden] {
  display: none;
}

.sales-content-host .search-band,
.sales-content-host .quote-panel {
  margin: 0;
  box-shadow: none;
}

.sales-content-host .quote-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.supply-child-view {
  margin-top: 10px;
}

.cart-header,
.cart-total,
.quote-header,
.receipt-header,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}

.cart-header {
  border-bottom: 1px solid var(--line);
}

.quote-header {
  border-bottom: 1px solid var(--line);
}

.receipt-header {
  border-bottom: 1px solid var(--line);
}

.admin-header {
  border-bottom: 1px solid var(--line);
}

.inventory-filters {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto 150px 110px 130px;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.replenishment-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.inventory-filters input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.replenishment-filters input,
.replenishment-filters select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.inventory-filters input:focus,
.replenishment-filters input:focus,
.replenishment-filters select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--ink);
}

.check-label input {
  width: 18px;
  min-height: 18px;
}

.inventory-toolbar {
  border-bottom: 1px solid var(--line);
}

.inventory-section {
  display: none;
}

.inventory-section.active {
  display: block;
}

.inventory-section-title {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.inventory-section-title strong {
  font-size: 1.02rem;
}

.inventory-section-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.inventory-subtabs {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.inventory-pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-pager span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.inventory-table-wrap table {
  min-width: 1360px;
}

.quality-filters {
  align-items: end;
  grid-template-columns: 1.15fr 0.55fr 0.55fr 0.55fr 1.35fr 0.55fr auto auto auto;
}

.quality-request-summary {
  align-items: center;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1.8fr 1fr;
  margin: 12px 0;
  padding: 12px 14px;
}

.quality-request-summary[hidden] {
  display: none;
}

.quality-request-summary div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.quality-request-summary strong {
  color: #0f172a;
  width: 100%;
}

.quality-request-summary span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.quality-summary-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin: 12px 0;
}

.quality-card {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  min-height: 72px;
  padding: 10px 12px;
}

.quality-card strong {
  color: #0f172a;
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

.quality-card span {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  margin-top: 6px;
}

.quality-card-green { border-bottom-color: #16a34a; }
.quality-card-red { border-bottom-color: #dc2626; }
.quality-card-teal { border-bottom-color: #0891b2; }
.quality-card-amber { border-bottom-color: #f59e0b; }
.quality-card-purple { border-bottom-color: #7c3aed; }
.quality-card-pink { border-bottom-color: #db2777; }

.quality-table-wrap {
  overflow-x: auto;
}

.quality-table-wrap table {
  min-width: 1280px;
  table-layout: fixed;
}

.quality-table-wrap th:nth-child(1),
.quality-table-wrap td:nth-child(1) { width: 44px; }
.quality-table-wrap th:nth-child(2),
.quality-table-wrap td:nth-child(2) { width: 128px; }
.quality-table-wrap th:nth-child(3),
.quality-table-wrap td:nth-child(3) { width: 260px; }
.quality-table-wrap th:nth-child(4),
.quality-table-wrap td:nth-child(4) { width: 120px; }
.quality-table-wrap th:nth-child(5),
.quality-table-wrap td:nth-child(5) { width: 130px; }
.quality-table-wrap th:nth-child(6),
.quality-table-wrap td:nth-child(6) { width: 150px; }
.quality-table-wrap th:nth-child(7),
.quality-table-wrap td:nth-child(7) { width: 78px; }
.quality-table-wrap th:nth-child(8),
.quality-table-wrap td:nth-child(8),
.quality-table-wrap th:nth-child(9),
.quality-table-wrap td:nth-child(9) { width: 72px; }
.quality-table-wrap th:nth-child(10),
.quality-table-wrap td:nth-child(10) { width: 150px; }
.quality-table-wrap th:nth-child(11),
.quality-table-wrap td:nth-child(11) { width: 150px; }
.quality-table-wrap th:nth-child(12),
.quality-table-wrap td:nth-child(12) { width: 150px; }
.quality-table-wrap th:last-child,
.quality-table-wrap td:last-child { width: 92px; }

.quality-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-print-form {
  align-items: end;
}

.label-print-form label {
  min-width: 160px;
}

.label-print-check {
  align-items: center;
  flex-direction: row;
  gap: 8px;
  min-height: 38px;
}

.label-print-check input {
  width: auto;
  min-height: auto;
}

.quality-request-summary[data-tone="ok"] {
  border-color: rgba(22, 163, 74, 0.35);
  background: #f0fdf4;
  color: #166534;
}

.quality-request-summary[data-tone="error"] {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: #991b1b;
}

.label-preview-shell {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 16px;
}

.label-preview-meta {
  color: var(--muted);
  font-size: 13px;
}

.label-sheet {
  display: grid;
  place-items: center;
  width: 120mm;
  min-height: 80mm;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.print-label {
  display: grid;
  grid-template-rows: 6.6mm 5.2mm 11.5mm 5mm 6.3mm;
  width: 60mm;
  height: 40mm;
  padding: 0.6mm 2mm 1.4mm;
  overflow: hidden;
  border: 1px solid #d0d7de;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  page-break-after: always;
  break-after: page;
}

.print-label-code {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-label-description {
  display: -webkit-box;
  overflow: hidden;
  font-size: 8.4px;
  font-weight: 700;
  line-height: 1.12;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.print-label-barcode {
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  background: #fff;
}

.print-label-barcode svg {
  display: block;
  max-width: 100%;
  height: 100%;
  background: #fff;
}

.print-label-location {
  overflow: hidden;
  font-size: 9.6px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-label-location.is-hidden {
  visibility: hidden;
}

.print-label-footer {
  overflow: hidden;
  font-size: 9.6px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.label-print-area {
  display: none;
}

@page {
  size: 60mm 40mm;
  margin: 0;
}

@media print {
  html,
  body {
    width: 60mm;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  body > :not(.app-shell),
  .app-shell > :not(#inventory-view),
  #inventory-view > :not(#inventory-labels-section),
  #inventory-labels-section > :not(.label-print-area) {
    display: none !important;
  }

  .app-shell,
  #inventory-view,
  #inventory-labels-section {
    display: contents !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .label-print-area {
    display: block !important;
    position: static !important;
    width: 60mm;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .print-label {
    display: grid !important;
    box-sizing: border-box;
    width: 60mm;
    height: 40mm;
    min-height: 40mm;
    max-height: 40mm;
    margin: 0;
    border: 0;
    box-shadow: none;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: always;
    break-after: page;
  }

  .print-label:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}

.immobilized-filters {
  align-items: end;
  grid-template-columns: 0.9fr 0.95fr 0.95fr 0.8fr 0.85fr 1fr 1fr 1fr 1.25fr 0.72fr auto auto;
}

.immobilized-summary-cards {
  grid-template-columns: repeat(2, minmax(190px, 1fr));
}

.immobilized-table-wrap {
  overflow-x: hidden;
}

.immobilized-table-wrap table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.immobilized-table-wrap th,
.immobilized-table-wrap td {
  font-size: 0.73rem;
  padding-left: 7px;
  padding-right: 7px;
}

.immobilized-table-wrap th:nth-child(1),
.immobilized-table-wrap td:nth-child(1) { width: 38px; }
.immobilized-table-wrap th:nth-child(2),
.immobilized-table-wrap td:nth-child(2) { width: 104px; }
.immobilized-table-wrap th:nth-child(3),
.immobilized-table-wrap td:nth-child(3) { width: auto; }
.immobilized-table-wrap th:nth-child(4),
.immobilized-table-wrap td:nth-child(4) { width: 82px; }
.immobilized-table-wrap th:nth-child(5),
.immobilized-table-wrap td:nth-child(5) { width: 82px; }
.immobilized-table-wrap th:nth-child(6),
.immobilized-table-wrap td:nth-child(6) { width: 82px; }
.immobilized-table-wrap th:nth-child(7),
.immobilized-table-wrap td:nth-child(7) { width: 82px; }
.immobilized-table-wrap th:nth-child(8),
.immobilized-table-wrap td:nth-child(8) { width: 82px; }
.immobilized-table-wrap th:nth-child(9),
.immobilized-table-wrap td:nth-child(9) { width: 126px; }
.immobilized-table-wrap th:nth-child(10),
.immobilized-table-wrap td:nth-child(10) { width: 58px; }
.immobilized-table-wrap th:nth-child(11),
.immobilized-table-wrap td:nth-child(11),
.immobilized-table-wrap th:nth-child(12),
.immobilized-table-wrap td:nth-child(12) { width: 94px; }
.immobilized-table-wrap th:nth-child(13),
.immobilized-table-wrap td:nth-child(13) { width: 88px; }
.immobilized-table-wrap th:nth-child(14),
.immobilized-table-wrap td:nth-child(14) { width: 112px; }
.immobilized-table-wrap th:nth-child(15),
.immobilized-table-wrap td:nth-child(15) { width: 112px; }

.immobilized-table-wrap td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.immobilized-table-wrap .actions-cell {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.immobilized-table-wrap .actions-cell .compact {
  min-height: 26px;
  padding: 5px 7px;
}

.inventory-control-header {
  display: block;
}

.inventory-control-header > div:first-child {
  margin-bottom: 14px;
  min-width: 0;
}

.inventory-control-filters {
  align-items: end;
  display: grid;
  gap: 10px 12px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  width: 100%;
}

.inventory-control-filters label {
  min-width: 0;
}

.inventory-control-filters label input,
.inventory-control-filters label select {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.inventory-control-filters button {
  align-self: end;
  min-width: 120px;
  white-space: nowrap;
}

.inventory-control-filters button[type="submit"] {
  grid-column: 1;
}

#low-stock-clear {
  grid-column: 2;
}

#low-stock-xls {
  grid-column: 3;
}

.inventory-control-summary-cards {
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.inventory-control-table-wrap {
  overflow-x: hidden;
}

.inventory-control-table-wrap table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.inventory-control-table-wrap th,
.inventory-control-table-wrap td {
  font-size: 0.74rem;
  padding-left: 7px;
  padding-right: 7px;
}

.inventory-control-table-wrap td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-control-table-wrap .actions-cell {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.inventory-control-table-wrap .actions-cell .compact {
  min-height: 26px;
  padding: 5px 7px;
}

.replenishment-table-wrap table {
  min-width: 1180px;
}

.purchase-table-wrap table {
  min-width: 1240px;
}

.provider-load-table-wrap {
  overflow-x: hidden;
}

#provider-load-view .result-toolbar.inventory-toolbar {
  display: none;
}

#provider-load-summary {
  display: block;
  margin: 8px 0 12px;
}

#provider-load-summary[hidden] {
  display: none;
}

#provider-load-summary h3 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
}

.provider-load-summary-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.provider-load-summary-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 15px 16px 14px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.provider-load-summary-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--summary-color);
}

.provider-load-summary-icon {
  display: inline-flex;
  grid-row: 1 / span 2;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  color: #fff;
  background: var(--summary-color);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.08);
}

.provider-load-summary-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.provider-load-summary-value {
  color: #020617;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.provider-load-summary-label {
  align-self: start;
  margin-top: 4px;
  color: #334155;
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.2;
}

.provider-load-summary-card-total {
  --summary-color: #2563eb;
}

.provider-load-summary-card-recognized {
  --summary-color: #16a34a;
}

.provider-load-summary-card-added {
  --summary-color: #15803d;
}

.provider-load-summary-card-unmatched {
  --summary-color: #f59e0b;
}

.provider-load-summary-card-ambiguous {
  --summary-color: #7c3aed;
}

.provider-load-summary-card-errors {
  --summary-color: #ef4444;
}

.provider-load-summary-card-visible {
  --summary-color: #0ea5a8;
}

@media (max-width: 1320px) {
  .provider-load-summary-cards {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }
}

@media (max-width: 760px) {
  .provider-load-summary-cards {
    grid-template-columns: 1fr;
  }
}

.purchase-review-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
}

.purchase-review-summary[hidden] {
  display: none;
}

.purchase-review-cards .provider-load-summary-value {
  font-size: 1.18rem;
  line-height: 1.15;
}

.purchase-review-status {
  margin-top: 0;
}

.pager-size-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.pager-size-label select {
  min-height: 32px;
  padding: 6px 26px 6px 9px;
  font-size: 0.78rem;
}

.provider-load-table-wrap .provider-load-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.provider-load-table th,
.provider-load-table td {
  box-sizing: border-box;
  padding: 7px 5px;
  font-size: 0.78rem;
  line-height: 1.22;
}

.provider-load-table th:nth-child(1),
.provider-load-table td:nth-child(1) {
  width: 4%;
}

.provider-load-table th:nth-child(2),
.provider-load-table td:nth-child(2) {
  width: 10%;
}

.provider-load-table th:nth-child(3),
.provider-load-table td:nth-child(3) {
  width: 22%;
}

.provider-load-table th:nth-child(4),
.provider-load-table td:nth-child(4) {
  width: 8%;
}

.provider-load-table th:nth-child(5),
.provider-load-table td:nth-child(5),
.provider-load-table th:nth-child(6),
.provider-load-table td:nth-child(6),
.provider-load-table th:nth-child(7),
.provider-load-table td:nth-child(7),
.provider-load-table th:nth-child(8),
.provider-load-table td:nth-child(8),
.provider-load-table th:nth-child(9),
.provider-load-table td:nth-child(9),
.provider-load-table th:nth-child(10),
.provider-load-table td:nth-child(10) {
  width: 5.5%;
  text-align: center;
}

.provider-load-table th:nth-child(11),
.provider-load-table td:nth-child(11) {
  width: 7%;
}

.provider-load-table th:nth-child(12),
.provider-load-table td:nth-child(12) {
  width: 6%;
  text-align: center;
}

.provider-load-table th:nth-child(13),
.provider-load-table td:nth-child(13) {
  width: 10%;
}

.provider-load-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-load-number {
  text-align: center;
  white-space: nowrap;
}

.provider-load-code,
.provider-load-brand,
.provider-load-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-load-row-number,
.provider-load-reviewed-cell {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.provider-load-reviewed-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #86efac;
  font-size: 0.86rem;
  font-weight: 900;
}

.provider-load-reviewed-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #16a34a;
  cursor: pointer;
}

#purchase-results .provider-load-actions-cell {
  justify-content: flex-start;
}

#purchase-results .provider-load-actions-cell .stock-detail-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.provider-load-review-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
}

.provider-load-review-summary[hidden] {
  display: none;
}

.provider-load-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 11px 13px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.provider-load-alert strong {
  font-weight: 900;
}

.provider-load-alert-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.provider-load-alert-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.provider-load-alert-success {
  color: #166534;
  border-color: #bbf7d0;
  background: #ecfdf3;
}

.provider-load-alert-warning {
  color: #92400e;
  border-color: #fcd34d;
  background: #fffbeb;
}

.provider-load-alert-error {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

.price-audit-view {
  display: grid;
  gap: 12px;
}

.price-audit-view[hidden],
.price-audit-detail-backdrop[hidden] {
  display: none;
}

.audit-mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.audit-mode-row strong {
  color: #0f172a;
  font-size: 0.88rem;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
}

.segmented-control button {
  min-height: 32px;
  padding: 0 16px;
  color: #1e3a8a;
  border: 0;
  border-right: 1px solid #dbe3ef;
  border-radius: 0;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.active {
  color: #fff;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.price-audit-filters {
  grid-template-columns: repeat(9, minmax(105px, 1fr));
  align-items: end;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.price-audit-filters .wide-filter {
  grid-column: span 2;
}

.input-suffix {
  display: grid;
  grid-template-columns: 1fr 34px;
}

.input-suffix input {
  border-radius: 6px 0 0 6px !important;
}

.input-suffix span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  color: #0f172a;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: #f8fafc;
  font-weight: 900;
}

.price-audit-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.price-audit-kpis:has(.audit-kpi:nth-child(7)) {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.price-audit-kpis[hidden] {
  display: none;
}

.audit-kpi {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 9px;
  align-items: center;
  min-height: 76px;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid var(--audit-kpi-border);
  border-radius: 8px;
  background: var(--audit-kpi-bg);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.audit-kpi span {
  display: inline-flex;
  grid-row: 1 / span 2;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--audit-kpi-color);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  font-weight: 900;
}

.audit-kpi strong {
  color: var(--audit-kpi-color);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.audit-kpi small {
  color: #334155;
  min-width: 0;
  font-size: 0.71rem;
  font-weight: 800;
  line-height: 1.18;
}

.audit-kpi-blue { --audit-kpi-color: #2563eb; --audit-kpi-bg: #eff6ff; --audit-kpi-border: #bfdbfe; }
.audit-kpi-red { --audit-kpi-color: #dc2626; --audit-kpi-bg: #fef2f2; --audit-kpi-border: #fecaca; }
.audit-kpi-green { --audit-kpi-color: #15803d; --audit-kpi-bg: #f0fdf4; --audit-kpi-border: #bbf7d0; }
.audit-kpi-yellow { --audit-kpi-color: #d97706; --audit-kpi-bg: #fffbeb; --audit-kpi-border: #fde68a; }
.audit-kpi-purple { --audit-kpi-color: #7c3aed; --audit-kpi-bg: #f5f3ff; --audit-kpi-border: #ddd6fe; }
.audit-kpi-cyan { --audit-kpi-color: #0284c7; --audit-kpi-bg: #ecfeff; --audit-kpi-border: #bae6fd; }
.audit-kpi-orange { --audit-kpi-color: #ea580c; --audit-kpi-bg: #fff7ed; --audit-kpi-border: #fed7aa; }

.price-audit-toolbar {
  margin-top: 4px;
}

.price-audit-table-wrap table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.price-audit-table-wrap th,
.price-audit-table-wrap td {
  padding: 8px 7px;
  font-size: 0.79rem;
}

.price-audit-table-wrap th:nth-child(1),
.price-audit-table-wrap td:nth-child(1) { width: 4%; }
.price-audit-table-wrap th:nth-child(2),
.price-audit-table-wrap td:nth-child(2) { width: 11%; }
.price-audit-table-wrap th:nth-child(3),
.price-audit-table-wrap td:nth-child(3) { width: 23%; }
.price-audit-table-wrap th:nth-child(4),
.price-audit-table-wrap td:nth-child(4) { width: 9%; }
.price-audit-table-wrap th:nth-child(5),
.price-audit-table-wrap td:nth-child(5),
.price-audit-table-wrap th:nth-child(6),
.price-audit-table-wrap td:nth-child(6),
.price-audit-table-wrap th:nth-child(7),
.price-audit-table-wrap td:nth-child(7),
.price-audit-table-wrap th:nth-child(8),
.price-audit-table-wrap td:nth-child(8) {
  width: 9%;
  text-align: center;
}
.price-audit-table-wrap th:nth-child(9),
.price-audit-table-wrap td:nth-child(9) { width: 9%; }
.price-audit-table-wrap th:nth-child(10),
.price-audit-table-wrap td:nth-child(10) { width: 8%; }

.empty-table-cell {
  height: 74px;
  color: var(--muted);
  text-align: center !important;
  font-weight: 800;
}

.inventory-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
}

.inventory-footer-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inventory-footer-row select {
  min-height: 32px;
  padding: 4px 28px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.price-audit-detail-backdrop {
  z-index: 130;
}

.price-audit-detail-modal {
  width: min(94vw, 1320px);
  max-width: calc(100vw - 36px);
  max-height: min(820px, calc(100vh - 36px));
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.price-audit-detail-modal *,
.price-audit-detail-modal *::before,
.price-audit-detail-modal *::after {
  box-sizing: border-box;
}

.price-audit-detail-modal > *,
.audit-detail-section,
.audit-detail-columns,
.audit-detail-grid,
.audit-detail-table {
  max-width: 100%;
}

.modal-header {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 12px;
  color: #0f172a;
  background: #fff;
}

.modal-header strong {
  font-size: 1rem;
  font-weight: 900;
}

.audit-detail-section {
  min-width: 0;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
}

.audit-detail-section h4 {
  margin: 0 0 10px;
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 900;
}

.audit-detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.72fr);
  gap: 10px;
  min-width: 0;
}

.audit-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  min-width: 0;
}

.audit-detail-grid > div {
  min-width: 0;
}

.audit-detail-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audit-detail-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.audit-detail-grid span,
.audit-detail-grid strong {
  display: block;
}

.audit-detail-grid span {
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
}

.audit-detail-grid strong {
  margin-top: 3px;
  color: #0f172a;
  font-size: 0.83rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.audit-variation-box {
  border-color: #fecaca;
  background: #fff7f4;
}

.audit-detail-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.74rem;
}

.audit-detail-table th {
  color: #1e3a8a;
  background: #eff6ff;
}

.audit-detail-table th,
.audit-detail-table td {
  padding: 7px 5px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.22;
}

.audit-detail-table th:nth-child(1),
.audit-detail-table td:nth-child(1) {
  width: 12%;
}

.audit-detail-table th:nth-child(2),
.audit-detail-table td:nth-child(2) {
  width: 22%;
}

.audit-detail-table th:nth-child(3),
.audit-detail-table td:nth-child(3) {
  width: 17%;
}

.audit-detail-table th:nth-child(4),
.audit-detail-table td:nth-child(4) {
  width: 12%;
}

.audit-detail-table th:nth-child(5),
.audit-detail-table td:nth-child(5) {
  width: 9%;
}

.audit-detail-table th:nth-child(6),
.audit-detail-table td:nth-child(6) {
  width: 15%;
}

.audit-detail-table th:nth-child(7),
.audit-detail-table td:nth-child(7) {
  width: 13%;
}

.audit-detail-table td[colspan] {
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

@media (max-width: 1380px) {
  .price-audit-filters {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .price-audit-kpis {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .price-audit-kpis:has(.audit-kpi:nth-child(7)) {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }
}

@media (max-width: 980px) {
  .audit-detail-columns {
    grid-template-columns: 1fr;
  }

  .audit-detail-grid.three,
  .audit-detail-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.price-audit-detail-modal .modal-actions {
  width: 100%;
  justify-content: flex-end;
  padding-top: 4px;
}

.purchase-table-wrap tr.provider-load-reviewed-row td {
  background: #f0fbef;
}

.purchase-table-wrap tr.purchase-row-in-oc td {
  background: #dff3dc;
}

/* ANOTACIONES-06C: mismo verde OC, estado ERP independiente. */
.purchase-table-wrap tr.purchase-row-erp-annotation td {
  background: #dff3dc;
}

.provider-load-actions-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-start;
  white-space: nowrap;
}

.provider-load-actions-cell .compact {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 0.72rem;
}

.provider-load-actions-cell .stock-detail-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.purchase-orders-table-wrap table {
  min-width: 1460px;
}

.purchase-order-filters {
  grid-template-columns: repeat(9, minmax(100px, 1fr)) auto auto auto;
}

.purchase-order-panel {
  border-top: 1px solid var(--line);
  background: #fff;
}

.purchase-orders {
  display: grid;
  gap: 22px;
  padding: 16px 14px 20px;
}

.purchase-order-actions-cell {
  display: flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}

.purchase-order-editor {
  width: min(1080px, 92vw);

  max-height: calc(100vh - 32px);

  overflow-y: scroll;
  overflow-x: hidden;

  scrollbar-gutter: stable;

  overscroll-behavior: contain;

  margin: 0;

  box-shadow:
    0 24px 70px rgba(15, 23, 42, 0.22);
}

.purchase-order-editor > .dashboard-card-head {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #fff;
  border-bottom: 1px solid #e3eaf3;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
}

.purchase-order-editor[data-mode="view"] input:disabled,
.purchase-order-editor[data-mode="view"] select:disabled {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
  background: #f8fafc;
  cursor: default;
}

.purchase-order-editor-modal {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.purchase-order-form-grid select,
.purchase-order-form-grid input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.purchase-order-editor-lines {
  display: grid;
  gap: 7px;
}

.saved-po-line {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(220px, 2fr) 80px 100px 110px 78px;
  gap: 7px;
  align-items: center;
  padding: 9px;
  border: 1px solid #e8eef6;
  border-radius: 7px;
  background: #f8fafc;
}

.saved-po-line input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
}

.saved-po-line strong {
  text-align: right;
}

.purchase-order-editor-total {
  justify-self: end;
  min-width: 220px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.purchase-order-history-list {
  display: grid;
  gap: 6px;
}

.purchase-order-history-list div {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #e8eef6;
  border-radius: 7px;
  background: #f8fafc;
}

.purchase-order-history-list span {
  color: var(--muted);
  font-size: 0.82rem;
}

.purchase-order-card {
  border: 1px solid #c9d7e6;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
}

.purchase-order-title,
.purchase-order-line {
  display: grid;
  grid-template-columns: 44px 1.1fr 1fr 2fr 90px 110px 110px 90px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.purchase-order-title {
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 14px;
  padding: 13px 14px;
  background: #eef5ff;
  border-left: 5px solid var(--blue);
}

.purchase-order-title span {
  color: var(--muted);
  font-weight: 800;
}

.purchase-order-provider {
  display: grid;
  gap: 3px;
}

.purchase-order-provider strong {
  color: var(--ink);
  font-size: 1rem;
}

.purchase-order-summary {
  display: grid;
  justify-items: end;
  gap: 3px;
  min-width: 120px;
}

.purchase-order-summary strong,
.purchase-order-subtotal strong {
  color: var(--ink);
  font-size: 1.02rem;
}

.purchase-order-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.purchase-order-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.purchase-order-select-all input,
.purchase-order-line input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
}

.purchase-order-line:last-child {
  border-bottom: 0;
}

.purchase-order-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.purchase-order-validation-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
}

.purchase-order-validation-summary.ok,
.purchase-order-validation-row.ok {
  background: #eaf7e8;
  color: #166534;
}

.purchase-order-validation-summary.warn,
.purchase-order-validation-row.warn {
  background: #fff7db;
  color: #92400e;
}

.purchase-order-validation-summary.danger,
.purchase-order-validation-row.danger {
  background: #feecec;
  color: #991b1b;
}

.purchase-order-validation-row {
  display: grid;
  grid-template-columns: 82px repeat(6, minmax(92px, auto)) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
}

.purchase-order-validation-row strong {
  font-weight: 900;
}

.purchase-order-validation-status {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.purchase-order-validation-reason {
  min-width: 0;
  overflow-wrap: anywhere;
}

.purchase-order-subtotal {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  padding: 12px 14px;
  border-top: 2px solid #d8e3ef;
  background: #fbfdff;
  color: var(--muted);
  font-weight: 900;
}

.purchase-order-line input,
.purchase-history-item input {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.purchase-order-line input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
  justify-self: center;
}

.purchase-history-row td {
  background: #f8fbff;
}

.purchase-history {
  display: grid;
  gap: 8px;
}

.purchase-history-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.purchase-selected-provider-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #dbe6f3;
  border-radius: 6px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
}

.purchase-selected-provider-code span {
  color: var(--blue-ink);
}

.purchase-selected-provider-code strong {
  color: var(--ink);
}

.purchase-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

body.purchase-modal-open {
  overflow: hidden;
}

.purchase-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1180px, 94vw);
  max-height: min(820px, 92vh);
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
}

.purchase-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.purchase-modal-head strong,
.purchase-modal-head span {
  display: block;
}

.purchase-modal-head strong {
  color: var(--blue);
  font-size: 1rem;
}

.purchase-modal-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.purchase-modal-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ICONOS-COMPRAS-03: acciones existentes en el encabezado. */
.purchase-modal-header-icons {
  flex: 0 0 auto;
  justify-content: flex-start;
  align-items: center;
  align-self: center;
  padding-top: 0;
  min-width: 0;
  margin-left: auto;
  margin-right: 0;
}

.purchase-modal-header-icons .stock-detail-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  box-sizing: border-box;
}

.purchase-modal-head-actions {
  flex: 0 0 auto;
  align-self: center;
}

/* ICONOS-COMPRAS-08D: correccion vertical medida en Chrome. */
.purchase-modal-head > .purchase-modal-header-icons {
  transform: translateY(-7.5px);
}

.purchase-modal-sticky {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.purchase-modal-context {
  display: grid;
  grid-template-columns: 115px minmax(220px, 1.5fr) 85px 90px minmax(150px, 0.9fr) minmax(150px, 1fr) 100px 85px;
  gap: 9px;
  align-items: start;
}

.purchase-modal-context > div {
  min-width: 0;
}

.purchase-modal-context span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-modal-context strong {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.purchase-modal-description strong {
  white-space: normal;
}

.purchase-modal-icon-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 15px;
}

.purchase-filtered-provider-action {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 100px 110px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.purchase-filtered-provider-action span,
.purchase-filtered-provider-action em {
  display: block;
}

.purchase-filtered-provider-action span,
.purchase-filtered-provider-action label {
  color: var(--blue-ink);
  font-size: 0.74rem;
  font-weight: 800;
}

.purchase-filtered-provider-action strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.purchase-filtered-provider-action em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 800;
}

.purchase-filtered-provider-action input {
  width: 100%;
  min-height: 34px;
  margin-top: 3px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.purchase-modal-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 14px;
  background: #f8fbff;
}

.purchase-modal-list {
  display: grid;
  gap: 8px;
}

.purchase-history-item {
  display: grid;
  grid-template-columns: 86px 115px 1.35fr 105px 1fr 82px 100px 100px 110px 90px;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.purchase-history-item.internal-farina-row {
  border-color: #c9d7e6;
  background: #f8fbff;
}

.purchase-history-item label {
  display: grid;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 800;
}

.purchase-history-quantity {
  display: grid;
  gap: 3px;
  color: var(--text);
  font-weight: 800;
  text-align: right;
}

.purchase-history-quantity small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.strong-stock {
  color: var(--blue);
  font-weight: 900;
}

.inventory-list {
  display: grid;
  gap: 3px;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.inventory-list span {
  display: block;
}

.admin-header-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-header-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.cart-header strong,
.cart-header span,
.quote-header strong,
.quote-header span,
.receipt-header strong,
.receipt-header span,
.admin-header strong,
.admin-header span {
  display: block;
}

.quote-header strong,
.receipt-header strong,
.admin-header strong {
  font-size: 1.05rem;
}

.cart-header span,
.quote-header span,
.receipt-header span,
.admin-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.88rem;
}

.cart-actions {
  display: flex;
  gap: 8px;
}

.cart-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.cart-items {
  max-height: 260px;
  overflow: auto;
}

.manual-product-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px 140px 100px 100px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.manual-product-form label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.manual-product-form input {
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.manual-product-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.quote-extra {
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.quote-extra summary {
  min-height: 44px;
  padding: 12px 14px;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
}

.quote-extra summary:hover {
  background: #eef6fc;
}

.quote-extra-body {
  border-top: 1px solid #edf1f5;
}

.quote-customer {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.quote-extra-body .quote-customer:first-child {
  border-top: 0;
}

.quote-customer-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.quote-customer-head strong {
  color: var(--ink);
}

.quote-customer-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.quote-customer-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 140px minmax(170px, 1fr) 140px minmax(190px, 1fr);
  gap: 10px;
}

.quote-customer-grid input,
.quote-customer-grid select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.customer-suggestions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.customer-suggestion {
  display: grid;
  gap: 2px;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dbe6ef;
  text-align: left;
}

.customer-suggestion:hover {
  color: var(--ink);
  background: #eef6fc;
}

.customer-suggestion span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.quote-note-label {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.quote-discount-label {
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.quote-note-label textarea,
.quote-discount-label input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.quote-note-label textarea {
  min-height: 74px;
  resize: vertical;
}

.quote-discount-label input {
  max-width: 180px;
  min-height: 38px;
}

.quote-note-label textarea:focus,
.quote-discount-label input:focus,
.quote-customer-grid input:focus,
.quote-customer-grid select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 76px 112px 122px 82px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f5;
}

.cart-row strong,
.cart-row span {
  display: block;
}

.cart-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.cart-total {
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}

.cart-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.cart-total span,
.cart-total strong {
  padding: 2px 0;
}

.admin-create {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.admin-create > label:first-child,
.admin-create > label:nth-child(2) {
  flex: 0 1 155px;
}

.admin-create .check-field {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e3ebf4;
  border-radius: 6px;
  background: #f8fbff;
  font-size: 0.82rem;
}

.admin-create button {
  flex: 0 0 auto;
  min-height: 38px;
}

.admin-create .ghost,
.admin-user-row .mini-button,
.admin-user-row .danger {
  min-width: 112px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 800;
}

.admin-create button[type="submit"],
.admin-user-row .save-user-button,
.admin-user-row .edit-user-button {
  color: #fff;
  background: var(--blue);
}

.admin-create button[type="submit"]:hover,
.admin-user-row .save-user-button:hover,
.admin-user-row .edit-user-button:hover {
  background: var(--blue-dark);
}

.admin-create .ghost,
.admin-user-row .mini-button:not(.save-user-button):not(.edit-user-button) {
  color: var(--blue);
  background: #f3f4f6;
}

.admin-create .ghost:hover,
.admin-user-row .mini-button:not(.save-user-button):not(.edit-user-button):hover {
  background: #e6edf5;
}

.admin-user-row .delete-user-button,
.admin-user-row .danger {
  color: #fff;
  background: var(--orange);
}

.admin-user-row .delete-user-button:hover,
.admin-user-row .danger:hover {
  background: var(--orange-dark);
}

.admin-create input,
.admin-create select,
.vendor-create input,
.vendor-create select,
.admin-user-row input {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.check-field,
.permission-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}

.admin-create .check-field,
.admin-user-row .permission-check {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.check-field input,
.permission-check input {
  width: 18px;
  min-height: auto;
  height: 18px;
  padding: 0;
  accent-color: var(--blue);
}

.admin-users {
  max-height: 380px;
  overflow: auto;
}

.admin-user-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
}

.admin-user-row:not(.is-editing) {
  min-height: 58px;
}

.admin-user-row > div:first-child {
  flex: 1 1 150px;
  min-width: 140px;
}

.admin-user-row:not(.is-editing) .permission-check,
.admin-user-row:not(.is-editing) input[data-password-user],
.admin-user-row:not(.is-editing) button:not(.edit-user-button):not(.delete-user-button) {
  display: none;
}

.admin-user-row.is-editing {
  align-items: flex-start;
  background: #fbfdff;
}

.admin-user-row.is-editing > div:first-child {
  flex-basis: 100%;
}

.admin-user-row .edit-user-button,
.admin-user-row .delete-user-button {
  flex: 0 0 112px;
}

.admin-user-row .permission-check {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.admin-user-row .access-check {
  background: #fff;
  border-color: var(--line);
}

.admin-user-row > button,
.admin-user-row > input {
  flex: 0 1 auto;
}

.admin-user-row > input {
  max-width: 170px;
  min-height: 32px;
}

.admin-user-row .save-user-button {
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.admin-user-row strong,
.admin-user-row span {
  display: block;
}

.admin-user-row strong {
  color: var(--blue);
}

.admin-user-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.vendor-admin-header {
  border-top: 1px solid var(--line);
}

.security-admin-header,
.access-audit-header {
  border-top: 1px solid var(--line);
}

.security-details {
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.security-details summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.security-details summary::-webkit-details-marker {
  display: none;
}

.security-details summary::after {
  content: "Abrir";
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #eaf2fb;
  color: var(--blue);
  text-align: center;
  font-size: 0.82rem;
}

.security-details[open] summary::after {
  content: "Cerrar";
}

.security-details summary small {
  color: var(--muted);
  font-weight: 700;
}

.security-schedule {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.security-schedule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  gap: 10px;
}

.security-schedule-row {
  display: grid;
  grid-template-columns: 92px 100px minmax(105px, 1fr) minmax(105px, 1fr);
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.security-schedule-row > strong {
  color: var(--blue);
  padding-bottom: 9px;
}

.security-schedule-row label,
.access-audit-search label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.security-schedule-row input,
.access-audit-search input,
.access-audit-search select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.security-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.security-actions button {
  min-width: 150px;
}

@media (max-width: 1100px) {
  .security-schedule-list {
    grid-template-columns: 1fr;
  }

  .inventory-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .replenishment-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .purchase-history-item,
  .purchase-order-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-filters .check-label {
    grid-column: span 1;
  }
}

.access-audit-search {
  display: grid;
  grid-template-columns: 160px 150px 150px minmax(190px, 1fr) 100px 100px;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.access-audit-list {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border-bottom: 1px solid var(--line);
}

.access-summary-note {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.access-audit-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.88rem;
}

.access-audit-table th,
.access-audit-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.access-audit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--blue);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.access-audit-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

.access-audit-table tbody tr:hover {
  background: #eef5ff;
}

.access-audit-table td strong {
  display: block;
  color: var(--blue);
}

.access-audit-table td span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.vendor-create {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) minmax(220px, 1fr) 90px 150px 96px;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.vendor-list {
  max-height: 540px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.vendor-row {
  display: grid;
  grid-template-columns: 130px minmax(230px, 1.2fr) 95px minmax(230px, 1fr) 95px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f5;
}

.vendor-row-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fbff;
  font-size: 0.86rem;
}

.vendor-row strong,
.vendor-row span {
  display: block;
}

.vendor-row strong {
  color: var(--blue);
}

.vendor-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.vendor-row input[type="text"],
.vendor-row input:not([type]) {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.compact-check {
  justify-content: flex-start;
  min-height: 34px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.admin-section {
  border-top: 1px solid var(--line);
}

.admin-subtabs {
  border-bottom: 0;
}

.vendor-detected-header {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.vendor-detected-list {
  max-height: 360px;
  overflow: auto;
}

.vendor-detected-row {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) minmax(180px, 1fr) 130px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f5;
}

.vendor-detected-row strong,
.vendor-detected-row span {
  display: block;
}

.vendor-detected-row strong {
  color: var(--blue);
}

.vendor-detected-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.quote-search {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 132px 92px 78px 148px;
  gap: 8px;
  align-items: center;
  width: min(700px, 100%);
}

.quote-search input,
.quote-search select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.quote-search button {
  min-height: 38px;
}

.quote-reminder {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border: 1px solid #c9ddf0;
  border-radius: 6px;
  color: var(--blue-dark);
  background: #f3f8fd;
  font-weight: 700;
}

.receipt-search {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 120px 135px 135px 92px 88px;
  gap: 8px;
  align-items: end;
  width: min(980px, 100%);
}

.receipt-search input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.receipt-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.14);
}

.receipt-search button {
  min-height: 38px;
}

.document-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.configuration-subtabs {
  display: flex;
}

.supply-subtabs {
  display: flex;
}

.sales-subtabs {
  display: flex;
}

.document-subtabs .mode-button,
.dashboard-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--blue);
  background: #eaf2f8;
  font-weight: 800;
}

.document-subtabs .mode-button.active,
.dashboard-tabs button.active {
  color: #fff;
  background: var(--blue);
}

.document-subtabs .mode-button:hover,
.dashboard-tabs button:hover {
  background: #dbeaf5;
}

.document-subtabs .mode-button.active:hover,
.dashboard-tabs button.active:hover {
  background: var(--blue-dark);
}

.configuration-admin-host .admin-section {
  padding: 0;
  border-top: 1px solid var(--line);
}

.admin-document-host .document-panel {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.admin-document-host .document-panel > .receipt-header,
.supply-child-view > .admin-header {
  display: none;
}

#sales-view > .receipt-header,
#documents-view > .receipt-header,
#inventory-view > .admin-header,
#supply-view > .admin-header,
#admin-view > .admin-header,
#maintenance-view > .receipt-header,
#configuration-view > .receipt-header {
  display: none;
}

#management-view > .receipt-header {
  justify-content: flex-end;
  min-height: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

#management-view > .receipt-header .panel-brand-lockup {
  display: none;
}

#sales-view > .document-subtabs,
#documents-view > .document-subtabs,
#inventory-view > .document-subtabs,
#supply-view > .document-subtabs,
#maintenance-view > .document-subtabs,
#configuration-view > .document-subtabs,
#management-view > .dashboard-tabs {
  border-top: 0;
}

.provider-dashboard-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.provider-dashboard-panel *,
.provider-dashboard-panel *::before,
.provider-dashboard-panel *::after {
  box-sizing: border-box;
}

.provider-dashboard-panel .dashboard-head,
.provider-dashboard-panel .dashboard-actions,
.provider-dashboard-panel .dashboard-card,
.provider-dashboard-panel .dashboard-card-head,
.provider-dashboard-panel .dashboard-card-head label,
.provider-dashboard-view,
.provider-dashboard-view > *,
.provider-analysis-selector,
.provider-dashboard-filters,
.provider-extra-filters,
.provider-kpi-grid,
.provider-dashboard-grid,
.provider-chart-placeholder,
.provider-required-state {
  max-width: 100%;
  min-width: 0;
}

.provider-dashboard-panel .dashboard-head,
.provider-dashboard-panel .dashboard-actions,
.provider-dashboard-panel .dashboard-card-head,
.provider-table-footer {
  flex-wrap: wrap;
}

.provider-analysis-selector {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.provider-analysis-selector label {
  display: grid;
  gap: 6px;
  width: min(360px, 100%);
  min-width: 0;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 900;
}

.dashboard-filters.provider-dashboard-filters {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
}

.dashboard-filters.provider-dashboard-filters .wide-filter {
  grid-column: span 2;
}

.dashboard-filters.provider-dashboard-filters label,
.dashboard-filters.provider-dashboard-filters input,
.dashboard-filters.provider-dashboard-filters select,
.dashboard-filters.provider-dashboard-filters button,
.provider-extra-filters label,
.provider-extra-filters input,
.provider-extra-filters select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.provider-extra-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.provider-extra-filters label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 900;
}

.provider-kpi-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.provider-kpi-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.provider-kpi-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.provider-kpi-grid.seven { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.provider-kpi-grid.provider-single-kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.provider-kpi-grid.provider-single-secondary-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.provider-kpi-grid > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  min-height: 78px;
  padding: 12px;
  border: 1px solid #d7e2ec;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.provider-kpi-grid span {
  color: #475569;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
  display: -webkit-box;
  min-height: 1.8em;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.provider-kpi-grid strong {
  color: var(--blue);
  font-size: 1.25rem;
  font-weight: 950;
  line-height: 1;
}

.provider-dashboard-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.provider-wide-card {
  grid-column: 1 / -1;
}

[data-provider-dashboard-view="comparison"] .provider-dashboard-grid > article:nth-child(5) {
  grid-column: 1 / -1;
}

.provider-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.provider-table-shell table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.76rem;
}

.provider-table-shell th,
.provider-table-shell td {
  min-width: 0;
  padding: 7px 6px;
  border-bottom: 1px solid #e5edf4;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.provider-table-shell th {
  color: #fff;
  background: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.16;
}

.provider-table-shell th[data-provider-single-sort] {
  cursor: pointer;
}

.provider-table-shell th[data-provider-single-sort]:hover {
  background: #003f8f;
}

.provider-table-shell td[colspan] {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.provider-table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  padding: 10px 0 0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 800;
}

.provider-table-footer > * {
  max-width: 100%;
  min-width: 0;
}

.provider-table-footer label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.provider-table-footer select {
  min-width: 64px;
}

.provider-chart-placeholder,
.provider-required-state {
  display: grid;
  place-items: center;
  min-height: 250px;
  border: 1px dashed #c9d7e5;
  border-radius: 8px;
  color: #64748b;
  background:
    linear-gradient(#eef4fa 1px, transparent 1px),
    linear-gradient(90deg, #eef4fa 1px, transparent 1px),
    #fbfdff;
  background-size: 42px 42px;
  font-weight: 900;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.provider-required-state {
  min-height: 54px;
  margin-bottom: 12px;
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.provider-mini-chart {
  display: flex;
  align-items: end;
  gap: 10px;
  width: 100%;
  min-height: 200px;
  padding: 18px 8px 8px;
}

.provider-mini-chart-col {
  flex: 1 1 0;
  min-width: 0;
  height: 180px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
}

.provider-mini-chart-col small {
  grid-column: 1 / -1;
  font-size: 10px;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}

.provider-mini-bar {
  display: block;
  min-height: 4px;
  border-radius: 5px 5px 0 0;
}

.provider-mini-bar.current {
  background: #2563eb;
}

.provider-mini-bar.compare {
  background: #93c5fd;
}

.provider-mini-bar.sales {
  background: #16a34a;
}

.provider-alert-toggle {
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.provider-detail-backdrop[hidden] {
  display: none;
}

.provider-detail-backdrop {
  z-index: 132;
}

.provider-detail-modal {
  width: min(95vw, 1480px);
  max-width: calc(100vw - 20px);
  max-height: min(840px, calc(100vh - 36px));
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.provider-detail-modal .provider-dashboard-grid,
.provider-detail-modal .provider-kpi-grid,
.provider-detail-modal .dashboard-card,
.provider-detail-modal .provider-table-shell,
.provider-detail-modal .provider-chart-placeholder {
  max-width: 100%;
  min-width: 0;
}

.provider-detail-modal *,
.provider-detail-modal *::before,
.provider-detail-modal *::after {
  box-sizing: border-box;
}

.provider-detail-summary {
  margin-top: 0;
}

.provider-detail-modal .modal-actions {
  width: 100%;
  justify-content: flex-end;
  padding-top: 6px;
}

@media (max-width: 1380px) {
  .dashboard-filters.provider-dashboard-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .provider-kpi-grid.seven,
  .provider-kpi-grid.six,
  .provider-kpi-grid.provider-single-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .provider-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-filters.provider-dashboard-filters,
  .provider-extra-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-filters.provider-dashboard-filters .wide-filter {
    grid-column: span 1;
  }

  .provider-kpi-grid.five,
  .provider-kpi-grid.six,
  .provider-kpi-grid.seven {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.configuration-section {
  padding: 18px 14px 24px;
  border-top: 1px solid var(--line);
}

.configuration-section-head {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.configuration-section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
  letter-spacing: 0;
}

.configuration-section-head > span,
.sync-block-head span,
.sync-placeholder span {
  color: var(--muted);
  font-size: 0.86rem;
}

.sync-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.sync-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.sync-block-head > div,
.sync-placeholder {
  display: grid;
  gap: 4px;
}

.sync-status {
  padding: 5px 8px;
  border: 1px solid #d7e2ec;
  border-radius: 5px;
  background: #f4f7fa;
  font-weight: 800;
  white-space: nowrap;
}

.sync-control-grid {
  display: grid;
  gap: 10px;
  align-items: end;
}

.sync-manual-controls {
  grid-template-columns: minmax(190px, 0.8fr) minmax(300px, 1.7fr) 170px;
}

.sync-control-grid input:disabled,
.sync-control-grid select:disabled {
  color: #718096;
  background: #f5f7fa;
  opacity: 1;
}

.sync-control-grid input,
.sync-control-grid select {
  width: 100%;
}

.sync-analysis {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.sync-analysis > div {
  display: grid;
  gap: 8px;
  min-height: 76px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.sync-analysis span,
.sync-helper,
.sync-validation-placeholder span,
.sync-future-note p {
  color: var(--muted);
  font-size: 0.82rem;
}

.sync-analysis strong {
  color: var(--blue);
  font-size: 1.05rem;
}

.sync-mapping,
.sync-preview,
.sync-history {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.sync-mapping-head,
.sync-mapping > div[role="row"],
.sync-preview-head {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.3fr) minmax(90px, auto) minmax(130px, auto);
  gap: 14px;
  align-items: center;
  padding: 9px 12px;
}

.sync-mapping-head,
.sync-preview-head {
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
  font-weight: 900;
}

.sync-mapping > div[role="row"] {
  border-top: 1px solid var(--line);
}

.sync-mapping select {
  width: 100%;
  color: #59697a;
  background: #f7f9fb;
  opacity: 1;
}

.sync-map-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: #42526b;
  font-weight: 800;
  white-space: nowrap;
}

.sync-map-check input {
  width: auto;
}

.sync-helper {
  margin: 10px 0 0;
}

.sync-preview-head {
  grid-template-columns: 1.3fr 0.7fr 1fr 1fr;
}

.sync-preview-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.sync-preview-row {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1fr 1fr;
  gap: 14px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
}

.sync-preview-row.invalid {
  background: #fff5f5;
}

.sync-preview-row.valid {
  background: #fbfefd;
}

.refax-pilot-block .sync-actions {
  margin: 12px 0;
}

.refax-pilot-summary {
  grid-template-columns: repeat(7, minmax(110px, 1fr));
}

.refax-pilot-table-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.refax-pilot-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.refax-pilot-table th,
.refax-pilot-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.refax-pilot-table th {
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.refax-pilot-table th:nth-child(1),
.refax-pilot-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.refax-pilot-table th:nth-child(2),
.refax-pilot-table td:nth-child(2),
.refax-pilot-table th:nth-child(3),
.refax-pilot-table td:nth-child(3) {
  width: 120px;
}

.refax-pilot-table th:nth-child(4),
.refax-pilot-table td:nth-child(4) {
  width: auto;
}

.refax-pilot-table th:nth-child(5),
.refax-pilot-table td:nth-child(5),
.refax-pilot-table th:nth-child(6),
.refax-pilot-table td:nth-child(6) {
  width: 90px;
  text-align: right;
}

.refax-pilot-table th:nth-child(7),
.refax-pilot-table td:nth-child(7) {
  width: 150px;
}

.refax-pilot-table th:nth-child(8),
.refax-pilot-table td:nth-child(8) {
  width: 145px;
}

.refax-pilot-table th:nth-child(9),
.refax-pilot-table td:nth-child(9) {
  width: 96px;
  text-align: center;
}

.refax-pilot-detail pre {
  max-height: 320px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sync-validation-placeholder {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border-left: 3px solid #c7d5e2;
  background: #f8fafc;
}

.sync-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.sync-history {
  overflow-x: auto;
}

.sync-history-head {
  display: grid;
  grid-template-columns: 1fr 1fr 0.75fr 1.2fr 0.7fr 0.7fr 0.7fr 0.75fr 98px;
  min-width: 1040px;
  padding: 10px 12px;
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
  font-weight: 900;
}

.sync-history-empty {
  min-width: 1040px;
  padding: 20px 12px;
  color: var(--muted);
  text-align: center;
}

.sync-history-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.75fr 1.2fr 0.7fr 0.7fr 0.7fr 0.75fr 98px;
  min-width: 1040px;
  align-items: center;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.sync-history-row strong {
  color: var(--blue);
}

.sync-history-delete {
  width: 98px;
  min-height: 34px;
}

.sync-future-note {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.sync-future-note summary {
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.sync-future-note p {
  margin: 10px 0 0;
}

.sync-future-flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(105px, 1fr));
  gap: 6px;
  align-items: center;
  margin-top: 12px;
}

.sync-future-flow span {
  min-height: 48px;
  padding: 8px;
  border: 1px solid #d7e2ec;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.sync-future-flow b {
  display: none;
  color: var(--blue);
  text-align: center;
}

.factor-card {
  display: grid;
  gap: 12px;
}

.factor-control-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(160px, 0.9fr) minmax(110px, auto) minmax(130px, auto) minmax(180px, auto);
  gap: 10px;
  align-items: end;
}

.factor-provider-controls {
  grid-template-columns: minmax(230px, 1.4fr) minmax(120px, 0.55fr) minmax(160px, 0.85fr) minmax(110px, auto) minmax(130px, auto) minmax(160px, auto);
}

.factor-control-grid input,
.factor-control-grid select {
  width: 100%;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-weight: 800;
}

.checkline input {
  width: auto;
}

.factor-table {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.factor-table-head,
.factor-table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 0.45fr 0.55fr 0.75fr 1fr minmax(160px, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.factor-table-head {
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
  font-weight: 900;
}

.factor-table-row {
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
}

.factor-table-row strong {
  color: var(--ink);
}

.factor-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.factor-table-empty {
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
}

.mail-settings-form,
.mail-test-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.mail-settings-form label,
.mail-test-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mail-settings-form input,
.mail-test-form input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.mail-settings-form .wide {
  grid-column: 1 / -1;
}

.mail-settings-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#mail-save-message,
#mail-test-message {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .sync-manual-controls {
    grid-template-columns: 0.8fr 1.5fr 170px;
  }

  .sync-manual-controls button {
    grid-column: 3;
  }

  .sync-analysis {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .factor-control-grid,
  .factor-provider-controls {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .factor-table-head,
  .factor-table-row {
    grid-template-columns: minmax(200px, 1.3fr) 0.5fr 0.6fr 0.8fr 1fr;
  }

  .factor-table-head span:last-child,
  .factor-table-row .factor-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sync-block-head {
    flex-direction: column;
  }

  .sync-manual-controls,
  .sync-analysis {
    grid-template-columns: 1fr;
  }

  .sync-manual-controls button {
    grid-column: auto;
  }

  .sync-mapping-head,
  .sync-mapping > div[role="row"],
  .sync-preview-head {
    grid-template-columns: 1fr;
  }

  .sync-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .configuration-subtabs,
  .factor-control-grid,
  .factor-provider-controls,
  .factor-table-head,
  .factor-table-row,
  .mail-settings-form,
  .mail-test-form {
    grid-template-columns: 1fr;
  }

  .mail-settings-actions {
    justify-content: flex-start;
  }

  .factor-row-actions {
    justify-content: flex-start;
  }

  .sync-future-flow {
    grid-template-columns: 1fr;
  }

  .sync-future-flow b {
    display: block;
  }

  .receipt-email-group,
  .receipt-email-result-head,
  .receipt-email-result-row {
    grid-template-columns: 1fr;
  }

  .receipt-email-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

.document-section {
  display: none;
}

.document-section.active {
  display: block;
}

.document-inner-header {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  align-items: stretch;
  flex-direction: column;
}

.sales-document-search {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
  width: 100%;
}

.sales-document-search button {
  min-height: 38px;
  padding: 0 14px;
}

.sales-document-search input,
.sales-document-search select,
.receipt-search select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: #fff;
}

.document-results {
  border-top: 1px solid var(--line);
}

.sales-document-grid-head,
.sales-document-card {
  display: grid;
  grid-template-columns:
    minmax(165px, 210px)
    minmax(260px, 1.6fr)
    minmax(135px, 175px)
    minmax(100px, 120px)
    minmax(155px, 190px)
    minmax(150px, auto);
  gap: 12px;
  align-items: center;
}

.sales-document-grid-head {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sales-document-card {
  padding: 11px 14px;
  border-bottom: 1px solid #edf1f5;
  background: #fff;
}

.sales-document-card strong,
.sales-document-card span {
  display: block;
}

.sales-document-card strong {
  color: var(--ink);
}

.sales-document-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.sales-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}


.sales-document-amount {
  text-align: right;
}

.sales-document-amount strong {
  font-size: 1rem;
}

.sales-document-payment strong {
  font-size: 0.88rem;
}

.sales-document-summary {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.sales-document-summary-total {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.sales-document-summary-total > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sales-document-summary-total > div:last-child {
  text-align: right;
}

.sales-document-summary-total span {
  color: var(--muted);
  font-size: 0.8rem;
}

.sales-document-summary-total strong {
  font-size: 1.12rem;
}

.sales-document-payment-summary {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.sales-document-payment-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.sales-document-payment-total span {
  color: var(--muted);
  font-size: 0.82rem;
}

.sales-document-payment-total strong {
  white-space: nowrap;
}

.sales-document-payment-total.is-adjustment {
  border-style: dashed;
}

.sales-document-operational-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sales-document-operational {
  background: #fbfcfe;
}

@media (max-width: 1100px) {
  .sales-document-grid-head {
    display: none;
  }
}

.sales-document-file-status {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sales-document-file-status strong {
  display: inline;
  color: var(--blue);
}

.sales-document-detail {
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
}

.sales-document-detail-head,
.sales-document-meta,
.sales-document-line {
  display: grid;
  gap: 10px;
  align-items: center;
}

.sales-document-detail-head {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.sales-document-detail-head span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.sales-document-meta {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.sales-document-lines {
  border: 1px solid #dde6f0;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.sales-document-line {
  grid-template-columns: 90px minmax(220px, 1fr) 70px 95px 95px;
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f5;
  font-size: 0.86rem;
}

.sales-document-line:last-child {
  border-bottom: 0;
}

.sales-document-line-head {
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}

.catalog-corrections-header {
  border-top: 1px solid var(--line);
}

.correction-search {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 92px 88px;
  gap: 8px;
  align-items: end;
  width: min(720px, 100%);
}

.correction-search input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.catalog-corrections {
  max-height: 320px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.correction-row {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(130px, 180px) minmax(0, 1fr) minmax(0, 1fr) minmax(140px, 180px) 92px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f5;
}

.correction-row strong,
.correction-row span {
  display: block;
}

.correction-row strong {
  color: var(--blue);
}

.correction-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 31, 48, 0.42);
}

.catalog-edit-dialog {
  width: min(900px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(13, 31, 48, 0.28);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head strong,
.modal-head span {
  display: block;
}

.modal-head strong {
  font-size: 1.2rem;
}

.modal-head span {
  color: var(--muted);
  margin-top: 3px;
}

.catalog-edit-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.catalog-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.catalog-edit-form input,
.catalog-edit-form textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  font: inherit;
}

.catalog-edit-form textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.quote-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 220px;
}

.receipt-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 260px;
}

.quote-layout.has-detail {
  grid-template-columns: 340px minmax(0, 1fr);
}

.receipt-layout.has-detail {
  grid-template-columns: 360px minmax(0, 1fr);
}

.quote-list {
  background: #fbfdff;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.receipt-list {
  background: #fbfdff;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.receipt-select-all-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 10px 14px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.receipt-select-all-bar input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.quote-layout.has-detail .quote-list {
  border-right: 1px solid var(--line);
}

.receipt-layout.has-detail .receipt-list {
  border-right: 1px solid var(--line);
}

.quote-card {
  display: block;
  width: 100%;
  min-height: auto;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.quote-card:hover {
  background: #eef6fc;
}

.quote-card.active {
  background: #e8f3fb;
}

.receipt-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 8px;
  width: 100%;
  min-height: auto;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.receipt-card:hover {
  background: #eef6fc;
}

.receipt-card.active {
  background: #e8f3fb;
}

.quote-card strong,
.quote-card span {
  display: block;
}

.receipt-card strong,
.receipt-card span,
.receipt-card em {
  display: block;
  grid-column: 2;
}

.receipt-select {
  grid-column: 1;
  grid-row: 1 / span 4;
  display: flex;
  align-items: flex-start;
  padding-top: 1px;
}

.receipt-select input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.quote-card strong {
  color: var(--blue);
}

.receipt-card strong {
  color: var(--blue);
}

.quote-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.receipt-card span,
.receipt-card em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.quote-detail {
  padding: 14px;
  color: var(--muted);
}

.receipt-detail {
  padding: 14px;
  color: var(--muted);
}

.quote-detail-head,
.receipt-detail-head,
.quote-detail-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quote-detail-head {
  margin-bottom: 12px;
}

.receipt-detail-head {
  margin-bottom: 12px;
}

.quote-detail-head strong,
.quote-detail-head span {
  display: block;
}

.receipt-detail-head strong,
.receipt-detail-head span {
  display: block;
}

.quote-detail-head strong {
  color: var(--ink);
}

.quote-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.receipt-detail-head strong {
  color: var(--ink);
}

.receipt-email-groups,
.receipt-email-results {
  display: grid;
  gap: 8px;
}

.receipt-email-group {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(105px, 0.55fr) minmax(150px, 0.9fr) minmax(220px, 1.25fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.receipt-email-group strong {
  color: var(--blue);
}

.receipt-email-group label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.receipt-email-group input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
}

.receipt-email-group.invalid-email {
  border-color: #f59e0b;
  background: #fff7ed;
}

.receipt-email-group.invalid-email input {
  border-color: #f59e0b;
}

.receipt-email-group [data-receipt-email-status] {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.receipt-email-group.invalid-email [data-receipt-email-status] {
  color: #b45309;
}

.receipt-email-message {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.receipt-email-message textarea {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  resize: vertical;
}

.receipt-email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.receipt-email-result-head,
.receipt-email-result-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(100px, 0.7fr) minmax(180px, 1.2fr) 70px minmax(180px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
}

.receipt-email-final-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.receipt-email-final-summary span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.receipt-email-final-summary strong {
  color: var(--blue);
}

.receipt-email-result-head {
  margin-top: 12px;
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
  font-weight: 900;
}

.receipt-email-result-row {
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
}

.receipt-email-result-row.sent {
  background: #eefbf2;
}

.receipt-email-result-row.error {
  background: #fff7ed;
}

.receipt-provider {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.receipt-provider strong {
  color: var(--ink);
}

.receipt-match {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--blue);
  background: #eef6fc;
  font-weight: 700;
}

.receipt-section {
  margin-top: 14px;
}

.receipt-section > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.receipt-table {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
}

.receipt-row {
  display: grid;
  grid-template-columns: 1.1fr 0.75fr 0.8fr 0.9fr 0.9fr;
  min-width: 560px;
  border-bottom: 1px solid #edf1f5;
}

.receipt-row:last-child {
  border-bottom: 0;
}

.receipt-row span {
  padding: 8px;
  color: var(--ink);
  font-size: 0.86rem;
}

.receipt-row span:nth-child(4),
.receipt-row span:nth-child(5) {
  text-align: right;
}

.receipt-row-head {
  background: var(--blue);
}

.receipt-row-head span {
  color: #fff;
  font-weight: 700;
}

.quote-detail-total {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.quote-note-view {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.quote-note-view strong,
.quote-note-view span {
  display: block;
}

.quote-note-view strong {
  color: var(--ink);
}

.quote-note-view span {
  margin-top: 3px;
  color: var(--muted);
}

.pdf-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.pdf-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
}

.pdf-choice {
  display: grid;
  gap: 10px;
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pdf-choice strong {
  font-size: 1.08rem;
}

.pdf-choice span {
  color: var(--muted);
}

.pdf-branch {
  margin-top: 4px;
}

.pdf-branch select {
  min-height: 40px;
}

.pdf-choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.pdf-choice-actions .ghost {
  grid-column: span 2;
}

.ticket-preview-list {
  display: grid;
  gap: 7px;
  max-height: 420px;
  overflow: auto;
}

.ticket-preview-row {
  display: grid;
  grid-template-columns: 110px minmax(180px, 1fr) 140px 92px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #dbe6ef;
  border-left-width: 5px;
  border-radius: 6px;
  background: #fff;
}

.ticket-preview-row strong {
  color: var(--blue);
  font-size: 0.86rem;
}

.ticket-preview-row span {
  color: var(--ink);
  font-size: 0.84rem;
}

.ticket-preview-row em {
  font-style: normal;
  font-weight: 700;
  text-align: right;
}

.ticket-preview-row.ok {
  border-left-color: var(--green);
}

.ticket-preview-row.low-stock {
  border-left-color: #d97706;
}

.ticket-preview-row.empty-stock {
  border-left-color: var(--danger);
}

.quote-items {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
}

.quote-item {
  padding: 9px 0;
  border-bottom: 1px solid #edf1f5;
}

.quote-item strong,
.quote-item span {
  display: block;
}

.quote-item strong {
  color: var(--blue);
}

.quote-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.result-toolbar strong {
  display: block;
  margin-bottom: 2px;
}

.result-toolbar span {
  color: var(--muted);
  font-size: 0.88rem;
}

.result-toolbar select {
  width: 92px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#catalog-view .result-panel {
  margin-left: -2px;
  margin-right: -2px;
}

#catalog-view .table-wrap {
  max-height: calc(100vh - 238px);
}

#results-table {
  min-width: 1580px;
  table-layout: fixed;
}

#results-table.catalog-current th:nth-child(1),
#results-table.catalog-current td:nth-child(1) {
  width: 118px;
}

#results-table.catalog-current th:nth-child(2),
#results-table.catalog-current td:nth-child(2) {
  width: auto;
}

#results-table.catalog-current th:nth-child(3),
#results-table.catalog-current td:nth-child(3) {
  width: 126px;
}

#results-table.catalog-current th:nth-child(4),
#results-table.catalog-current td:nth-child(4) {
  width: 190px;
}

#results-table.catalog-current th:nth-child(5),
#results-table.catalog-current td:nth-child(5),
#results-table.catalog-current th:nth-child(6),
#results-table.catalog-current td:nth-child(6) {
  width: 68px;
  text-align: center;
}

#results-table.catalog-current th:nth-child(7),
#results-table.catalog-current td:nth-child(7) {
  width: 96px;
}

#results-table.catalog-current th:nth-child(8),
#results-table.catalog-current td:nth-child(8) {
  width: 64px;
  text-align: center;
}

#results-table.catalog-current th:nth-child(9),
#results-table.catalog-current td:nth-child(9) {
  width: 98px;
}

#results-table.catalog-current th:nth-child(10),
#results-table.catalog-current td:nth-child(10) {
  width: 64px;
  text-align: center;
}

#results-table.catalog-current th:nth-child(11),
#results-table.catalog-current td:nth-child(11) {
  width: 92px;
}

#results-table.catalog-current td:nth-child(3),
#results-table.catalog-current td:nth-child(4),
#results-table.catalog-current td:nth-child(9) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#results-table.catalog-grouped {
  min-width: 1320px;
}

#results-table.catalog-grouped th:nth-child(1),
#results-table.catalog-grouped td:nth-child(1) {
  width: 118px;
}

#results-table.catalog-grouped th:nth-child(2),
#results-table.catalog-grouped td:nth-child(2) {
  width: auto;
}

#results-table.catalog-grouped th:nth-child(3),
#results-table.catalog-grouped td:nth-child(3) {
  width: 96px;
}

#results-table.catalog-grouped th:nth-child(4),
#results-table.catalog-grouped td:nth-child(4) {
  width: 64px;
  text-align: center;
}

#results-table.catalog-grouped th:nth-child(5),
#results-table.catalog-grouped td:nth-child(5) {
  width: 300px;
}

#results-table.catalog-grouped th:nth-child(6),
#results-table.catalog-grouped td:nth-child(6) {
  width: 64px;
  text-align: center;
}

#results-table.catalog-grouped th:nth-child(7),
#results-table.catalog-grouped td:nth-child(7) {
  width: 92px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 9px;
  color: #fff;
  background: var(--blue);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 8px 9px;
  border-bottom: 1px solid #edf1f5;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: #fbfdff;
}

tbody tr:hover {
  background: #fff6e8;
}

.code {
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}

.code[data-edit-index] {
  cursor: pointer;
}

.code-cell {
  display: inline-grid;
  gap: 5px;
  max-width: 100%;
}

.code-cell > span {
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.code-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stock-detail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid #cbdaf0;
  border-radius: 6px;
  color: var(--blue);
  background: #eef5ff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

.stock-detail-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-detail-button:hover {
  border-color: var(--blue);
  background: #e1edff;
}

.provider-detail-button {
  color: #8a4b08;
  background: #fff7ed;
  border-color: #fed7aa;
}

.provider-detail-button:hover {
  color: #7c2d12;
  background: #ffedd5;
  border-color: var(--orange);
}

.provider-reference-note {
  display: none;
}

.provider-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.provider-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.provider-table th,
.provider-table td {
  padding: 10px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}

.provider-table th {
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
  font-weight: 900;
}

.provider-table .numeric {
  text-align: right;
}

.provider-table th:nth-child(1),
.provider-table td:nth-child(1) {
  width: 24%;
}

.provider-table th:nth-child(2),
.provider-table td:nth-child(2) {
  width: 18%;
}

.provider-table th:nth-child(3),
.provider-table td:nth-child(3) {
  width: 17%;
}

.provider-table th:nth-child(4),
.provider-table td:nth-child(4) {
  width: 19%;
}

.provider-table th:nth-child(5),
.provider-table td:nth-child(5) {
  width: 22%;
}

.provider-table[data-provider-ui-version="20260628-provider-dynamic-cols"] th,
.provider-table[data-provider-ui-version="20260628-provider-dynamic-cols"] td {
  width: auto;
}

.provider-table td {
  color: var(--ink);
  font-weight: 800;
}

.provider-row-available {
  background: #f0fdf4;
}

.provider-row-quantity {
  background: #fffbeb;
}

.provider-row-empty {
  background: #fef2f2;
}

.provider-row-unknown {
  background: #f8fafc;
}

.product-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-description {
  color: var(--ink);
  display: -webkit-box;
  min-height: 2.35em;
  max-height: 2.35em;
  overflow: hidden;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-meta {
  --catalog-brand-chip-width: 112px;
  --catalog-origin-chip-width: 84px;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  max-width: 150px;
  padding: 2px 7px;
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.69rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-chip.brand {
  flex: 0 0 var(--catalog-brand-chip-width);
  width: var(--catalog-brand-chip-width);
  max-width: var(--catalog-brand-chip-width);
  justify-content: flex-start;
  color: #2357d8;
  background: #e9f2ff;
}

.product-chip.origin {
  flex: 0 0 var(--catalog-origin-chip-width);
  width: var(--catalog-origin-chip-width);
  max-width: var(--catalog-origin-chip-width);
  justify-content: flex-start;
  color: #087443;
  background: #eef7f1;
}

.product-chip.missing {
  color: #667085;
  background: #eef2f6;
}

.price {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.stock {
  color: var(--green);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.qty-input {
  width: 54px;
  min-height: 34px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: right;
}

.mini-button,
.icon-button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.link-button {
  min-height: 30px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.link-button:hover {
  color: var(--blue-dark);
  background: transparent;
  text-decoration: underline;
}

.match-source {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 2px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef5ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.applications-row,
.applications-row:hover {
  background: #f8fbff;
}

.applications-row td {
  padding: 0;
}

.applications-panel {
  padding: 14px;
  border-top: 1px solid #dbe6ef;
}

.stock-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.32);
}

.stock-modal {
  width: min(920px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stock-modal.provider-modal {
  width: min(860px, calc(100vw - 36px));
  overflow: hidden;
}

.stock-modal.receipt-email-modal {
  width: min(980px, 90vw);
  overflow-x: hidden;
}

.stock-modal.sales-email-modal {
  width: min(820px, 92vw);
  overflow-x: hidden;
}

.stock-modal.purchase-order-communication-modal {
  width: min(760px, 92vw);
  overflow-x: hidden;
}

.purchase-order-communication-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.stock-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.stock-modal-head strong,
.stock-modal-head span {
  display: block;
}

.stock-modal-head strong {
  color: var(--blue);
  font-size: 1rem;
}

.stock-modal-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stock-modal-close {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: #eaf1f8;
  color: var(--blue-ink);
  font-size: 0.82rem;
}

.stock-modal-body {
  padding: 12px 14px 14px;
}

.provider-modal .stock-modal-body {
  max-height: min(68vh, 620px);
  overflow-x: hidden;
  overflow-y: auto;
}

.provider-modal .stock-modal-head {
  align-items: center;
}

.provider-modal .stock-modal-head strong,
.provider-modal .stock-modal-head span {
  display: inline;
}

.provider-modal .stock-modal-head span {
  margin-top: 0;
}

.provider-modal .stock-modal-head span::before {
  content: " - ";
}

.stock-branch-list {
  display: grid;
  gap: 7px;
}

.stock-branch-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 150px;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #e3ebf2;
  border-radius: 6px;
  background: #fff;
}

.stock-branch-row span {
  color: var(--ink);
  font-weight: 700;
}

.stock-branch-row strong {
  color: var(--green);
  font-size: 0.96rem;
  text-align: right;
}

.stock-branch-row.total {
  border-color: #cbdaf0;
  background: #eef5ff;
}

.stock-branch-head {
  background: #f6f9fc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stock-transit-link {
  justify-self: end;
  min-width: 88px;
  padding: 5px 10px;
  border: 1px solid #d6e3f2;
  border-radius: 6px;
  color: var(--blue);
  background: #f8fbff;
  font-weight: 800;
  cursor: pointer;
}

.stock-transit-link:hover {
  border-color: var(--blue);
  background: #eef5ff;
}

.stock-transit-detail {
  margin-top: 14px;
}

.stock-transit-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.stock-transit-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stock-transit-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.stock-transit-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.stock-transit-table th,
.stock-transit-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e8eef5;
  text-align: left;
  white-space: nowrap;
}

.stock-transit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f9fc;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.stock-transit-table .numeric {
  text-align: right;
}

.inline-field-action {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-field-action input {
  min-width: 0;
  flex: 1;
}

.saved-po-line.selected {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  background: #eef5ff;
}

.applications-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.applications-list {
  display: grid;
  gap: 8px;
}

.application-card {
  display: grid;
  grid-template-columns: 160px 1fr 88px 88px minmax(220px, 1.4fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid #e3ebf2;
  border-radius: 6px;
  background: #fff;
}

.application-card span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.application-card strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.application-detail {
  min-width: 0;
}

.icon-button {
  color: var(--blue);
  background: #eaf2f8;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.dashboard-panel {
  padding: 14px;
}

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

.dashboard-head strong,
.dashboard-card-head strong {
  display: block;
  color: var(--ink);
}

.dashboard-head span,
.dashboard-card-head span,
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  margin: 10px 12px 0;
  border-radius: 8px;
  background: #eef6fd;
}

.view-toggle button {
  min-height: 32px;
  padding: 0 12px;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 220px)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-filters input,
.dashboard-filters select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--blue);
  font-size: 1.45rem;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.3fr);
  gap: 12px;
}

.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.dashboard-card:last-child {
  grid-column: 1 / -1;
}

.dashboard-card-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.commercial-brand-filters {
  grid-template-columns: minmax(320px, 1.6fr) repeat(2, minmax(132px, 0.65fr)) minmax(145px, 0.75fr) minmax(155px, 0.85fr) repeat(2, minmax(155px, 0.9fr)) minmax(240px, 1.35fr);
  align-items: end;
}

.commercial-brand-filters .wide-filter {
  min-width: 0;
}

.commercial-brand-filters button {
  min-height: 38px;
  white-space: nowrap;
}

.commercial-brand-filters button,
.commercial-brand-filters .commercial-export-excel,
.commercial-brand-filters .commercial-export-pdf {
  align-self: end;
}

.commercial-brand-analysis {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.commercial-brand-analysis[hidden] {
  display: none !important;
}

.commercial-brand-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.commercial-brand-kpi {
  position: relative;
  min-height: 88px;
  height: 88px;
  padding: 12px 10px 10px 54px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.commercial-brand-kpi::before {
  content: "";
  position: absolute;
  top: 27px;
  left: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--kpi-color, var(--blue));
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.08);
}

.commercial-brand-kpi span {
  display: block;
  min-height: 28px;
  color: #1e3a5f;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.commercial-brand-kpi strong {
  display: block;
  margin: 5px 0 4px;
  color: #020617;
  font-size: 1.24rem;
  line-height: 1;
  white-space: nowrap;
}

.commercial-brand-kpi small {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.commercial-brand-kpi.blue { --kpi-color: #2563eb; }
.commercial-brand-kpi.green { --kpi-color: #16a34a; }
.commercial-brand-kpi.violet { --kpi-color: #7c3aed; }
.commercial-brand-kpi.orange { --kpi-color: #f59e0b; }
.commercial-brand-kpi.cyan { --kpi-color: #06b6d4; }
.commercial-brand-kpi.teal { --kpi-color: #0ea5a8; }
.commercial-brand-kpi.gold { --kpi-color: #eab308; }

.commercial-brand-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.commercial-brand-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.commercial-brand-main-grid .dashboard-card,
.commercial-brand-bottom-grid .dashboard-card,
.commercial-brand-analysis > .dashboard-card {
  grid-column: auto;
  min-width: 0;
}

.commercial-ranking-card {
  order: 1;
}

.commercial-chart-card {
  order: 2;
}

.commercial-chart-card .dashboard-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.commercial-chart-card select {
  min-height: 32px;
  padding: 4px 24px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.commercial-chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.commercial-chart-legend span {
  width: 22px;
  height: 8px;
  border-radius: 999px;
}

.commercial-chart-legend .buy {
  background: #2563eb;
}

.commercial-chart-legend .sale {
  background: #16a34a;
}

.commercial-empty-chart {
  display: grid;
  min-height: 340px;
  margin: 12px;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(#eef2f7 1px, transparent 1px),
    linear-gradient(90deg, #eef2f7 1px, transparent 1px);
  background-size: 42px 42px;
  font-weight: 900;
}

.commercial-empty-chart.compact {
  min-height: 180px;
}

.commercial-brand-table-shell {
  max-width: 100%;
  overflow-x: auto;
}

.commercial-brand-bars {
  display: grid;
  gap: 8px;
  min-height: 260px;
  align-content: start;
}

.commercial-brand-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  grid-template-rows: repeat(2, 10px);
  gap: 3px 10px;
  align-items: center;
  font-size: 11px;
}

.commercial-brand-bar-row strong {
  grid-row: 1 / span 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commercial-brand-bar-row span {
  display: block;
  height: 10px;
  border-radius: 999px;
}

.commercial-brand-bar-row span.buy {
  background: #2563eb;
}

.commercial-brand-bar-row span.sale {
  background: #16a34a;
}

.commercial-brand-bar-row.single {
  grid-template-rows: 14px;
}

.commercial-brand-bar-row.single strong {
  grid-row: auto;
}

.commercial-brand-bar-row.single span {
  height: 14px;
}

.commercial-brand-table-shell table {
  min-width: 1180px;
  table-layout: fixed;
}

.commercial-brand-table-shell th,
.commercial-brand-table-shell td {
  white-space: normal;
  word-break: normal;
}

.commercial-ranking-card .commercial-brand-table-shell {
  overflow-x: hidden;
}

.commercial-ranking-card .commercial-brand-table-shell table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.commercial-ranking-card .commercial-brand-table-shell th,
.commercial-ranking-card .commercial-brand-table-shell td {
  padding: 8px 7px;
  font-size: 0.72rem;
  line-height: 1.18;
  vertical-align: middle;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(1),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(1) {
  width: 5%;
  text-align: center;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(2),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(2) {
  width: 12%;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(3),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(3),
.commercial-ranking-card .commercial-brand-table-shell th:nth-child(4),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(4) {
  width: 9%;
  text-align: right;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(5),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(5),
.commercial-ranking-card .commercial-brand-table-shell th:nth-child(6),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(6) {
  width: 11%;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(7),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(7) {
  width: 10%;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(8),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(8),
.commercial-ranking-card .commercial-brand-table-shell th:nth-child(9),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(9),
.commercial-ranking-card .commercial-brand-table-shell th:nth-child(10),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(10),
.commercial-ranking-card .commercial-brand-table-shell th:nth-child(11),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(11) {
  width: 7%;
  text-align: right;
}

.commercial-ranking-card .commercial-brand-table-shell th:nth-child(12),
.commercial-ranking-card .commercial-brand-table-shell td:nth-child(12) {
  width: 5%;
  text-align: center;
}

.commercial-ranking-card .provider-table-footer {
  flex-wrap: wrap;
  gap: 8px;
}

.commercial-brand-bottom-grid .dashboard-card:nth-child(3) {
  grid-column: 1 / -1;
}

.commercial-monthly-filters {
  grid-template-columns: repeat(3, minmax(180px, 260px));
  margin-bottom: 0;
}

.commercial-brand-detail-modal[hidden] {
  display: none !important;
}

.commercial-brand-detail {
  width: min(95vw, 1480px);
  max-height: 90vh;
  overflow: auto;
}

.commercial-brand-detail,
.commercial-brand-detail * {
  box-sizing: border-box;
  max-width: 100%;
}

.commercial-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.commercial-detail-grid .dashboard-card {
  grid-column: auto;
  min-width: 0;
}

.commercial-detail-grid .dashboard-card:nth-child(n + 3) {
  grid-column: 1 / -1;
}

.commercial-detail-summary {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(120px, 1fr);
  gap: 8px 12px;
  padding: 12px;
  font-size: 0.84rem;
}

.commercial-detail-summary span {
  color: var(--muted);
  font-weight: 800;
}

.commercial-detail-summary strong {
  color: var(--ink);
}

@media (max-width: 1280px) {
  .commercial-brand-kpis {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }
}

@media (max-width: 1180px) {
  .commercial-brand-filters {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .commercial-brand-main-grid,
  .commercial-brand-bottom-grid,
  .commercial-detail-grid {
    grid-template-columns: 1fr;
  }

  .commercial-detail-grid .dashboard-card:nth-child(n) {
    grid-column: auto;
  }
}

.maintenance-party-panel {
  display: grid;
  gap: 12px;
}

[data-maintenance-section][hidden] {
  display: none !important;
}

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

.party-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.party-list-card,
.party-form-card {
  min-width: 0;
}

.party-layout .dashboard-card:last-child {
  grid-column: auto;
}

.party-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.party-table th,
.party-table td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.party-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.party-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-file-card .party-form-grid {
  grid-template-columns: minmax(190px, 0.85fr) minmax(240px, 1.2fr) minmax(180px, 0.95fr);
  gap: 10px;
  margin: 12px;
}

.party-form-grid .wide {
  grid-column: span 2;
}

.master-file-card .party-form-grid .wide {
  grid-column: 1 / -1;
}

.party-form-card {
  display: grid;
  gap: 12px;
}

.master-file-card {
  gap: 0;
  overflow: hidden;
  border-color: #b8c7dc;
  background: #f6f8fb;
}

.master-file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, #002b57, #003f8f);
  color: #fff;
}

.master-file-title-block {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.master-file-eyebrow {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-transform: uppercase;
}

.master-file-title-block > strong {
  overflow: hidden;
  font-size: 1.12rem;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.master-file-summary,
.master-file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 10px;
  min-width: 0;
}

.master-file-summary {
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 800;
}

.master-file-summary span {
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
}

.master-file-summary span:last-child {
  border-right: 0;
}

.master-file-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(21, 128, 61, 0.28);
  border-radius: 6px;
  background: #e8f7ee;
  color: #0f7a35;
  font-size: 0.75rem;
  font-weight: 900;
}

.master-file-badge.muted {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #dbeafe;
}

.master-file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 360px;
}

.master-file-actions button,
.master-add-button {
  min-height: 34px;
  border-radius: 6px;
  font-weight: 900;
}

.master-file-actions button {
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: #1d5bd7;
  color: #fff;
}

.master-file-actions .success {
  border-color: #12843e;
  background: #159947;
  color: #fff;
}

.master-file-actions .ghost {
  border-color: #c8d4e5;
  background: #fff;
  color: #0b2f66;
}

.master-file-card .party-form-actions {
  display: none;
}

.party-section {
  margin: 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.master-file-card .party-section {
  margin: 12px;
  padding: 0;
  overflow: hidden;
  border-color: #b8c7dc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.party-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e8eef6;
}

.party-section-head strong {
  color: var(--blue);
  font-size: 0.95rem;
}

.master-file-card .party-section-head {
  min-height: 34px;
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid #001d3d;
  background: linear-gradient(90deg, #002b57, #003f8f);
  color: #fff;
}

.master-file-card .party-section-head strong {
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.party-read-row {
  display: grid;
  grid-template-columns: minmax(170px, 240px) 90px 90px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  padding: 0 0 12px;
}

.master-file-card .party-read-row {
  grid-template-columns: minmax(190px, 260px) 78px 78px minmax(0, 1fr);
  margin: 12px 12px 0;
  padding: 0 0 10px;
  border-bottom: 1px solid #e3ebf5;
}

.party-read-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.party-read-row input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

#party-message {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding-bottom: 9px;
}

.party-name-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 6px;
}

.party-role-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.master-file-card .party-role-box {
  margin: 0 12px 12px;
}

.party-role-box label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 700;
}

.party-contact-list,
.party-address-list {
  display: grid;
  gap: 8px;
  padding: 0;
}

.master-file-card .party-contact-list,
.master-file-card .party-address-list {
  margin: 0 12px 12px;
}

.product-sheet-panel {
  gap: 8px;
}

.product-sheet-panel > .dashboard-card-head {
  display: none;
}

.product-sheet-readonly {
  justify-self: end;
  padding: 6px 10px;
  border: 1px solid #b7d7ff;
  border-radius: 6px;
  color: var(--blue);
  background: #eef6ff;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-sheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 36fr) minmax(0, 30fr) minmax(310px, 34fr);
  grid-template-rows: auto auto auto auto auto auto;
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.product-search-card,
.product-sheet-main,
.product-sheet-title-card,
.product-sheet-section,
.product-sheet-table-card,
.product-sheet-side {
  min-width: 0;
}

.product-search-card {
  display: grid;
  grid-column: 1;
  grid-row: 3 / 5;
  gap: 7px;
  align-content: start;
  position: sticky;
  top: 8px;
}

.product-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 7px 7px 0 0;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-sheet-panel .product-card-head {
  background: linear-gradient(90deg, #002b57, #003f8f);
}

.product-card-head-blue { background: #0d5bd7; }
.product-card-head-green { background: #16a34a; }
.product-card-head-orange { background: #f97316; }
.product-card-head-purple { background: #7c3aed; }
.product-card-head-cyan { background: #0891b2; }
.product-card-head-pink { background: #db2777; }
.product-card-head-gold { background: #b77900; }
.product-card-head-slate { background: #475569; }

.product-sheet-search {
  display: grid;
  gap: 5px;
  padding: 0 9px 1px;
}

.product-sheet-search label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-sheet-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 5px;
}

.product-sheet-search-row input {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.product-sheet-search-row button {
  width: 30px;
  min-width: 30px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  position: relative;
}

.product-sheet-search-row button::before {
  content: "⌕";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 1rem;
  font-weight: 900;
}

.product-search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 9px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-search-meta span {
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
}

.product-sheet-results {
  display: grid;
  max-height: 420px;
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.product-sheet-result {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 56px;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.product-sheet-result:hover,
.product-sheet-result.active {
  background: #0d5bd7;
  color: #fff;
}

.product-sheet-result strong {
  font-size: 0.95rem;
  font-weight: 900;
}

.product-sheet-result span,
.product-sheet-result em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-style: normal;
}

.product-sheet-main {
  display: contents;
}

.product-sheet-title-card {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
}

.product-sheet-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 auto;
}

.product-sheet-title strong {
  color: #0f2d5c;
  font-size: 1.22rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.product-sheet-title span:not(.product-sheet-icon) {
  color: #002ee6;
  font-size: 1.2rem;
  font-weight: 900;
  white-space: nowrap;
}

.product-sheet-title em {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-sheet-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #16a34a;
  border: 3px solid currentColor;
  font-size: 0;
}

.product-sheet-search-open {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #9bb7e3;
  border-radius: 6px;
  color: #002b57;
  background: #eef6ff;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.product-sheet-search-open::before {
  content: "⌕";
  margin-right: 6px;
  color: var(--blue);
  font-weight: 900;
}

.product-sheet-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.product-action {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: default;
  box-shadow: 0 5px 12px rgba(16, 24, 40, 0.08);
}

.product-action[aria-disabled="true"] {
  pointer-events: none;
}

.product-action-read { background: #0b3f93; }
.product-action-save { background: #16a34a; }
.product-action-history { background: #f97316; }
.product-action-delete { background: #dc2626; }

.product-action-secondary {
  color: #0f2d5c;
  border-color: #b9c7dd;
  background: #fff;
}

.product-sheet-tabs {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
}

.product-sheet-tabs button {
  min-width: 0;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.product-sheet-tabs button:nth-child(1) { background: #1d4ed8; }
.product-sheet-tabs button:nth-child(2) { background: #16a34a; }
.product-sheet-tabs button:nth-child(3) { background: #f97316; }
.product-sheet-tabs button:nth-child(4) { background: #7c3aed; }
.product-sheet-tabs button:nth-child(5) { background: #0891b2; }
.product-sheet-tabs button:nth-child(6) { background: #db2777; }
.product-sheet-tabs button:nth-child(7) { background: #b77900; }
.product-sheet-tabs button:nth-child(8) { background: #475569; }

.product-sheet-tabs button:not(.active) {
  opacity: 0.72;
}

.product-sheet-tab-panel {
  display: none;
  min-width: 0;
}

.product-sheet-tab-panel.active {
  display: block;
  grid-column: 1 / -1;
  grid-row: 3;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active,
.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-general-grid,
.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-center,
.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-side,
.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-two-columns {
  display: contents;
}

.product-sheet-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-items: start;
}

.product-sheet-two-columns > .product-sheet-section:nth-child(1),
.product-sheet-two-columns > .product-sheet-section:nth-child(2) {
  grid-column: span 1;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-two-columns > .product-sheet-section:nth-child(1) {
  grid-column: 1;
  grid-row: 3;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-two-columns > .product-sheet-section:nth-child(2) {
  grid-column: 2;
  grid-row: 3;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-two-columns > .product-sheet-section:nth-child(3) {
  grid-column: 1;
  grid-row: 4;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-two-columns > .product-sheet-section:nth-child(4) {
  grid-column: 2;
  grid-row: 4;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-side > .product-sheet-stock-summary {
  grid-column: 3;
  grid-row: 3;
}

.product-sheet-tab-panel[data-product-sheet-panel="general"].active .product-sheet-side > .product-sheet-section {
  grid-column: 3;
  grid-row: 4;
}

.product-sheet-commercial-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.product-sheet-commercial-grid .product-sheet-info-grid {
  border-top: 0;
  grid-template-columns: minmax(84px, 1fr) minmax(58px, 0.62fr);
}

.product-sheet-commercial-grid .product-sheet-info-grid strong {
  font-size: 0.72rem;
  white-space: nowrap;
  word-break: normal;
}

.product-sheet-section,
.product-sheet-table-card,
.product-sheet-stock-summary {
  overflow: hidden;
  border: 1px solid #bfd0e7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
}

.product-sheet-section-wide {
  grid-column: auto;
}

.product-sheet-info-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.2fr);
  border-top: 1px solid #e5edf8;
}

.product-sheet-info-grid div {
  display: contents;
}

.product-sheet-info-grid span,
.product-sheet-info-grid strong {
  min-width: 0;
  padding: 5px 9px;
  border-bottom: 1px solid #e5edf8;
  font-size: 0.76rem;
}

.product-sheet-info-grid span {
  color: #111827;
  font-weight: 900;
}

.product-sheet-info-grid strong {
  color: #002ee6;
  font-weight: 900;
  word-break: break-word;
}

.product-sheet-vehicle-brand {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 6px;
  padding: 5px 8px;
  border: 1px solid #b7e5bd;
  border-radius: 6px;
  background: #ecfdf3;
}

.product-sheet-vehicle-brand span,
.product-sheet-vehicle-brand strong {
  font-size: 0.84rem;
  font-weight: 900;
}

.product-sheet-vehicle-brand strong {
  color: #14702a;
}

.product-sheet-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 8px;
}

.product-sheet-shortcuts button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 42px;
  color: #111827;
  font-size: 0.7rem;
  font-weight: 900;
}

.product-sheet-tool-button span {
  color: #002b57;
  font-size: 1.35rem;
  line-height: 1;
}

.product-sheet-warehouse-inline {
  margin: 7px 0 0;
  border-top: 1px solid var(--line);
}

.product-sheet-warehouse-inline .product-card-head {
  border-radius: 0;
}

.product-sheet-warehouse-inline select {
  width: calc(100% - 16px);
  min-width: 0;
  height: 32px;
  margin: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.product-sheet-notes,
.product-sheet-placeholder {
  min-height: 112px;
  padding: 9px;
  color: var(--muted);
  font-weight: 800;
}

.product-sheet-stock-big {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.product-sheet-stock-big span {
  color: #0f5132;
  font-size: 0.8rem;
  font-weight: 900;
}

.product-sheet-stock-big strong {
  color: #002ee6;
  font-size: 1.45rem;
  font-weight: 900;
}

.product-sheet-stock-tools {
  display: grid;
  grid-template-columns: 40px 40px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}

.product-sheet-stock-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: #fff;
  pointer-events: none;
}

.product-sheet-stock-icon-catalog {
  border: 1px solid #9db8ff;
}

.product-sheet-stock-icon-truck {
  border: 1px solid #f1a95a;
}

.product-sheet-stock-icon::before {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 900;
}

.product-sheet-stock-icon-catalog::before {
  content: "□";
  color: #1d4ed8;
}

.product-sheet-stock-icon-truck::before {
  content: "▭";
  color: #ea580c;
}

.product-sheet-stock-links {
  display: grid;
  gap: 4px;
  color: #002b57;
  font-size: 0.75rem;
  font-weight: 900;
}

.product-sheet-catalog-icon {
  width: 36px;
  height: 36px;
}

.product-sheet-stock-big.transit span,
.product-sheet-stock-big.transit strong {
  color: #ea580c;
}

.product-sheet-table {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.product-sheet-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-sheet-table th,
.product-sheet-table td {
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 0.76rem;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.product-sheet-table th {
  background: #002b57;
  color: #fff;
  font-weight: 900;
}

.product-sheet-table td.numeric {
  text-align: center;
}

.product-sheet-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.product-sheet-location-table table,
.product-sheet-stock-table table {
  table-layout: fixed;
}

.product-sheet-location-table {
  max-height: none;
  overflow-x: hidden;
}

.product-sheet-location-table table {
  min-width: 0;
}

.product-sheet-location-table th,
.product-sheet-location-table td {
  padding-top: 4px;
  padding-bottom: 4px;
}

.product-sheet-location-table th:nth-child(1),
.product-sheet-location-table td:nth-child(1) {
  width: 32%;
}

.product-sheet-location-table th:nth-child(2),
.product-sheet-location-table td:nth-child(2) {
  width: 34%;
  text-align: center;
}

.product-sheet-location-table th:nth-child(3),
.product-sheet-location-table td:nth-child(3) {
  width: 34%;
  text-align: center;
}

.product-sheet-stock-table th:nth-child(1),
.product-sheet-stock-table td:nth-child(1) {
  width: 58%;
}

.product-sheet-stock-table th:nth-child(2),
.product-sheet-stock-table td:nth-child(2),
.product-sheet-stock-table th:nth-child(3),
.product-sheet-stock-table td:nth-child(3) {
  width: 21%;
  text-align: center;
}

.product-sheet-location-host {
  grid-column: 1 / -1;
  grid-row: 5;
  min-width: 0;
}

.product-sheet-location-host[hidden] {
  display: none !important;
}

.product-sheet-footer {
  grid-column: 1 / -1;
  grid-row: 6;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.5fr) minmax(160px, 0.7fr) minmax(120px, 0.5fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, #002b57, #003f8f);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.product-sheet-footer strong {
  color: #dbeafe;
}

.product-sheet-status {
  justify-self: end;
  position: relative;
  padding: 5px 10px 5px 24px;
  border-radius: 6px;
  color: #166534;
  background: #dcfce7;
  font-weight: 900;
}

.product-sheet-status::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  transform: translateY(-50%);
}

.product-search-modal {
  width: min(1120px, 92vw);
  max-height: min(760px, 88vh);
  overflow: hidden;
}

.product-search-modal-form {
  grid-template-columns: minmax(0, 1fr) 140px;
  padding: 12px;
}

.product-search-modal-form input {
  width: 100%;
}

.product-search-modal-meta {
  padding: 0 12px 8px;
}

.product-sheet-modal-results {
  max-height: 520px;
  margin: 0 12px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.product-sheet-modal-results table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-sheet-modal-results th,
.product-sheet-modal-results td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
}

.product-sheet-modal-results th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: #002b57;
  font-weight: 900;
}

.product-sheet-modal-results th:nth-child(1),
.product-sheet-modal-results td:nth-child(1) {
  width: 15%;
}

.product-sheet-modal-results th:nth-child(2),
.product-sheet-modal-results td:nth-child(2) {
  width: 38%;
}

.product-sheet-modal-results th:nth-child(3),
.product-sheet-modal-results td:nth-child(3),
.product-sheet-modal-results th:nth-child(4),
.product-sheet-modal-results td:nth-child(4),
.product-sheet-modal-results th:nth-child(5),
.product-sheet-modal-results td:nth-child(5) {
  width: 12%;
}

.product-sheet-modal-results th:nth-child(6),
.product-sheet-modal-results td:nth-child(6) {
  width: 11%;
  text-align: center;
}

.product-sheet-modal-results .product-sheet-result {
  display: table-row;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.product-sheet-modal-results .product-sheet-result:hover,
.product-sheet-modal-results .product-sheet-result.active {
  color: #fff;
  background: #0d5bd7;
}

.product-sheet-modal-results .product-sheet-result:hover button,
.product-sheet-modal-results .product-sheet-result.active button {
  color: #002b57;
  background: #fff;
}

.product-sheet-select-product {
  min-height: 28px;
  padding: 0 9px;
}

.party-contact-row,
.party-address-row {
  display: grid;
  grid-template-columns: 112px minmax(120px, 1fr) minmax(140px, 1fr) minmax(100px, 0.8fr) minmax(120px, 1fr) 70px;
  gap: 6px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e8eef6;
  border-radius: 7px;
  background: #f8fafc;
}

.party-row-header {
  display: grid;
  gap: 6px;
  align-items: center;
  margin: 12px 12px 6px;
  padding: 0 10px;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.party-contact-header {
  grid-template-columns: 112px minmax(120px, 1fr) minmax(140px, 1fr) minmax(100px, 0.8fr) minmax(120px, 1fr) 70px;
}

.party-address-header {
  grid-template-columns: 112px minmax(180px, 1fr) minmax(100px, 0.7fr) minmax(130px, 0.9fr) 70px;
}

.master-file-card .party-contact-row,
.master-file-card .party-address-row {
  padding: 7px 10px;
  border-radius: 6px;
  background: #fff;
}

.party-contact-row input,
.party-contact-row select,
.party-address-row input,
.party-address-row select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
}

.master-file-card .party-contact-row button,
.master-file-card .party-address-row button {
  min-height: 32px;
  padding: 0 8px;
  border-color: #fecaca;
  color: #b91c1c;
}

.party-address-row {
  grid-template-columns: 112px minmax(180px, 1fr) minmax(100px, 0.7fr) minmax(130px, 0.9fr) 70px;
}

.party-credit-grid {
  padding: 0;
}

.party-search-modal {
  width: min(80vw, 1200px);
  max-width: calc(100vw - 28px);
}

.party-search-modal #party-name-query {
  min-height: 36px;
  padding: 0 10px;
}

.party-search-modal .dashboard-table {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(64vh, 620px);
}

.party-search-modal table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.party-search-modal th:nth-child(1),
.party-search-modal td:nth-child(1) {
  width: 180px;
}

.party-search-modal th:nth-child(2),
.party-search-modal td:nth-child(2) {
  width: auto;
}

.party-search-modal td {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.party-search-modal th,
.party-search-modal td {
  padding: 10px 12px;
  height: 40px;
  vertical-align: middle;
}

.party-search-modal thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.party-search-modal tbody tr:nth-child(even) {
  background: #fbfdff;
}

.party-search-row {
  cursor: pointer;
}

.party-search-row:hover,
.party-search-row.selected {
  background: #eef5ff;
}

.party-search-row:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: -2px;
}

.party-form-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px;
}

.branch-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, 0.65fr);
}

.branch-list-card {
  align-self: start;
}

.branch-suggestions {
  display: grid;
  gap: 8px;
  margin: 12px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.branch-suggestions .party-section-head {
  margin: 0;
  padding-bottom: 8px;
}

.branch-suggestions .party-section-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

#branch-suggestions-list {
  display: grid;
  gap: 7px;
}

.branch-suggestion-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid #e8eef6;
  border-radius: 7px;
  background: #fff;
}

.branch-suggestion-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.branch-suggestion-row strong,
.branch-suggestion-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-suggestion-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.branch-form-grid select,
.branch-form-grid input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.branch-table th:nth-child(1),
.branch-table td:nth-child(1) {
  width: 112px;
}

.branch-table th:nth-child(3),
.branch-table td:nth-child(3) {
  width: 140px;
}

.branch-table th:nth-child(4),
.branch-table td:nth-child(4) {
  width: 110px;
}

.branch-table th:nth-child(5),
.branch-table td:nth-child(5) {
  width: 86px;
}

.branch-table th:nth-child(6),
.branch-table td:nth-child(6) {
  width: 72px;
}

.party-save-success-backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.party-save-success-dialog {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(420px, calc(100vw - 36px));
  padding: 28px 26px 24px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(13, 31, 48, 0.28);
  text-align: center;
}

.party-save-success-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
}

.party-save-success-dialog strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.party-save-success-dialog span {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.35;
}

.erp-success-document-number {
  min-width: 180px;
  padding: 10px 16px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
}

.party-save-success-dialog button {
  min-width: 132px;
  margin-top: 4px;
  background: #16a34a;
  color: #fff;
}

.party-save-success-dialog button:hover {
  background: #15803d;
}

.sales-email-content {
  display: grid;
  gap: 12px;
}

.sales-email-meta,
.sales-email-files {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sales-email-meta-row,
.sales-email-file-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 30px;
  color: var(--ink);
}

.sales-email-meta-row span:first-child,
.sales-email-file-row span:first-child {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.sales-email-content input[type="email"] {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #d5e0ea;
  border-radius: 6px;
}

.sales-email-warning {
  padding: 10px 12px;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

.sales-email-warning label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 600;
}

.sales-email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.sales-email-actions button {
  min-width: 128px;
}

.dashboard-table {
  overflow: auto;
}

.dashboard-table table {
  width: 100%;
  border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.dashboard-table th {
  color: #fff;
  background: var(--blue);
  font-size: 0.78rem;
}

.dashboard-table td {
  color: var(--ink);
  font-size: 0.86rem;
}

.dashboard-table .numeric {
  text-align: right;
  font-weight: 700;
}

.dashboard-table th.numeric {
  text-align: right;
}

.seller-dashboard-grid .select-col {
  width: 54px;
  text-align: center;
}

.seller-dashboard-grid .select-col input {
  width: 18px;
  height: 18px;
}

.seller-dashboard-total td {
  position: sticky;
  bottom: 0;
  color: var(--ink);
  font-weight: 900;
  background: #eaf3fb;
  border-top: 2px solid var(--blue);
}

.seller-analysis {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #d9e4ee;
  border-radius: 8px;
  background: #fff;
}

.seller-branch-summary {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #c7d9ea;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f8fbff;
}

.seller-period-comparison,
.seller-insights {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid #d9e4ee;
  border-radius: 8px;
  background: #fff;
}

.seller-insights strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.seller-insights ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-weight: 700;
}

.seller-analysis-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.seller-analysis-header h4 {
  margin: 2px 0 0;
  font-size: 1.05rem;
}

.seller-code-badge {
  padding: 5px 9px;
  color: var(--blue);
  font-weight: 800;
  background: #eef6fd;
  border-radius: 6px;
}

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

.seller-kpis div {
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 7px;
  background: #f8fbfd;
}

.seller-kpis span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.seller-kpis strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 1rem;
}

.seller-monthly {
  margin-top: 14px;
  overflow-x: auto;
}

.seller-monthly table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.seller-monthly th,
.seller-monthly td {
  padding: 8px 9px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
}

.seller-monthly th {
  color: var(--blue);
  background: #eef6fd;
  font-size: 0.78rem;
}

.seller-monthly .numeric {
  text-align: right;
}

.seller-total-row td {
  font-weight: 800;
  background: #f5f8fb;
}

.seller-executive-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.seller-executive-card {
  min-height: 128px;
  padding: 16px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.seller-executive-card span,
.seller-executive-card small,
.seller-executive-card em {
  display: block;
}

.seller-executive-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.seller-executive-card strong {
  display: block;
  margin: 12px 0 8px;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
}

.seller-executive-card em {
  font-style: normal;
  font-weight: 900;
}

.seller-executive-card small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.seller-executive-card.positive {
  border-top: 4px solid #12b886;
}

.seller-executive-card.negative {
  border-top: 4px solid #e03131;
}

.seller-executive-card.neutral {
  border-top: 4px solid #94a3b8;
}

.seller-comparison-card {
  padding: 14px;
  margin: 0 14px 14px;
  border: 1px solid #dbe6f0;
  border-radius: 8px;
  background: #fff;
}

.seller-annual-kpis {
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.seller-annual-projection .seller-executive-card {
  min-height: 104px;
}

.seller-projection-note {
  margin: 12px 0;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 7px;
}

.seller-mini-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.seller-mini-chart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #f8fbfd;
}

.seller-mini-chart strong {
  color: var(--ink);
}

.seller-mini-chart div {
  display: grid;
  grid-template-columns: 32px minmax(80px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.seller-mini-chart span,
.seller-mini-chart em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.seller-mini-chart i {
  display: block;
  height: 12px;
  min-width: 4px;
  border-radius: 999px;
  background: var(--blue);
}

.seller-mini-chart i.muted {
  background: #94a3b8;
}

.seller-executive-summary p {
  margin: 7px 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}

.positive {
  color: #087f5b !important;
}

.negative {
  color: #b42318 !important;
}

.neutral {
  color: var(--muted) !important;
}

.cart-empty {
  padding: 18px 14px;
  color: var(--muted);
}

.empty {
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  body {
    background: #e8eef3;
  }

  .app-tabs {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .tab-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-button {
    width: 100%;
    padding: 0 8px;
  }

  .session-box {
    justify-content: flex-end;
  }

  .brand-row,
  .result-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup {
    align-items: center;
  }

  .global-search,
  .filters,
  .cart-row,
  .manual-product-form,
  .admin-create,
  .admin-user-row,
  .vendor-create,
  .vendor-row,
  .vendor-detected-row,
  .correction-row,
  .quote-layout,
  .quote-search,
  .receipt-layout,
  .receipt-search,
  .sales-document-card,
  .sales-document-detail-head,
  .sales-document-meta,
  .sales-document-line,
  .sales-document-search,
  .correction-search,
  .security-schedule-list,
  .security-schedule-row,
  .access-audit-search,
  .catalog-edit-grid,
  .dashboard-grid,
  .dashboard-filters,
  .kpi-grid,
  .seller-executive-kpis,
  .seller-mini-charts {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .security-details summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .security-actions {
    justify-content: stretch;
  }

  .security-actions button {
    width: 100%;
  }

  .sales-document-actions {
    justify-content: stretch;
  }

  .sales-document-actions button {
    flex: 1;
  }

  .quote-header,
  .receipt-header {
    align-items: stretch;
    flex-direction: column;
  }

  .document-subtabs {
    width: calc(100% - 28px);
    align-items: stretch;
  }

  .document-subtabs .mode-button {
    flex: 1 1 160px;
  }

  .quote-list,
  .receipt-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quote-customer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    width: fit-content;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .search-band,
  .result-panel,
  .cart-panel,
  .quote-panel,
  .admin-panel {
    border-radius: 6px;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.1);
  }

  .search-band {
    padding: 14px;
  }

  h1 {
    font-size: 1.6rem;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .login-logo {
    width: min(230px, 88%);
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .metric {
    padding: 7px 9px;
    font-size: 0.86rem;
    white-space: normal;
  }

  .global-search {
    grid-template-columns: 1fr;
  }

  .search-mode {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .view-mode {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    margin-left: 0;
  }

  .global-search input {
    height: 48px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 1rem;
  }

  .global-search button,
  .filters button,
  .cart-actions button,
  .quote-search button,
  .admin-create button {
    width: 100%;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .vehicle-context-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .vehicle-context-head div {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .vehicle-context-status {
    max-width: 100%;
  }

  .vehicle-context-form label,
  .vehicle-context-form button {
    grid-column: auto;
  }

  .quote-customer-grid {
    grid-template-columns: 1fr;
  }

  .filters label:nth-child(2),
  .filters label:nth-child(4),
  .filters label:nth-child(5),
  .filters button {
    grid-column: span 2;
  }

  .cart-header,
  .cart-total {
    align-items: stretch;
    flex-direction: column;
  }

  .cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .cart-row {
    grid-template-columns: 1fr 82px;
    gap: 8px;
  }

  .cart-row > div,
  .cart-row .icon-button {
    grid-column: span 2;
  }

  .cart-row .price {
    text-align: left;
  }

  .quote-header,
  .quote-detail-head,
  .quote-detail-total,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-search {
    grid-template-columns: 1fr 1fr;
  }

  .quote-search input,
  .quote-search .danger {
    grid-column: span 2;
  }

  .pdf-choice-actions {
    grid-template-columns: 1fr;
  }

  .pdf-choice-actions .ghost {
    grid-column: auto;
  }

  .ticket-preview-row {
    grid-template-columns: 1fr;
  }

  .ticket-preview-row em {
    text-align: left;
  }

  .quote-detail {
    padding: 12px;
  }

  .admin-create,
  .admin-user-row {
    grid-template-columns: 1fr;
  }

  .admin-users,
  .quote-list,
  .quote-items {
    max-height: none;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
  }

  table {
    min-width: 0;
    font-size: 0.9rem;
  }

  thead {
    display: none;
  }

  tbody {
    padding: 8px;
    background: #f8fafc;
  }

  tbody tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }

  tbody tr:nth-child(even),
  tbody tr:hover {
    background: #fff;
  }

  tbody td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    min-height: 38px;
    padding: 8px 10px;
    border-bottom: 1px solid #edf1f5;
  }

  tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  tbody td.row-action {
    display: block;
  }

  tbody td.row-action::before {
    content: "";
  }

  .provider-modal .provider-table {
    display: table;
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.72rem;
  }

  .provider-modal .provider-table thead {
    display: table-header-group;
  }

  .provider-modal .provider-table tbody {
    display: table-row-group;
    padding: 0;
    background: transparent;
  }

  .provider-modal .provider-table tr {
    display: table-row;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .provider-modal .provider-table th,
  .provider-modal .provider-table td {
    display: table-cell;
    min-height: 0;
    padding: 7px 5px;
    word-break: break-word;
  }

  .provider-modal .provider-table td::before {
    content: none;
  }

  .mini-button {
    width: 100%;
  }

  .applications-row {
    border: 0;
    background: transparent;
  }

  .applications-row td {
    display: block;
    padding: 0;
  }

  .applications-row td::before {
    content: "";
  }

  .applications-panel {
    padding: 10px 0;
  }

  .application-card {
    grid-template-columns: 1fr 1fr;
  }

  .application-detail {
    grid-column: span 2;
  }

  .price,
  .stock {
    text-align: left;
  }

  .qty-input {
    width: 82px;
  }
}

@media (max-width: 920px) {
  .master-file-header,
  .master-file-actions {
    align-items: stretch;
  }

  .master-file-header {
    flex-direction: column;
  }

  .master-file-actions {
    min-width: 0;
    justify-content: flex-start;
  }

  .master-file-title-block > strong {
    white-space: normal;
  }

  .master-file-card .party-form-grid {
    grid-template-columns: 1fr;
  }

  .master-file-card .party-form-grid .wide {
    grid-column: auto;
  }

  .party-layout {
    grid-template-columns: 1fr;
  }

  .party-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .party-contact-row {
    grid-template-columns: 1fr 1fr;
  }

  .party-address-row {
    grid-template-columns: 1fr 1fr;
  }

  .party-row-header {
    display: none;
  }

  .party-read-row {
    grid-template-columns: 1fr;
  }

  #party-message {
    padding-bottom: 0;
  }
}

@media (max-width: 460px) {
  .tab-group {
    grid-template-columns: 1fr;
  }

  .session-box {
    justify-content: space-between;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters label:nth-child(2),
  .filters label:nth-child(4),
  .filters label:nth-child(5),
  .filters button {
    grid-column: auto;
  }

  .cart-actions,
  .quote-search {
    grid-template-columns: 1fr;
  }

  .quote-search input,
  .quote-search .danger {
    grid-column: auto;
  }

  tbody td {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}


/* CONSULTA CAJA - ALINEACION MONTOS V1 */

#cash-query-results .commercial-brand-kpis .dashboard-card strong {
  display: block;
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#cash-query-results table th:nth-child(n+2),
#cash-query-results table td:nth-child(n+2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#cash-query-results table td:nth-child(n+2) {
  white-space: nowrap;
}


/* CONSULTA CAJA - GRILLA FINAL V3 */
@media (min-width: 851px) {
  #cash-query-search {
    display: grid;
    grid-template-columns:
      repeat(4, minmax(0, 1fr))
      repeat(3, 100px);
    gap: 8px;
    width: min(980px, 100%);
    align-items: end;
  }

  #cash-query-search > label {
    width: auto;
    min-width: 0;
  }

  #cash-query-search > label input,
  #cash-query-search > label select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #cash-query-search > button {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
  }
}


/* ==========================================================
   CUENTAS POR PAGAR
   ========================================================== */

.cxp-query-search {
  grid-template-columns:
    minmax(180px, 1fr)
    150px
    120px
    120px
    135px
    92px
    88px
    88px;
  width: min(1080px, 100%);
  align-items: end;
}

.cxp-summary-kpis {
  margin-bottom: 12px;
}

.cxp-summary-kpis small {
  display: block;
  margin-top: 4px;
}

.cxp-table-shell table {
  min-width: 980px;
}

.cxp-table-shell th:nth-child(n+5),
.cxp-table-shell td:nth-child(n+5):nth-child(-n+7) {
  text-align: right;
}

.cxp-table-shell td.numeric {
  white-space: nowrap;
}



/* ==========================================================
   CXP FASE 2A - VENCIMIENTOS
   ========================================================== */

.cxp-due-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.cxp-due-summary .dashboard-card {
  min-width: 0;
}

.cxp-due-summary small {
  display: block;
  margin-top: 4px;
}

.cxp-due-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.85em;
  font-weight: 600;
}

.cxp-due-badge.is-overdue {
  background: rgba(190, 38, 38, 0.14);
  color: #9f1d1d;
}

.cxp-due-badge.is-due-soon {
  background: rgba(230, 126, 34, 0.16);
  color: #a34d00;
}

.cxp-table-shell tr.is-overdue td {
  background: rgba(190, 38, 38, 0.035);
}

.cxp-table-shell tr.is-due-soon td {
  background: rgba(230, 126, 34, 0.035);
}

@media (max-width: 900px) {
  .cxp-due-summary {
    grid-template-columns: 1fr;
  }
}



/* CXP - SEMAFORO FINAL */

.cxp-due-badge.is-due-warning {
  background: rgba(241, 196, 15, 0.32);
  color: #5f4b00;
  border: 1px solid rgba(180, 140, 0, 0.30);
  font-weight: 700;
}

.cxp-table-shell tr.is-due-warning td {
  background: rgba(241, 196, 15, 0.025);
}



@media (max-width: 900px) {
  .cxp-query-search {
    grid-template-columns: 1fr;
    width: 100%;
  }
}


/* ==========================================================
   CXP FASE 3 - GESTION CONSOLIDADA
   ========================================================== */

.cxp-view-tabs {
  padding-left: 14px;
  padding-right: 14px;
}

.cxp-general-search {
  grid-template-columns:
    150px
    135px
    135px
    180px
    92px
    88px;
  width: min(900px, 100%);
  align-items: end;
}

.cxp-general-aging {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.cxp-general-aging .dashboard-card {
  min-width: 0;
}

.cxp-general-aging .is-overdue {
  border-color:
    rgba(190, 38, 38, 0.35);
}

.cxp-general-aging .is-due-soon {
  border-color:
    rgba(230, 126, 34, 0.40);
}

.cxp-general-aging .is-due-warning {
  border-color:
    rgba(201, 151, 0, 0.40);
}

.cxp-general-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}

.cxp-general-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cxp-general-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.cxp-general-filter span {
  font-size: 0.78rem;
  opacity: 0.72;
}

.cxp-general-filter.active {
  border-color: var(--blue);
  background: rgba(31, 78, 120, 0.10);
  font-weight: 700;
}

.cxp-general-filter-result {
  color: var(--muted);
  font-size: 0.84rem;
}

.cxp-general-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.cxp-general-list-card {
  padding-bottom: 10px;
}

.cxp-general-table-shell table {
  min-width: 1260px;
}

.cxp-general-table-shell td.numeric,
.cxp-general-table-shell th:nth-child(n+2):nth-child(-n+8) {
  text-align: right;
  white-space: nowrap;
}

.cxp-general-provider {
  min-width: 235px;
}

.cxp-general-provider strong,
.cxp-general-provider small {
  display: block;
}

.cxp-general-provider small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.cxp-general-net {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.cxp-general-net.is-credit strong {
  color: #1d6b45;
}

.cxp-provider-state {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
}

.cxp-provider-state.is-payable {
  background:
    rgba(31, 78, 120, 0.10);
  color: var(--blue-dark);
}

.cxp-provider-state.is-credit {
  background:
    rgba(39, 128, 83, 0.12);
  color: #1d6b45;
}

.cxp-general-money.is-overdue {
  color: #a82424;
  font-weight: 700;
}

.cxp-general-money.is-due-soon {
  color: #a34d00;
  font-weight: 700;
}

.cxp-general-credit {
  color: #1d6b45;
}

.cxp-general-table-shell
tr.is-credit-row td {
  background:
    rgba(39, 128, 83, 0.025);
}

@media (max-width: 900px) {
  .cxp-general-search {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .cxp-general-aging {
    grid-template-columns: 1fr;
  }

  .cxp-general-toolbar {
    align-items: flex-start;
  }
}



/* ==========================================================
   CXP FASE 3B - AJUSTE VISUAL GESTION CONSOLIDADA
   FRONTEND ONLY
   ========================================================== */

.cxp-general-executive {
  display: grid;
  grid-template-columns:
    minmax(0, 1.15fr)
    minmax(560px, 0.85fr);
  gap: 12px;
  margin-bottom: 12px;
}

.cxp-general-executive .dashboard-card {
  min-width: 0;
  min-height: 118px;
  padding: 18px 20px;
  border-radius: 10px;
}

.cxp-general-executive > .dashboard-card:last-child {
  grid-column: auto;
}

.cxp-general-balance-card {
  border-left: 4px solid var(--blue);
  background:
    linear-gradient(
      135deg,
      rgba(31, 78, 120, 0.055),
      rgba(255, 255, 255, 0) 58%
    ),
    var(--surface);
}

.cxp-general-balance-card > span,
.cxp-general-providers-copy > span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.cxp-general-balance-card > strong {
  display: block;
  margin: 8px 0 7px;
  color: var(--text);
  font-size: clamp(1.75rem, 2vw, 2.2rem);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.cxp-general-balance-card > small {
  color: var(--muted);
  font-size: 0.82rem;
}

.cxp-general-providers-card {
  display: grid;
  grid-template-columns:
    minmax(105px, 0.45fr)
    minmax(420px, 1.55fr);
  align-items: center;
  gap: 18px;
}

.cxp-general-providers-copy > strong {
  display: block;
  margin: 6px 0 5px;
  color: var(--text);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.cxp-general-providers-copy > small {
  color: var(--muted);
  font-size: 0.78rem;
}

.cxp-general-provider-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cxp-general-provider-breakdown > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(31, 78, 120, 0.15);
  border-radius: 8px;
  background: rgba(31, 78, 120, 0.055);
}

.cxp-general-provider-breakdown > div.is-credit {
  border-color: rgba(39, 128, 83, 0.18);
  background: rgba(39, 128, 83, 0.07);
}

.cxp-general-provider-breakdown > div.is-nc {
  border-color: rgba(14, 116, 144, 0.18);
  background: rgba(14, 116, 144, 0.06);
}

.cxp-general-provider-breakdown span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.cxp-general-provider-breakdown strong {
  display: block;
  color: var(--blue-dark);
  font-size: 1.25rem;
  line-height: 1;
}

.cxp-general-provider-breakdown .is-credit strong {
  color: #1d6b45;
}

.cxp-general-provider-breakdown .is-nc strong {
  color: #0e7490;
}


/* Tramos exclusivos */

.cxp-general-aging {
  gap: 8px;
  margin-bottom: 14px;
}

.cxp-general-aging .dashboard-card {
  position: relative;
  min-width: 0;
  min-height: 92px;
  padding: 15px 16px 13px;
  overflow: hidden;
  border-radius: 9px;
}

.cxp-general-aging .dashboard-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #94a3b8;
}

.cxp-general-aging .dashboard-card > span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.cxp-general-aging .dashboard-card > strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.cxp-general-aging .dashboard-card > small {
  color: var(--muted);
  font-size: 0.72rem;
}

.cxp-general-aging .is-overdue {
  border-color: rgba(190, 38, 38, 0.26);
  background: rgba(190, 38, 38, 0.035);
}

.cxp-general-aging .is-overdue::before {
  background: #b42318;
}

.cxp-general-aging .is-overdue > strong {
  color: #a82424;
}

.cxp-general-aging .is-due-soon {
  border-color: rgba(230, 126, 34, 0.28);
  background: rgba(230, 126, 34, 0.04);
}

.cxp-general-aging .is-due-soon::before {
  background: #d97706;
}

.cxp-general-aging .is-due-soon > strong {
  color: #a34d00;
}

.cxp-general-aging .is-due-warning {
  border-color: rgba(201, 151, 0, 0.28);
  background: rgba(201, 151, 0, 0.04);
}

.cxp-general-aging .is-due-warning::before {
  background: #ca8a04;
}

.cxp-general-aging .is-due-warning > strong {
  color: #8a6500;
}

.cxp-general-aging .is-neutral::before {
  background: #94a3b8;
}


/* Filtros y tabla */

.cxp-general-toolbar {
  margin-top: 4px;
  margin-bottom: 12px;
}

.cxp-general-list-card {
  padding: 16px 16px 12px;
}

.cxp-general-table-shell th,
.cxp-general-table-shell td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.cxp-general-table-shell thead th {
  background: #f8fafc;
}

.cxp-general-table-shell tbody tr:hover td {
  background: rgba(31, 78, 120, 0.025);
}

.cxp-general-table-shell
tr.is-credit-row:hover td {
  background: rgba(39, 128, 83, 0.055);
}


@media (max-width: 1250px) {
  .cxp-general-executive {
    grid-template-columns: 1fr;
  }

  .cxp-general-providers-card {
    grid-template-columns:
      minmax(120px, 0.7fr)
      minmax(220px, 1.3fr);
  }
}


@media (max-width: 900px) {
  .cxp-general-providers-card {
    grid-template-columns: 1fr;
  }

  .cxp-general-provider-breakdown {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   CXP VISUAL V6 - MANTENER 5 TRAMOS EN UNA SOLA FILA
   ========================================================== */

.cxp-general-aging > .dashboard-card:last-child {
  grid-column: auto;
}


/* ==========================================================
   CXP CONSULTA PROVEEDOR - ARMONIZACION VISUAL V1
   ========================================================== */

.cxp-provider-executive {
  display: grid;
  grid-template-columns:
    minmax(0, 1.25fr)
    minmax(260px, 0.8fr)
    minmax(260px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.cxp-provider-executive > .dashboard-card {
  position: relative;
  min-width: 0;
  min-height: 110px;
  padding: 18px 20px;
  border-radius: 10px;
}

/* Evita la regla global .dashboard-card:last-child */
.cxp-provider-executive > .dashboard-card:last-child {
  grid-column: auto;
}

.cxp-provider-executive > .dashboard-card > span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cxp-provider-executive > .dashboard-card > strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.cxp-provider-executive > .dashboard-card > small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.cxp-provider-balance-card {
  border-left: 4px solid var(--blue);
  background:
    linear-gradient(
      135deg,
      rgba(31, 78, 120, 0.055),
      rgba(255, 255, 255, 0) 58%
    ),
    var(--surface);
}

.cxp-provider-balance-card > strong {
  font-size: clamp(1.7rem, 2vw, 2.1rem) !important;
}

.cxp-provider-invoices-card {
  border-top: 4px solid #64748b;
}

.cxp-provider-credit-card {
  border-top: 4px solid #0e7490;
  background: rgba(14, 116, 144, 0.035);
}

.cxp-provider-credit-card > strong {
  color: #0e7490 !important;
}


/* Vencimientos acumulados */

.cxp-provider-aging {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.cxp-provider-aging > .dashboard-card {
  position: relative;
  min-width: 0;
  min-height: 92px;
  padding: 15px 16px 13px;
  overflow: hidden;
  border-radius: 9px;
}

/* Evita expansión de la cuarta tarjeta */
.cxp-provider-aging > .dashboard-card:last-child {
  grid-column: auto;
}

.cxp-provider-aging > .dashboard-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #94a3b8;
}

.cxp-provider-aging > .dashboard-card > span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.cxp-provider-aging > .dashboard-card > strong {
  display: block;
  margin: 8px 0 5px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.cxp-provider-aging > .dashboard-card > small {
  color: var(--muted);
  font-size: 0.72rem;
}

.cxp-provider-aging > .is-overdue {
  border-color: rgba(190, 38, 38, 0.26);
  background: rgba(190, 38, 38, 0.035);
}

.cxp-provider-aging > .is-overdue::before {
  background: #b42318;
}

.cxp-provider-aging > .is-overdue > strong {
  color: #a82424;
}

.cxp-provider-aging > .is-due-soon {
  border-color: rgba(230, 126, 34, 0.28);
  background: rgba(230, 126, 34, 0.04);
}

.cxp-provider-aging > .is-due-soon::before {
  background: #d97706;
}

.cxp-provider-aging > .is-due-soon > strong {
  color: #a34d00;
}

.cxp-provider-aging > .is-due-warning {
  border-color: rgba(201, 151, 0, 0.28);
  background: rgba(201, 151, 0, 0.04);
}

.cxp-provider-aging > .is-due-warning::before {
  background: #ca8a04;
}

.cxp-provider-aging > .is-due-warning > strong {
  color: #8a6500;
}

.cxp-provider-aging > .is-neutral::before {
  background: #94a3b8;
}

.cxp-provider-aging-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}


/* Tabla: conservar funcionalidad, mejorar continuidad visual */

#cxp-query-results > .dashboard-card:last-child {
  grid-column: auto;
}

.cxp-table-shell th,
.cxp-table-shell td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.cxp-table-shell thead th {
  background: #f8fafc;
}


@media (max-width: 1200px) {
  .cxp-provider-executive {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cxp-provider-balance-card {
    grid-column: 1 / -1;
  }

  .cxp-provider-aging {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


@media (max-width: 900px) {
  .cxp-provider-executive,
  .cxp-provider-aging {
    grid-template-columns: 1fr;
  }

  .cxp-provider-balance-card {
    grid-column: auto;
  }
}


/* ==========================================================
   CXP FINAL UI V2
   UNIFICACION TARJETAS + CONTRASTE TABLAS
   CSS ONLY
   ========================================================== */


/* ----------------------------------------------------------
   1. SISTEMA COMUN DE TARJETAS CXP
   ---------------------------------------------------------- */

.cxp-general-executive > .dashboard-card,
.cxp-general-aging > .dashboard-card,
.cxp-provider-executive > .dashboard-card,
.cxp-provider-aging > .dashboard-card {
  border-radius: 10px;
}


/* ----------------------------------------------------------
   2. RESUMEN EJECUTIVO - GESTION CONSOLIDADA
   ---------------------------------------------------------- */

.cxp-general-balance-card {
  border-left: 1px solid var(--line);
  border-top: 4px solid var(--blue);
}

.cxp-general-providers-card {
  border-top: 4px solid #64748b;
}


/* ----------------------------------------------------------
   3. RESUMEN EJECUTIVO - CONSULTA PROVEEDOR
   ---------------------------------------------------------- */

.cxp-provider-balance-card {
  border-left: 1px solid var(--line);
  border-top: 4px solid var(--blue);
}

.cxp-provider-invoices-card {
  border-top: 4px solid #64748b;
}

.cxp-provider-credit-card {
  border-top: 4px solid #0e7490;
}


/* ----------------------------------------------------------
   4. VENCIMIENTOS - UNIFICAR BARRA SUPERIOR REAL
   ---------------------------------------------------------- */

.cxp-general-aging > .dashboard-card::before,
.cxp-provider-aging > .dashboard-card::before {
  display: none;
}


/* Vencido */

.cxp-general-aging > .is-overdue,
.cxp-provider-aging > .is-overdue {
  border-top: 4px solid #b42318;
}


/* 0-7 / Proximos 7 */

.cxp-general-aging > .is-due-soon,
.cxp-provider-aging > .is-due-soon {
  border-top: 4px solid #d97706;
}


/* 8-15 / Proximos 15 */

.cxp-general-aging > .is-due-warning,
.cxp-provider-aging > .is-due-warning {
  border-top: 4px solid #ca8a04;
}


/* Tramos neutros */

.cxp-general-aging > .is-neutral,
.cxp-provider-aging > .is-neutral {
  border-top: 4px solid #94a3b8;
}


/* ----------------------------------------------------------
   5. ENCABEZADOS DE TABLAS CXP
   Mejor contraste sin convertirlos en una franja pesada
   ---------------------------------------------------------- */

#cxp-query-results .cxp-table-shell thead th,
#cxp-general-results .cxp-general-table-shell thead th {
  background: #eaf0f6;
  color: #27364a;
  font-weight: 800;
  border-bottom: 1px solid #c8d3df;
}


/* Mantener lectura clara incluso con estilos heredados */

#cxp-query-results .cxp-table-shell thead tr,
#cxp-general-results .cxp-general-table-shell thead tr {
  background: #eaf0f6;
}



@media (max-width: 1280px) {
  .inventory-control-filters {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }
}

@media (max-width: 900px) {
  .inventory-control-filters {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

/* ==========================================================
   CONTROL INVENTARIO V4
   Override final sobre estilos heredados de .receipt-search
   ========================================================== */

.receipt-search.inventory-control-filters {
  align-items: end;
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  max-width: none;
  width: 100%;
}

.receipt-search.inventory-control-filters label {
  min-width: 0;
  width: 100%;
}

.receipt-search.inventory-control-filters input,
.receipt-search.inventory-control-filters select {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.receipt-search.inventory-control-filters button {
  min-width: 120px;
  width: 100%;
}

.receipt-search.inventory-control-filters button[type="submit"] {
  grid-column: 1;
}

.receipt-search.inventory-control-filters #low-stock-clear {
  grid-column: 2;
}

.receipt-search.inventory-control-filters #low-stock-xls {
  grid-column: 3;
}

@media (max-width: 1280px) {
  .receipt-search.inventory-control-filters {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }
}

@media (max-width: 900px) {
  .receipt-search.inventory-control-filters {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}


/* SOLO_CON_COMPRAS_VISUAL_V1
   Agrupa ambos filtros booleanos sin cambiar lógica. */

.purchase-check-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  align-self: end;
  gap: 3px;
  min-width: 132px;
  padding-bottom: 2px;
  transform: translateY(-2px);
}

.purchase-check-stack .check-label {
  margin: 0;
  min-height: 20px;
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .purchase-check-stack {
    transform: none;
  }
}



/* ==========================================================
   AUDITORIA OC V1 - MODAL COMPACTO
   ========================================================== */

#oc-audit-detail-modal .price-audit-detail-modal {
  width: min(97vw, 1550px);
  max-width: 1550px;
}

#oc-audit-detail-modal .table-wrap {
  overflow-x: auto;
}

#oc-audit-detail-modal .audit-detail-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

#oc-audit-detail-modal .audit-detail-table th,
#oc-audit-detail-modal .audit-detail-table td {
  padding-left: 7px;
  padding-right: 7px;
  vertical-align: top;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(1),
#oc-audit-detail-modal .audit-detail-table td:nth-child(1) {
  width: 42px;
  text-align: center;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(2),
#oc-audit-detail-modal .audit-detail-table td:nth-child(2) {
  width: 145px;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(3),
#oc-audit-detail-modal .audit-detail-table td:nth-child(3) {
  width: 260px;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(4),
#oc-audit-detail-modal .audit-detail-table td:nth-child(4) {
  width: 58px;
  text-align: center;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(5),
#oc-audit-detail-modal .audit-detail-table td:nth-child(5) {
  width: 92px;
  white-space: nowrap;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(6),
#oc-audit-detail-modal .audit-detail-table td:nth-child(6) {
  width: 92px;
  white-space: nowrap;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(7),
#oc-audit-detail-modal .audit-detail-table td:nth-child(7) {
  width: 88px;
  white-space: nowrap;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(8),
#oc-audit-detail-modal .audit-detail-table td:nth-child(8) {
  width: 58px;
  text-align: center;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(9),
#oc-audit-detail-modal .audit-detail-table td:nth-child(9) {
  width: 95px;
  white-space: nowrap;
}

#oc-audit-detail-modal .audit-detail-table th:nth-child(10),
#oc-audit-detail-modal .audit-detail-table td:nth-child(10) {
  width: 125px;
}

#oc-audit-detail-modal .oc-audit-diff {
  font-weight: 600;
}

#oc-audit-detail-modal .oc-audit-same-day-row td {
  background: #fff8e7;
}

#oc-audit-detail-modal .oc-audit-no-evidence td {
  background: #f8fafc;
  color: #64748b;
}

/* AUDITORIA OC V1 - MODAL COMPACTO */

/* E8T2 IMMOBILIZED COLUMN WIDTHS */
.immobilized-table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 1373px;
}

.immobilized-table-wrap th,
.immobilized-table-wrap td {
  box-sizing: border-box;
}

.immobilized-table-wrap thead th {
  white-space: normal;
  line-height: 1.1;
  vertical-align: middle;
  overflow: hidden;
}

.immobilized-table-wrap tbody td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* N° */
.immobilized-table-wrap th:nth-child(1),
.immobilized-table-wrap td:nth-child(1) {
  width: 32px;
}

/* Código interno */
.immobilized-table-wrap th:nth-child(2),
.immobilized-table-wrap td:nth-child(2) {
  width: 90px;
}

/* Descripción */
.immobilized-table-wrap th:nth-child(3),
.immobilized-table-wrap td:nth-child(3) {
  width: 250px;
}

/* Marca vehículo */
.immobilized-table-wrap th:nth-child(4),
.immobilized-table-wrap td:nth-child(4) {
  width: 90px;
}

/* Sucursal */
.immobilized-table-wrap th:nth-child(5),
.immobilized-table-wrap td:nth-child(5) {
  width: 60px;
}

/* Última venta */
.immobilized-table-wrap th:nth-child(6),
.immobilized-table-wrap td:nth-child(6) {
  width: 92px;
}

/* Meses sin venta */
.immobilized-table-wrap th:nth-child(7),
.immobilized-table-wrap td:nth-child(7) {
  width: 90px;
}

/* Última compra */
.immobilized-table-wrap th:nth-child(8),
.immobilized-table-wrap td:nth-child(8) {
  width: 92px;
}

/* Proveedor */
.immobilized-table-wrap th:nth-child(9),
.immobilized-table-wrap td:nth-child(9) {
  width: 130px;
}

/* Stock */
.immobilized-table-wrap th:nth-child(10),
.immobilized-table-wrap td:nth-child(10) {
  width: 55px;
}

/* Costo última compra */
.immobilized-table-wrap th:nth-child(11),
.immobilized-table-wrap td:nth-child(11) {
  width: 95px;
}

/* Precio venta */
.immobilized-table-wrap th:nth-child(12),
.immobilized-table-wrap td:nth-child(12) {
  width: 90px;
}

/* Factor precio/costo */
.immobilized-table-wrap th:nth-child(13),
.immobilized-table-wrap td:nth-child(13) {
  width: 92px;
}

/* Valor inmovilizado */
.immobilized-table-wrap th:nth-child(14),
.immobilized-table-wrap td:nth-child(14) {
  width: 115px;
}
/* END E8T2 IMMOBILIZED COLUMN WIDTHS */



/* ==========================================================
   General + REFAX - UI candidata V1
   ========================================================== */

.refax-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.refax-result-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

.refax-result-badge-ambiguous {
  border-style: dashed;
}

.refax-match-note {
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.72;
}

.catalog-refax-external > td:first-child,
.catalog-refax-ambiguous > td:first-child {
  border-left: 3px solid currentColor;
}

.catalog-refax-external .qty-input:disabled,
.catalog-refax-ambiguous .qty-input:disabled {
  opacity: 0.55;
}

.catalog-refax-external .row-action button:disabled,
.catalog-refax-ambiguous .row-action button:disabled,
.catalog-refax-bridge .row-action button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.refax-static-applications {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.72;
}


/* ==========================================================
   PROVEEDOR UNIVERSAL V2
   Aplicaciones externas REFAX
   ========================================================== */

.refax-app-button {
  margin-top: 6px;
  white-space: nowrap;
}

.refax-applications-modal {
  max-width: 900px;
}

.refax-app-summary {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.refax-app-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.refax-app-summary span {
  font-size: 0.76rem;
  opacity: 0.7;
}

.refax-app-section {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.refax-app-list {
  display: grid;
  gap: 6px;
}

.refax-app-item {
  padding: 9px 11px;
  border: 1px solid #d8e1eb;
  border-radius: 7px;
  background: #f8fafc;
  line-height: 1.35;
}

.refax-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.refax-code-list span {
  padding: 5px 8px;
  border: 1px solid #d8e1eb;
  border-radius: 6px;
  background: #f8fafc;
  font-weight: 600;
}

.refax-factory-list {
  display: grid;
  gap: 6px;
}

.refax-factory-list > div {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 7px 9px;
  border-bottom: 1px solid #e4e9ef;
}

.refax-factory-list span {
  opacity: 0.72;
}


/* ==========================================================
   FICHA PRODUCTO REFAX V1
   ========================================================== */

.refax-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.refax-sheet-button {
  white-space: nowrap;
}

.refax-product-sheet {
  width: min(1180px, calc(100vw - 36px));
  max-width: 1180px;
  max-height: calc(100vh - 36px);
}

.refax-sheet-body {
  overflow-y: auto;
}

.refax-sheet-kicker {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef3f8;
}

.refax-sheet-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 14px;
}

.refax-sheet-summary,
.refax-sheet-commercial,
.refax-sheet-section {
  overflow: hidden;
}

.refax-sheet-info-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 14px;
}

.refax-sheet-info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.refax-sheet-info-grid span,
.refax-sheet-price span,
.refax-sheet-stock span {
  font-size: 0.77rem;
  opacity: 0.7;
}

.refax-sheet-commercial {
  padding-bottom: 14px;
}

.refax-sheet-price,
.refax-sheet-stock {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px 0;
}

.refax-sheet-price strong {
  font-size: 1.8rem;
}

.refax-sheet-stock strong {
  font-size: 1.15rem;
}

.refax-sheet-note {
  margin: 14px 16px 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: #f6f8fa;
  font-size: 0.8rem;
}

.refax-sheet-section {
  margin-top: 14px;
}

.refax-sheet-images {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px;
}

.refax-sheet-image-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 150px;
  text-decoration: none;
}

.refax-sheet-image-link img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  border: 1px solid #dde4eb;
  border-radius: 8px;
  background: #fff;
}

.refax-sheet-image-link span {
  font-size: 0.75rem;
  text-align: center;
}

.refax-sheet-image-link.image-error {
  display: none;
}

.refax-sheet-applications {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.refax-sheet-application {
  padding: 10px 12px;
  border: 1px solid #dde4eb;
  border-radius: 7px;
  background: #f8fafc;
  line-height: 1.35;
}

.refax-sheet-codes-grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.refax-sheet-code-list {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.refax-sheet-code-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e9ee;
}

.refax-sheet-code-list span {
  opacity: 0.7;
}

.refax-sheet-footer-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #f6f8fa;
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 850px) {
  .refax-sheet-top-grid,
  .refax-sheet-codes-grid {
    grid-template-columns: 1fr;
  }

  .refax-sheet-info-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   APLICACIONES PRODUCTO - MODAL V1
   ========================================================== */

.catalog-applications-modal {
  width: min(1080px, calc(100vw - 36px));
  max-width: 1080px;
  max-height: calc(100vh - 36px);
}

.catalog-applications-modal-body {
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.catalog-applications-content {
  min-height: 90px;
}

.catalog-applications-modal .applications-title {
  margin-bottom: 12px;
}

.catalog-applications-modal .applications-list {
  display: grid;
  gap: 10px;
}

.catalog-applications-modal .application-card {
  margin: 0;
}

@media (max-width: 760px) {
  .catalog-applications-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .catalog-applications-modal-body {
    max-height: calc(100vh - 110px);
  }
}


/* ==============================================================
   FICHA UNICA FARIÑA / REFAX
   CABECERA DE FUENTES
   ============================================================== */

.unified-product-sheet {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 18px);
}

.unified-sheet-body {
  overflow-y: auto;
}

.unified-sheet-head {
  display: grid;
  grid-template-columns:
    minmax(180px, 1fr)
    auto
    auto;
  align-items: center;
  gap: 18px;
}

.unified-sheet-title {
  min-width: 0;
}

.unified-sheet-title > strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.unified-sheet-title > span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-sheet-source-tabs {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}

.unified-sheet-source-tab {
  min-width: 150px;
  min-height: 54px;
  padding: 8px 28px;

  border: 2px solid #111827;
  border-radius: 0;

  background: #f5f6f8;
  color: #111827;

  font-size: 22px;
  font-weight: 800;
  letter-spacing: .01em;

  cursor: pointer;
}

.unified-sheet-source-tab:hover {
  background: #eceff3;
}

.unified-sheet-source-tab.active {
  border-width: 4px;
  background: #ffffff;
}

.unified-sheet-close {
  align-self: start;
}

.unified-sheet-source[hidden] {
  display: none !important;
}

.unified-sheet-open-button {
  display: inline-flex;
  width: max-content;
  margin-top: 5px;
  white-space: nowrap;
}

.unified-sheet-stock-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  padding: 12px;
}

.unified-sheet-stock-item {
  display: flex;
  flex-direction: column;
  gap: 4px;

  min-height: 74px;
  padding: 10px 12px;

  border: 1px solid #dfe3e8;
  border-radius: 7px;

  background: #fff;
}

.unified-sheet-stock-item span {
  font-size: 11px;
  color: #667085;
}

.unified-sheet-stock-item strong {
  font-size: 21px;
  line-height: 1;
}

.unified-sheet-stock-item small {
  font-size: 10px;
  color: #667085;
}

.unified-sheet-transit {
  margin-top: 8px;
}

.unified-sheet-list {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.unified-sheet-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 9px 12px;

  border: 1px solid #e1e5eb;
  border-radius: 7px;

  background: #f8fafc;
}

.unified-sheet-list-row span {
  color: #667085;
  text-align: right;
}

.unified-sheet-applications {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.unified-sheet-applications
.refax-sheet-application {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.unified-sheet-applications
.refax-sheet-application small {
  flex-basis: 100%;
  color: #667085;
}

.unified-refax-product
+ .unified-refax-product {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #e5e7eb;
}

.unified-refax-product-title {
  display: inline-flex;

  margin-bottom: 10px;
  padding: 5px 10px;

  border-radius: 999px;

  background: #eef2f7;

  font-size: 12px;
  font-weight: 800;
}

.refax-static-applications {
  display: inline-block;

  font-size: 11px;
  color: #667085;

  white-space: nowrap;
}


/* Preparado para futura tercera pestaña ALSACIA.
   No se muestra hasta que exista data real. */

.unified-sheet-source-tab[data-unified-sheet-tab="alsacia"] {
  min-width: 150px;
}


@media (max-width: 900px) {

  .unified-sheet-head {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .unified-sheet-source-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .unified-sheet-source-tab {
    min-width: 125px;
    min-height: 44px;
    padding: 6px 18px;

    font-size: 17px;
  }

}


@media (max-width: 600px) {

  .unified-product-sheet {
    width: calc(100vw - 8px);
    max-height: calc(100vh - 8px);
  }

  .unified-sheet-head {
    gap: 8px;
  }

  .unified-sheet-source-tabs {
    gap: 3px;
  }

  .unified-sheet-source-tab {
    min-width: 105px;
    min-height: 40px;

    padding: 5px 12px;

    font-size: 15px;
  }

  .unified-sheet-stock-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .unified-sheet-list-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .unified-sheet-list-row span {
    text-align: left;
  }

}


/* Ficha Única V2:
   con una sola fuente no se muestra selector redundante. */

.unified-sheet-source-tabs[hidden] {
  display: none !important;
}



/* FICHA UNICA - HEADER COMPACTO V1 */

.unified-product-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.unified-sheet-head {
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.unified-sheet-title {
  min-width: 0;
}

.unified-sheet-title .refax-sheet-kicker {
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
}

.unified-sheet-title > strong {
  color: var(--blue);
}

.unified-sheet-title > span {
  color: #475569;
}

.unified-sheet-source-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;

  padding: 3px;

  border: 1px solid var(--line);
  border-radius: 7px;

  background: #f4f7fb;
}

.unified-sheet-source-tabs::before {
  content: "Fuente";

  padding: 0 6px 0 5px;

  color: #64748b;

  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.unified-sheet-source-tab {
  min-width: 82px;
  min-height: 32px;

  padding: 0 14px;

  border: 1px solid transparent;
  border-radius: 5px;

  background: transparent;
  color: var(--blue);

  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;

  box-shadow: none;
}

.unified-sheet-source-tab:hover {
  border-color: #cbd8ea;
  background: #e9f0fa;
}

.unified-sheet-source-tab.active {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;

  box-shadow: none;
}

.unified-sheet-close {
  align-self: center;

  min-height: 32px;
  padding: 0 12px;

  border: 1px solid var(--line);
  border-radius: 6px;

  background: #f4f7fb;
  color: var(--blue);

  font-size: 0.8rem;
  font-weight: 700;
}

.unified-sheet-close:hover {
  border-color: #cbd8ea;
  background: #e9f0fa;
}

@media (max-width: 900px) {
  .unified-sheet-source-tabs {
    justify-self: start;
  }
}

@media (max-width: 600px) {
  .unified-sheet-head {
    gap: 8px;
    padding: 9px 10px;
  }

  .unified-sheet-source-tabs {
    max-width: 100%;
  }

  .unified-sheet-source-tabs::before {
    padding-left: 3px;
    font-size: 0.68rem;
  }

  .unified-sheet-source-tab {
    min-width: 72px;
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.78rem;
  }
}


/* FICHA UNICA - SCROLL INTERNO V1 */

.unified-product-sheet {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 18px);
  overflow: hidden;
}

.unified-sheet-head {
  flex: 0 0 auto;
}

.unified-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}



/* =========================================================
   USUARIOS V2B - EDITOR MODAL GRANDE
   Solo presentación. No modifica lógica ni permisos.
   ========================================================= */

/*
 * El editor existente usa .admin-user-row.is-editing.
 * En V2B esa misma fila pasa a comportarse visualmente
 * como un diálogo grande centrado.
 */

.admin-users {
  max-height: min(64vh, 660px);
}

/* Estado normal: listado más cómodo. */
.admin-user-row:not(.is-editing) {
  padding-top: 11px;
  padding-bottom: 11px;
}

/* Editor grande. */
.admin-user-row.is-editing {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50000;

  width: min(1180px, 92vw);
  min-height: min(620px, 80vh);
  max-height: 88vh;

  transform: translate(-50%, -50%);

  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  align-items: stretch;
  gap: 12px;

  padding: 24px;

  overflow-x: hidden;
  overflow-y: auto;

  border: 1px solid #d6e0eb;
  border-radius: 16px;
  background: #ffffff;

  box-shadow:
    0 0 0 100vmax rgba(15, 23, 42, 0.46),
    0 24px 70px rgba(15, 23, 42, 0.28);
}

/* Título del editor. */
.admin-user-row.is-editing::before {
  content: "Editar usuario";

  grid-column: 1 / -1;
  grid-row: 1;

  display: block;

  padding: 0 0 16px;

  border-bottom: 1px solid #dce5ef;

  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.2;
}

/* Identidad / estado del usuario. */
.admin-user-row.is-editing > div:first-child {
  grid-column: 1 / 3;
  grid-row: 2;

  min-width: 0;
  padding: 4px 4px 10px;
}

.admin-user-row.is-editing > div:first-child strong {
  display: block;

  margin-bottom: 5px;

  color: var(--blue);
  font-size: 1.12rem;
  font-weight: 900;
}

.admin-user-row.is-editing > div:first-child span {
  font-size: 0.88rem;
  color: var(--muted);
}

/* Cerrar y eliminar en encabezado. */
.admin-user-row.is-editing .edit-user-button {
  grid-column: 4;
  grid-row: 2;

  width: 120px;
  min-width: 120px;

  justify-self: end;
  align-self: start;
}

.admin-user-row.is-editing .delete-user-button {
  grid-column: 3;
  grid-row: 2;

  width: 120px;
  min-width: 120px;

  justify-self: end;
  align-self: start;
}

/* Permisos: 4 columnas cómodas. */
.admin-user-row.is-editing .permission-check {
  min-width: 0;
  min-height: 54px;

  padding: 10px 14px;

  border: 1px solid #dfe7f0;
  border-radius: 9px;

  background: #f9fbfd;

  font-size: 0.9rem;
  line-height: 1.2;
}

.admin-user-row.is-editing .permission-check:hover {
  border-color: #bfd1e6;
  background: #f4f8fd;
}

.admin-user-row.is-editing .permission-check input[type="checkbox"] {
  flex: 0 0 19px;

  width: 19px;
  height: 19px;
}

/* Acceso operativo: visualmente separado de permisos. */
.admin-user-row.is-editing .access-check {
  margin-top: 8px;

  border-color: #cedaea;
  background: #f3f7fb;
}

.admin-user-row.is-editing .access-check select {
  width: 100%;
  min-width: 0;
  min-height: 36px;

  padding: 0 8px;

  border: 1px solid var(--line);
  border-radius: 6px;

  background: #fff;
}

/* Contraseña ocupa media fila. */
.admin-user-row.is-editing input[data-password-user] {
  grid-column: 1 / 3;
  grid-row: 6;

  width: 100%;
  max-width: none;

  min-height: 44px;

  padding: 0 12px;

  border-radius: 8px;
}

/* Acciones de contraseña. */
.admin-user-row.is-editing button[data-generate-password] {
  grid-column: 3;
  grid-row: 6;

  width: 100%;
}

.admin-user-row.is-editing button[data-set-password] {
  grid-column: 4;
  grid-row: 6;

  width: 100%;
}

/* Acciones operativas inferiores. */
.admin-user-row.is-editing button[data-unlock-user] {
  grid-column: 1;
  grid-row: 7;

  width: 100%;
}

.admin-user-row.is-editing button[data-toggle-user] {
  grid-column: 2;
  grid-row: 7;

  width: 100%;
}

/* Guardar: acción principal al extremo derecho. */
.admin-user-row.is-editing .save-user-button {
  grid-column: 4;
  grid-row: 7;

  width: 100%;
  min-height: 44px;

  font-size: 0.92rem;
}

/* Botones del editor con tamaño consistente. */
.admin-user-row.is-editing > button {
  min-height: 44px;
  border-radius: 8px;
}

/* Scroll discreto dentro del editor. */
.admin-user-row.is-editing::-webkit-scrollbar {
  width: 10px;
}

.admin-user-row.is-editing::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 10px;
  background: #c5d1df;
}


/* Pantalla intermedia. */
@media (max-width: 980px) {
  .admin-user-row.is-editing {
    width: 94vw;
    min-height: 0;
    max-height: 92vh;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    padding: 20px;
  }

  .admin-user-row.is-editing > div:first-child {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .admin-user-row.is-editing .edit-user-button,
  .admin-user-row.is-editing .delete-user-button {
    grid-column: auto;
    grid-row: auto;

    width: 100%;
    min-width: 0;

    justify-self: stretch;
  }

  .admin-user-row.is-editing input[data-password-user],
  .admin-user-row.is-editing button[data-generate-password],
  .admin-user-row.is-editing button[data-set-password],
  .admin-user-row.is-editing button[data-unlock-user],
  .admin-user-row.is-editing button[data-toggle-user],
  .admin-user-row.is-editing .save-user-button {
    grid-column: auto;
    grid-row: auto;

    width: 100%;
  }

  .admin-user-row.is-editing input[data-password-user] {
    grid-column: 1 / -1;
  }
}


/* Pantalla pequeña. */
@media (max-width: 620px) {
  .admin-user-row.is-editing {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);

    grid-template-columns: 1fr;

    padding: 16px;
    gap: 10px;

    border-radius: 12px;
  }

  .admin-user-row.is-editing::before,
  .admin-user-row.is-editing > div:first-child,
  .admin-user-row.is-editing .edit-user-button,
  .admin-user-row.is-editing .delete-user-button,
  .admin-user-row.is-editing .permission-check,
  .admin-user-row.is-editing input[data-password-user],
  .admin-user-row.is-editing button[data-generate-password],
  .admin-user-row.is-editing button[data-set-password],
  .admin-user-row.is-editing button[data-unlock-user],
  .admin-user-row.is-editing button[data-toggle-user],
  .admin-user-row.is-editing .save-user-button {
    grid-column: 1 / -1;
    grid-row: auto;

    width: 100%;
  }
}

/* USUARIOS V2B - EDITOR MODAL GRANDE */


/* =========================================================
   USUARIOS V2C - ALTURA AUTO
   ========================================================= */

.admin-user-row.is-editing {
  min-height: 0;
  height: auto;
  max-height: 88vh;
  padding-bottom: 22px;
}

/* USUARIOS V2C - ALTURA AUTO */


/* PURCHASE-COMPANY-AVG-UI-V1 */
#purchase-view .purchase-reviewed-header,
#provider-load-view .purchase-reviewed-header,
#purchase-view .provider-load-reviewed-cell,
#provider-load-view .provider-load-reviewed-cell {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  white-space: nowrap;
}

#purchase-view .provider-load-reviewed-cell input,
#provider-load-view .provider-load-reviewed-cell input {
  margin-left: auto;
  margin-right: auto;
}


/* PURCHASE-GRID-VISUAL-ALIGN-V1 */

/*
 * Compra sugerida y Carga proveedor:
 * misma escala tipográfica y misma densidad visual.
 */
#purchase-view .purchase-table-wrap th,
#purchase-view .purchase-table-wrap td,
#provider-load-view .provider-load-table th,
#provider-load-view .provider-load-table td {
  box-sizing: border-box;
  font-size: 0.82rem;
  line-height: 1.22;
  padding: 7px 6px;
}

/*
 * Carga proveedor tiene una columna adicional: Estado.
 * Distribución actualizada para las 13 columnas reales.
 */
#provider-load-view .provider-load-table th:nth-child(1),
#provider-load-view .provider-load-table td:nth-child(1) {
  width: 3.5%;
}

#provider-load-view .provider-load-table th:nth-child(2),
#provider-load-view .provider-load-table td:nth-child(2) {
  width: 9%;
}

#provider-load-view .provider-load-table th:nth-child(3),
#provider-load-view .provider-load-table td:nth-child(3) {
  width: 22%;
}

#provider-load-view .provider-load-table th:nth-child(4),
#provider-load-view .provider-load-table td:nth-child(4) {
  width: 8%;
}

/* Prom base, Prom empresa, Stock suc, ref y tránsito */
#provider-load-view .provider-load-table th:nth-child(5),
#provider-load-view .provider-load-table td:nth-child(5),
#provider-load-view .provider-load-table th:nth-child(6),
#provider-load-view .provider-load-table td:nth-child(6),
#provider-load-view .provider-load-table th:nth-child(7),
#provider-load-view .provider-load-table td:nth-child(7),
#provider-load-view .provider-load-table th:nth-child(8),
#provider-load-view .provider-load-table td:nth-child(8),
#provider-load-view .provider-load-table th:nth-child(9),
#provider-load-view .provider-load-table td:nth-child(9) {
  width: 6.3%;
  text-align: center;
}

/* Sugerido */
#provider-load-view .provider-load-table th:nth-child(10),
#provider-load-view .provider-load-table td:nth-child(10) {
  width: 6%;
  text-align: center;
}

/* Estado */
#provider-load-view .provider-load-table th:nth-child(11),
#provider-load-view .provider-load-table td:nth-child(11) {
  width: 7%;
}

/* Revisado */
#provider-load-view .provider-load-table th:nth-child(12),
#provider-load-view .provider-load-table td:nth-child(12) {
  width: 3.5%;
  text-align: center;
}

/* Acciones */
#provider-load-view .provider-load-table th:nth-child(13),
#provider-load-view .provider-load-table td:nth-child(13) {
  width: 9.5%;
}

/* Evita que encabezados largos se monten entre sí. */
#provider-load-view .provider-load-table thead th {
  line-height: 1.15;
}


/* PURCHASE-HEADERS-UPPERCASE-V1 */
#purchase-view .purchase-table-wrap thead th,
#provider-load-view .provider-load-table thead th {
  text-transform: uppercase;
}


/* ==========================================================
   COMMERCIAL SELLER BRAND MATRIX V1
   CANDIDATE ONLY
   ========================================================== */

.commercial-matrix-shell {
  overflow: auto;
  max-height: 72vh;
  width: 100%;
}

.commercial-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

.commercial-matrix-table th,
.commercial-matrix-table td {
  white-space: nowrap;
  min-width: 108px;
  font-variant-numeric: tabular-nums;
}

.commercial-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface, #ffffff);
}

.commercial-matrix-table .commercial-matrix-brand {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 180px;
  max-width: 240px;
  text-align: left;
  background: var(--surface, #ffffff);
}

.commercial-matrix-table thead .commercial-matrix-brand {
  z-index: 5;
}

.commercial-matrix-table tfoot th,
.commercial-matrix-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  font-weight: 700;
  background: var(--surface, #ffffff);
}

.commercial-matrix-table tfoot .commercial-matrix-brand {
  z-index: 5;
}

.commercial-matrix-table .commercial-matrix-total {
  font-weight: 700;
}

.commercial-matrix-table .commercial-matrix-negative {
  font-weight: 700;
}

.commercial-matrix-seller {
  min-width: 130px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* COMMERCIAL_SELLER_BRAND_MATRIX_FRONTEND_V1 */



/* ==========================================================
   COMMERCIAL SELLER BRAND MATRIX HEADERS V2
   Legibilidad + encabezados fijos
   ========================================================== */

/* Encabezado superior: vendedores */
.commercial-matrix-table thead th {
  color: #ffffff;
  background: var(--blue, #24578a);
  font-weight: 700;
  font-size: 0.76rem;
  line-height: 1.15;
  text-align: center;
  vertical-align: middle;
  padding: 9px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

/* Nombres de vendedor: permitir 2 líneas */
.commercial-matrix-table thead .commercial-matrix-seller {
  color: #ffffff;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  min-width: 125px;
  max-width: 150px;
}

/* Esquina superior izquierda */
.commercial-matrix-table thead .commercial-matrix-brand {
  color: #ffffff;
  background: var(--blue, #24578a);
  min-width: 205px;
  max-width: 240px;
}

/* Marcas de cada fila */
.commercial-matrix-table tbody .commercial-matrix-brand {
  color: #27364a;
  background: #f7f9fc;
  font-weight: 700;
  font-size: 0.78rem;
  min-width: 205px;
  max-width: 240px;
  border-right: 1px solid #dce4ee;
}

/* Valores de la matriz */
.commercial-matrix-table tbody td {
  color: var(--ink, #1f2937);
}

/* Negativos siempre visibles */
.commercial-matrix-table tbody td.commercial-matrix-negative {
  color: #b42318;
  font-weight: 700;
}

/* Columna Total marca */
.commercial-matrix-table thead .commercial-matrix-total {
  position: sticky;
  right: 0;
  z-index: 6;
  color: #ffffff;
  background: var(--blue, #24578a);
}

.commercial-matrix-table tbody .commercial-matrix-total {
  position: sticky;
  right: 0;
  z-index: 2;
  color: #27364a;
  background: #eef3f8;
  font-weight: 700;
  border-left: 1px solid #d5dfeb;
}

/* Fila Total vendedor */
.commercial-matrix-table tfoot th,
.commercial-matrix-table tfoot td {
  color: #27364a;
  background: #eaf0f7;
  font-weight: 700;
  border-top: 2px solid #b8c8da;
}

/* Esquina inferior izquierda */
.commercial-matrix-table tfoot .commercial-matrix-brand {
  color: #27364a;
  background: #eaf0f7;
}

/* Gran total inferior derecho */
.commercial-matrix-table tfoot .commercial-matrix-total {
  position: sticky;
  right: 0;
  z-index: 6;
  color: #27364a;
  background: #dfe8f2;
}

/* Evitar que encabezado sticky sea tapado */
.commercial-matrix-table thead th {
  z-index: 4;
}

.commercial-matrix-table thead .commercial-matrix-brand {
  z-index: 7;
}


/* COMMERCIAL_SELLER_BRAND_MATRIX_HEADERS_V2 */



/* ==========================================================
   COMMERCIAL SELLER BRAND MATRIX DIMENSIONS V3
   ========================================================== */

.commercial-matrix-table {
  table-layout: auto !important;
}

/* Primera columna: marca */
.commercial-matrix-table .commercial-matrix-brand {
  width: 185px !important;
  min-width: 185px !important;
  max-width: 185px !important;
  box-sizing: border-box;
  text-align: left !important;
  padding-left: 10px !important;
}

/* Columnas de vendedores */
.commercial-matrix-table thead .commercial-matrix-seller {
  width: 95px !important;
  min-width: 95px !important;
  max-width: 95px !important;
  box-sizing: border-box;
  white-space: normal !important;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 0.71rem;
}

.commercial-matrix-table tbody td:not(.commercial-matrix-total),
.commercial-matrix-table tfoot td:not(.commercial-matrix-total) {
  width: 95px !important;
  min-width: 95px !important;
  max-width: 95px !important;
  box-sizing: border-box;
  padding-left: 6px;
  padding-right: 6px;
  font-size: 0.72rem;
}

/* Total marca */
.commercial-matrix-table .commercial-matrix-total {
  width: 125px !important;
  min-width: 125px !important;
  max-width: 125px !important;
  box-sizing: border-box;
}

/* Etiquetas de marca */
.commercial-matrix-table tbody .commercial-matrix-brand {
  font-size: 0.74rem;
  line-height: 1.15;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

/* Total vendedor no debe mezclarse con el primer monto */
.commercial-matrix-table tfoot .commercial-matrix-brand {
  white-space: nowrap !important;
  font-size: 0.74rem;
}


/* COMMERCIAL_SELLER_BRAND_MATRIX_DIMENSIONS_V3 */



/* ==========================================================
   COMMERCIAL SELLER BRAND MATRIX SCROLL V4
   31+ vendedores: matriz ancha con scroll horizontal
   ========================================================== */

.commercial-matrix-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 72vh;
  position: relative;
}

/*
 * La tabla NO debe intentar entrar completa en el viewport.
 * Su ancho depende del número de vendedores.
 */
.commercial-matrix-table {
  width: max-content !important;
  min-width: max-content !important;
  table-layout: fixed !important;
}

/* Marca fija */
.commercial-matrix-table .commercial-matrix-brand {
  width: 190px !important;
  min-width: 190px !important;
  max-width: 190px !important;
  position: sticky;
  left: 0;
  box-sizing: border-box;
}

/* Cada vendedor conserva ancho legible */
.commercial-matrix-table thead .commercial-matrix-seller,
.commercial-matrix-table tbody td:not(.commercial-matrix-total),
.commercial-matrix-table tfoot td:not(.commercial-matrix-total) {
  width: 125px !important;
  min-width: 125px !important;
  max-width: 125px !important;
  box-sizing: border-box;
}

/* Nombre vendedor hasta 2 líneas */
.commercial-matrix-table thead .commercial-matrix-seller {
  white-space: normal !important;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Importes en una línea */
.commercial-matrix-table tbody td,
.commercial-matrix-table tfoot td {
  white-space: nowrap !important;
  text-align: right;
}

/*
 * Total marca queda al final natural de la matriz.
 * No lo dejamos sticky a la derecha porque con 31 vendedores
 * taparía columnas mientras se navega horizontalmente.
 */
.commercial-matrix-table .commercial-matrix-total {
  position: static !important;
  width: 135px !important;
  min-width: 135px !important;
  max-width: 135px !important;
}

/* Header fijo al bajar */
.commercial-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Esquina superior izquierda por encima de todo */
.commercial-matrix-table thead .commercial-matrix-brand {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 8;
}

/* Primera columna fija durante scroll horizontal */
.commercial-matrix-table tbody .commercial-matrix-brand {
  position: sticky;
  left: 0;
  z-index: 3;
}

/* Total vendedor permanece visible al bajar */
.commercial-matrix-table tfoot th,
.commercial-matrix-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 4;
}

.commercial-matrix-table tfoot .commercial-matrix-brand {
  position: sticky;
  left: 0;
  bottom: 0;
  z-index: 8;
}


/* COMMERCIAL_SELLER_BRAND_MATRIX_SCROLL_V4 */


:root {

  color-scheme: light;

  /* Identidad corporativa */
  --ui-brand-primary: var(--blue);
  --ui-brand-primary-dark: var(--blue-dark);

  /* Superficies */
  --ui-bg: #f4f7fb;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f8fafc;
  --ui-surface-hover: #f3f6fb;
  --ui-surface-selected: #eef4ff;

  /* Texto */
  --ui-text: #172033;
  --ui-text-secondary: #667085;
  --ui-text-muted: #8993a4;

  /* Estructura */
  --ui-border: #dfe6ef;
  --ui-border-strong: #c9d5e3;

  /* Acciones */
  --ui-action-bg: var(--ui-brand-primary);
  --ui-action-bg-hover: var(--ui-brand-primary-dark);
  --ui-action-text: #ffffff;

  /* Marca suave */
  --ui-brand-soft: #eef4ff;

  /* Estados funcionales */
  --ui-success: #15803d;
  --ui-warning: #d97706;
  --ui-danger: #b42318;

  /* Forma */
  --ui-radius-sm: 6px;
  --ui-radius-md: 8px;
  --ui-radius-lg: 10px;

  /* Elevación */
  --ui-shadow-soft:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 4px 14px rgba(16, 24, 40, 0.05);

  /* Tipografía */
  --ui-font:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;
}



/* ==========================================================
   3. CATALOGO - BASE
   ========================================================== */

#catalog-view {
  font-family: var(--ui-font);
  color: var(--ui-text);
}


/* ==========================================================
   4. CABECERA / MARCA
   ========================================================== */

#catalog-view .search-band {
  padding: 22px 24px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-soft);
}

#catalog-view .brand-row {
  gap: 18px;
  margin-bottom: 18px;
}

#catalog-view .brand-lockup {
  gap: 14px;
}

#catalog-view .brand-logo {
  width: 56px;
  height: 56px;
}

#catalog-view h1 {
  margin: 0;
  color: var(--ui-text);
  font-family: var(--ui-font);
  font-size: 1.82rem;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.025em;
}

#catalog-view .metric {
  padding: 8px 11px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-brand-soft);
  color: var(--ui-brand-primary);
  font-size: 0.82rem;
  font-weight: 650;
}


/* ==========================================================
   5. BUSCADOR PRINCIPAL
   ========================================================== */

#catalog-view .global-search {
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 10px;
  margin-bottom: 16px;
}

#catalog-view .global-search input {
  height: 48px;
  padding: 0 16px;

  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-md);

  outline: none;

  background: var(--ui-surface);
  color: var(--ui-text);

  font-family: var(--ui-font);
  font-size: 0.94rem;
  font-weight: 400;

  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background-color 120ms ease;
}

#catalog-view .global-search input::placeholder {
  color: var(--ui-text-muted);
}

#catalog-view .global-search input:focus,
#catalog-view .filters input:focus,
#catalog-view select:focus {
  border-color: var(--ui-brand-primary);
  box-shadow: 0 0 0 3px rgba(31, 78, 120, 0.12);
}


/* ==========================================================
   6. INPUTS / SELECTS
   ========================================================== */

#catalog-view input,
#catalog-view select {
  font-family: var(--ui-font);
}

#catalog-view .filters input,
#catalog-view .filters select,
#catalog-view .vehicle-context-form input,
#catalog-view .vehicle-context-form select {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text);
}


/* ==========================================================
   7. MODOS / TABS INTERNOS
   ========================================================== */

#catalog-view .search-mode,
#catalog-view .view-mode {
  padding: 3px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface-soft);
}

#catalog-view .mode-button {
  min-height: 34px;
  padding: 0 12px;

  border: 0;
  border-radius: var(--ui-radius-sm);

  background: transparent;
  color: var(--ui-brand-primary);

  font-family: var(--ui-font);
  font-size: 0.82rem;
  font-weight: 600;

  transition:
    background-color 120ms ease,
    color 120ms ease;
}

#catalog-view .mode-button:hover {
  background: var(--ui-surface-hover);
}

#catalog-view .mode-button.active {
  background: var(--ui-action-bg);
  color: var(--ui-action-text);
}


/* ==========================================================
   8. VEHICULO CONSULTADO
   ========================================================== */

#catalog-view .vehicle-context-panel {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
}

#catalog-view .vehicle-context-head {
  color: var(--ui-text);
  font-family: var(--ui-font);
  font-weight: 650;
}

#catalog-view .vehicle-context-status {
  color: var(--ui-text-secondary);
}


/* ==========================================================
   9. RESULTADOS
   ========================================================== */

#catalog-view .result-panel {
  border-color: var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: var(--ui-surface);
}

#catalog-view .result-toolbar {
  color: var(--ui-text-secondary);
}

#catalog-view .result-toolbar strong {
  color: var(--ui-text);
}

#catalog-view .table-wrap {
  border-color: var(--ui-border);
}


/* ==========================================================
   10. TABLA
   ========================================================== */

#catalog-view table {
  font-family: var(--ui-font);
  font-size: 0.84rem;
}

#catalog-view thead th {
  background: var(--ui-brand-primary);
  color: #ffffff;

  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.015em;

  border-color: var(--ui-brand-primary-dark);
}

#catalog-view tbody td {
  background: var(--ui-surface);
  color: var(--ui-text);
  border-color: var(--ui-border);
}

#catalog-view tbody tr:hover td {
  background: var(--ui-surface-hover);
}


/* ==========================================================
   11. BOTONES
   ========================================================== */

#catalog-view button {
  font-family: var(--ui-font);
  font-weight: 600;
}

#catalog-view button.primary {
  border-color: var(--ui-action-bg);
  border-radius: var(--ui-radius-sm);

  background: var(--ui-action-bg);
  color: var(--ui-action-text);
}

#catalog-view button.primary:hover {
  border-color: var(--ui-action-bg-hover);
  background: var(--ui-action-bg-hover);
}

#catalog-view button.ghost {
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);

  background: var(--ui-surface);
  color: var(--ui-brand-primary);
}

#catalog-view button.ghost:hover {
  border-color: var(--ui-brand-primary);
  background: var(--ui-brand-soft);
}

#catalog-view .result-actions {
  gap: 6px;
}

#catalog-view .result-actions button {
  min-height: 32px;
}


/* ==========================================================
   12. ESTADOS VACIOS / TEXTO SECUNDARIO
   ========================================================== */

#catalog-view .empty,
#catalog-view #result-hint,
#catalog-view .compact {
  color: var(--ui-text-secondary);
}



/* ==========================================================
   14. PRINT SIEMPRE CLARO
   ========================================================== */


/* ==========================================================
   FARINA UI V1.1
   VEHICLE HEADER CONTRAST FIX
   Mantener azul corporativo Fariña.
   ========================================================== */

#catalog-view .vehicle-context-head {
  color: #ffffff;
}

#catalog-view .vehicle-context-head strong,
#catalog-view .vehicle-context-head span {
  color: #ffffff;
}

#catalog-view .vehicle-context-status {
  color: #ffffff;
}


/* ==========================================================
   FARINA UI LIGHT
   MANTENIMIENTOS M2
   FICHA CLIENTE / PROVEEDOR

   Objetivo:
   unificar esta pantalla con el lenguaje aprobado
   en Ventas > Catalogo.

   Identidad:
   azul Fariña + blanco + gris claro.
   Verde y rojo permanecen como colores funcionales.
   ========================================================== */


/* ----------------------------------------------------------
   CONTEXTO GENERAL
   ---------------------------------------------------------- */

#maintenance-view {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  color: #172033;
}


/* ----------------------------------------------------------
   TABS DE MANTENIMIENTOS
   ---------------------------------------------------------- */

#maintenance-view .dashboard-tabs {
  gap: 6px;
}

#maintenance-view .dashboard-tabs button {
  min-height: 34px;
  padding: 0 13px;

  border: 1px solid #dfe6ef;
  border-radius: 6px;

  background: #eef4fa;
  color: var(--blue);

  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 650;
}

#maintenance-view .dashboard-tabs button:hover {
  border-color: #c9d5e3;
  background: #e5eef7;
}

#maintenance-view .dashboard-tabs button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}


/* ----------------------------------------------------------
   PANEL GENERAL
   ---------------------------------------------------------- */

#maintenance-view .maintenance-party-panel {
  background: transparent;
}

#maintenance-view .party-layout {
  gap: 14px;
}


/* ----------------------------------------------------------
   TARJETA PRINCIPAL
   ---------------------------------------------------------- */

#party-form {
  overflow: hidden;

  border: 1px solid #dfe6ef;
  border-radius: 9px;

  background: #ffffff;

  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 4px 14px rgba(16, 24, 40, 0.05);
}


/* ----------------------------------------------------------
   CABECERA FICHA
   ---------------------------------------------------------- */

#party-form .master-file-header {
  padding: 14px 16px;

  border: 0;
  border-radius: 0;

  background: var(--blue);
  color: #ffffff;
}

#party-form .master-file-eyebrow,
#party-form .master-file-title-block,
#party-form .master-file-title-block strong,
#party-form .master-file-summary,
#party-form .master-file-summary span,
#party-form .master-file-badges,
#party-form .master-file-badge {
  color: #ffffff;
}

#party-form .master-file-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.035em;
}

#party-form #party-form-title {
  color: #ffffff;

  font-size: 1rem;
  line-height: 1.2;
  font-weight: 700;
}

#party-form .master-file-summary {
  margin-top: 4px;

  font-size: 0.76rem;
  line-height: 1.35;
}


/* Badges sobre cabecera azul */

#party-form .master-file-badge {
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 5px;

  background: rgba(255, 255, 255, 0.12);

  font-size: 0.68rem;
  font-weight: 650;
}


/* ----------------------------------------------------------
   ACCIONES SUPERIORES
   ---------------------------------------------------------- */

#party-form .master-file-actions {
  gap: 7px;
}

#party-form .master-file-actions button {
  min-height: 34px;
  padding: 0 13px;

  border-radius: 6px;

  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 650;
}


/* Leer: acción operativa principal */

#party-form #party-read-top {
  border: 1px solid rgba(255, 255, 255, 0.55);

  background: #ffffff;
  color: var(--blue);
}

#party-form #party-read-top:hover {
  background: #f4f7fb;
}


/* Buscar / Nueva ficha / Cerrar */

#party-form #party-search-top,
#party-form #party-new-top,
#party-form #party-form-reset {
  border: 1px solid rgba(255, 255, 255, 0.72);

  background: rgba(255, 255, 255, 0.96);
  color: var(--blue);
}

#party-form #party-search-top:hover,
#party-form #party-new-top:hover,
#party-form #party-form-reset:hover {
  background: #eef4ff;
}


/* Guardar mantiene semántica verde */

#party-form #party-save-top {
  border-color: #15803d;

  background: #16a34a;
  color: #ffffff;
}

#party-form #party-save-top:hover {
  border-color: #166534;
  background: #15803d;
}


/* ----------------------------------------------------------
   SECCIONES
   ---------------------------------------------------------- */

#party-form .party-section {
  margin: 12px 10px;

  overflow: hidden;

  border: 1px solid #dfe6ef;
  border-radius: 7px;

  background: #ffffff;
}


/* Cambiamos azul marino heredado por azul Fariña */

#party-form .party-section-head {
  min-height: 32px;
  padding: 0 10px;

  border: 0;

  background: var(--blue);
  color: #ffffff;

  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

#party-form .party-section-head strong,
#party-form .party-section-head span {
  color: #ffffff;
}


/* ----------------------------------------------------------
   CAMPOS
   ---------------------------------------------------------- */

#party-form label {
  color: #344054;

  font-size: 0.72rem;
  font-weight: 600;
}

#party-form input,
#party-form select,
#party-form textarea {
  border: 1px solid #d5dee9;
  border-radius: 5px;

  background: #ffffff;
  color: #172033;

  font-family: inherit;
  font-size: 0.82rem;

  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}

#party-form input,
#party-form select {
  min-height: 36px;
}

#party-form textarea {
  min-height: 40px;
}

#party-form input::placeholder,
#party-form textarea::placeholder {
  color: #98a2b3;
}

#party-form input:focus,
#party-form select:focus,
#party-form textarea:focus {
  outline: none;

  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.10);
}


/* ----------------------------------------------------------
   BOTONES GENERALES SECUNDARIOS
   ---------------------------------------------------------- */

#party-form button.ghost,
#party-form .master-add-button {
  border: 1px solid #c9d5e3;
  border-radius: 5px;

  background: #ffffff;
  color: var(--blue);

  font-family: inherit;
  font-weight: 650;
}

#party-form button.ghost:hover,
#party-form .master-add-button:hover {
  border-color: var(--blue);

  background: #eef4ff;
  color: var(--blue);
}


/* ----------------------------------------------------------
   AGREGAR CONTACTO / DIRECCION
   ---------------------------------------------------------- */

#party-form #party-contact-add,
#party-form #party-address-add {
  border: 1px solid rgba(255, 255, 255, 0.78);

  background: #ffffff;
  color: var(--blue);

  font-weight: 650;
}

#party-form #party-contact-add:hover,
#party-form #party-address-add:hover {
  background: #eef4ff;
}


/* ----------------------------------------------------------
   CONTACTOS / DIRECCIONES
   ---------------------------------------------------------- */

#party-form .party-contact-list,
#party-form .party-address-list {
  background: #ffffff;
}

#party-form .party-contact-header,
#party-form .party-address-header {
  color: #344054;

  font-size: 0.67rem;
  font-weight: 700;
}


/* ----------------------------------------------------------
   ROLES CLIENTE / PROVEEDOR
   ---------------------------------------------------------- */

#party-form .party-role-box {
  border-color: #dfe6ef;
  background: #f8fafc;
}

#party-form .party-role-box label {
  color: #344054;
}


/* ----------------------------------------------------------
   MENSAJES / TEXTO SECUNDARIO
   ---------------------------------------------------------- */

#party-form .muted,
#party-form #party-message {
  color: #667085;
}


/* ----------------------------------------------------------
   ACCIONES DE ELIMINACIÓN
   Mantener rojo funcional.
   ---------------------------------------------------------- */

#party-form button.danger,
#party-form [data-action="remove"],
#party-form [data-action="delete"] {
  border-color: #f3c7c3;

  background: #fff7f6;
  color: #b42318;
}

#party-form button.danger:hover,
#party-form [data-action="remove"]:hover,
#party-form [data-action="delete"]:hover {
  border-color: #e69a93;

  background: #feeceb;
  color: #912018;
}


/* ----------------------------------------------------------
   FILAS Y SEPARADORES
   ---------------------------------------------------------- */

#party-form .party-read-row,
#party-form .party-form-grid,
#party-form .party-credit-grid {
  border-color: #e5ebf2;
}


/* ----------------------------------------------------------
   CHECKBOXES
   ---------------------------------------------------------- */

#party-form input[type="checkbox"] {
  min-height: auto;

  accent-color: var(--blue);
}


/* ----------------------------------------------------------
   RESPONSIVE
   No alteramos estructura.
   Solo evitamos desbordes visuales.
   ---------------------------------------------------------- */

#maintenance-view *,
#maintenance-view *::before,
#maintenance-view *::after {
  box-sizing: border-box;
}



/* ==========================================================
   FARINA UI LIGHT V2
   M3 - CORPORATE VISUAL REFINEMENT

   Principio:
   - Azul Fariña fuerte: estados activos y acciones principales.
   - Azul Fariña suavizado: superficies grandes.
   - Blanco/gris: superficie dominante.
   - Verde: guardar / éxito.
   - Rojo: eliminar / error.
   ========================================================== */


#maintenance-view {
  --farina-ui-blue-strong: var(--blue);

  /* Azul corporativo suavizado para superficies grandes */
  --farina-ui-blue-band: #2f5fbd;
  --farina-ui-blue-band-hover: #2954a7;

  --farina-ui-blue-soft: #eef4fb;
  --farina-ui-blue-softer: #f5f8fc;

  --farina-ui-border: #dbe4ef;
  --farina-ui-border-strong: #c7d4e3;

  --farina-ui-ink: #172033;
  --farina-ui-muted: #667085;
}


/* ==========================================================
   A. FICHA CLIENTE / PROVEEDOR
   Reducir masa de azul intenso
   ========================================================== */


/* Header grande:
   mantiene identidad azul, pero menos saturada.
*/

#party-form .master-file-header {
  background: var(--farina-ui-blue-band);
}


/* Barras de sección:
   mismo azul corporativo calmado.
*/

#party-form .party-section-head {
  background: var(--farina-ui-blue-band);
}


/* Hover de acciones de cabecera */

#party-form #party-read-top:hover,
#party-form #party-search-top:hover,
#party-form #party-new-top:hover,
#party-form #party-form-reset:hover {
  background: #f5f8fc;
}


/* Botones Agregar:
   quedan secundarios y no compiten con el header.
*/

#party-form #party-contact-add,
#party-form #party-address-add {
  border-color: #d7e1ec;

  background: #ffffff;
  color: var(--blue);
}


/* ==========================================================
   B. FICHA DE PRODUCTO
   Base corporativa
   ========================================================== */

#maintenance-view .product-sheet-panel {
  color: var(--farina-ui-ink);
}


/* ----------------------------------------------------------
   CABECERA PRINCIPAL
   ---------------------------------------------------------- */

#maintenance-view .product-sheet-title-card {
  border: 1px solid var(--farina-ui-border);
  border-radius: 8px;

  background: #ffffff;

  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.035);
}


#maintenance-view .product-sheet-title {
  color: var(--farina-ui-ink);
}


#maintenance-view #product-sheet-title-code {
  color: var(--blue);
}


#maintenance-view #product-sheet-title-description {
  color: var(--farina-ui-ink);
}


/* Icono / indicador visual */

#maintenance-view .product-sheet-icon {
  border-color: var(--farina-ui-border-strong);

  background: var(--farina-ui-blue-softer);
  color: var(--blue);
}


/* Buscar producto */

#maintenance-view .product-sheet-search-open {
  border: 1px solid var(--farina-ui-border-strong);
  border-radius: 6px;

  background: #ffffff;
  color: var(--blue);

  font-weight: 650;
}

#maintenance-view .product-sheet-search-open:hover {
  border-color: var(--blue);

  background: var(--farina-ui-blue-soft);
}


/* ==========================================================
   C. ACCIONES FICHA PRODUCTO
   ========================================================== */

#maintenance-view .product-sheet-actions {
  gap: 6px;
}


#maintenance-view .product-action {
  border-radius: 6px;

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-weight: 650;
}


/* Leer:
   acción principal operativa.
*/

#maintenance-view .product-action-read {
  border-color: var(--blue);

  background: var(--blue);
  color: #ffffff;
}

#maintenance-view .product-action-read:hover {
  background: var(--blue-dark);
}


/* Grabar:
   verde se conserva por significado.
*/

#maintenance-view .product-action-save {
  border-color: #15803d;

  background: #16a34a;
  color: #ffffff;
}

#maintenance-view .product-action-save:hover {
  border-color: #166534;
  background: #15803d;
}


/* Historial deja de ser naranja:
   no es una advertencia.
*/

#maintenance-view .product-action-history {
  border: 1px solid var(--farina-ui-border-strong);

  background: #ffffff;
  color: var(--blue);
}

#maintenance-view .product-action-history:hover {
  border-color: var(--blue);

  background: var(--farina-ui-blue-soft);
}


/* Secundarias:
   Cancelar, Salir, etc.
*/

#maintenance-view .product-action-secondary {
  border: 1px solid var(--farina-ui-border-strong);

  background: #ffffff;
  color: #344054;
}

#maintenance-view .product-action-secondary:hover {
  border-color: #9fb0c3;

  background: #f6f8fb;
}


/* Eliminar conserva semántica roja */

#maintenance-view .product-action-delete {
  border-color: #dc2626;

  background: #dc2626;
  color: #ffffff;
}

#maintenance-view .product-action-delete:hover {
  border-color: #b91c1c;

  background: #b91c1c;
}


/* ==========================================================
   D. TABS DE FICHA DE PRODUCTO
   Quitar arcoiris
   ========================================================== */

#maintenance-view .product-sheet-tabs {
  gap: 6px;
}


/* Todas las pestañas comienzan neutras */

#maintenance-view .product-sheet-tabs > button {
  border: 1px solid var(--farina-ui-border);
  border-radius: 6px;

  background: var(--farina-ui-blue-soft);
  color: var(--blue);

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-weight: 650;

  box-shadow: none;
}


#maintenance-view .product-sheet-tabs > button:hover {
  border-color: var(--farina-ui-border-strong);

  background: #e3edf8;
  color: var(--blue-dark);
}


/* Activa:
   azul Fariña corporativo.
*/

#maintenance-view .product-sheet-tabs > button.active {
  border-color: var(--blue);

  background: var(--blue);
  color: #ffffff;
}


#maintenance-view .product-sheet-tabs > button.active:hover {
  border-color: var(--blue-dark);

  background: var(--blue-dark);
  color: #ffffff;
}


/* ==========================================================
   E. CABECERAS INTERNAS FICHA PRODUCTO
   Unificar los colores por categoría
   ========================================================== */

/*
   Antes:
   green / orange / purple / cyan / pink.

   Ahora:
   todas pertenecen a la misma familia Fariña.
*/

#maintenance-view .product-sheet-panel .product-card-head,
#maintenance-view .product-card-head-blue,
#maintenance-view .product-card-head-green,
#maintenance-view .product-card-head-orange,
#maintenance-view .product-card-head-purple,
#maintenance-view .product-card-head-cyan,
#maintenance-view .product-card-head-pink,
#maintenance-view .product-card-head-slate {
  background: var(--farina-ui-blue-band);
  color: #ffffff;
}


/* Texto de las cabeceras */

#maintenance-view .product-card-head strong,
#maintenance-view .product-card-head span {
  color: #ffffff;
}


/* ==========================================================
   F. CARDS / TABLAS / PANELES
   ========================================================== */

#maintenance-view .product-sheet-table-card,
#maintenance-view .product-sheet-tab-panel {
  border-color: var(--farina-ui-border);

  background: #ffffff;
}


#maintenance-view .product-sheet-table {
  color: var(--farina-ui-ink);
}


#maintenance-view .product-sheet-table thead th {
  border-color: #d6e0eb;

  background: #f1f5fa;
  color: #344054;

  font-weight: 700;
}


#maintenance-view .product-sheet-table tbody td {
  border-color: #e2e8f0;

  background: #ffffff;
  color: var(--farina-ui-ink);
}


#maintenance-view .product-sheet-table tbody tr:hover td {
  background: #f7f9fc;
}


/* ==========================================================
   G. PLACEHOLDER
   ========================================================== */

#maintenance-view .product-sheet-placeholder {
  color: var(--farina-ui-muted);
}


/* ==========================================================
   H. ESTADOS FUNCIONALES
   NO neutralizar colores semánticos.
   ========================================================== */

#maintenance-view .success {
  color: #15803d;
}


/* ==========================================================
   I. GARANTIA:
   Los colores antiguos de categoría quedan anulados
   exclusivamente dentro de Ficha de Producto.
   ========================================================== */

#maintenance-view .product-sheet-main .product-card-head-green,
#maintenance-view .product-sheet-main .product-card-head-orange,
#maintenance-view .product-sheet-main .product-card-head-purple,
#maintenance-view .product-sheet-main .product-card-head-cyan,
#maintenance-view .product-sheet-main .product-card-head-pink {
  background: var(--farina-ui-blue-band);
}


/* ==========================================================
   FARINA UI - PRODUCT SHEET EXACT CODE E3
   ========================================================== */

#maintenance-view .product-sheet-exact-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  min-width: 0;
}


#maintenance-view #product-sheet-exact-code {
  width: 155px;
  min-height: 32px;

  padding: 0 10px;

  border: 1px solid var(--farina-ui-border-strong);
  border-radius: 6px;

  outline: none;

  background: #ffffff;
  color: var(--farina-ui-ink);

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-size: 0.8rem;
  font-weight: 600;
}


#maintenance-view #product-sheet-exact-code::placeholder {
  color: #8a94a6;
  font-weight: 500;
}


#maintenance-view #product-sheet-exact-code:focus {
  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.10);
}


#maintenance-view .product-sheet-exact-button {
  min-height: 32px;

  padding: 0 12px;

  border: 1px solid var(--blue);
  border-radius: 6px;

  background: var(--blue);
  color: #ffffff;

  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 650;
}


#maintenance-view .product-sheet-exact-button:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}


#maintenance-view .product-sheet-exact-button:disabled {
  opacity: 0.65;
  cursor: wait;
}


#maintenance-view .product-sheet-exact-message {
  max-width: 240px;

  color: var(--farina-ui-muted);

  font-size: 0.72rem;
  font-weight: 600;
}


#maintenance-view .product-sheet-exact-message.error {
  color: #b42318;
}


@media (max-width: 1100px) {

  #maintenance-view .product-sheet-exact-search {
    flex-wrap: wrap;
  }

  #maintenance-view .product-sheet-exact-message {
    flex-basis: 100%;
  }

}



/* ==========================================================
   FARINA UI - PRODUCT SEARCH MODAL P4
   Buscador flexible Ficha de Producto
   ========================================================== */


/* ----------------------------------------------------------
   MODAL
   ---------------------------------------------------------- */

#product-sheet-search-modal .product-search-modal {
  width: min(920px, calc(100vw - 48px));
  max-width: 920px;

  overflow: hidden;

  border: 1px solid #dbe4ef;
  border-radius: 10px;

  background: #ffffff;

  box-shadow:
    0 18px 50px rgba(16, 24, 40, 0.18),
    0 3px 10px rgba(16, 24, 40, 0.08);
}


/* ----------------------------------------------------------
   CABECERA
   ---------------------------------------------------------- */

#product-sheet-search-modal .stock-modal-head {
  min-height: 58px;

  padding: 14px 18px;

  border-bottom: 1px solid #e2e8f0;

  background: #ffffff;
}


#product-sheet-search-modal .stock-modal-head strong {
  color: #172033;

  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}


#product-sheet-search-modal #product-sheet-search-close {
  min-height: 34px;

  padding: 0 12px;

  border: 1px solid #d5dfeb;
  border-radius: 6px;

  background: #f5f8fc;
  color: var(--blue);

  font-weight: 650;
}


#product-sheet-search-modal #product-sheet-search-close:hover {
  border-color: #bfcddd;

  background: #eaf1f8;
}


/* ----------------------------------------------------------
   CUERPO
   ---------------------------------------------------------- */

#product-sheet-search-modal .stock-modal-body {
  padding: 16px 18px 18px;

  background: #ffffff;
}


/* ----------------------------------------------------------
   FORMULARIO DE BUSQUEDA
   ---------------------------------------------------------- */

#product-sheet-search-form {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 7px 8px;

  align-items: end;

  margin-bottom: 18px;
}


#product-sheet-search-form label {
  grid-column: 1 / -1;

  margin: 0;

  color: #667085;

  font-size: 0.76rem;
  font-weight: 600;
}


#product-sheet-query {
  width: 100%;
  height: 42px;

  padding: 0 12px;

  border: 1px solid #cbd7e4;
  border-radius: 7px;

  outline: none;

  background: #ffffff;
  color: #172033;

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-size: 0.86rem;

  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}


#product-sheet-query::placeholder {
  color: #98a2b3;
}


#product-sheet-query:focus {
  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.10);
}


#product-sheet-search-form button[type="submit"] {
  height: 42px;

  padding: 0 18px;

  border: 1px solid var(--blue);
  border-radius: 7px;

  background: var(--blue);
  color: #ffffff;

  font-size: 0.82rem;
  font-weight: 650;
}


#product-sheet-search-form button[type="submit"]:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}


/* ----------------------------------------------------------
   CABECERA RESULTADOS
   ---------------------------------------------------------- */

#product-sheet-search-modal .result-toolbar,
#product-sheet-search-modal .stock-modal-toolbar {
  min-height: 34px;

  margin-bottom: 7px;

  padding: 0;

  border: 0;

  background: transparent;
}


#product-sheet-search-modal .result-toolbar strong,
#product-sheet-search-modal .stock-modal-toolbar strong {
  color: var(--blue);

  font-size: 0.76rem;
  font-weight: 700;

  letter-spacing: 0.02em;
}


#product-sheet-result-count {
  color: #667085;

  font-size: 0.76rem;
  font-weight: 600;
}


/* ----------------------------------------------------------
   CONTENEDOR RESULTADOS
   ---------------------------------------------------------- */

#product-sheet-results {
  overflow: hidden;

  border: 1px solid #dbe4ef;
  border-radius: 7px;

  background: #ffffff;
}


/* ----------------------------------------------------------
   TABLA
   ---------------------------------------------------------- */

#product-sheet-results table {
  width: 100% !important;
  min-width: 0 !important;

  table-layout: fixed;

  border-collapse: collapse;

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;
}


#product-sheet-results thead th {
  height: 36px;

  padding: 0 10px;

  border-bottom: 1px solid #dbe4ef;

  background: #f2f6fb;
  color: #344054;

  font-size: 0.72rem;
  font-weight: 700;

  text-align: left;
}


#product-sheet-results tbody td {
  height: 42px;

  padding: 7px 10px;

  overflow: hidden;

  border-bottom: 1px solid #e5ebf2;

  background: #ffffff;
  color: #172033;

  font-size: 0.78rem;

  text-overflow: ellipsis;
  white-space: nowrap;
}


#product-sheet-results tbody tr:last-child td {
  border-bottom: 0;
}


/* ----------------------------------------------------------
   ANCHOS
   ---------------------------------------------------------- */

#product-sheet-results th:nth-child(1),
#product-sheet-results td:nth-child(1) {
  width: 18%;
}


#product-sheet-results th:nth-child(2),
#product-sheet-results td:nth-child(2) {
  width: 40%;
}


#product-sheet-results th:nth-child(3),
#product-sheet-results td:nth-child(3) {
  width: 16%;
}


#product-sheet-results th:nth-child(4),
#product-sheet-results td:nth-child(4) {
  width: 12%;
}


#product-sheet-results th:nth-child(5),
#product-sheet-results td:nth-child(5) {
  width: 14%;
}


/* ----------------------------------------------------------
   FILA HOVER
   ---------------------------------------------------------- */

#product-sheet-results .product-sheet-result:hover td {
  background: #f6f9fc;

  cursor: pointer;
}


/* ----------------------------------------------------------
   FILA SELECCIONADA
   Ya no azul sólido completo.
   ---------------------------------------------------------- */

#product-sheet-results .product-sheet-result.active td {
  background: #eef4ff;
  color: #172033;
}


#product-sheet-results .product-sheet-result.active td:first-child {
  box-shadow:
    inset 3px 0 0 var(--blue);
}


#product-sheet-results .product-sheet-result.active td strong {
  color: var(--blue);
}


/* Código */

#product-sheet-results td:first-child strong {
  color: #172033;

  font-weight: 700;
}


/* ----------------------------------------------------------
   ESTADO VACIO
   ---------------------------------------------------------- */

#product-sheet-results .cart-empty {
  padding: 20px 14px;

  border: 0;

  background: #ffffff;
  color: #667085;

  font-size: 0.82rem;

  text-align: center;
}


/* ----------------------------------------------------------
   ELIMINAR SCROLL HORIZONTAL LEGACY
   ---------------------------------------------------------- */

#product-sheet-search-modal .table-wrap,
#product-sheet-search-modal .product-sheet-table,
#product-sheet-search-modal .stock-modal-results {
  max-width: 100%;

  overflow-x: hidden;
}


/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 760px) {

  #product-sheet-search-modal .product-search-modal {
    width: calc(100vw - 20px);
  }


  #product-sheet-search-form {
    grid-template-columns: 1fr;
  }


  #product-sheet-search-form button[type="submit"] {
    width: 100%;
  }


  #product-sheet-results th:nth-child(4),
  #product-sheet-results td:nth-child(4),
  #product-sheet-results th:nth-child(5),
  #product-sheet-results td:nth-child(5) {
    display: none;
  }


  #product-sheet-results th:nth-child(1),
  #product-sheet-results td:nth-child(1) {
    width: 28%;
  }


  #product-sheet-results th:nth-child(2),
  #product-sheet-results td:nth-child(2) {
    width: 48%;
  }


  #product-sheet-results th:nth-child(3),
  #product-sheet-results td:nth-child(3) {
    width: 24%;
  }

}

/* ==========================================================
   FARINA UI LIGHT
   DARK MODE REMOVED - D1

   Fariña Light es el único tema productivo.
   La paleta corporativa y colores funcionales permanecen.
   ========================================================== */


/* ==========================================================
   FARINA UI LIGHT
   UNIFIED PRODUCT SHEET U2
   FICHA FARINA / REFAX
   ========================================================== */


/* ----------------------------------------------------------
   MODAL
   ---------------------------------------------------------- */

.unified-product-sheet {
  width: min(1040px, calc(100vw - 44px));
  max-width: 1040px;
  max-height: calc(100vh - 32px);

  overflow: hidden;

  border: 1px solid #d9e3ee;
  border-radius: 11px;

  background: #ffffff;

  box-shadow:
    0 20px 60px rgba(16, 24, 40, 0.20),
    0 4px 14px rgba(16, 24, 40, 0.08);
}


/* ----------------------------------------------------------
   CABECERA STICKY
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-head {
  position: sticky;
  top: 0;
  z-index: 5;

  min-height: 68px;

  padding: 12px 16px;

  border-bottom: 1px solid #dfe6ef;

  background: #ffffff;
}


.unified-product-sheet .unified-sheet-title {
  min-width: 0;
}


.unified-product-sheet .unified-sheet-title > span,
.unified-product-sheet .refax-sheet-kicker {
  color: #667085;

  font-size: 0.68rem;
  font-weight: 650;
}


.unified-product-sheet .unified-sheet-title strong {
  color: var(--blue);

  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 700;
}


.unified-product-sheet .unified-sheet-title small,
.unified-product-sheet .unified-sheet-title em {
  color: #344054;

  font-size: 0.82rem;
}


/* ----------------------------------------------------------
   CERRAR
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-close {
  min-height: 34px;

  padding: 0 12px;

  border: 1px solid #d5dfeb;
  border-radius: 6px;

  background: #f7f9fc;
  color: var(--blue);

  font-weight: 650;
}


.unified-product-sheet .unified-sheet-close:hover {
  border-color: #bdcad9;

  background: #edf3f8;
}


/* ----------------------------------------------------------
   SELECTOR FUENTE FARINA / REFAX
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-source-tabs {
  display: inline-flex;
  align-items: center;

  gap: 3px;

  padding: 3px;

  border: 1px solid #d9e3ee;
  border-radius: 7px;

  background: #f2f6fa;

  box-shadow: none;
}


.unified-product-sheet .unified-sheet-source-tabs::before {
  color: #667085;

  font-size: 0.68rem;
  font-weight: 600;
}


.unified-product-sheet .unified-sheet-source-tab {
  min-height: 31px;

  padding: 0 15px;

  border: 0;
  border-radius: 5px;

  background: transparent;
  color: var(--blue);

  font-size: 0.78rem;
  font-weight: 650;

  box-shadow: none;
}


.unified-product-sheet .unified-sheet-source-tab:hover {
  background: #e7eef7;
}


.unified-product-sheet .unified-sheet-source-tab.active {
  background: var(--blue);
  color: #ffffff;

  box-shadow: none;
}


/* ----------------------------------------------------------
   CUERPO
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-body,
.unified-product-sheet .refax-sheet-body {
  max-height: calc(100vh - 116px);

  overflow-y: auto;
  overflow-x: hidden;

  padding: 14px 16px 20px;

  background: #f5f7fa;
}


/* ----------------------------------------------------------
   SECCIONES
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-section {
  margin: 0 0 12px;

  overflow: hidden;

  border: 1px solid #dbe4ef;
  border-radius: 8px;

  background: #ffffff;

  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.025);
}


/*
  Neutralizamos cabeceras multicolor.
  Todas pasan a familia corporativa Fariña.
*/

.unified-product-sheet .refax-sheet-section > strong,
.unified-product-sheet .refax-sheet-section > header,
.unified-product-sheet .refax-sheet-section > .refax-sheet-section-head {
  color: #ffffff;
  background: #2f5fbd;
}


/*
  Si la sección ya usa un strong directo como barra,
  damos formato corporativo.
*/

.unified-product-sheet .refax-sheet-section > strong:first-child {
  display: block;

  min-height: 30px;

  padding: 7px 10px;

  color: #ffffff;
  background: #2f5fbd;

  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}


/* ----------------------------------------------------------
   DATOS / INFO GRID
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-info-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 12px 22px;

  padding: 12px;
}


.unified-product-sheet .refax-sheet-info-grid > div {
  min-width: 0;
}


.unified-product-sheet .refax-sheet-info-grid span {
  display: block;

  margin-bottom: 3px;

  color: #667085;

  font-size: 0.69rem;
  font-weight: 600;
}


.unified-product-sheet .refax-sheet-info-grid strong {
  display: block;

  color: #172033;

  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 650;
}


/* ----------------------------------------------------------
   FARINA: APROVECHAR EL ANCHO
   ---------------------------------------------------------- */

.unified-product-sheet
.unified-sheet-source[data-unified-sheet-source="farina"]
.refax-sheet-top-grid {
  grid-template-columns: minmax(0, 1fr);
}


/* ----------------------------------------------------------
   INFORMACION COMERCIAL / PRECIO
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-commercial {
  border-color: #dbe4ef;

  background: #ffffff;
}


.unified-product-sheet .refax-sheet-price {
  padding: 12px;

  background: #ffffff;
}


.unified-product-sheet .refax-sheet-price span {
  color: #667085;

  font-size: 0.72rem;
  font-weight: 600;
}


.unified-product-sheet .refax-sheet-price strong {
  display: block;

  margin-top: 3px;

  color: #172033;

  font-size: 1.55rem;
  line-height: 1.1;
  font-weight: 700;

  font-variant-numeric: tabular-nums;
}


/* ----------------------------------------------------------
   STOCK
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-stock {
  border-color: #dbe4ef;

  background: #ffffff;
}


.unified-product-sheet .refax-sheet-stock strong {
  color: var(--blue);

  font-variant-numeric: tabular-nums;
}


/* ----------------------------------------------------------
   UBICACIONES / LISTAS
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-list {
  display: grid;

  gap: 5px;

  padding: 9px;
}


.unified-product-sheet .unified-sheet-list-row {
  display: grid;

  grid-template-columns:
    minmax(110px, 0.45fr)
    minmax(0, 1fr);

  gap: 12px;

  align-items: center;

  min-height: 34px;

  padding: 6px 10px;

  border: 1px solid #e1e8f0;
  border-radius: 6px;

  background: #f8fafc;
}


.unified-product-sheet .unified-sheet-list-row:hover {
  border-color: #cdd9e6;

  background: #f3f7fb;
}


/* ----------------------------------------------------------
   APLICACIONES
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-applications {
  display: grid;

  gap: 6px;

  padding: 9px;
}


.unified-product-sheet .unified-sheet-applications
.refax-sheet-application {
  padding: 9px 11px;

  border: 1px solid #dfe6ef;
  border-radius: 6px;

  background: #ffffff;
}


.unified-product-sheet .unified-sheet-applications
.refax-sheet-application strong {
  color: #172033;

  font-size: 0.84rem;
  font-weight: 650;
}


.unified-product-sheet .unified-sheet-applications
.refax-sheet-application small {
  display: block;

  margin-top: 3px;

  color: #667085;

  font-size: 0.72rem;
}


/* ----------------------------------------------------------
   CODIGOS
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-code-list,
.unified-product-sheet .refax-sheet-codes-grid {
  gap: 6px;

  padding: 9px;
}


.unified-product-sheet .refax-sheet-code-list > *,
.unified-product-sheet .refax-sheet-codes-grid > * {
  border-color: #dfe6ef;

  background: #f8fafc;

  color: #172033;
}


/* ----------------------------------------------------------
   ELIMINAR MULTICOLOR HEREDADO
   DENTRO DEL MODAL UNIFICADO
   ---------------------------------------------------------- */

.unified-product-sheet
.refax-sheet-section:nth-child(n) > strong:first-child {
  background: #2f5fbd;
}


/* ----------------------------------------------------------
   SCROLLBAR DISCRETO
   ---------------------------------------------------------- */

.unified-product-sheet .unified-sheet-body::-webkit-scrollbar,
.unified-product-sheet .refax-sheet-body::-webkit-scrollbar {
  width: 9px;
}


.unified-product-sheet .unified-sheet-body::-webkit-scrollbar-thumb,
.unified-product-sheet .refax-sheet-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;

  background: #b9c5d3;
  background-clip: padding-box;
}


/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 800px) {

  .unified-product-sheet {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }


  .unified-product-sheet .unified-sheet-head {
    flex-wrap: wrap;
  }


  .unified-product-sheet .refax-sheet-info-grid {
    grid-template-columns: 1fr;
  }


  .unified-product-sheet .unified-sheet-list-row {
    grid-template-columns: 1fr;
  }

}



/* ==========================================================
   FARINA UI LIGHT
   UNIFIED PRODUCT SHEET U2B
   Corrección exacta de cabeceras y ancho
   ========================================================== */


/* ----------------------------------------------------------
   1. TODAS LAS CABECERAS INTERNAS
   pasan a la familia corporativa Fariña.
   ---------------------------------------------------------- */

.unified-product-sheet .product-card-head,
.unified-product-sheet .product-card-head-blue,
.unified-product-sheet .product-card-head-green,
.unified-product-sheet .product-card-head-orange,
.unified-product-sheet .product-card-head-purple,
.unified-product-sheet .product-card-head-cyan,
.unified-product-sheet .product-card-head-pink,
.unified-product-sheet .product-card-head-gold,
.unified-product-sheet .product-card-head-slate {
  min-height: 30px;

  padding: 7px 10px;

  border-radius: 0;

  background: #2f5fbd;
  color: #ffffff;

  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.015em;

  box-shadow: none;
}


.unified-product-sheet .product-card-head strong,
.unified-product-sheet .product-card-head span {
  color: #ffffff;
}


/* ----------------------------------------------------------
   2. DATOS DEL PRODUCTO
   elimina la columna vacía heredada.
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-top-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr);

  gap: 12px;
}


/* La ficha de datos conserva distribución interna
   de dos columnas.
*/

.unified-product-sheet .refax-sheet-info-grid {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 10px 28px;
}


/* ----------------------------------------------------------
   3. CARDS PRINCIPALES
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-summary,
.unified-product-sheet .refax-sheet-commercial,
.unified-product-sheet .refax-sheet-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  border: 1px solid #dbe4ef;
  border-radius: 8px;

  background: #ffffff;
}


/* ----------------------------------------------------------
   4. INFORMACIÓN COMERCIAL
   misma identidad de sección, precio sigue protagonista.
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-commercial {
  padding-bottom: 12px;
}


.unified-product-sheet .refax-sheet-price strong {
  color: #172033;

  font-size: 1.45rem;
  font-weight: 700;
}


/* ----------------------------------------------------------
   5. CÓDIGOS
   Las dos tarjetas se mantienen lado a lado cuando cabe.
   ---------------------------------------------------------- */

.unified-product-sheet .refax-sheet-codes-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 12px;
}


/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 760px) {

  .unified-product-sheet .refax-sheet-info-grid,
  .unified-product-sheet .refax-sheet-codes-grid {
    grid-template-columns: 1fr;
  }

}



/* ==========================================================
   FARINA UI - COMPRA SUGERIDA C2
   Botón Generar informe compacto
   ========================================================== */

/*
   Selector deliberadamente específico:
   solo el submit que viene inmediatamente después de
   .purchase-check-stack en Compra sugerida.
*/

.purchase-check-stack + button[type="submit"] {
  width: 92px;
  min-width: 92px;
  max-width: 92px;

  min-height: 40px;

  margin-left: 7px;
  padding: 5px 8px;

  font-size: 12px;
  line-height: 1.08;
  font-weight: 650;

  white-space: normal;
  text-align: center;

  border-radius: 6px;
}


/* Un poco más de respiración para los checks */

.purchase-check-stack {
  padding-right: 3px;
}


/* Mantener ambos labels compactos */

.purchase-check-stack .check-label {
  line-height: 1.15;
  white-space: nowrap;
}




/* ==========================================================
   FARINA UI - COMPRA SUGERIDA C2A
   Alineación vertical botón Generar informe
   ========================================================== */

.purchase-check-stack + button[type="submit"] {
  position: relative;
  top: -2px;
}



/* ==========================================================
   FARINA UI - COMPRA SUGERIDA C2A
   Alineación vertical botón Generar informe
   ========================================================== */

.purchase-check-stack + button[type="submit"] {
  position: relative;
  top: -2px;
}



/* ==========================================================
   FARINA UI - COMPRA SUGERIDA C2B
   Alineación vertical final Generar informe
   ========================================================== */

.purchase-check-stack + button[type="submit"] {
  top: 0;
  transform: translateY(-6px);
}



/* ==========================================================
   FARINA UI - CARGA PROVEEDOR CP1
   Selector de archivo corporativo
   ========================================================== */

#provider-load-file {
  width: 100%;
  min-height: 34px;

  padding: 0;

  overflow: hidden;

  border: 1px solid #cfd9e5;
  border-radius: 6px;

  background: #ffffff;
  color: #667085;

  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;

  font-size: 12px;

  cursor: pointer;
}


/* Botón interno del input file */

#provider-load-file::file-selector-button {
  height: 32px;

  margin: 0 8px 0 0;
  padding: 0 12px;

  border: 0;
  border-right: 1px solid #cfd9e5;

  background: #eef4fb;
  color: var(--blue);

  font-family: inherit;
  font-size: 12px;
  font-weight: 650;

  cursor: pointer;

  transition:
    background 120ms ease,
    color 120ms ease;
}


#provider-load-file:hover::file-selector-button {
  background: #e1ebf6;
  color: var(--blue-dark);
}


#provider-load-file:focus {
  outline: none;

  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.10);
}


/* Compatibilidad Chromium/WebKit */

#provider-load-file::-webkit-file-upload-button {
  height: 32px;

  margin: 0 8px 0 0;
  padding: 0 12px;

  border: 0;
  border-right: 1px solid #cfd9e5;

  background: #eef4fb;
  color: var(--blue);

  font-family: inherit;
  font-size: 12px;
  font-weight: 650;

  cursor: pointer;
}




/* ==========================================================
   FARINA UI - GERENCIA COMERCIAL G2
   Tablas resumen sin scroll horizontal
   ========================================================== */


/* ----------------------------------------------------------
   CONTENEDORES
   Solo tablas resumen del Dashboard Comercial.
   NO afecta matrices de vendedores/marcas.
   ---------------------------------------------------------- */

#commercial-branches,
#commercial-top-products {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  overflow-x: hidden;
}


/* ----------------------------------------------------------
   TABLAS
   Anulan min-width genérico de dashboard-table.
   ---------------------------------------------------------- */

#commercial-branches table,
#commercial-top-products table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;

  table-layout: fixed;

  border-collapse: collapse;
}


/* Evitar que padding/border ensanche columnas */

#commercial-branches th,
#commercial-branches td,
#commercial-top-products th,
#commercial-top-products td {
  min-width: 0 !important;

  box-sizing: border-box;
}


/* ==========================================================
   VENTAS POR SUCURSAL
   Sucursal / Venta neta / Promedio mensual
   ========================================================== */

#commercial-branches th:nth-child(1),
#commercial-branches td:nth-child(1) {
  width: 40%;
}


#commercial-branches th:nth-child(2),
#commercial-branches td:nth-child(2) {
  width: 30%;
}


#commercial-branches th:nth-child(3),
#commercial-branches td:nth-child(3) {
  width: 30%;
}


/* Números alineados y estables */

#commercial-branches th:nth-child(2),
#commercial-branches th:nth-child(3),
#commercial-branches td:nth-child(2),
#commercial-branches td:nth-child(3) {
  text-align: right;

  white-space: nowrap;

  font-variant-numeric:
    tabular-nums;
}


/* ==========================================================
   TOP 20 PRODUCTOS
   Código / Descripción / Venta 12M / Promedio mensual
   ========================================================== */

#commercial-top-products th:nth-child(1),
#commercial-top-products td:nth-child(1) {
  width: 20%;
}


#commercial-top-products th:nth-child(2),
#commercial-top-products td:nth-child(2) {
  width: 46%;
}


#commercial-top-products th:nth-child(3),
#commercial-top-products td:nth-child(3) {
  width: 17%;
}


#commercial-top-products th:nth-child(4),
#commercial-top-products td:nth-child(4) {
  width: 17%;
}


/* Código */

#commercial-top-products th:nth-child(1),
#commercial-top-products td:nth-child(1) {
  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}


/* Descripción aprovecha el espacio y puede bajar de línea */

#commercial-top-products th:nth-child(2),
#commercial-top-products td:nth-child(2) {
  white-space: normal;

  overflow-wrap: anywhere;

  line-height: 1.25;
}


/* Valores monetarios */

#commercial-top-products th:nth-child(3),
#commercial-top-products th:nth-child(4),
#commercial-top-products td:nth-child(3),
#commercial-top-products td:nth-child(4) {
  text-align: right;

  white-space: nowrap;

  font-variant-numeric:
    tabular-nums;
}


/* ----------------------------------------------------------
   Un poco más compacta la tabla sin perder lectura
   ---------------------------------------------------------- */

#commercial-branches th,
#commercial-branches td,
#commercial-top-products th,
#commercial-top-products td {
  padding-left: 9px;
  padding-right: 9px;
}




/* ==========================================================
   FARINA UI - GERENCIA COMERCIAL G3A
   Venta / compra por marca de vehículo
   Tablas inferiores sin scroll horizontal
   ========================================================== */


/* ----------------------------------------------------------
   1. EVITAR QUE LAS TARJETAS SE ESTIREN
   ---------------------------------------------------------- */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid {
  align-items: start;
}


[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid > .dashboard-card {
  align-self: start;
}


/* ----------------------------------------------------------
   2. MARCAS CON MAYOR VENTA / COMPRA
   Primera tarjeta del grid
   ---------------------------------------------------------- */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
.provider-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  overflow-x: hidden;
}


[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
.provider-table-shell table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;

  table-layout: fixed;
}


/* Ranking */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(1),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(1) {
  width: 14%;
}


/* Marca */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(2),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(2) {
  width: 36%;
}


/* Venta / Compra neta */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(3),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(3) {
  width: 28%;
}


/* Participación */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(4),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(4) {
  width: 22%;
}


/* Columnas numéricas */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(3),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
th:nth-child(4),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(3),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(1)
td:nth-child(4) {
  text-align: right;

  white-space: nowrap;

  font-variant-numeric: tabular-nums;
}


/* ----------------------------------------------------------
   3. PRODUCTOS PRINCIPALES
   Segunda tarjeta
   ---------------------------------------------------------- */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
.provider-table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;

  overflow-x: hidden;
}


[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
.provider-table-shell table {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;

  table-layout: fixed;
}


/* Marca */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
th:nth-child(1),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
td:nth-child(1) {
  width: 20%;
}


/* Código */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
th:nth-child(2),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
td:nth-child(2) {
  width: 24%;

  white-space: nowrap;

  overflow: hidden;
  text-overflow: ellipsis;
}


/* Descripción */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
th:nth-child(3),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
td:nth-child(3) {
  width: 38%;

  white-space: normal;

  overflow-wrap: anywhere;

  line-height: 1.2;
}


/* Venta / Compra */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
th:nth-child(4),

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(2)
td:nth-child(4) {
  width: 18%;

  text-align: right;

  white-space: nowrap;

  font-variant-numeric: tabular-nums;
}


/* ----------------------------------------------------------
   4. AJUSTE DE CELDAS
   ---------------------------------------------------------- */

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(-n+2)
th,

[data-commercial-analysis-panel="vehicle"]
.commercial-brand-bottom-grid
> .dashboard-card:nth-child(-n+2)
td {
  min-width: 0 !important;

  box-sizing: border-box;

  padding-left: 8px;
  padding-right: 8px;
}




/* ==========================================================
   FARINA UI - OC2C
   Editor Ordenes de Compra
   ========================================================== */

.purchase-order-editor::-webkit-scrollbar {
  width: 10px;
}

.purchase-order-editor::-webkit-scrollbar-track {
  background: #eef3f8;
}

.purchase-order-editor::-webkit-scrollbar-thumb {
  background: #9aa9bd;
  border-radius: 10px;
  border: 2px solid #eef3f8;
}

.purchase-order-editor::-webkit-scrollbar-thumb:hover {
  background: #7d8da3;
}


/* MODO EDICION */

.purchase-order-editor[data-mode="edit"]
> .dashboard-card-head {
  border-top: 3px solid #16a34a;
}

#saved-po-save {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

#saved-po-save:hover {
  background: #15803d;
  border-color: #15803d;
}


/* CONFIRMACION FARINA */

.farina-confirm-backdrop {
  position: fixed;
  inset: 0;

  z-index: 10000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  background: rgba(15, 23, 42, 0.48);
}

.farina-confirm-card {
  width: min(440px, calc(100vw - 40px));

  background: #fff;

  border: 1px solid #dbe5f0;
  border-radius: 10px;

  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.28);

  overflow: hidden;
}

.farina-confirm-head {
  padding: 16px 18px 12px;

  border-bottom: 1px solid #e7edf5;

  color: #173f83;
}

.farina-confirm-head strong {
  font-size: 1rem;
}

.farina-confirm-body {
  padding: 18px;

  color: #27364a;

  line-height: 1.5;
}

.farina-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;

  padding: 12px 18px 16px;

  background: #f8fafc;

  border-top: 1px solid #edf1f6;
}



/* ==========================================================
   FARINA UI - OC2D
   Scroll robusto Orden de Compra
   El backdrop controla el desplazamiento vertical.
   ========================================================== */


/* CONTENEDOR DEL MODAL = SCROLL PRINCIPAL */

#saved-po-editor-modal.purchase-order-editor-modal {
  overflow-y: auto !important;
  overflow-x: hidden !important;

  align-items: flex-start !important;

  scrollbar-width: auto !important;
  scrollbar-color: #8798ad #e8eef5;

  overscroll-behavior: contain;
}


/* REVERTIR CUALQUIER OCULTAMIENTO WEBKIT ANTERIOR */

#saved-po-editor-modal.purchase-order-editor-modal::-webkit-scrollbar {
  display: block !important;

  width: 12px !important;
  height: 12px !important;
}

#saved-po-editor-modal.purchase-order-editor-modal::-webkit-scrollbar-track {
  display: block !important;

  background: #e8eef5 !important;
}

#saved-po-editor-modal.purchase-order-editor-modal::-webkit-scrollbar-thumb {
  display: block !important;

  background: #8798ad !important;

  border: 2px solid #e8eef5 !important;
  border-radius: 10px !important;
}

#saved-po-editor-modal.purchase-order-editor-modal::-webkit-scrollbar-thumb:hover {
  background: #6f8198 !important;
}


/* LA TARJETA YA NO CREA UN SEGUNDO SCROLL */

#saved-po-editor.purchase-order-editor {
  width: min(1080px, 92vw);

  max-height: none !important;

  overflow: visible !important;

  margin: 16px auto 24px !important;

  scrollbar-width: auto !important;
}


/* ENCABEZADO SIEMPRE VISIBLE AL BAJAR */

#saved-po-editor.purchase-order-editor
> .dashboard-card-head {
  position: sticky !important;

  top: 0 !important;

  z-index: 20;

  background: #fff;
}


/* ASEGURAR ESPACIO FINAL PARA LLEGAR A HISTORIAL */

#saved-po-editor.purchase-order-editor
> .party-section:last-child {
  margin-bottom: 8px;
}




/* ==========================================================
   FARINA UI - OC2E
   Orden de Compra
   Scroll interno + modal mas ancho
   ========================================================== */


/* ----------------------------------------------------------
   1. BACKDROP
   Ya no controla el scroll.
   ---------------------------------------------------------- */

#saved-po-editor-modal.purchase-order-editor-modal {
  overflow: hidden !important;

  align-items: center !important;
  justify-content: center !important;

  padding: 16px !important;
}


/* ----------------------------------------------------------
   2. TARJETA PRINCIPAL OC
   Scroll dentro del modal blanco.
   ---------------------------------------------------------- */

#saved-po-editor.purchase-order-editor {
  width: min(1280px, 96vw) !important;

  max-width: 1280px !important;

  max-height: calc(100vh - 32px) !important;

  overflow-y: scroll !important;
  overflow-x: hidden !important;

  overscroll-behavior: contain;

  scrollbar-gutter: stable;

  scrollbar-width: auto !important;
  scrollbar-color:
    #8798ad
    #edf2f7 !important;

  margin: 0 !important;
}


/* ----------------------------------------------------------
   3. SCROLLBAR CHROME / EDGE
   Forzar visible aunque exista una regla antigua.
   ---------------------------------------------------------- */

#saved-po-editor.purchase-order-editor::-webkit-scrollbar {
  display: block !important;

  width: 11px !important;
  height: 11px !important;
}


#saved-po-editor.purchase-order-editor::-webkit-scrollbar-track {
  display: block !important;

  background: #edf2f7 !important;
}


#saved-po-editor.purchase-order-editor::-webkit-scrollbar-thumb {
  display: block !important;

  background: #8798ad !important;

  border: 2px solid #edf2f7 !important;

  border-radius: 10px !important;
}


#saved-po-editor.purchase-order-editor::-webkit-scrollbar-thumb:hover {
  background: #6f8198 !important;
}


/* ----------------------------------------------------------
   4. CABECERA FIJA
   ---------------------------------------------------------- */

#saved-po-editor.purchase-order-editor
> .dashboard-card-head {
  position: sticky !important;

  top: 0 !important;

  z-index: 30;

  background: #ffffff !important;

  border-bottom: 1px solid #dfe7f0;

  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.06);
}


/* ----------------------------------------------------------
   5. LINEAS OC
   Aprovechar ancho adicional.
   ---------------------------------------------------------- */

#saved-po-editor
.saved-po-line {
  grid-template-columns:
    minmax(125px, 1fr)
    minmax(125px, 1fr)
    minmax(340px, 2.6fr)
    78px
    100px
    110px
    78px !important;

  gap: 8px;
}


/* Codigo interno */

#saved-po-editor
.saved-po-line
[data-saved-po-line-internal] {
  min-width: 0;
}


/* Codigo proveedor */

#saved-po-editor
.saved-po-line
[data-saved-po-line-provider] {
  min-width: 0;
}


/* Descripcion */

#saved-po-editor
.saved-po-line
[data-saved-po-line-description] {
  min-width: 0;
}


/* ----------------------------------------------------------
   6. ENCABEZADO FORMULARIO
   Más aire aprovechando ancho de PC.
   ---------------------------------------------------------- */

#saved-po-editor
.purchase-order-form-grid {
  column-gap: 12px;
  row-gap: 9px;
}


/* ----------------------------------------------------------
   7. ESPACIO FINAL
   ---------------------------------------------------------- */

#saved-po-editor.purchase-order-editor
> .party-section:last-child {
  margin-bottom: 12px;
}





/* ==========================================================
   FARINA UI - OC2F
   Confirmacion previa a guardar Orden de Compra
   ========================================================== */

.purchase-order-final-card {
  width: min(560px, calc(100vw - 40px));
}


.purchase-order-final-body {
  display: grid;

  gap: 16px;

  padding: 18px;
}


.purchase-order-final-summary {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr)
    110px;

  gap: 10px;
}


.purchase-order-final-summary > div {
  display: grid;

  gap: 4px;

  padding: 10px 12px;

  border: 1px solid #e1e8f0;

  border-radius: 7px;

  background: #f8fafc;
}


.purchase-order-final-summary span,
.purchase-order-final-field > span {
  color: #65748a;

  font-size: 0.76rem;

  font-weight: 700;
}


.purchase-order-final-summary strong {
  color: #17263a;

  font-size: 0.88rem;
}


.purchase-order-final-field {
  display: grid;

  gap: 6px;
}


.purchase-order-final-field input {
  width: 100%;

  height: 38px;

  box-sizing: border-box;

  border: 1px solid #cad6e4;

  border-radius: 7px;

  padding: 0 10px;

  background: #fff;

  color: #17263a;
}


.purchase-order-final-field small {
  color: #748196;

  font-size: 0.75rem;
}


.purchase-order-final-validation {
  display: grid;

  gap: 3px;

  padding: 10px 12px;

  border: 1px solid #dce6f1;

  border-radius: 7px;

  background: #f5f8fc;
}


.purchase-order-final-validation strong {
  color: #214f9c;

  font-size: 0.82rem;
}


.purchase-order-final-validation span {
  color: #596a80;

  font-size: 0.78rem;
}


.purchase-order-final-card
[data-po-final-save] {
  background: #16a34a;

  border-color: #16a34a;

  color: #fff;
}


.purchase-order-final-card
[data-po-final-save]:hover {
  background: #15803d;

  border-color: #15803d;
}


@media (max-width: 700px) {

  .purchase-order-final-summary {
    grid-template-columns: 1fr;
  }

}




/* ==========================================================
   FARINA UI - SUCURSALES S2
   Listado lateral compacto
   ========================================================== */


/* El contenedor no necesita desplazamiento horizontal */

#branch-list.branch-table {
  width: 100%;
  max-width: 100%;

  min-width: 0 !important;

  overflow-x: hidden !important;
}


/* La tabla utiliza exactamente el ancho disponible */

#branch-list.branch-table table {
  width: 100% !important;
  max-width: 100% !important;

  min-width: 0 !important;

  table-layout: fixed !important;
}


/* ----------------------------------------------------------
   En este panel lateral mostramos solamente:
   Código corto | Nombre sucursal | Acción

   Tipo, Ciudad y Estado siguen disponibles en la ficha
   de la izquierda al seleccionar la sucursal.
   ---------------------------------------------------------- */

#branch-list.branch-table th:nth-child(3),
#branch-list.branch-table td:nth-child(3),
#branch-list.branch-table th:nth-child(4),
#branch-list.branch-table td:nth-child(4),
#branch-list.branch-table th:nth-child(5),
#branch-list.branch-table td:nth-child(5) {
  display: none !important;
}


/* Código corto */

#branch-list.branch-table th:nth-child(1),
#branch-list.branch-table td:nth-child(1) {
  width: 31% !important;

  min-width: 0 !important;

  white-space: nowrap !important;

  overflow: hidden;

  text-overflow: ellipsis;
}


/* Nombre sucursal */

#branch-list.branch-table th:nth-child(2),
#branch-list.branch-table td:nth-child(2) {
  width: auto !important;

  min-width: 0 !important;

  white-space: normal !important;

  overflow-wrap: anywhere;

  line-height: 1.25;
}


/* Acción */

#branch-list.branch-table th:nth-child(6),
#branch-list.branch-table td:nth-child(6) {
  width: 64px !important;

  min-width: 64px !important;

  text-align: right;

  white-space: nowrap !important;
}


/* Más compacto, pero manteniendo buena lectura */

#branch-list.branch-table th,
#branch-list.branch-table td {
  box-sizing: border-box;

  padding-left: 9px;
  padding-right: 9px;
}


/* CASA_MATRIZ debe mantenerse completa */

#branch-list.branch-table td:nth-child(1) strong {
  white-space: nowrap !important;

  font-size: 0.78rem;
}


/* Botón de edición contenido dentro de la columna */

#branch-list.branch-table
[data-branch-edit] {
  width: auto;

  min-width: 0;

  padding-left: 8px;
  padding-right: 8px;
}




/* ==========================================================
   GERENCIA - COMPARATIVOS DE VENTAS H2B-1
   ========================================================== */

.sales-comparison-dashboard {
  display: grid;
  gap: 16px;
}

.sales-comparison-dashboard[hidden] {
  display: none;
}

.sales-comparison-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sales-comparison-view-tabs button {
  min-height: 38px;
}

.sales-comparison-view {
  display: grid;
  gap: 14px;
}

.sales-comparison-view[hidden] {
  display: none;
}

.sales-comparison-filters {
  align-items: end;
}

.sales-comparison-range-filters {
  grid-template-columns:
    minmax(160px, 1.1fr)
    repeat(4, minmax(145px, 1fr))
    auto;
}

.sales-comparison-helper {
  padding: 10px 12px;
  border: 1px solid rgba(15, 59, 102, 0.12);
  border-radius: 10px;
  background: rgba(15, 59, 102, 0.04);
  color: var(--muted, #64748b);
  font-size: 0.86rem;
}

.sales-comparison-idle {
  min-height: 130px;
}

.sales-comparison-idle .cart-empty {
  min-height: 130px;
  display: grid;
  place-items: center;
}

@media (max-width: 1050px) {
  .sales-comparison-range-filters {
    grid-template-columns:
      repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 680px) {
  .sales-comparison-range-filters {
    grid-template-columns: 1fr;
  }
}



/* ==========================================================
   COMPARATIVOS H2C - RESULTADOS
   ========================================================== */

.sales-comparison-kpis {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.sales-comparison-kpi,
.sales-comparison-secondary-kpis article {
  border: 1px solid rgba(15, 59, 102, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 14px 16px;
  min-width: 0;
}

.sales-comparison-kpi span,
.sales-comparison-secondary-kpis span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin-bottom: 7px;
}

.sales-comparison-kpi strong,
.sales-comparison-secondary-kpis strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.2;
  color: #0f3b66;
}

.sales-comparison-kpi small {
  display: block;
  margin-top: 6px;
  color: var(--muted, #64748b);
}

.sales-comparison-kpi.positive strong,
.sales-comparison-table .positive {
  color: #15803d;
}

.sales-comparison-kpi.negative strong,
.sales-comparison-table .negative {
  color: #b91c1c;
}

.sales-comparison-secondary-kpis {
  margin-top: 12px;
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sales-comparison-wide-card {
  margin-top: 14px;
}

.sales-comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.sales-comparison-table th,
.sales-comparison-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 59, 102, 0.09);
  white-space: nowrap;
}

.sales-comparison-table th {
  text-align: left;
}

.sales-comparison-table .numeric {
  text-align: right;
}

.sales-comparison-table tfoot td {
  font-weight: 700;
  background: rgba(15, 59, 102, 0.035);
}

@media (max-width: 1050px) {
  .sales-comparison-kpis {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .sales-comparison-secondary-kpis {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .sales-comparison-kpis,
  .sales-comparison-secondary-kpis {
    grid-template-columns: 1fr;
  }
}



/* ==========================================================
   SEGUIMIENTO V1.1 - CALENDARIO COMERCIAL
   ========================================================== */

.sales-comparison-calendar-card {
  margin-top: 14px;
  border: 1px solid rgba(15, 59, 102, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 14px 16px;
}

.sales-comparison-calendar-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.sales-comparison-calendar-head strong {
  color: #0f3b66;
}

.sales-comparison-calendar-head span {
  font-weight: 700;
  color: #0f3b66;
}

.sales-comparison-calendar-grid {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sales-comparison-calendar-grid > div {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 59, 102, 0.035);
}

.sales-comparison-calendar-grid span,
.sales-comparison-calendar-grid small {
  display: block;
  color: var(--muted, #64748b);
}

.sales-comparison-calendar-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
  color: #0f3b66;
}

.sales-comparison-calendar-grid small {
  margin-top: 3px;
  font-size: 0.72rem;
}

.sales-comparison-holiday-detail {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 59, 102, 0.08);
  color: var(--muted, #64748b);
  font-size: 0.78rem;
}

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


/* GERENCIA COMPARATIVOS - eliminar cabecera global redundante */
#management-view > .receipt-header.management-header-hidden {
  display: none !important;
}


/* Seguimiento V1.4 simple - promedio L-V / sábado */
.sales-comparison-daytype-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.sales-comparison-daytype-grid > div + div {
  border-left: 1px solid rgba(15, 59, 102, 0.10);
  padding-left: 10px;
}

.sales-comparison-daytype-grid small,
.sales-comparison-daytype-grid em,
.sales-comparison-daytype-grid b {
  display: block;
}

.sales-comparison-daytype-grid small {
  color: var(--muted, #64748b);
  font-style: normal;
}

.sales-comparison-daytype-grid strong {
  display: block;
  color: #0f3b66;
  margin: 2px 0;
}

.sales-comparison-daytype-grid em {
  color: var(--muted, #64748b);
  font-size: 0.72rem;
  font-style: normal;
}

.sales-comparison-daytype-grid b {
  margin-top: 2px;
  font-size: 0.78rem;
}

.sales-comparison-daytype-grid .positive {
  color: #15803d;
}

.sales-comparison-daytype-grid .negative {
  color: #b91c1c;
}

/* ============================================================
   COMPARATIVOS / EVOLUCION / GRAFICO BARRAS V1
   ============================================================ */

.sales-comparison-evolution-chart-card {
  margin-bottom: 16px;
  padding: 18px 20px 14px;
  overflow: hidden;
}

.sales-comparison-evolution-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.sales-comparison-evolution-chart-head > div:first-child {
  display: grid;
  gap: 3px;
}

.sales-comparison-evolution-chart-head strong {
  font-size: 16px;
  line-height: 1.2;
}

.sales-comparison-evolution-chart-head span {
  font-size: 12px;
  opacity: 0.72;
}

.sales-comparison-evolution-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  white-space: nowrap;
}

.sales-comparison-evolution-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}

.sales-comparison-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.sales-comparison-legend-dot.is-previous {
  background: #91a9c7;
}

.sales-comparison-legend-dot.is-current {
  background: #1565c0;
}

.sales-comparison-evolution-live-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  margin: 2px 0 6px;
  border-radius: 999px;
  background: rgba(21, 101, 192, 0.08);
  color: #285b93;
  font-size: 11px;
  font-weight: 700;
}

.sales-comparison-evolution-chart-shell {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.sales-comparison-evolution-chart {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
}

.sales-comparison-chart-gridline {
  stroke: rgba(100, 116, 139, 0.17);
  stroke-width: 1;
}

.sales-comparison-chart-y-label,
.sales-comparison-chart-x-label {
  fill: #667085;
  font-size: 11px;
  font-family: inherit;
}

.sales-comparison-chart-x-label {
  font-weight: 700;
}

.sales-comparison-chart-bar {
  transition:
    opacity 120ms ease,
    filter 120ms ease;
  cursor: default;
}

.sales-comparison-chart-bar:hover {
  opacity: 0.8;
  filter: brightness(0.97);
}

.sales-comparison-chart-bar-previous {
  fill: #91a9c7;
}

.sales-comparison-chart-bar-current {
  fill: #1565c0;
}

.sales-comparison-chart-bar.is-live {
  stroke: #0d47a1;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.sales-comparison-evolution-chart-foot {
  margin-top: 1px;
  text-align: right;
  font-size: 10px;
  color: #7b8794;
}

@media (max-width: 760px) {
  .sales-comparison-evolution-chart-card {
    padding: 14px 12px 10px;
  }

  .sales-comparison-evolution-chart-head {
    display: grid;
  }

  .sales-comparison-evolution-legend {
    justify-content: flex-start;
  }
}


/* ============================================================
   COMPARATIVOS / EVOLUCION / GRAFICOS V2
   Tabla primero + mensual compacto + anual
   ============================================================ */

.sales-comparison-evolution-chart-card-v2 {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 14px 18px 10px;
}

.sales-comparison-evolution-chart-head-v2 {
  align-items: center;
  margin-bottom: 2px;
}

.sales-comparison-evolution-chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.sales-comparison-evolution-chart-controls label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sales-comparison-evolution-chart-controls label > span {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.sales-comparison-evolution-chart-controls select {
  min-width: 76px;
  height: 28px;
  padding: 2px 24px 2px 8px;
  border: 1px solid #d7deea;
  border-radius: 5px;
  background: #fff;
  color: #26364b;
  font-size: 11px;
  font-weight: 700;
}

.sales-comparison-vs {
  font-size: 10px !important;
  font-weight: 700;
  color: #8290a4;
}

.sales-comparison-evolution-live-note-v2 {
  margin: 0 0 0 4px;
  min-height: 26px;
  padding: 3px 8px;
}

.sales-comparison-evolution-chart-shell-v2 {
  margin-top: 0;
}

.sales-comparison-evolution-chart-v2 {
  min-width: 720px;
  max-height: 245px;
}

.sales-comparison-chart-bar.is-live-v2 {
  stroke: none;
  opacity: 0.92;
}

/* ---------- Anual ---------- */

.sales-comparison-annual-card {
  margin-top: 14px;
  padding: 14px 18px 12px;
}

.sales-comparison-annual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.sales-comparison-annual-head > div {
  display: grid;
  gap: 2px;
}

.sales-comparison-annual-head strong {
  font-size: 15px;
  line-height: 1.2;
}

.sales-comparison-annual-head span {
  font-size: 11px;
  color: #718096;
}

.sales-comparison-annual-ytd-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(21, 101, 192, 0.08);
  color: #285b93 !important;
  font-weight: 700;
  white-space: nowrap;
}

.sales-comparison-annual-chart {
  height: 170px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(18px, 5vw, 58px);
  padding: 4px 20px 0;
}

.sales-comparison-annual-item {
  width: min(88px, 14vw);
  display: grid;
  grid-template-rows: 22px 1fr 22px;
  align-items: stretch;
  text-align: center;
}

.sales-comparison-annual-value {
  font-size: 10px;
  font-weight: 700;
  color: #53657b;
  white-space: nowrap;
}

.sales-comparison-annual-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 108px;
  border-bottom: 1px solid #dfe5ed;
}

.sales-comparison-annual-bar {
  width: 42px;
  max-width: 70%;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: #4f83bd;
  transition:
    opacity 120ms ease,
    filter 120ms ease;
}

.sales-comparison-annual-bar:hover {
  opacity: 0.82;
  filter: brightness(0.97);
}

.sales-comparison-annual-item.is-ytd
.sales-comparison-annual-bar {
  background: #1565c0;
}

.sales-comparison-annual-year {
  padding-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #425466;
}

.sales-comparison-annual-item.is-ytd
.sales-comparison-annual-year {
  color: #1565c0;
}


@media (max-width: 760px) {
  .sales-comparison-evolution-chart-head-v2,
  .sales-comparison-annual-head {
    display: grid;
  }

  .sales-comparison-evolution-chart-controls {
    justify-content: flex-start;
  }

  .sales-comparison-annual-chart {
    justify-content: flex-start;
    overflow-x: auto;
    gap: 18px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .sales-comparison-annual-item {
    flex: 0 0 68px;
    width: 68px;
  }
}


/* ============================================================
   COMPARATIVOS / EVOLUCION / ANUAL FIX V3
   ============================================================ */

.sales-comparison-annual-chart {
  height: 180px;
  align-items: stretch;
  padding-top: 2px;
  padding-bottom: 0;
}

.sales-comparison-annual-item {
  grid-template-rows: 24px 126px 24px;
}

.sales-comparison-annual-track {
  height: 126px;
  min-height: 126px;
  max-height: 126px;
  align-self: end;
}

.sales-comparison-annual-bar {
  width: 46px;
  max-width: 70%;
}

.sales-comparison-annual-value {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 10px;
  line-height: 1.1;
}

.sales-comparison-annual-year {
  padding-top: 6px;
  line-height: 1.1;
}


/* ============================================================
   COMPARATIVOS / EVOLUCION / ANUAL R2
   Eje Y + barras absolutas
   ============================================================ */

.sales-comparison-annual-card-r2 {
  padding-bottom: 14px;
}

.sales-comparison-annual-axis-label {
  margin: 0 0 4px 72px;
  font-size: 10px;
  color: #7b8794;
}

.sales-comparison-annual-plot-r2 {
  position: relative;
  height: 205px;
  margin-top: 2px;
  padding-left: 72px;
}

.sales-comparison-annual-grid {
  position: absolute;
  inset: 6px 0 28px 0;
  pointer-events: none;
}

.sales-comparison-annual-grid-row {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
}

.sales-comparison-annual-grid-row span {
  width: 62px;
  padding-right: 9px;
  text-align: right;
  font-size: 10px;
  color: #6f7d90;
  white-space: nowrap;
}

.sales-comparison-annual-grid-row i {
  flex: 1;
  height: 1px;
  background: rgba(100, 116, 139, 0.15);
}

.sales-comparison-annual-bars-r2 {
  position: absolute;
  left: 72px;
  right: 8px;
  top: 6px;
  bottom: 28px;

  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  gap: 18px;
}

.sales-comparison-annual-column {
  position: relative;
  width: 110px;
  height: 100%;
  display: grid;
  grid-template-rows: 24px 1fr 22px;
  text-align: center;
}

.sales-comparison-annual-column-value {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #52657a;
  white-space: nowrap;
}

.sales-comparison-annual-column-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 150px;
}

.sales-comparison-annual-column-bar {
  width: 48px;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: #4f83bd;
  transition:
    opacity 120ms ease,
    filter 120ms ease;
}

.sales-comparison-annual-column-bar:hover {
  opacity: 0.82;
  filter: brightness(0.97);
}

.sales-comparison-annual-column-bar.is-ytd {
  background: #1565c0;
}

.sales-comparison-annual-column-year {
  padding-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #425466;
}

.sales-comparison-annual-column-year.is-ytd {
  color: #1565c0;
}


@media (max-width: 760px) {
  .sales-comparison-annual-plot-r2 {
    overflow-x: auto;
    padding-left: 62px;
  }

  .sales-comparison-annual-bars-r2 {
    min-width: 620px;
  }
}


/* ============================================================
   COMPARATIVOS / EVOLUCION / ANUAL SVG R3
   ============================================================ */

.sales-comparison-annual-svg-card {
  margin-top: 14px;
  padding: 14px 18px 10px;
  overflow: hidden;
}

.sales-comparison-annual-svg-scale {
  margin:
    -2px
    0
    2px
    74px;

  font-size: 10px;
  color: #778599;
}

.sales-comparison-annual-svg-shell {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.sales-comparison-annual-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
  max-height: 255px;
}

.sales-comparison-annual-svg-grid {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 1;
}

.sales-comparison-annual-svg-y {
  fill: #667085;
  font-size: 11px;
  font-family: inherit;
}

.sales-comparison-annual-svg-value {
  fill: #40546c;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
}

.sales-comparison-annual-svg-year {
  fill: #425466;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
}

.sales-comparison-annual-svg-year.is-ytd {
  fill: #1565c0;
}

.sales-comparison-annual-svg-bar {
  fill: #6f96c2;
  transition:
    opacity 120ms ease,
    filter 120ms ease;
}

.sales-comparison-annual-svg-bar:hover {
  opacity: 0.82;
  filter: brightness(0.97);
}

.sales-comparison-annual-svg-bar.is-ytd {
  fill: #1565c0;
}

@media (max-width: 760px) {
  .sales-comparison-annual-svg-card {
    padding:
      12px
      10px
      8px;
  }

  .sales-comparison-annual-svg-scale {
    margin-left: 66px;
  }
}



/* ==========================================================
   VEHICLE_FRONTEND_V1_R2
   ========================================================== */

.vehicle-search-view {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.vehicle-search-band {
  margin-top: 0;
}

.vehicle-search-branch {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7ff;
}

.vehicle-search-branch span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.vehicle-search-branch strong {
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 800;
}

.vehicle-search-controls {
  display: grid;
  grid-template-columns:
    minmax(220px, 0.8fr)
    minmax(360px, 1.8fr)
    124px;
  gap: 12px;
  align-items: end;
}

.vehicle-search-controls select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

.vehicle-search-controls select:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px
    rgba(31, 78, 120, 0.14);
}

.vehicle-search-controls button {
  min-height: 42px;
}

.vehicle-search-controls button:disabled {
  opacity: 0.5;
  cursor: default;
}

.vehicle-search-description {
  margin-top: 14px;
}

.vehicle-search-description input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.vehicle-search-description input:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px
    rgba(31, 78, 120, 0.14);
}

.vehicle-search-description input:disabled {
  background: #f8fafc;
}

.vehicle-search-cart-status {
  color: var(--blue-ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.vehicle-search-table-wrap table {
  width: 100%;
  min-width: 900px;
}

.vehicle-search-table-wrap th:nth-child(1) {
  width: 140px;
}

.vehicle-search-table-wrap th:nth-child(3),
.vehicle-search-table-wrap th:nth-child(4),
.vehicle-search-table-wrap th:nth-child(5) {
  width: 110px;
}

.vehicle-search-table-wrap th:nth-child(6) {
  width: 74px;
}

.vehicle-search-table-wrap th:nth-child(7) {
  width: 100px;
}

.vehicle-search-description-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-search-qty {
  width: 58px;
  min-height: 32px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
}

@media (max-width: 980px) {
  .vehicle-search-controls {
    grid-template-columns:
      1fr 1fr;
  }

  .vehicle-search-controls button {
    grid-column: 1 / -1;
  }
}




/* ==========================================================
   VEHICLE_FRONTEND_V1_R3
   ========================================================== */


.vehicle-search-combo {
  position: relative;
}


.vehicle-search-combo-box {
  position: relative;
}


.vehicle-search-combo-box input {
  width: 100%;
  min-height: 42px;

  padding:
    0
    42px
    0
    10px;

  border:
    1px solid
    var(--line);

  border-radius: 6px;

  outline: none;

  color:
    var(--ink);

  background:
    #fff;

  font:
    inherit;
}


.vehicle-search-combo-box input:focus {
  border-color:
    var(--blue);

  box-shadow:
    0 0 0 3px
    rgba(31, 78, 120, 0.14);
}


.vehicle-search-combo-box input:disabled {
  background:
    #f8fafc;
}


.vehicle-search-combo-toggle {
  position: absolute;

  top: 1px;
  right: 1px;

  width: 40px;

  min-height:
    40px !important;

  padding: 0;

  border: 0;

  border-left:
    1px solid
    var(--line);

  border-radius:
    0 6px 6px 0;

  background:
    #fff;

  color:
    var(--blue);

  font-size:
    1rem;
}


.vehicle-search-combo-toggle:disabled {
  color:
    var(--muted);

  background:
    #f8fafc;
}


.vehicle-search-combo-options {
  position:
    absolute;

  z-index:
    40;

  top:
    calc(100% + 4px);

  left:
    0;

  right:
    0;

  max-height:
    310px;

  overflow-y:
    auto;

  padding:
    4px;

  border:
    1px solid
    var(--line);

  border-radius:
    6px;

  background:
    #fff;

  box-shadow:
    0 12px 28px
    rgba(15, 23, 42, 0.16);
}


.vehicle-search-combo-options button {
  display:
    block;

  width:
    100%;

  min-height:
    34px !important;

  padding:
    7px 9px;

  border:
    0;

  border-radius:
    4px;

  background:
    #fff;

  color:
    var(--ink);

  text-align:
    left;

  font-weight:
    600;
}


.vehicle-search-combo-options button:hover {
  background:
    #eef4ff;

  color:
    var(--blue);
}


.vehicle-search-combo-empty {
  padding:
    10px;

  color:
    var(--muted);

  font-size:
    0.82rem;
}


.vehicle-search-filters {
  display:
    grid;

  grid-template-columns:
    minmax(230px, 0.65fr)
    minmax(420px, 1.7fr)
    105px;

  gap:
    12px;

  align-items:
    end;

  margin-top:
    14px;
}


.vehicle-search-filters input {
  width:
    100%;

  min-height:
    42px;

  padding:
    0 12px;

  border:
    1px solid
    var(--line);

  border-radius:
    6px;

  outline:
    none;

  color:
    var(--ink);

  background:
    #fff;

  font:
    inherit;
}


.vehicle-search-filters input:focus {
  border-color:
    var(--blue);

  box-shadow:
    0 0 0 3px
    rgba(31, 78, 120, 0.14);
}


.vehicle-search-filters input:disabled {
  background:
    #f8fafc;
}


.vehicle-search-filters > button {
  min-height:
    42px;
}


.vehicle-search-alpha {
  display:
    flex;

  flex-wrap:
    wrap;

  align-items:
    center;

  gap:
    4px;

  margin-top:
    10px;
}


.vehicle-search-alpha button {
  min-width:
    31px;

  min-height:
    30px;

  padding:
    4px 7px;

  border:
    1px solid
    #cbd8ea;

  border-radius:
    5px;

  background:
    #edf3fa;

  color:
    var(--blue-ink);

  font-size:
    0.78rem;

  font-weight:
    800;
}


.vehicle-search-alpha button:first-child {
  min-width:
    54px;
}


.vehicle-search-alpha button:hover:not(:disabled) {
  border-color:
    var(--blue);

  background:
    #e5efff;
}


.vehicle-search-alpha button.active {
  border-color:
    var(--blue);

  background:
    var(--blue);

  color:
    #fff;
}


.vehicle-search-alpha button:disabled {
  opacity:
    0.28;

  cursor:
    default;
}


@media (max-width: 980px) {

  .vehicle-search-filters {
    grid-template-columns:
      1fr 1fr;
  }


  .vehicle-search-filters > button {
    grid-column:
      1 / -1;
  }

}



/* ==========================================================
   VEHICLE_FRONTEND_R3_2_QUOTE_SUMMARY
   ========================================================== */

.vehicle-search-cart-status {
  display: grid;
  gap: 6px;
  min-width: 305px;
}

.vehicle-search-cart-caption {
  display: block;
  text-align: right;
  color: var(--blue-ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.vehicle-search-quote-summary {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd8ea;
  border-radius: 7px;
  background: #f8fbff;
}

.vehicle-search-quote-line {
  display: grid;
  grid-template-columns:
    minmax(130px, 1fr)
    auto;
  align-items: center;
  gap: 12px;
  min-height: 25px;
  font-size: 0.79rem;
}

.vehicle-search-quote-line > span,
.vehicle-search-quote-line > label {
  color: var(--muted);
  font-weight: 700;
}

.vehicle-search-quote-line strong {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
}

.vehicle-search-discount-input {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.vehicle-search-discount-input input {
  width: 58px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: right;
}

.vehicle-search-discount-input input:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 2px
    rgba(31, 78, 120, 0.12);
}

.vehicle-search-discount-input span {
  min-width: 12px;
  color: var(--muted);
  font-weight: 800;
}

.vehicle-search-total-line {
  margin-top: 2px;
  padding-top: 5px;
  border-top: 1px solid #d8e3f2;
}

.vehicle-search-total-line > span {
  color: var(--blue-ink);
  font-weight: 900;
  text-transform: uppercase;
}

.vehicle-search-total-line strong {
  color: var(--blue);
  font-size: 1.08rem;
  font-weight: 900;
}

@media (max-width: 980px) {
  .vehicle-search-cart-status {
    min-width: 250px;
  }
}



/* ==========================================================
   VEHICLE_R3_2A_SUMMARY_HEADER
   Resumen entre título y Sucursal local.
   ========================================================== */

.vehicle-search-brand-row-with-summary {
  align-items: center;
  gap: 14px;
}

.vehicle-search-cart-status-header {
  width: min(500px, 40vw);
  min-width: 410px;
  margin-left: auto;
  margin-right: 0;
  gap: 3px;
}

.vehicle-search-cart-status-header
.vehicle-search-cart-caption {
  display: block;
  margin: 0 2px 2px 0;
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: right;
}

.vehicle-search-cart-status-header
.vehicle-search-quote-summary {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 5px 7px;
}

.vehicle-search-cart-status-header
.vehicle-search-quote-line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 39px;
  padding: 0 10px;
  border-right: 1px solid #d8e3f2;
}

.vehicle-search-cart-status-header
.vehicle-search-quote-line:last-child {
  border-right: 0;
}

.vehicle-search-cart-status-header
.vehicle-search-quote-line > span,
.vehicle-search-cart-status-header
.vehicle-search-quote-line > label {
  font-size: 0.68rem;
  line-height: 1.1;
  white-space: nowrap;
}

.vehicle-search-cart-status-header
.vehicle-search-quote-line strong {
  font-size: 0.91rem;
  line-height: 1.1;
  text-align: left;
}

.vehicle-search-cart-status-header
.vehicle-search-discount-line {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

.vehicle-search-cart-status-header
.vehicle-search-discount-input {
  justify-content: flex-start;
}

.vehicle-search-cart-status-header
.vehicle-search-discount-input input {
  width: 48px;
  height: 25px;
}

.vehicle-search-cart-status-header
.vehicle-search-total-line {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.vehicle-search-cart-status-header
.vehicle-search-total-line strong {
  font-size: 1rem;
}


/* Pantallas algo más estrechas:
   mantener funcionalidad antes que comprimir demasiado. */

@media (max-width: 1180px) {

  .vehicle-search-cart-status-header {
    width: 360px;
    min-width: 340px;
  }

}


/* Si ya no cabe en línea, baja solo el resumen.
   No altera Marca/Modelo/Consultar. */

@media (max-width: 980px) {

  .vehicle-search-brand-row-with-summary {
    flex-wrap: wrap;
  }

  .vehicle-search-cart-status-header {
    order: 3;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

}



/* ==========================================================
   VEHICLE_R3_2B_COMPACT_ACTIONS
   Grilla densa tipo ERP Windows:
   máximo contenido visible con acciones compactas.
   ========================================================== */

.vehicle-search-table-wrap table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}


/* Código */
.vehicle-search-table-wrap th:nth-child(1),
.vehicle-search-table-wrap td:nth-child(1) {
  width: 126px;
}


/* Producto:
   conserva prioridad visual y ocupa todo el espacio restante. */
.vehicle-search-table-wrap th:nth-child(2),
.vehicle-search-table-wrap td:nth-child(2) {
  width: auto;
}


/* Marca producto */
.vehicle-search-table-wrap th:nth-child(3),
.vehicle-search-table-wrap td:nth-child(3) {
  width: 105px;
}


/* Origen */
.vehicle-search-table-wrap th:nth-child(4),
.vehicle-search-table-wrap td:nth-child(4) {
  width: 100px;
}


/* Desde */
.vehicle-search-table-wrap th:nth-child(5),
.vehicle-search-table-wrap td:nth-child(5) {
  width: 54px;
}


/* Hasta */
.vehicle-search-table-wrap th:nth-child(6),
.vehicle-search-table-wrap td:nth-child(6) {
  width: 54px;
}


/* Precio */
.vehicle-search-table-wrap th:nth-child(7),
.vehicle-search-table-wrap td:nth-child(7) {
  width: 92px;
}


/* Stock */
.vehicle-search-table-wrap th:nth-child(8),
.vehicle-search-table-wrap td:nth-child(8) {
  width: 55px;
}


/* Tránsito */
.vehicle-search-table-wrap th:nth-child(9),
.vehicle-search-table-wrap td:nth-child(9) {
  width: 58px;
}


/* Cantidad */
.vehicle-search-table-wrap th:nth-child(10),
.vehicle-search-table-wrap td:nth-child(10) {
  width: 60px;
}


/* Acciones */
.vehicle-search-table-wrap th:nth-child(11),
.vehicle-search-table-wrap td:nth-child(11) {
  width: 132px;
}


/* Densidad vertical ERP */
.vehicle-search-table-wrap thead th {
  padding: 6px 7px;
  line-height: 1.05;
  white-space: nowrap;
}

.vehicle-search-table-wrap tbody td {
  height: 36px;
  padding: 3px 7px;
  line-height: 1.08;
  vertical-align: middle;
}


/* Código compacto pero legible */
.vehicle-search-table-wrap tbody td:first-child strong {
  white-space: nowrap;
  font-size: 0.78rem;
}


/* Producto conserva prioridad visual */
.vehicle-search-description-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px !important;
}


/* Precio / stock / tránsito */
.vehicle-search-table-wrap
td.numeric {
  white-space: nowrap;
}


/* Cantidad más baja */
.vehicle-search-qty {
  width: 46px;
  height: 27px;
  min-height: 27px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: 0.78rem;
}


/* Celda de acciones */
.vehicle-search-actions-cell {
  padding-left: 3px !important;
  padding-right: 3px !important;
}

.vehicle-search-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  white-space: nowrap;
}


/* Reutilizar lenguaje visual de Catálogo,
   pero con tamaño de grilla ERP. */
.vehicle-search-action-button,
.vehicle-search-cart-button {
  box-sizing: border-box;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 5px;
  border-radius: 5px;
}

.vehicle-search-action-button svg,
.vehicle-search-cart-button svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* Carrito */
.vehicle-search-cart-button {
  border: 1px solid #1f5bd8;
  background: #fff;
  color: #1456d9;
  cursor: pointer;
}

.vehicle-search-cart-button:hover {
  background: #edf4ff;
}


/* Producto ya incorporado */
.vehicle-search-cart-button.active {
  border-color: #1456d9;
  background: #1456d9;
  color: #fff;
}

.vehicle-search-cart-button.active:hover {
  background: #0f49bc;
}


/* Check sobre carrito */
.vehicle-cart-check {
  stroke-width: 2.4;
}


/* Resaltado discreto:
   mantiene identidad ERP, no "pinta" la tabla completa. */
.vehicle-search-row-in-cart td {
  background: #f1f6ff;
}

.vehicle-search-row-in-cart td:first-child {
  box-shadow:
    inset 3px 0 0 #1456d9;
}


/* Hover de lectura */
.vehicle-search-table-wrap tbody tr:hover td {
  background: #f7faff;
}

.vehicle-search-table-wrap
tbody tr.vehicle-search-row-in-cart:hover td {
  background: #eaf2ff;
}


/* En pantallas grandes se prioriza mostrar más información. */
@media (min-width: 1400px) {

  .vehicle-search-table-wrap tbody td {
    height: 35px;
  }

}




/* CATALOG_BRANCH_HEADER_V1 */
.catalog-head-meta {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.catalog-head-meta .vehicle-search-branch {
  min-width: 150px;
}

.catalog-head-meta .metric {
  display: flex;
  align-items: center;
}

@media (max-width: 900px) {
  .catalog-head-meta {
    flex-wrap: wrap;
  }
}


/* CATALOG_FILTERS_UX_V2 */

/*
  Distribución específica del bloque VEHÍCULO CONSULTADO.
  Se libera espacio para Chassis / VIN y se normalizan
  las tres acciones a la misma medida.
*/
#catalog-vehicle-context-panel .filters {
  grid-template-columns:
    minmax(145px, 1.05fr)
    minmax(180px, 1.25fr)
    68px
    minmax(130px, 0.95fr)
    84px
    minmax(220px, 1.45fr)
    110px
    110px
    110px;
  gap: 10px;
  align-items: end;
}

/*
  El selector stock continúa existiendo oculto
  por contrato JS, por lo que no participa del grid.
*/
#catalog-vehicle-context-panel #stock-view[hidden] {
  display: none !important;
}

/*
  Botones del bloque:
  misma altura, ancho y alineación.
  Se conserva primary/ghost del ERP para jerarquía.
*/
#catalog-vehicle-context-panel .catalog-filter-action {
  width: 110px;
  min-width: 110px;
  min-height: 42px;
  height: 42px;
  padding: 0 12px;
  justify-self: stretch;
  white-space: nowrap;
}

/*
  Consultar deja de usar el tratamiento especial
  lookup-button. Se comporta como ghost ERP estándar.
*/
#catalog-plate-lookup.catalog-filter-action {
  color: var(--blue);
  background: #eaf2f8;
  border-color: transparent;
}

#catalog-plate-lookup.catalog-filter-action:hover {
  color: var(--blue);
  background: #dbeaf5;
  border-color: transparent;
}

@media (max-width: 1200px) {
  #catalog-vehicle-context-panel .filters {
    grid-template-columns:
      minmax(130px, 1fr)
      minmax(160px, 1.15fr)
      68px
      minmax(120px, 0.9fr)
      84px
      minmax(180px, 1.25fr)
      104px
      104px
      104px;
  }

  #catalog-vehicle-context-panel .catalog-filter-action {
    width: 104px;
    min-width: 104px;
  }
}

/* END CATALOG_FILTERS_UX_V2 */


/* CATALOG_COPY_VIN_V1 */
.catalog-vin-copy-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.catalog-vin-copy-wrap #catalog-vin {
  min-width: 0;
}

.catalog-vin-copy {
  min-width: 72px;
  min-height: 42px;
  height: 42px;
  padding: 0 10px;
  white-space: nowrap;
}

.catalog-vin-copy:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ==========================================================
   VEHICLE_COMBO_KEYBOARD_V1
   Navegación ↑ ↓ Enter en Marca / Modelo.
   ========================================================== */

.vehicle-search-combo-options
button.vehicle-search-combo-option-active {
  background: #eef4ff;
  color: var(--blue);
  outline: 1px solid rgba(31, 85, 216, 0.28);
}



/* ==========================================================
   VEHICLE_PRICE_STOCK_BOLD_V1
   Jerarquía visual corporativa:
   Precio y Stock destacados solo por peso tipográfico.
   ========================================================== */

.vehicle-search-table-wrap tbody td:nth-child(7),
.vehicle-search-table-wrap tbody td:nth-child(8) {
  font-weight: 800;
}


/* ==========================================================
   QUOTES_BUTTONS_BLUE_V1
   Cotizaciones: todas las acciones dentro de la familia azul.
   Mantiene diferencia primary / secondary sin naranja.
   ========================================================== */

#quotes-view #quote-cleanup,
#quotes-view .quote-detail-actions button.danger {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

#quotes-view #quote-cleanup:hover,
#quotes-view .quote-detail-actions button.danger:hover {
  color: #fff;
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}


/* ----------------------------------------------------------
   Cotizaciones - acciones de detalle uniformes
   Aprobar / Rechazar / Editar / Abrir PDF
   ---------------------------------------------------------- */

#quotes-view .quote-detail-actions button {
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}


/* ==========================================================
   ACTIVE-BRANCH-V1
   Selector de sucursal operativa dentro del indicador actual.
   ========================================================== */

.vehicle-search-branch .active-branch-select {
  width: 100%;
  min-width: 130px;
  min-height: 30px;
  padding: 4px 28px 4px 8px;

  border: 1px solid #c9d5e3;
  border-radius: 5px;

  background: #ffffff;
  color: var(--blue);

  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;

  cursor: pointer;
}

.vehicle-search-branch .active-branch-select:hover {
  border-color: var(--blue);
  background: #eef4ff;
}

.vehicle-search-branch .active-branch-select:focus {
  outline: 2px solid rgba(31, 85, 216, 0.16);
  outline-offset: 1px;
  border-color: var(--blue);
}

.vehicle-search-branch .active-branch-select:disabled {
  cursor: wait;
  opacity: 0.7;
}

/* Cotizaciones ERP V1 - trazabilidad visual */
.quote-erp-export {
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  font-weight: 700;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  opacity: 1;
}

.quote-erp-export:hover:not(:disabled) {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: #fff;
}

.quote-erp-export:focus-visible {
  outline: 2px solid rgba(31, 85, 216, 0.28);
  outline-offset: 2px;
}

.quote-erp-export:disabled {
  background: #e9eef4;
  color: #7a8796;
  border-color: #c9d3df;
  cursor: not-allowed;
  opacity: 0.78;
}

.quote-erp-export.exported,
.quote-erp-export.exported:disabled {
  opacity: 1;
  background: #eef5ef;
  color: #315d39;
  border-color: #bfd1c1;
  cursor: default;
}

.quote-erp-link {
  border-left: 3px solid #7da0c4;
}

/* ==========================================================
   COTIZACIONES ERP - CONFIRMACION CORPORATIVA V1
   Mantiene el lenguaje visual Farina existente.
   ========================================================== */

.farina-confirm-actions .farina-confirm-primary {
  min-width: 128px;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 700;
}

.farina-confirm-actions .farina-confirm-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: #fff;
}

.farina-confirm-actions .farina-confirm-primary:focus-visible {
  outline: 2px solid rgba(31, 85, 216, 0.28);
  outline-offset: 2px;
}


/* ==========================================================
   PERMISSIONS 3.0 - P7A-R1 CANDIDATE
   ========================================================== */

.permissions-v3 {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.025);
}

.permissions-v3-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.permissions-v3-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permissions-v3-head strong {
  font-size: 14px;
}

.permissions-v3-head > div > span {
  font-size: 12px;
  opacity: 0.72;
}

.permissions-v3-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.permissions-v3-search {
  margin-bottom: 10px;
}

.permissions-v3-search input {
  width: 100%;
  min-height: 38px;
}

.permission-tree {
  display: grid;
  gap: 8px;
}

.permission-tree-module {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  overflow: hidden;
}

.permission-tree-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.035);
}

.permission-tree-parent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
}

.permission-tree-summary {
  flex: 0 0 auto;
  font-size: 12px;
  opacity: 0.72;
}

.permission-tree-children {
  display: grid;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(220px, 1fr)
    );
}

.permission-tree-child {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.permission-tree-child:hover {
  background: rgba(15, 23, 42, 0.025);
}

.permission-tree[data-all-permissions-active="1"] {
  opacity: 0.58;
}

.permission-tree-empty {
  padding: 14px;
  text-align: center;
  opacity: 0.7;
}

.permission-tree-child[hidden],
.permission-tree-module[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .permissions-v3-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .permission-tree-children {
    grid-template-columns: 1fr;
  }
}



/* ============================================================
   USUARIOS 3.0 - P7F-B
   EDITOR MODAL CORPORATIVO
   PRESENTACION ONLY
   ============================================================ */


/* ------------------------------------------------------------
   1. LISTADO NORMAL
   Solo identidad + Editar + Eliminar.
   ------------------------------------------------------------ */

.admin-users {
  max-height: 520px;
  overflow: auto;
  background: #ffffff;
}


.admin-user-row:not(.is-editing) {
  display: grid;
  grid-template-columns:
    minmax(220px, 1fr)
    112px
    112px;

  gap: 10px;
  align-items: center;

  min-height: 64px;

  padding: 10px 14px;

  border-bottom: 1px solid #edf1f5;
  background: #ffffff;
}


.admin-user-row:not(.is-editing):hover {
  background: #fbfdff;
}


.admin-user-row:not(.is-editing)
  > div:first-child {
  min-width: 0;
}


.admin-user-row:not(.is-editing)
  > div:first-child strong {
  display: block;

  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 900;
}


.admin-user-row:not(.is-editing)
  > div:first-child span {
  display: block;

  margin-top: 3px;

  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}


/*
  Todo lo editable queda oculto hasta presionar Editar.
  Esto corrige específicamente el árbol P7A que estaba
  apareciendo en el listado principal.
*/

.admin-user-row:not(.is-editing)
  .permission-check,

.admin-user-row:not(.is-editing)
  .permissions-v3,

.admin-user-row:not(.is-editing)
  input[data-password-user],

.admin-user-row:not(.is-editing)
  button:not(.edit-user-button):not(.delete-user-button) {
  display: none !important;
}


.admin-user-row:not(.is-editing)
  .edit-user-button,

.admin-user-row:not(.is-editing)
  .delete-user-button {
  width: 112px;
  min-width: 112px;
  min-height: 38px;

  padding: 0 14px;

  border-radius: 6px;
}


/* ------------------------------------------------------------
   2. MODAL REAL VISUAL
   Conservamos la lógica existente de .is-editing,
   pero la presentación pasa a ser un editor centrado.
   ------------------------------------------------------------ */

.admin-user-row.is-editing {
  position: fixed;

  top: 50%;
  left: 50%;

  z-index: 50000;

  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 12px;

  width: min(1080px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);

  padding: 0;

  overflow-x: hidden;
  overflow-y: auto;

  transform: translate(-50%, -50%);

  border: 1px solid var(--line);
  border-radius: 12px;

  background: var(--surface);

  box-shadow:
    0 0 0 100vmax rgba(13, 31, 48, 0.48),
    0 24px 70px rgba(13, 31, 48, 0.28);
}


/*
  Encabezado visual del modal.
*/

.admin-user-row.is-editing::before {
  content: "Editar usuario";

  grid-column: 1 / -1;

  display: block;

  padding: 18px 20px 14px;

  border-bottom: 1px solid var(--line);

  color: var(--ink);

  background:
    linear-gradient(
      180deg,
      #ffffff,
      #fbfdff
    );

  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.2;
}


/* ------------------------------------------------------------
   3. IDENTIDAD DEL USUARIO
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  > div:first-child {
  grid-column: 1 / 3;

  min-width: 0;

  padding: 4px 0 2px 20px;
}


.admin-user-row.is-editing
  > div:first-child strong {
  display: block;

  color: var(--blue);

  font-size: 1rem;
  font-weight: 900;
}


.admin-user-row.is-editing
  > div:first-child span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 0.82rem;
}


/* ------------------------------------------------------------
   4. ACCIONES CABECERA
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .edit-user-button {
  grid-column: 4;

  justify-self: end;

  width: 112px;
  min-width: 112px;

  margin-right: 20px;

  color: var(--blue);

  background: #eaf2f8;
}


.admin-user-row.is-editing
  .edit-user-button:hover {
  background: #dbeaf5;
}


.admin-user-row.is-editing
  .delete-user-button {
  grid-column: 3;

  justify-self: end;

  width: 112px;
  min-width: 112px;

  color: #ffffff;

  background: var(--orange);
}


.admin-user-row.is-editing
  .delete-user-button:hover {
  background: var(--orange-dark);
}


/* ------------------------------------------------------------
   5. MODULOS PRINCIPALES
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-check {
  min-width: 0;
  min-height: 48px;

  margin: 0;

  padding: 9px 12px;

  border: 1px solid var(--line);
  border-radius: 8px;

  color: var(--ink);

  background: #ffffff;

  font-size: 0.84rem;
  font-weight: 700;
}


.admin-user-row.is-editing
  .permission-check:hover {
  border-color: #bfd1e6;
  background: #f8fbff;
}


.admin-user-row.is-editing
  .permission-check input[type="checkbox"] {
  flex: 0 0 18px;

  width: 18px;
  height: 18px;

  accent-color: var(--blue);
}


/*
  Primer permiso general inicia nueva fila visual.
*/

.admin-user-row.is-editing
  > .permission-check:first-of-type {
  margin-left: 20px;
}


/*
  Última tarjeta general mantiene margen derecho.
*/

.admin-user-row.is-editing
  > .permission-check:nth-of-type(4n) {
  margin-right: 20px;
}


/* ------------------------------------------------------------
   6. ARBOL DE PERMISOS 3.0
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permissions-v3 {
  grid-column: 1 / -1;

  margin: 4px 20px 0;

  padding: 0;

  overflow: hidden;

  border: 1px solid #d8e0e8;
  border-radius: 10px;

  background: #ffffff;
}


.admin-user-row.is-editing
  .permissions-v3-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 16px;

  margin: 0;
  padding: 13px 14px;

  border-bottom: 1px solid var(--line);

  background: #f8fbff;
}


.admin-user-row.is-editing
  .permissions-v3-head strong {
  color: var(--blue-ink);

  font-size: 0.9rem;
  font-weight: 900;
}


.admin-user-row.is-editing
  .permissions-v3-head
  > div > span {
  margin-top: 2px;

  color: var(--muted);

  font-size: 0.76rem;
  font-weight: 600;
}


.admin-user-row.is-editing
  .permissions-v3-all {
  display: flex;

  align-items: center;

  gap: 8px;

  min-height: 36px;

  padding: 0 11px;

  border: 1px solid #cbd8e8;
  border-radius: 7px;

  color: var(--blue-ink);

  background: #eef4ff;

  font-size: 0.8rem;
  font-weight: 900;
}


.admin-user-row.is-editing
  .permissions-v3-search {
  margin: 0;

  padding: 10px 14px;

  border-bottom: 1px solid #edf1f5;

  background: #ffffff;
}


.admin-user-row.is-editing
  .permissions-v3-search input {
  width: 100%;
  min-height: 38px;

  padding: 0 11px;

  border: 1px solid var(--line);
  border-radius: 6px;

  outline: none;

  background: #ffffff;
}


.admin-user-row.is-editing
  .permissions-v3-search input:focus {
  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.12);
}


.admin-user-row.is-editing
  .permission-tree {
  display: grid;

  gap: 0;

  padding: 0;
}


.admin-user-row.is-editing
  .permission-tree-module {
  border: 0;
  border-radius: 0;

  background: #ffffff;
}


.admin-user-row.is-editing
  .permission-tree-module-head {
  padding: 10px 14px;

  border-bottom: 1px solid #edf1f5;

  background: #fbfdff;
}


.admin-user-row.is-editing
  .permission-tree-parent {
  color: var(--blue-ink);

  font-size: 0.84rem;
  font-weight: 900;
}


.admin-user-row.is-editing
  .permission-tree-summary {
  color: var(--muted);

  font-size: 0.75rem;
  font-weight: 700;
}


.admin-user-row.is-editing
  .permission-tree-children {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 0;
}


.admin-user-row.is-editing
  .permission-tree-child {
  min-height: 48px;

  padding: 9px 14px;

  border-top: 0;
  border-right: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;

  color: var(--ink);

  background: #ffffff;

  font-size: 0.82rem;
  font-weight: 700;
}


.admin-user-row.is-editing
  .permission-tree-child:nth-child(3n) {
  border-right: 0;
}


.admin-user-row.is-editing
  .permission-tree-child:hover {
  background: #f8fbff;
}


/* ------------------------------------------------------------
   7. ACCESO OPERATIVO
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .access-check {
  margin-top: 0;

  border-color: #cedaea;

  background: #f3f7fb;
}


.admin-user-row.is-editing
  .access-check select {
  width: 100%;
  min-width: 0;
  min-height: 36px;

  padding: 0 8px;

  border: 1px solid var(--line);
  border-radius: 6px;

  color: var(--ink);

  background: #ffffff;
}


/* ------------------------------------------------------------
   8. CONTRASEÑA
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  input[data-password-user] {
  grid-column: 1 / 3;

  width: auto;
  max-width: none;

  min-height: 42px;

  margin-left: 20px;

  padding: 0 11px;

  border: 1px solid var(--line);
  border-radius: 7px;

  background: #ffffff;
}


.admin-user-row.is-editing
  button[data-generate-password],

.admin-user-row.is-editing
  button[data-set-password] {
  width: auto;

  min-height: 42px;
}


/* ------------------------------------------------------------
   9. ACCIONES OPERATIVAS Y GUARDADO
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  button[data-unlock-user] {
  margin-left: 20px;
}


.admin-user-row.is-editing
  .save-user-button {
  grid-column: 4;

  min-height: 42px;

  margin-right: 20px;

  color: #ffffff;

  background: var(--blue);

  font-weight: 900;
}


.admin-user-row.is-editing
  .save-user-button:hover {
  background: var(--blue-dark);
}


/* ------------------------------------------------------------
   10. FOCUS / ACCESIBILIDAD
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  button:focus-visible,

.admin-user-row.is-editing
  input:focus-visible,

.admin-user-row.is-editing
  select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}


/* ------------------------------------------------------------
   11. RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 900px) {

  .admin-user-row.is-editing {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }


  .admin-user-row.is-editing::before,
  .admin-user-row.is-editing
    .permissions-v3 {
    grid-column: 1 / -1;
  }


  .admin-user-row.is-editing
    > div:first-child {
    grid-column: 1 / -1;

    padding-right: 20px;
  }


  .admin-user-row.is-editing
    .delete-user-button {
    grid-column: 1;

    margin-left: 20px;

    justify-self: stretch;

    width: auto;
  }


  .admin-user-row.is-editing
    .edit-user-button {
    grid-column: 2;

    justify-self: stretch;

    width: auto;
  }


  .admin-user-row.is-editing
    .permission-tree-children {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }


  .admin-user-row.is-editing
    .permission-tree-child:nth-child(3n) {
    border-right: 1px solid #edf1f5;
  }


  .admin-user-row.is-editing
    .permission-tree-child:nth-child(2n) {
    border-right: 0;
  }


  .admin-user-row.is-editing
    input[data-password-user] {
    grid-column: 1 / -1;

    margin-right: 20px;
  }


  .admin-user-row.is-editing
    .save-user-button {
    grid-column: 2;
  }
}


@media (max-width: 620px) {

  .admin-user-row:not(.is-editing) {
    grid-template-columns:
      minmax(0, 1fr)
      88px
      88px;
  }


  .admin-user-row:not(.is-editing)
    .edit-user-button,

  .admin-user-row:not(.is-editing)
    .delete-user-button {
    width: 88px;
    min-width: 88px;

    padding: 0 8px;
  }


  .admin-user-row.is-editing {
    grid-template-columns: 1fr;
  }


  .admin-user-row.is-editing::before,

  .admin-user-row.is-editing
    > div:first-child,

  .admin-user-row.is-editing
    .delete-user-button,

  .admin-user-row.is-editing
    .edit-user-button,

  .admin-user-row.is-editing
    .permissions-v3,

  .admin-user-row.is-editing
    input[data-password-user],

  .admin-user-row.is-editing
    .save-user-button {
    grid-column: 1;
  }


  .admin-user-row.is-editing
    .delete-user-button,

  .admin-user-row.is-editing
    .edit-user-button,

  .admin-user-row.is-editing
    .save-user-button {
    margin-left: 20px;
    margin-right: 20px;

    width: auto;

    justify-self: stretch;
  }


  .admin-user-row.is-editing
    .permission-tree-children {
    grid-template-columns: 1fr;
  }


  .admin-user-row.is-editing
    .permission-tree-child {
    border-right: 0;
  }


  .admin-user-row.is-editing
    input[data-password-user] {
    margin-right: 20px;
  }
}


/* ============================================================
   FIN P7F-B
   ============================================================ */


/* ============================================================
   USUARIOS 3.0 - P7F-D
   AJUSTE VISUAL CORPORATIVO V2

   Identidad:
   - azul = acción principal
   - gris/azul suave = acción secundaria
   - rojo = acción destructiva
   - naranja eliminado del editor
   ============================================================ */


/* ------------------------------------------------------------
   MODAL: MÁS COMPACTO
   ------------------------------------------------------------ */

.admin-user-row.is-editing {
  width: min(1000px, calc(100vw - 44px));

  max-height: calc(100vh - 52px);

  gap: 10px;

  border-radius: 10px;
}


/* Título */

.admin-user-row.is-editing::before {
  padding: 15px 16px 13px;

  font-size: 1.08rem;
}


/* Identidad */

.admin-user-row.is-editing
  > div:first-child {
  padding-left: 16px;
}


.admin-user-row.is-editing
  > div:first-child strong {
  font-size: 0.95rem;
}


.admin-user-row.is-editing
  > div:first-child span {
  font-size: 0.78rem;
}


/* ------------------------------------------------------------
   BOTONES GENERALES DEL MODAL
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  button {
  min-height: 38px;

  border-radius: 6px;

  font-size: 0.8rem;
}


/* Cerrar */

.admin-user-row.is-editing
  .edit-user-button {
  width: 100px;
  min-width: 100px;

  margin-right: 16px;

  color: var(--blue);

  background: #eaf2f8;
}


.admin-user-row.is-editing
  .edit-user-button:hover {
  color: var(--blue-dark);

  background: #dbeaf5;
}


/* ------------------------------------------------------------
   ELIMINAR
   Acción destructiva real.
   Rojo sobrio, no naranja.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .delete-user-button {
  width: 100px;
  min-width: 100px;

  border: 1px solid #fecaca;

  color: #b42318;

  background: #fff5f5;
}


.admin-user-row.is-editing
  .delete-user-button:hover {
  border-color: #fca5a5;

  color: #991b1b;

  background: #feecec;
}


/* ------------------------------------------------------------
   MÓDULOS GENERALES
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-check {
  min-height: 42px;

  padding: 7px 10px;

  border-radius: 7px;

  font-size: 0.8rem;
}


.admin-user-row.is-editing
  .permission-check input[type="checkbox"] {
  width: 17px;
  height: 17px;

  flex-basis: 17px;
}


/* ------------------------------------------------------------
   BLOQUE PERMISOS DETALLADOS
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permissions-v3 {
  margin-left: 16px;
  margin-right: 16px;

  border-radius: 8px;
}


.admin-user-row.is-editing
  .permissions-v3-head {
  padding: 10px 12px;
}


.admin-user-row.is-editing
  .permissions-v3-head strong {
  font-size: 0.84rem;
}


.admin-user-row.is-editing
  .permissions-v3-head
  > div > span {
  font-size: 0.72rem;
}


/* Todos los permisos */

.admin-user-row.is-editing
  .permissions-v3-all {
  min-height: 32px;

  padding: 0 9px;

  border-color: #cbd8e8;

  color: var(--blue-ink);

  background: #eef4ff;

  font-size: 0.76rem;
}


/* Buscador */

.admin-user-row.is-editing
  .permissions-v3-search {
  padding: 8px 12px;
}


.admin-user-row.is-editing
  .permissions-v3-search input {
  min-height: 34px;

  font-size: 0.8rem;
}


/* Padre */

.admin-user-row.is-editing
  .permission-tree-module-head {
  padding: 8px 12px;
}


.admin-user-row.is-editing
  .permission-tree-parent {
  font-size: 0.8rem;
}


/* Hijos */

.admin-user-row.is-editing
  .permission-tree-child {
  min-height: 42px;

  padding: 7px 11px;

  font-size: 0.78rem;
}


/* ------------------------------------------------------------
   ACCESO OPERATIVO
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .access-check {
  min-height: 42px;

  background: #f8fafc;
}


.admin-user-row.is-editing
  .access-check select {
  min-height: 32px;

  font-size: 0.78rem;
}


/* ------------------------------------------------------------
   CONTRASEÑA
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  input[data-password-user] {
  min-height: 38px;

  margin-left: 16px;

  font-size: 0.8rem;
}


/*
  Generar / Clave:
  acción secundaria consistente con el resto del ERP.
*/

.admin-user-row.is-editing
  button[data-generate-password],

.admin-user-row.is-editing
  button[data-set-password],

.admin-user-row.is-editing
  button[data-unlock-user] {
  border: 0;

  color: var(--blue);

  background: #f3f4f6;
}


.admin-user-row.is-editing
  button[data-generate-password]:hover,

.admin-user-row.is-editing
  button[data-set-password]:hover,

.admin-user-row.is-editing
  button[data-unlock-user]:hover {
  background: #e6edf5;
}


/* Liberar */

.admin-user-row.is-editing
  button[data-unlock-user] {
  margin-left: 16px;
}


/* ------------------------------------------------------------
   DESACTIVAR / ACTIVAR

   No compite visualmente con Guardar.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  button[data-toggle-user] {
  border: 1px solid #d8e0e8;

  color: #475569;

  background: #f8fafc;
}


.admin-user-row.is-editing
  button[data-toggle-user]:hover {
  border-color: #cbd5e1;

  color: #334155;

  background: #eef2f7;
}


/*
  Cuando el botón representa "Desactivar", conserva
  advertencia visual leve, sin convertirse en CTA principal.
*/

.admin-user-row.is-editing
  button[data-toggle-user][data-active="0"] {
  border-color: #fecaca;

  color: #b42318;

  background: #fff7f7;
}


.admin-user-row.is-editing
  button[data-toggle-user][data-active="0"]:hover {
  background: #feecec;
}


/* ------------------------------------------------------------
   GUARDAR
   CTA ÚNICO PRINCIPAL
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .save-user-button {
  min-height: 40px;

  margin-right: 16px;

  border: 0;

  color: #ffffff;

  background: var(--blue);

  font-size: 0.82rem;
  font-weight: 900;
}


.admin-user-row.is-editing
  .save-user-button:hover {
  background: var(--blue-dark);
}


/* ------------------------------------------------------------
   ELIMINAR NARANJA HEREDADO DENTRO DEL EDITOR
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .danger {
  background: #fff7f7;
  color: #b42318;
}


.admin-user-row.is-editing
  .danger:hover {
  background: #feecec;
  color: #991b1b;
}


/*
  La acción principal nunca hereda danger.
*/

.admin-user-row.is-editing
  .save-user-button {
  color: #ffffff !important;
  background: var(--blue) !important;
}


/* ------------------------------------------------------------
   CONSISTENCIA DE SUPERFICIES
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-check,

.admin-user-row.is-editing
  .permission-tree-child {
  box-shadow: none;
}


.admin-user-row.is-editing
  .permission-check:hover,

.admin-user-row.is-editing
  .permission-tree-child:hover {
  background: #f8fbff;
}


/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 900px) {

  .admin-user-row.is-editing {
    width: calc(100vw - 28px);

    max-height: calc(100vh - 28px);
  }


  .admin-user-row.is-editing
    > div:first-child {
    padding-left: 16px;
    padding-right: 16px;
  }


  .admin-user-row.is-editing
    .delete-user-button {
    margin-left: 16px;
  }


  .admin-user-row.is-editing
    .edit-user-button {
    margin-right: 16px;
  }


  .admin-user-row.is-editing
    input[data-password-user] {
    margin-right: 16px;
  }


  .admin-user-row.is-editing
    .save-user-button {
    margin-right: 16px;
  }
}


@media (max-width: 620px) {

  .admin-user-row.is-editing
    .delete-user-button,

  .admin-user-row.is-editing
    .edit-user-button,

  .admin-user-row.is-editing
    .save-user-button {
    margin-left: 16px;
    margin-right: 16px;
  }
}


/* ============================================================
   FIN P7F-D
   ============================================================ */


/* ============================================================
   USUARIOS 3.0 - P7F-F
   ALINEACION CHECKBOX + DESCRIPCION
   ============================================================ */


/* ------------------------------------------------------------
   PADRE: ABASTECIMIENTO
   Checkbox y texto forman una sola unidad visual.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-tree-parent {
  display: inline-grid;

  grid-template-columns:
    18px
    minmax(0, auto);

  align-items: center;
  justify-content: start;

  gap: 8px;

  width: auto;
}


.admin-user-row.is-editing
  .permission-tree-parent
  input[type="checkbox"] {
  width: 17px;
  height: 17px;

  min-width: 17px;

  margin: 0;

  justify-self: start;

  accent-color: var(--blue);
}


.admin-user-row.is-editing
  .permission-tree-parent
  span {
  margin: 0;

  line-height: 1.2;

  text-align: left;
}


/* ------------------------------------------------------------
   HIJOS
   Cada celda = checkbox + descripción juntos.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-tree-child {
  display: grid;

  grid-template-columns:
    22px
    minmax(0, 1fr);

  align-items: center;
  justify-content: start;

  column-gap: 9px;

  min-height: 48px;

  padding:
    8px
    14px;

  text-align: left;
}


.admin-user-row.is-editing
  .permission-tree-child
  input[type="checkbox"] {
  width: 18px;
  height: 18px;

  min-width: 18px;

  margin: 0;

  justify-self: start;
  align-self: center;

  accent-color: var(--blue);
}


.admin-user-row.is-editing
  .permission-tree-child
  span {
  display: block;

  min-width: 0;

  margin: 0;

  color: var(--ink);

  font-size: 0.78rem;
  font-weight: 700;

  line-height: 1.15;

  text-align: left;
}


/* ------------------------------------------------------------
   CELDAS DESHABILITADAS
   Mantienen alineación; solo cambia estado visual.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-tree[data-all-permissions-active="1"]
  .permission-tree-child {
  opacity: 0.58;
}


/* ------------------------------------------------------------
   MATRIZ
   Conservamos 3 x 2 en escritorio.
   ------------------------------------------------------------ */

.admin-user-row.is-editing
  .permission-tree-children {
  grid-template-columns:
    repeat(3, minmax(0, 1fr));
}


/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 900px) {

  .admin-user-row.is-editing
    .permission-tree-children {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}


@media (max-width: 620px) {

  .admin-user-row.is-editing
    .permission-tree-children {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   FIN P7F-F
   ============================================================ */


/* ============================================================
   USUARIOS 3.0 - P7H
   ESTANDARIZACION VISUAL COMPLETA DE PAGINA
   ============================================================ */


/* ------------------------------------------------------------
   1. CONTENEDOR GENERAL
   ------------------------------------------------------------ */

#configuration-users-view,
[data-admin-section="users"] {
  background: #ffffff;
}


/* ------------------------------------------------------------
   2. CABECERA DE USUARIOS
   ------------------------------------------------------------ */

[data-admin-section="users"]
  .admin-header {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 16px;

  min-height: 62px;

  padding: 12px 14px;

  border-bottom: 1px solid var(--line);

  background: #fbfdff;
}


[data-admin-section="users"]
  .admin-header
  .eyebrow {
  margin: 0 0 2px;

  color: var(--blue);

  font-size: 0.68rem;
  font-weight: 900;

  text-transform: uppercase;
}


[data-admin-section="users"]
  .admin-header strong {
  color: var(--ink);

  font-size: 1rem;
  font-weight: 900;
}


[data-admin-section="users"]
  .admin-header span {
  color: var(--muted);

  font-size: 0.78rem;
}


/* ------------------------------------------------------------
   3. FORMULARIO CREAR USUARIO
   ------------------------------------------------------------ */

.admin-create {
  display: grid;

  grid-template-columns:
    minmax(120px, 1.1fr)
    minmax(140px, 1.2fr)
    repeat(8, minmax(105px, auto))
    auto
    auto;

  gap: 8px;

  align-items: end;

  padding: 12px 14px;

  border-bottom: 1px solid var(--line);

  background: #f8fafc;
}


.admin-create label {
  min-width: 0;

  color: var(--muted);

  font-size: 0.72rem;
  font-weight: 800;
}


.admin-create input,
.admin-create select {
  min-height: 38px;

  border: 1px solid var(--line);
  border-radius: 6px;

  color: var(--ink);

  background: #ffffff;

  font-size: 0.78rem;
}


.admin-create input:focus,
.admin-create select:focus {
  border-color: var(--blue);

  outline: none;

  box-shadow:
    0 0 0 3px rgba(31, 85, 216, 0.10);
}


/* ------------------------------------------------------------
   4. CHECKBOXES DEL FORMULARIO SUPERIOR
   ------------------------------------------------------------ */

.admin-create
  .check-field {
  display: flex;

  align-items: center;

  gap: 7px;

  min-height: 38px;

  padding: 0 10px;

  border: 1px solid var(--line);
  border-radius: 6px;

  color: var(--ink);

  background: #ffffff;

  font-size: 0.74rem;
  font-weight: 700;
}


.admin-create
  .check-field:hover {
  border-color: #bfd1e6;

  background: #f8fbff;
}


.admin-create
  .check-field
  input[type="checkbox"] {
  width: 17px;
  height: 17px;

  min-height: auto;

  margin: 0;

  accent-color: var(--blue);
}


/* ------------------------------------------------------------
   5. BOTONES CREACION
   ------------------------------------------------------------ */

.admin-create button {
  min-height: 38px;

  padding: 0 14px;

  border-radius: 6px;

  font-size: 0.78rem;
  font-weight: 900;
}


/* Crear usuario */

.admin-create
  button[type="submit"] {
  border: 0;

  color: #ffffff;

  background: var(--blue);
}


.admin-create
  button[type="submit"]:hover {
  background: var(--blue-dark);
}


/* Generar clave */

.admin-create
  .ghost {
  border: 1px solid #dbe4ef;

  color: var(--blue);

  background: #f3f7fb;
}


.admin-create
  .ghost:hover {
  border-color: #cbd8e8;

  color: var(--blue-dark);

  background: #eaf2f8;
}


/* ------------------------------------------------------------
   6. LISTADO
   ------------------------------------------------------------ */

.admin-users {
  max-height: min(64vh, 660px);

  overflow-y: auto;
  overflow-x: hidden;

  background: #ffffff;
}


/* ------------------------------------------------------------
   7. FILA USUARIO
   ------------------------------------------------------------ */

.admin-user-row:not(.is-editing) {
  display: grid;

  grid-template-columns:
    minmax(220px, 1fr)
    92px
    92px;

  gap: 8px;

  align-items: center;

  min-height: 52px;

  padding: 8px 14px;

  border-bottom: 1px solid #edf1f5;

  background: #ffffff;

  transition:
    background 120ms ease,
    border-color 120ms ease;
}


.admin-user-row:not(.is-editing):hover {
  background: #f8fbff;
}


/* Identidad usuario */

.admin-user-row:not(.is-editing)
  > div:first-child strong {
  display: block;

  color: var(--blue);

  font-size: 0.82rem;
  font-weight: 900;

  line-height: 1.15;
}


.admin-user-row:not(.is-editing)
  > div:first-child span {
  display: block;

  margin-top: 3px;

  color: var(--muted);

  font-size: 0.72rem;
  font-weight: 600;

  line-height: 1.15;
}


/* ------------------------------------------------------------
   8. BOTONES LISTADO
   ------------------------------------------------------------ */

.admin-user-row:not(.is-editing)
  .edit-user-button,

.admin-user-row:not(.is-editing)
  .delete-user-button {
  width: 92px;
  min-width: 92px;

  min-height: 34px;

  padding: 0 10px;

  border-radius: 6px;

  font-size: 0.74rem;
  font-weight: 900;
}


/* Editar */

.admin-user-row:not(.is-editing)
  .edit-user-button {
  border: 0;

  color: #ffffff;

  background: var(--blue);
}


.admin-user-row:not(.is-editing)
  .edit-user-button:hover {
  background: var(--blue-dark);
}


/* Eliminar */

.admin-user-row:not(.is-editing)
  .delete-user-button {
  border: 1px solid #fecaca;

  color: #b42318;

  background: #fff7f7;
}


.admin-user-row:not(.is-editing)
  .delete-user-button:hover {
  border-color: #fca5a5;

  color: #991b1b;

  background: #feecec;
}


/* ------------------------------------------------------------
   9. LIBERAR TODOS
   Neutralizamos cualquier herencia naranja en la cabecera.
   ------------------------------------------------------------ */

[data-admin-section="users"]
  .admin-header button,

[data-admin-section="users"]
  button[data-unlock-all],

[data-admin-section="users"]
  button[id*="unlock"][id*="all"] {
  border: 1px solid #dbe4ef;

  color: var(--blue);

  background: #f3f7fb;
}


[data-admin-section="users"]
  .admin-header button:hover,

[data-admin-section="users"]
  button[data-unlock-all]:hover,

[data-admin-section="users"]
  button[id*="unlock"][id*="all"]:hover {
  border-color: #cbd8e8;

  color: var(--blue-dark);

  background: #eaf2f8;
}


/* ------------------------------------------------------------
   10. SCROLL DEL LISTADO
   ------------------------------------------------------------ */

.admin-users {
  scrollbar-width: thin;
  scrollbar-color:
    #9ca8b5
    #edf1f5;
}


.admin-users::-webkit-scrollbar {
  width: 8px;
}


.admin-users::-webkit-scrollbar-track {
  background: #edf1f5;
}


.admin-users::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background: #9ca8b5;
}


/* ------------------------------------------------------------
   11. FOCUS
   ------------------------------------------------------------ */

.admin-create button:focus-visible,
.admin-user-row:not(.is-editing)
  button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}


/* ------------------------------------------------------------
   12. RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 1380px) {

  .admin-create {
    grid-template-columns:
      repeat(6, minmax(110px, 1fr));
  }
}


@media (max-width: 900px) {

  .admin-create {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }
}


@media (max-width: 620px) {

  .admin-create {
    grid-template-columns: 1fr;
  }


  .admin-user-row:not(.is-editing) {
    grid-template-columns:
      minmax(0, 1fr)
      76px
      76px;

    padding-left: 10px;
    padding-right: 10px;
  }


  .admin-user-row:not(.is-editing)
    .edit-user-button,

  .admin-user-row:not(.is-editing)
    .delete-user-button {
    width: 76px;
    min-width: 76px;

    padding: 0 6px;
  }
}


/* ============================================================
   FIN P7H
   ============================================================ */


/* ============================================================
   USUARIOS 3.0 - P7J-B
   MICROAJUSTE ALINEACION MODULOS PRINCIPALES
   ============================================================ */


/*
  Neutralizar reglas P7F-B basadas en posición.
  Evita que nth-of-type pueda afectar también controles
  de acceso que aparecen después de los módulos.
*/

.admin-user-row.is-editing
  > .permission-check:first-of-type {
  margin-left: 0;
}


.admin-user-row.is-editing
  > .permission-check:nth-of-type(4n) {
  margin-right: 0;
}


/*
  Referencia lateral única del modal = 16px,
  igual que Permisos de acceso, identidad y controles.
*/


/* Primera fila: Ventas */

.admin-user-row.is-editing
  > .permission-check:has(
    > input[data-permission-sales]
  ) {
  margin-left: 16px;
}


/* Segunda fila: Mantenciones */

.admin-user-row.is-editing
  > .permission-check:has(
    > input[data-permission-maintenance]
  ) {
  margin-left: 16px;
}


/* Fin primera fila: Administración */

.admin-user-row.is-editing
  > .permission-check:has(
    > input[data-permission-admin]
  ) {
  margin-right: 16px;
}


/*
  Los controles operativos no reciben márgenes derivados
  de la posición de los módulos principales.
*/

.admin-user-row.is-editing
  > .access-check {
  margin-left: 0;
  margin-right: 0;
}


/* ============================================================
   FIN P7J-B
   ============================================================ */

/* ==========================================================
   STRUCTURAL SYNC VISUAL V2
   ========================================================== */

.structural-sync-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.structural-sync-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.structural-sync-header > div {
  min-width: 0;
}

.structural-sync-header strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  color: var(--ink);
}

.structural-sync-subtitle {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.structural-sync-badge {
  flex: 0 0 auto;
}

.structural-sync-badge[data-state="success"],
.structural-sync-badge[data-state="no_changes"] {
  color: var(--green);
  border-color: rgba(25, 115, 90, 0.28);
  background: rgba(25, 115, 90, 0.08);
}

.structural-sync-badge[data-state="failed"] {
  color: #a23b3b;
  border-color: rgba(162, 59, 59, 0.25);
  background: rgba(162, 59, 59, 0.08);
}

.structural-sync-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.structural-sync-metrics > div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.structural-sync-metrics > div:last-child {
  border-right: 0;
}

.structural-sync-metrics span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.structural-sync-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.structural-sync-progress {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
}

.structural-sync-progress span {
  white-space: nowrap;
}

.structural-sync-progress span.done {
  color: var(--green);
}

.structural-sync-progress span.active {
  color: var(--blue);
}

.structural-sync-progress b {
  color: #c7ced6;
  font-weight: 400;
}

.structural-sync-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.structural-sync-detail span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
}

.structural-sync-detail strong {
  color: var(--ink);
}

.structural-sync-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-top: 4px;
}

.structural-sync-window {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.structural-sync-action {
  display: grid;
  justify-items: end;
  gap: 5px;
  flex: 0 0 auto;
}

.structural-sync-action small {
  color: var(--muted);
  font-size: 10px;
}

#structural-sync-run:disabled {
  color: #8b95a1;
  background: #e5e9ee;
  border-color: #d3dae2;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

#structural-sync-run:disabled:hover {
  color: #8b95a1;
  background: #e5e9ee;
  border-color: #d3dae2;
}

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

  .structural-sync-metrics > div:nth-child(2) {
    border-right: 0;
  }

  .structural-sync-metrics > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .structural-sync-progress {
    flex-wrap: wrap;
  }

  .structural-sync-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .structural-sync-action {
    justify-items: stretch;
  }

  #structural-sync-run {
    width: 100%;
  }
}

/* ==========================================================
   CONFIGURACION / SINCRONIZACION - CORPORATE ACCORDION V3
   ========================================================== */

.configuration-section[data-configuration-section="sync"] {
  gap: 10px;
}

.configuration-section[data-configuration-section="sync"]
  > .configuration-section-head {
  margin-bottom: 4px;
}

.sync-accordion.sync-block {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.sync-accordion + .sync-accordion {
  margin-top: 0;
}

.sync-accordion > summary {
  list-style: none;
}

.sync-accordion > summary::-webkit-details-marker {
  display: none;
}

.sync-accordion-summary,
.sync-accordion-future > summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px 10px 38px;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  background: var(--surface);
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.sync-accordion-summary:hover,
.sync-accordion-future > summary:hover {
  background: #f8fafc;
}

.sync-accordion[open]
  > .sync-accordion-summary,
.sync-accordion-future[open]
  > summary {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.sync-accordion-summary::before,
.sync-accordion-future > summary::before {
  content: "›";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 12px;
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  transform:
    translateY(-50%)
    rotate(0deg);
  transform-origin: center;
  transition: transform 120ms ease;
}

.sync-accordion[open]
  > .sync-accordion-summary::before,
.sync-accordion-future[open]
  > summary::before {
  transform:
    translateY(-50%)
    rotate(90deg);
}

.sync-accordion-summary > div {
  flex: 1 1 auto;
  min-width: 0;
}

.sync-accordion-summary .eyebrow {
  display: none;
}

.sync-accordion-summary strong,
.sync-accordion-future > summary {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.sync-accordion-summary
  > div
  > span,
.sync-accordion-summary
  .structural-sync-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.sync-accordion-summary .sync-status {
  flex: 0 0 auto;
  margin-left: auto;
}

.sync-accordion-body {
  padding: 14px;
  background: var(--surface);
}

.sync-accordion-structural {
  border-color: #cfd9e5;
}

.sync-accordion-structural
  > .sync-accordion-summary {
  min-height: 60px;
}

.sync-accordion-structural
  > .sync-accordion-body {
  display: grid;
  gap: 12px;
}

.sync-accordion-structural.structural-sync-card {
  padding: 0;
}

.sync-accordion-structural
  .structural-sync-metrics {
  margin: 0;
}

.sync-accordion-structural
  .structural-sync-progress {
  margin: 0;
}

.sync-accordion-structural
  .structural-sync-footer {
  padding-top: 0;
}

.sync-accordion-future {
  margin-top: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sync-accordion-future > summary {
  min-height: 50px;
  box-sizing: border-box;
}

.sync-accordion-future > p,
.sync-accordion-future
  > .sync-future-flow {
  margin-left: 14px;
  margin-right: 14px;
}

.sync-accordion-future
  > .sync-future-flow {
  margin-bottom: 14px;
}

/* Contenido funcional conserva estética ERP compacta. */
.sync-accordion-body
  .sync-actions {
  margin-top: 12px;
}

.sync-accordion-body
  .sync-validation-placeholder {
  margin-top: 12px;
}

.sync-accordion-body
  .sync-helper {
  margin-bottom: 0;
}

/* Deshabilitado debe parecer realmente no disponible. */
.configuration-section[data-configuration-section="sync"]
  button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

/* Piloto REFAX ya no forma parte de la interfaz productiva. */
.refax-pilot-block {
  display: none !important;
}

@media (max-width: 900px) {
  .sync-accordion-summary,
  .sync-accordion-future > summary {
    align-items: flex-start;
    min-height: 52px;
  }

  .sync-accordion-summary {
    flex-wrap: wrap;
  }

  .sync-accordion-summary .sync-status {
    margin-left: 0;
  }

  .sync-accordion-body {
    padding: 12px;
  }
}

/* ==========================================================
   CONFIGURACION / FACTORES COMERCIALES - CORPORATE V1
   ========================================================== */

.configuration-section[data-configuration-section="factors"] {
  display: grid;
  gap: 14px;
}

.configuration-section[data-configuration-section="factors"][hidden] {
  display: none;
}

.configuration-section[data-configuration-section="factors"]
  > .configuration-section-head {
  margin-bottom: 0;
}

.factor-card-corporate {
  display: grid;
  gap: 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

.factor-card-corporate > .sync-block-head {
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.factor-card-corporate
  > .sync-block-head
  > div
  > strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.factor-card-corporate
  > .sync-block-head
  > div
  > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.factor-card-corporate
  > .sync-block-head
  .sync-status {
  flex: 0 0 auto;
  color: var(--blue-ink);
  background: #f1f6ff;
  border-color: #cfdaee;
  font-size: 11px;
  font-weight: 700;
}

.factor-card-corporate
  > .factor-control-grid {
  margin: 0 14px;
}

.factor-card-corporate
  .factor-control-grid label:not(.checkline) {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.factor-card-corporate
  .factor-control-grid input[type="number"],
.factor-card-corporate
  .factor-control-grid select {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.factor-card-corporate
  .factor-control-grid input[type="number"]:focus,
.factor-card-corporate
  .factor-control-grid select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 85, 216, 0.08);
}

.factor-card-corporate
  .checkline {
  min-height: 34px;
  gap: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.factor-card-corporate
  .checkline input {
  accent-color: var(--blue);
}

.factor-card-corporate
  .factor-control-grid > button {
  min-height: 34px;
  white-space: nowrap;
}

.factor-card-general
  .factor-control-grid {
  grid-template-columns:
    minmax(140px, 0.7fr)
    minmax(190px, 0.9fr)
    auto
    auto
    auto;
}

.factor-card-provider
  .factor-provider-controls {
  grid-template-columns:
    minmax(240px, 1.45fr)
    minmax(110px, 0.55fr)
    minmax(180px, 0.9fr)
    auto
    auto
    auto;
}

.factor-card-provider
  .factor-table {
  margin: 2px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.factor-card-provider
  .factor-table-head,
.factor-card-provider
  .factor-table-row {
  grid-template-columns:
    minmax(220px, 1.4fr)
    0.45fr
    0.55fr
    0.75fr
    1fr
    minmax(150px, auto);
  gap: 10px;
  padding: 9px 11px;
}

.factor-card-provider
  .factor-table-head {
  color: var(--blue-ink);
  background: #f1f6fb;
  font-size: 11px;
  font-weight: 700;
}

.factor-card-provider
  .factor-table-row {
  min-height: 46px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.factor-card-provider
  .factor-table-row:hover {
  background: #fafcff;
}

.factor-card-provider
  .factor-table-row strong {
  font-weight: 700;
}

.factor-card-provider
  .factor-row-actions {
  gap: 6px;
}

.factor-card-provider
  .factor-row-actions
  .mini-button {
  min-height: 30px;
  padding: 5px 10px;
}

.factor-card-provider
  .factor-row-actions
  [data-edit-factor-provider] {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.factor-card-provider
  .factor-row-actions
  [data-edit-factor-provider]:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.factor-toggle-button {
  color: var(--blue-ink);
  border: 1px solid #cbd7e6;
  background: #f7f9fc;
}

.factor-toggle-button:hover {
  color: var(--blue-dark);
  border-color: #adbed5;
  background: #eef3f8;
}

.factor-toggle-button[data-factor-state="inactive"] {
  color: var(--green);
  border-color: #c6ded6;
  background: #f4faf7;
}

.factor-toggle-button[data-factor-state="inactive"]:hover {
  border-color: #9fc9bb;
  background: #edf7f2;
}

.factor-table-empty {
  padding: 18px 12px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .factor-card-general
    .factor-control-grid,
  .factor-card-provider
    .factor-provider-controls {
    grid-template-columns:
      repeat(3, minmax(150px, 1fr));
  }

  .factor-card-provider
    .factor-table-head,
  .factor-card-provider
    .factor-table-row {
    grid-template-columns:
      minmax(200px, 1.3fr)
      0.5fr
      0.6fr
      0.8fr
      1fr;
  }

  .factor-card-provider
    .factor-table-head
    span:last-child,
  .factor-card-provider
    .factor-table-row
    .factor-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .factor-card-corporate
    > .sync-block-head {
    align-items: flex-start;
    min-height: auto;
  }

  .factor-card-corporate
    > .factor-control-grid {
    margin-left: 12px;
    margin-right: 12px;
  }

  .factor-card-general
    .factor-control-grid,
  .factor-card-provider
    .factor-provider-controls,
  .factor-card-provider
    .factor-table-head,
  .factor-card-provider
    .factor-table-row {
    grid-template-columns: 1fr;
  }

  .factor-card-provider
    .factor-table {
    margin-left: 12px;
    margin-right: 12px;
  }
}

/* ==========================================================
   VENTAS / BUSQUEDA POR VEHICULO - COMPACT HEADER V1
   Solo frontend operativo. Login y documentos sin cambios.
   ========================================================== */

.vehicle-search-view
  .vehicle-search-band {
  padding-top: 10px;
  padding-bottom: 10px;
}

.vehicle-search-view
  .brand-row {
  min-height: 0;
  margin-bottom: 8px;
  align-items: center;
}

.vehicle-search-view
  .brand-lockup {
  min-height: 0;
  gap: 0;
}

.vehicle-search-view
  .brand-lockup h1 {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.3px;
}

.vehicle-search-view
  .vehicle-search-branch {
  padding-top: 6px;
  padding-bottom: 6px;
}

@media (max-width: 720px) {
  .vehicle-search-view
    .brand-lockup h1 {
    font-size: 21px;
  }

  .vehicle-search-view
    .brand-row {
    margin-bottom: 7px;
  }
}

/* ==========================================================
   VENTAS / VEHICULO - LEFT COLUMN ALIGNMENT V1
   Marca y Codigo comparten exactamente el mismo ancho.
   Solo escritorio; responsive existente permanece intacto.
   ========================================================== */

@media (min-width: 981px) {
  .vehicle-search-controls {
    grid-template-columns:
      330px
      minmax(0, 1fr)
      100px;
  }

  .vehicle-search-filters {
    grid-template-columns:
      330px
      minmax(0, 1fr)
      88px;
  }
}

/* ==========================================================
   VENTAS / BUSQUEDA GENERAL - HEADER CORPORATIVO V1
   Gemelo visual de Busqueda por Vehiculo.
   ========================================================== */

#catalog-view {
  --ui-font: Arial, Helvetica, sans-serif;
  --ui-brand-primary: var(--blue);
  --ui-brand-primary-dark: var(--blue-dark);
  --ui-brand-soft: #eef4ff;

  font-family: Arial, Helvetica, sans-serif;
}

#catalog-view .search-band {
  padding: 10px 14px;
}

#catalog-view .brand-row {
  min-height: 0;
  gap: 12px;
  margin-bottom: 8px;
  align-items: center;
}

#catalog-view .brand-lockup {
  min-height: 0;
  gap: 0;
}

#catalog-view .brand-lockup h1,
#catalog-view h1 {
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.3px;
}

#catalog-view .catalog-head-meta {
  align-items: stretch;
}

#catalog-view
  .catalog-head-meta
  .vehicle-search-branch {
  padding-top: 6px;
  padding-bottom: 6px;
}

#catalog-view .metric {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 10px;
  border-color: #cfdaee;
  background: #f1f6ff;
  color: var(--blue);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
}

#catalog-view .global-search {
  margin-bottom: 10px;
}

@media (max-width: 720px) {
  #catalog-view .brand-lockup h1,
  #catalog-view h1 {
    font-size: 21px;
  }

  #catalog-view .brand-row {
    margin-bottom: 7px;
  }
}

/* ==========================================================
   VENTAS / COTIZACIONES - CORPORATE V1
   Hermano visual de Busqueda General y Busqueda por Vehiculo.
   ========================================================== */

#quotes-view {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
}

/* ----------------------------------------------------------
   CARRO / ENCABEZADO OPERATIVO
   ---------------------------------------------------------- */

#quotes-view .cart-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

#quotes-view .cart-header {
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

#quotes-view .cart-header > div:first-child {
  min-width: 0;
}

#quotes-view .cart-header strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.3px;
}

#quotes-view .cart-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

#quotes-view .cart-actions {
  gap: 7px;
}

#quotes-view .cart-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

#quotes-view #cart-pdf {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

#quotes-view #cart-pdf:hover:not(:disabled) {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

#quotes-view #manual-product-toggle,
#quotes-view #quote-reset,
#quotes-view #cart-clear {
  border: 1px solid #d3deea;
  background: #f7f9fc;
  color: var(--blue-ink);
}

#quotes-view #manual-product-toggle:hover:not(:disabled),
#quotes-view #quote-reset:hover:not(:disabled),
#quotes-view #cart-clear:hover:not(:disabled) {
  border-color: #b8c8dc;
  background: #eef3f8;
}

/* Estado vacío más compacto: no consumir altura innecesaria. */
#quotes-view .cart-items .cart-empty {
  min-height: 0;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

/* ----------------------------------------------------------
   DATOS ADICIONALES / TOTALES
   ---------------------------------------------------------- */

#quotes-view .quote-extra {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#quotes-view .quote-extra summary {
  padding: 9px 14px;
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 700;
}

#quotes-view .quote-discount-label {
  margin: 10px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

#quotes-view .quote-discount-label input {
  height: 32px;
}

#quotes-view .cart-total {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fafcff;
}

#quotes-view .cart-total span {
  color: var(--muted);
  font-size: 12px;
}

#quotes-view .cart-total strong {
  color: var(--ink);
  font-size: 13px;
}

#quotes-view #cart-total {
  color: var(--blue);
  font-weight: 800;
}

/* ----------------------------------------------------------
   COTIZACIONES GUARDADAS
   ---------------------------------------------------------- */

#quotes-view .quote-header {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: #ffffff;
}

#quotes-view .quote-header .panel-brand-lockup {
  gap: 0;
}

#quotes-view .quote-header .eyebrow {
  margin: 0 0 2px;
  color: var(--blue-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#quotes-view .quote-header strong {
  display: block;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}

#quotes-view .quote-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

#quotes-view .quote-search {
  gap: 7px;
  align-items: center;
}

#quotes-view .quote-search input,
#quotes-view .quote-search select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: Arial, Helvetica, sans-serif;
}

#quotes-view .quote-search button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Buscar = acción primaria. */
#quotes-view .quote-search button[type="submit"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

#quotes-view .quote-search button[type="submit"]:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

/* Todas = secundaria. */
#quotes-view #quote-clear {
  border-color: #d3deea;
  background: #f7f9fc;
  color: var(--blue-ink);
}

/* Limpieza histórica sí es destructiva. */
#quotes-view #quote-cleanup {
  border: 1px solid #d92d20;
  background: #ffffff;
  color: #b42318;
}

#quotes-view #quote-cleanup:hover {
  border-color: #b42318;
  background: #fff5f4;
  color: #912018;
}

/* ----------------------------------------------------------
   LISTADO
   ---------------------------------------------------------- */

#quotes-view .quote-reminder {
  border-color: #cddcf1;
  background: #f3f7fd;
  color: var(--blue-ink);
  font-size: 12px;
}

#quotes-view .quote-list {
  border-color: var(--line);
  background: #ffffff;
}

#quotes-view .quote-card {
  padding: 9px 10px;
  border-color: var(--line);
  background: #ffffff;
}

#quotes-view .quote-card:hover {
  background: #fafcff;
}

#quotes-view .quote-card.active {
  background: #f1f6ff;
  border-color: #bfd0e8;
}

#quotes-view .quote-card strong {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

#quotes-view .quote-card span {
  color: var(--muted);
  font-size: 11px;
}

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 900px) {
  #quotes-view .cart-header,
  #quotes-view .quote-header {
    align-items: flex-start;
  }

  #quotes-view .cart-header strong {
    font-size: 21px;
  }

  #quotes-view .cart-actions {
    flex-wrap: wrap;
  }
}

/* ==========================================================
   GLOBAL HEADER - FARINA WORDMARK V1
   Identidad corporativa fija del frontend operativo.
   ========================================================== */

.app-nav-primary {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.app-brand-wordmark {
  display: flex;
  flex: 0 0 96px;
  width: 96px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.app-brand-wordmark img {
  display: block;
  width: 96px;
  height: 32px;
  object-fit: contain;
}

.app-nav-primary .tab-group {
  min-width: 0;
}

.app-tabs {
  min-height: 40px;
}

@media (max-width: 900px) {
  .app-nav-primary {
    gap: 8px;
  }

  .app-brand-wordmark {
    flex-basis: 72px;
    width: 72px;
    height: 24px;
  }

  .app-brand-wordmark img {
    width: 72px;
    height: 24px;
  }
}

/* ==========================================================
   GLOBAL HEADER - WORDMARK RIGHT ALIGNMENT V1
   Firma corporativa junto al bloque de sesion.
   ========================================================== */

.app-nav-primary {
  gap: 0;
}

.app-nav-right {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 16px;
}

.app-nav-right .app-brand-wordmark {
  flex: 0 0 96px;
  width: 96px;
  height: 32px;
}

.app-nav-right .app-brand-wordmark img {
  width: 96px;
  height: 32px;
}

.app-nav-right .session-box {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .app-nav-right {
    gap: 10px;
  }

  .app-nav-right .app-brand-wordmark {
    flex-basis: 72px;
    width: 72px;
    height: 24px;
  }

  .app-nav-right .app-brand-wordmark img {
    width: 72px;
    height: 24px;
  }
}

@media (max-width: 760px) {
  .app-nav-right .app-brand-wordmark {
    display: none;
  }
}

/* ==========================================================
   GLOBAL HEADER - RESPONSIVE FLOW V2
   Prioridad:
   1. Navegacion
   2. Sesion / Salir
   3. Wordmark usa espacio restante
   Nunca superponer elementos.
   ========================================================== */

.app-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.app-nav-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.app-nav-primary .tab-group {
  flex: 0 1 auto;
  min-width: 0;
}

.app-nav-right {
  flex: 0 0 auto;
  min-width: 0;
  margin-left: 18px;
}

.app-nav-right .session-box {
  flex: 0 0 auto;
  min-width: max-content;
}

/*
  El nombre del usuario determina naturalmente la posición
  del wordmark porque ambos pertenecen al mismo flujo flex.
*/
.app-nav-right .app-brand-wordmark {
  flex: 0 1 96px;
  min-width: 72px;
  max-width: 96px;
}

.app-nav-right .app-brand-wordmark img {
  width: 100%;
  max-width: 96px;
  height: 32px;
  object-fit: contain;
}

/* Reducir identidad antes de comprometer navegación. */
@media (max-width: 1180px) {
  .app-nav-right {
    gap: 10px;
    margin-left: 12px;
  }

  .app-nav-right .app-brand-wordmark {
    flex-basis: 80px;
    min-width: 64px;
    max-width: 80px;
  }

  .app-nav-right .app-brand-wordmark img {
    max-width: 80px;
    height: 27px;
  }
}

/* En anchos críticos desaparece solo el wordmark. */
@media (max-width: 980px) {
  .app-nav-right .app-brand-wordmark {
    display: none;
  }

  .app-nav-right {
    margin-left: 10px;
  }
}

/* Documentos pendientes de ingreso V1 */
#pending-xml-section .pending-xml-summary {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
}
#pending-xml-section .pending-xml-table-wrap {
  width: 100%;
  overflow-x: auto;
}
#pending-xml-section .pending-xml-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}
#pending-xml-section .pending-xml-grid th,
#pending-xml-section .pending-xml-grid td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
#pending-xml-section .pending-xml-grid th {
  position: sticky;
  top: 0;
  background: #f6f8fb;
  color: var(--blue-dark);
  font-weight: 800;
}
#pending-xml-section .pending-xml-grid
.pending-xml-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#pending-xml-section .pending-xml-grid
.pending-xml-entered {
  color: var(--muted);
}
#pending-xml-section .pending-xml-notice {
  padding: 10px 14px;
  color: var(--muted);
}
#pending-xml-section #pending-xml-status {
  padding: 10px 14px;
}

/* Documentos pendientes: filtros compactos desktop */
#pending-xml-search {
  grid-template-columns:
    minmax(130px, 0.9fr)
    minmax(130px, 0.9fr)
    minmax(130px, 0.9fr)
    minmax(150px, 1.15fr)
    minmax(130px, 1fr)
    minmax(190px, 1.4fr)
    repeat(3, minmax(84px, 0.65fr));
  gap: 8px;
  align-items: end;
  padding: 0 10px 10px;
}
#pending-xml-search label {
  min-width: 0;
}
#pending-xml-search input,
#pending-xml-search select {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
#pending-xml-search button {
  min-width: 0;
}
@media (max-width: 1250px) {
  #pending-xml-search {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 650px) {
  #pending-xml-search {
    grid-template-columns: 1fr 1fr;
  }
}


/* Documentos XML: agrupacion por sucursal */
#pending-xml-section .pending-xml-branch {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
#pending-xml-section .pending-xml-branch-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--blue);
  color: white;
  font-size: 13px;
}
#pending-xml-section .pending-xml-branch-totals {
  padding: 9px 14px;
  background: #f6f8fb;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}


/* Modal y ficha documental, independientes de los comprobantes */
#receipt-document-status[hidden] { display: none !important; }
#receipt-document-status {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
#receipt-document-status .receipt-document-v3-heading,
#receipt-document-status .receipt-document-v3-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 15px;
}
#receipt-document-status .receipt-document-v3-heading strong,
#receipt-document-status .receipt-document-v3-card > strong {
  color: var(--blue-dark);
}
#receipt-document-status p { margin: 8px 0 0; }
#receipt-document-status .receipt-document-v3-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
#receipt-document-status .receipt-document-v3-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
#receipt-document-status .receipt-document-v3-field span {
  font-size: 12px;
  color: #64748b;
}
#receipt-document-status .receipt-document-v3-field strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
#receipt-document-dialog {
  width: min(92vw, 480px);
  max-width: 480px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  color: inherit;
  background: #fff;
  box-shadow: 0 20px 60px #0003;
}
#receipt-document-dialog::backdrop { background: #0f172a70; }
#receipt-document-dialog .receipt-document-dialog-body {
  padding: 22px;
}
#receipt-document-dialog .receipt-document-dialog-body > strong {
  color: var(--blue-dark);
}
#receipt-document-dialog p { margin: 14px 0; }
#receipt-document-dialog .receipt-document-disclaimer {
  font-size: 12px;
  color: #64748b;
}
#receipt-document-dialog .receipt-document-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}


/* V4: solo ajustar la vista cuando aparece información ERP/XML. */
#provider-receipts-section:has(
  #receipt-document-status:not([hidden])
) #receipt-layout:not(.has-detail) {
  min-height: 0;
}

/* V4: tarjeta documental más compacta, sin afectar comprobantes. */
#receipt-document-status {
  margin-top: 8px;
  gap: 8px;
}

#receipt-document-status .receipt-document-v3-heading,
#receipt-document-status .receipt-document-v3-card {
  padding: 11px 14px;
}

#receipt-document-status .receipt-document-v3-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
}

@media (max-width: 900px) {
  #receipt-document-status .receipt-document-v3-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  #receipt-document-status .receipt-document-v3-grid {
    grid-template-columns: 1fr;
  }
}


/* V4.1 - Tabla documental compacta; alcance exclusivo ERP/XML. */
#receipt-document-status .receipt-document-v41-heading {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 14px;
  background: #fff;
}

#receipt-document-status .receipt-document-v41-heading strong {
  display: block;
  color: #1744a6;
  font-weight: 800;
}

#receipt-document-status .receipt-document-v41-heading p {
  margin: 4px 0 0;
}

#receipt-document-status .receipt-document-v41-section {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

#receipt-document-status .receipt-document-v41-state {
  padding: 10px 14px;
  font-weight: 800;
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
}

#receipt-document-status .receipt-document-v41-ok {
  color: #17603d;
  background: #eaf6ef;
  border-bottom-color: #b9dfc8;
}

#receipt-document-status .receipt-document-v41-warning {
  color: #805500;
  background: #fff5df;
  border-bottom-color: #efd5a0;
}

#receipt-document-status .receipt-document-v41-scroll {
  overflow-x: auto;
  max-width: 100%;
}

#receipt-document-status .receipt-document-v41-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
  font-size: .8rem;
}

#receipt-document-status .receipt-document-v41-table th {
  padding: 9px 12px 6px;
  color: #536a8e;
  font-size: .73rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  background: #f8fafc;
}

#receipt-document-status .receipt-document-v41-table td {
  padding: 9px 12px;
  color: #16253d;
  font-weight: 600;
  border-top: 1px solid #e5ebf3;
  vertical-align: top;
}

#receipt-document-status .receipt-document-v41-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

#receipt-document-status .receipt-document-v41-table th:first-child,
#receipt-document-status .receipt-document-v41-table td:first-child {
  min-width: 185px;
}

#receipt-document-status .receipt-document-v41-empty,
#receipt-document-status .receipt-document-v41-notice {
  padding: 12px 14px;
}


/* V4.2 - Formulario exclusivo Comprobantes proveedores / pagos */
#provider-receipts-section .receipt-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

#provider-receipts-section #receipt-search {
  display: grid;
  width: 100%;
  max-width: none;
  grid-template-columns:
    minmax(155px, 1.4fr)
    minmax(135px, 1fr)
    minmax(120px, .9fr)
    minmax(140px, 1fr)
    minmax(140px, 1fr)
    auto auto auto auto;
  gap: 12px;
  align-items: end;
}

#provider-receipts-section #receipt-search > label {
  min-width: 0;
  width: 100%;
}

#provider-receipts-section #receipt-search input {
  box-sizing: border-box;
  display: block;
  min-width: 0;
  width: 100%;
}

#provider-receipts-section #receipt-search button {
  min-width: max-content;
  white-space: nowrap;
  padding-inline: 12px;
}

#provider-receipts-section #receipt-document-search-button {
  background: #f8fafc;
  color: var(--ink);
  border: 1px solid var(--line);
}

#provider-receipts-section #receipt-layout[hidden],
#provider-receipts-section #receipt-select-all[hidden],
#provider-receipts-section #receipt-email-send[hidden] {
  display: none !important;
}

@media (max-width: 1700px) {
  #provider-receipts-section #receipt-search {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  #provider-receipts-section #receipt-search > button[type="submit"] {
    grid-column: 2;
  }
}

@media (max-width: 950px) {
  #provider-receipts-section #receipt-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #provider-receipts-section #receipt-search > button[type="submit"] {
    grid-column: auto;
  }
}

@media (max-width: 540px) {
  #provider-receipts-section #receipt-search {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* V4.2-B: ocultación completa de selección en consulta documental */
#provider-receipts-section .receipt-select-all-bar[hidden] {
  display: none !important;
}

/* V4.2-B: evitar desbordamiento de las etiquetas de filtros */
#provider-receipts-section #receipt-search > label {
  box-sizing: border-box;
  min-width: 0;
}

#provider-receipts-section #receipt-search > button {
  box-sizing: border-box;
  max-width: 100%;
}

#provider-receipts-section #receipt-search {
  min-width: 0;
}

/* El texto de los botones no invade otras columnas. */
#provider-receipts-section #receipt-search > button {
  overflow-wrap: normal;
}


/* V4.2-C: aviso informativo exclusivo de Comprobantes */
#receipt-cp-empty-dialog {
  width: min(410px, calc(100vw - 32px));
  max-width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0,0,0,.20);
}

#receipt-cp-empty-dialog::backdrop {
  background: rgba(15,23,42,.38);
}

#receipt-cp-empty-dialog .receipt-cp-empty-body {
  display: grid;
  gap: 14px;
  padding: 22px;
}

#receipt-cp-empty-dialog .receipt-cp-empty-body strong {
  font-size: 17px;
}

#receipt-cp-empty-dialog .receipt-cp-empty-body p {
  margin: 0;
}

#receipt-cp-empty-dialog #receipt-cp-empty-ok {
  min-height: 38px;
  justify-self: end;
  padding: 0 24px;
}


/* PASO 162B - V4.2-E, limpieza visual de Comprobantes */
#provider-receipts-section #receipt-count {
  display: none !important;
}

#provider-receipts-section #receipt-cp-empty-dialog
.receipt-cp-empty-body {
  gap: 16px;
  padding: 22px;
}


/* Documentos pendientes V2: sin espacio para estado vacío. */
#pending-xml-section #pending-xml-status:empty {
  display: none;
}


/* PASO 165B: limpieza visual exclusiva Documentos de venta. */
#sales-documents-section #sales-document-count {
  display: none !important;
}


/* PASO 166D: sucursal global junto a logo y usuario. */
.app-nav-right .header-local-branch {
  min-width: 145px;
  max-width: 205px;
  padding: 4px 9px;
  gap: 2px;
  background: #f4f7ff;
  box-sizing: border-box;
}

.app-nav-right .header-local-branch > span {
  font-size: 10px;
}

.app-nav-right .header-local-branch > strong {
  min-width: 0;
  font-size: 12px;
}

.app-nav-right .header-local-branch .active-branch-select {
  min-width: 0;
  width: 100%;
}

.app-nav-right .header-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
}

.app-nav-right .header-logout svg {
  display: block;
  flex: 0 0 auto;
}

/* Ocultar solo el duplicado visual de Vehículo.
   El nodo técnico permanece montado para su JavaScript. */
#vehicle-search-branch {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-nav-right .header-local-branch {
    min-width: 115px;
    max-width: 155px;
  }
  .app-nav-right {
    gap: 7px;
  }
}

@media (max-width: 900px) {
  .app-nav-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .app-nav-right .header-local-branch {
    max-width: 190px;
  }
}

@media (max-width: 540px) {
  .app-nav-right .header-local-branch {
    min-width: 110px;
    max-width: 160px;
  }
}


/* PASO 166G - Sucursal del encabezado visible solo en Ventas.
   La pestaña activa la determina showTab() existente. */
.app-nav-right .header-local-branch {
  display: none;
}

.app-tabs:has(.tab-button[data-tab="sales"].active)
  .app-nav-right .header-local-branch {
  display: grid;
}


/* PASO 166I: ocultar el contenedor duplicado de Vehículo.
   Conserva el nodo usado por JavaScript. */
.vehicle-search-view .vehicle-local-branch-hidden {
  display: none !important;
}


/* PASO 167A - Busqueda general: eliminar cabecera redundante. */
#catalog-view .brand-row {
  display: none !important;
}

#catalog-view #metric-total {
  display: none !important;
}


/* PASO 168C-2: Vehiculo, abecedario y resumen en una fila. */
#vehicle-search-view .vehicle-search-alpha-quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
  min-width: 0;
}

#vehicle-search-view .vehicle-search-alpha-quote-row
> .vehicle-search-alpha {
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
}

#vehicle-search-view .vehicle-search-alpha-quote-row
> .vehicle-search-cart-status {
  flex: 0 0 500px;
  width: 500px;
  min-width: 0;
  margin: 0;
}

@media (max-width: 1350px) {
  #vehicle-search-view .vehicle-search-alpha-quote-row {
    flex-wrap: wrap;
  }

  #vehicle-search-view .vehicle-search-alpha-quote-row
  > .vehicle-search-alpha {
    flex-basis: 100%;
  }

  #vehicle-search-view .vehicle-search-alpha-quote-row
  > .vehicle-search-cart-status {
    flex: 0 1 500px;
    width: min(500px, 100%);
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  #vehicle-search-view .vehicle-search-alpha-quote-row
  > .vehicle-search-cart-status {
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
  }
}


/* PASO 169C - Gerencia: ocultar cabecera global redundante.
   Conserva el boton management-refresh y todos sus eventos. */
#management-view > .receipt-header {
  display: none !important;
}


/* PASO 170C - Proveedores: ocultar contenedor del selector
   de vistas inhabilitado, sin eliminar sus nodos ni eventos. */
#management-view #provider-dashboard
  > .provider-analysis-selector {
  display: none !important;
}


/* Pago proveedores — candidato UI informativo V1 */
.payment-providers-section { margin-top: 12px; }
.pp-table-wrap { overflow-x: auto; }
.pp-document-table { width: 100%; border-collapse: collapse; }
.pp-document-table th,
.pp-document-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--border, #d9dfe4);
  text-align: left;
  white-space: nowrap;
}
.pp-document-table th { font-size: 12px; }
.pp-document-table td { font-size: 13px; }
.pp-disclaimer { font-size: 12px; opacity: .75; }
.pp-xml-dialog {
  width: min(540px, calc(100vw - 28px));
  max-height: 85vh;
  overflow: auto;
  border-radius: 12px;
  padding: 18px;
  background: var(--surface, #fff);
  color: var(--text, #20252b);
}
.pp-xml-dialog::backdrop { background: rgba(0,0,0,.5); }
.pp-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.pp-detail-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid #ddd;
  font-size: 13px;
}
.pp-detail-line span { color: #68717a; }
.pp-detail-line strong {
  text-align: right;
  overflow-wrap: anywhere;
}


/* Documentos pendientes ERP V2 */
.pp-v2-query { margin-top: 10px; }
.pp-v2-mode { margin-bottom: 12px; }
.pp-v2-results { margin-top: 14px; }
.pp-v2-provider { margin: 0 0 18px; }
.pp-v2-provider-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(37, 102, 114, .07);
  border-radius: 8px 8px 0 0;
}
.pp-v2-provider-heading strong { font-size: 14px; }
.pp-v2-provider-heading span {
  font-size: 12px;
  opacity: .7;
}
.pp-v2-number { text-align: right !important; }
.pp-v2-subtotal { font-weight: 700; }
.pp-v2-general-total {
  padding: 15px;
  border-top: 2px solid #27727b;
  font-weight: 700;
  text-align: right;
}


/* PASO 182A-2: filtros compactos Documentos pendientes */
#pp-v2-form.pp-v3-filter-row {
  display: grid;
  grid-template-columns:
    minmax(155px, 1.1fr)
    minmax(200px, 1.6fr)
    minmax(135px, 1fr)
    minmax(135px, 1fr)
    minmax(130px, auto);
  align-items: end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

#pp-v2-form .pp-v3-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

#pp-v2-form .pp-v3-field input,
#pp-v2-form .pp-v3-field select {
  width: 100%;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
  font-size: 13px;
}

#pp-v2-form .pp-v3-generate {
  height: 36px;
  white-space: nowrap;
  align-self: end;
}

.pp-v2-query {
  overflow-x: auto;
}

@media (max-width: 900px) {
  #pp-v2-form.pp-v3-filter-row {
    min-width: 810px;
  }
}


/* PASO 185B - alineación exclusiva Documentos pendientes */
#payment-providers-section .pp-document-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

/* Anchos idénticos en todas las tablas de proveedores */
#payment-providers-section .pp-document-table th:nth-child(1) {
  width: 12%;
}
#payment-providers-section .pp-document-table th:nth-child(2) {
  width: 12%;
}
#payment-providers-section .pp-document-table th:nth-child(3) {
  width: 13%;
}
#payment-providers-section .pp-document-table th:nth-child(4) {
  width: 15%;
}
#payment-providers-section .pp-document-table th:nth-child(5) {
  width: 16%;
}
#payment-providers-section .pp-document-table th:nth-child(6) {
  width: 16%;
}
#payment-providers-section .pp-document-table th:nth-child(7) {
  width: 16%;
}

/* Importes en encabezado, detalle y subtotal */
#payment-providers-section .pp-document-table
  th:nth-child(n+5),
#payment-providers-section .pp-document-table
  td.pp-v2-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* Fila de filtros compacta con espacio para exportar */
#pp-v2-form.pp-v3-filter-row {
  display: grid;
  grid-template-columns:
    minmax(155px, 1.05fr)
    minmax(190px, 1.45fr)
    minmax(140px, .90fr)
    minmax(140px, .90fr)
    132px 60px 60px;
  align-items: end;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

#pp-v2-form .pp-v3-generate,
#pp-v2-form .pp-v3-export {
  height: 36px;
  min-width: 0;
  padding: 0 8px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}

#pp-v2-form .pp-v3-export {
  border: 1px solid var(--border, #d9dfe4);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text, #20252b);
}

#pp-v2-form .pp-v3-export:disabled {
  cursor: not-allowed;
  opacity: .52;
}

/* En pantallas estrechas, desplazamiento horizontal del filtro */
@media (max-width: 1090px) {
  #pp-v2-form.pp-v3-filter-row {
    min-width: 1040px;
  }
}


/* PASO 186B-1: vencimientos sin limite inferior */
#pp-v2-form.pp-v3-filter-row {
  grid-template-columns:
    minmax(155px, 1.05fr)
    minmax(230px, 1.65fr)
    minmax(175px, 1fr)
    132px 60px 60px;
}

@media (max-width: 1090px) {
  #pp-v2-form.pp-v3-filter-row {
    min-width: 850px;
  }
}


/* PASO 186C-1B: siete controles compactos, fila unica */
#pp-v2-form.pp-v3-filter-row {
  grid-template-columns:
    minmax(145px, 1fr)
    minmax(190px, 1.3fr)
    minmax(165px, 1fr)
    125px 72px 55px 55px;
  gap: 7px;
}

#pp-v2-form .pp-v3-clear {
  height: 36px;
  min-width: 0;
  padding: 0 8px;
  align-self: end;
  white-space: nowrap;
  font-size: 12px;
  border: 1px solid var(--border, #d9dfe4);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text, #20252b);
  cursor: pointer;
}

#pp-v2-form .pp-v3-clear:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 1090px) {
  #pp-v2-form.pp-v3-filter-row {
    min-width: 920px;
  }
}


/* PASO 187G - exportaciones habilitadas en azul Farina */
#pp-v2-form .pp-v3-export:not(:disabled) {
  background: #2155d8;
  color: #ffffff;
  border-color: #2155d8;
  opacity: 1;
  cursor: pointer;
  font-weight: 600;
}

#pp-v2-form .pp-v3-export:not(:disabled):hover {
  background: #1745ba;
  border-color: #1745ba;
}

#pp-v2-form .pp-v3-export:not(:disabled):focus-visible {
  outline: 2px solid #1745ba;
  outline-offset: 2px;
}


/* ============================================================
   PAYMENT_SUGGESTED_UI_V1
   ============================================================ */

#pp-suggested-view {
  margin-top: 10px;
}

.pp-suggested-filter-row {
  display: grid;
  grid-template-columns: minmax(170px, 220px) 120px;
  align-items: end;
  gap: 8px;
  margin-bottom: 8px;
}

.pp-suggested-filter-row label {
  min-width: 0;
}

.pp-suggested-filter-row input {
  width: 100%;
  box-sizing: border-box;
}

.pp-suggested-filter-row button {
  height: 36px;
}

.pp-suggested-status {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.pp-suggested-results {
  display: grid;
  gap: 12px;
}

.pp-suggested-summary {
  display: grid;
  grid-template-columns:
    repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.pp-suggested-summary article {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pp-suggested-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pp-suggested-summary strong {
  color: var(--blue-dark);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.pp-suggested-summary small {
  color: var(--muted);
  font-size: 11px;
}

.pp-suggested-list {
  display: grid;
  gap: 9px;
}

.pp-suggested-provider {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pp-suggested-provider-toggle {
  display: grid;
  grid-template-columns:
    minmax(280px, 1fr)
    minmax(105px, auto)
    minmax(125px, auto)
    20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pp-suggested-provider-toggle:hover,
.pp-suggested-provider.is-open
  .pp-suggested-provider-toggle {
  background: #f6f8fb;
}

.pp-suggested-provider-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pp-suggested-provider-main strong {
  overflow: hidden;
  color: var(--blue-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-suggested-provider-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-suggested-provider-receipts {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.pp-suggested-provider-total {
  color: var(--blue-dark);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pp-suggested-chevron {
  color: var(--muted);
  font-size: 18px;
  text-align: center;
  transition: transform .15s ease;
}

.pp-suggested-provider.is-open
  .pp-suggested-chevron {
  transform: rotate(180deg);
}

.pp-suggested-provider-detail {
  border-top: 1px solid var(--line);
  background: #fff;
}

.pp-suggested-provider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
  font-size: 11px;
  color: var(--muted);
}

.pp-suggested-provider-meta span {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
}

.pp-suggested-provider-meta strong {
  color: var(--blue-dark);
  font-variant-numeric: tabular-nums;
}

.pp-suggested-receipt {
  margin: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.pp-suggested-receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
}

.pp-suggested-receipt-head > div:first-child {
  display: grid;
  gap: 2px;
}

.pp-suggested-receipt-head strong {
  color: var(--blue-dark);
}

.pp-suggested-receipt-head span {
  color: var(--muted);
  font-size: 11px;
}

.pp-suggested-receipt-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 16px;
}

.pp-suggested-receipt-totals span {
  white-space: nowrap;
}

.pp-suggested-receipt-totals strong {
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

.pp-suggested-receipt-totals .is-net {
  color: var(--blue-dark);
  font-weight: 700;
}

.pp-suggested-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.pp-suggested-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.pp-suggested-table th,
.pp-suggested-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.pp-suggested-table th {
  color: var(--blue-dark);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.pp-suggested-table tbody tr:last-child td {
  border-bottom: 0;
}

.pp-suggested-table th:last-child,
.pp-suggested-table td:last-child {
  text-align: right;
}

.pp-suggested-number {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.pp-suggested-origin {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.pp-suggested-table tr.is-xml {
  background: #f6f8fb;
}

.pp-suggested-empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.pp-suggested-disclaimer {
  margin-top: 10px;
}

@media (max-width: 1000px) {
  .pp-suggested-summary {
    grid-template-columns:
      repeat(2, minmax(150px, 1fr));
  }

  .pp-suggested-provider-toggle {
    grid-template-columns:
      minmax(220px, 1fr)
      auto
      auto
      20px;
  }
}

@media (max-width: 650px) {
  .pp-suggested-filter-row {
    grid-template-columns: 1fr 110px;
  }

  .pp-suggested-summary {
    grid-template-columns: 1fr 1fr;
  }

  .pp-suggested-provider-toggle {
    grid-template-columns:
      minmax(0, 1fr)
      auto
      20px;
  }

  .pp-suggested-provider-receipts {
    display: none;
  }

  .pp-suggested-receipt-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .pp-suggested-receipt-totals {
    justify-content: flex-start;
  }
}


/* ============================================================
   PAYMENT_SUGGESTED_UI_V2
   ============================================================ */

.pp-suggested-filter-row {
  grid-template-columns:
    minmax(170px, 220px)
    110px
    170px;
}

.pp-suggested-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface, #fff);
  font-size: 12px;
}

.pp-suggested-dates[hidden] {
  display: none;
}

.pp-suggested-document-block {
  margin-top: 12px;
}

.pp-suggested-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.pp-suggested-section-title strong {
  color: var(--blue-dark);
  font-size: 12px;
  letter-spacing: .04em;
}

.pp-suggested-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pp-suggested-document-block.is-credit {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.pp-suggested-inline-empty {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}

.pp-suggested-table tfoot th {
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.pp-suggested-table tfoot th:last-child {
  text-align: right;
}

.pp-suggested-proposal-number {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 650px) {
  .pp-suggested-filter-row {
    grid-template-columns: 1fr;
  }

  .pp-suggested-filter-row button {
    width: 100%;
  }

  .pp-suggested-section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}


/* ============================================================
   PAYMENT_SUGGESTED_UI_V2F3 - EXPORTACIONES
   ============================================================ */

.pp-suggested-filter-row {
  grid-template-columns:
    minmax(170px, 220px)
    105px
    165px
    135px;
}

.pp-suggested-receipt-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pp-suggested-export-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.pp-suggested-export-link:hover {
  border-color: var(--blue-dark);
  text-decoration: none;
}

@media (max-width: 650px) {
  .pp-suggested-filter-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   PAYMENT_SUGGESTED_VISUAL_X8B
   Barra compacta desplazada a la derecha.
   La franja de fechas duplicada queda oculta.
   ============================================================ */

#pp-suggested-form.pp-suggested-filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
  padding-left: 32px;
  margin-bottom: 7px;
}

#pp-suggested-form .pp-suggested-date-field {
  flex: 0 0 220px;
  min-width: 220px;
}

#pp-suggested-form .pp-suggested-date-field input {
  width: 100%;
  box-sizing: border-box;
}

#pp-suggested-form button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Las mismas fechas ya aparecen en el estado de simulación. */
#pp-suggested-dates {
  display: none !important;
}

@media (max-width: 900px) {
  #pp-suggested-form.pp-suggested-filter-row {
    flex-wrap: wrap;
    padding-left: 16px;
  }

  #pp-suggested-form .pp-suggested-date-field {
    flex-basis: 200px;
    min-width: 180px;
  }
}


/* XML_DETAIL_LUPA_V1 */

#pp-xml-dialog.pp-xml-dialog {
  width: min(
    980px,
    calc(100vw - 32px)
  );
  max-width: none;
}

.pp-xml-detail-btn {
  min-width: 28px;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
}

.pp-xml-summary-grid {
  display: grid;
  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );
  gap: 8px 18px;
  margin-bottom: 16px;
}

.pp-xml-summary-grid > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pp-xml-summary-grid span,
.pp-xml-totals span {
  font-size: 11px;
  color: #68717a;
}

.pp-xml-summary-grid strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pp-xml-lines-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.pp-xml-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.pp-xml-lines-table th,
.pp-xml-lines-table td {
  padding: 8px 9px;
  border-bottom:
    1px solid
    var(--border, #d9dfe4);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.pp-xml-lines-table th {
  font-size: 11px;
}

.pp-xml-lines-table .pp-xml-description {
  min-width: 240px;
  white-space: normal;
}

.pp-xml-lines-table
.pp-xml-description small {
  display: block;
  margin-top: 2px;
  opacity: .7;
}

.pp-xml-num,
.pp-xml-money {
  text-align: right !important;
}

.pp-xml-totals {
  width: min(340px, 100%);
  margin: 16px 0 0 auto;
}

.pp-xml-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 5px 0;
}

.pp-xml-totals .is-total {
  margin-top: 4px;
  padding-top: 8px;
  border-top:
    2px solid
    var(--border, #d9dfe4);
  font-size: 15px;
}

.pp-xml-loading,
.pp-xml-error {
  margin: 18px 0;
  font-size: 13px;
}

.pp-xml-error {
  color: #a52b2b;
}

@media (max-width: 700px) {
  .pp-xml-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   VEHICLE_CONTEXT_INFO_V1
   Ventas > Vehículo
   Réplica informativa del vehículo consultado.
   NO participa de filtros ni de búsqueda vehículo.
   ========================================================== */

#vehicle-search-view .vehicle-context-info-panel {
  margin: 0 0 12px;
}

#vehicle-search-view .vehicle-context-info-grid {
  display: grid;
  grid-template-columns:
    minmax(140px, 1fr)
    minmax(190px, 1.25fr)
    80px
    minmax(130px, 0.95fr)
    100px
    minmax(220px, 1.4fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
}

#vehicle-search-view .vehicle-context-info-grid input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #f7f9fc;
}

#vehicle-search-view .vehicle-context-info-grid input[readonly] {
  cursor: default;
}

@media (max-width: 1200px) {
  #vehicle-search-view .vehicle-context-info-grid {
    grid-template-columns:
      minmax(130px, 1fr)
      minmax(160px, 1.15fr)
      72px
      minmax(120px, 0.9fr)
      94px
      minmax(180px, 1.25fr);
  }
}

/* END VEHICLE_CONTEXT_INFO_V1 */


/* ==========================================================
   PAYMAIL_TRANSFER_V1
   ========================================================== */

.receipt-transfer-date {
  display: grid;
  gap: 6px;
  max-width: 280px;
  font-weight: 700;
}

.receipt-transfer-date input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.receipt-transfer-date small {
  font-weight: 400;
  line-height: 1.3;
}

.receipt-email-transfer-label {
  font-weight: 800;
}

.receipt-email-transfer-label.is-pending {
  font-weight: 600;
  opacity: 0.7;
}

/* END PAYMAIL_TRANSFER_V1 */


/* ==========================================================
   PAYMAIL_TRANSFER_STATUS_V2
   ========================================================== */

.receipt-selection-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
}

.receipt-status-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.receipt-status-filter {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.receipt-status-filter.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.receipt-selection-toolbar .receipt-select-all-bar {
  margin: 0 0 0 auto;
}

.receipt-email-state {
  font-size: 11px;
  font-weight: 800;
}

.receipt-email-state.sent {
  color: var(--blue);
}

.receipt-email-state.unsent {
  opacity: 0.65;
}

@media (max-width: 900px) {
  .receipt-selection-toolbar .receipt-select-all-bar {
    margin-left: 0;
  }
}

/* END PAYMAIL_TRANSFER_STATUS_V2 */


/* ==========================================================
   PAYMAIL_TRANSFER_SEMANTICS_V3
   ========================================================== */

.receipt-email-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.receipt-email-line {
  display: block;
  line-height: 1.2;
}

.receipt-transfer-line {
  font-weight: 800;
}

.receipt-email-transfer-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.receipt-email-transfer-row {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.receipt-email-transfer-row.is-pending {
  opacity: 0.72;
}

.receipt-transfer-date[hidden] {
  display: none !important;
}

/* END PAYMAIL_TRANSFER_SEMANTICS_V3 */


/* ==========================================================
   PAYDOC_XML_MODAL_WIDE_V1
   Detalle XML:
   - Desktop: tabla completa sin scroll horizontal.
   - Pantalla estrecha: conserva scroll de seguridad.
   ========================================================== */

@media (min-width: 1101px) {

  #pp-xml-dialog.pp-xml-dialog {
    width: min(
      1280px,
      calc(100vw - 48px)
    );
    max-width: none;
    box-sizing: border-box;
  }

  #pp-xml-detail {
    min-width: 0;
    max-width: 100%;
  }

  .pp-xml-lines-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
  }

  .pp-xml-lines-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .pp-xml-lines-table th,
  .pp-xml-lines-table td {
    box-sizing: border-box;
    min-width: 0;
  }

  /* Línea */
  .pp-xml-lines-table th:nth-child(1),
  .pp-xml-lines-table td:nth-child(1) {
    width: 5%;
    white-space: nowrap;
  }

  /* Código proveedor */
  .pp-xml-lines-table th:nth-child(2),
  .pp-xml-lines-table td:nth-child(2) {
    width: 11%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Código interno */
  .pp-xml-lines-table th:nth-child(3),
  .pp-xml-lines-table td:nth-child(3) {
    width: 11%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Descripción */
  .pp-xml-lines-table th:nth-child(4),
  .pp-xml-lines-table td:nth-child(4) {
    width: 40%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Cantidad */
  .pp-xml-lines-table th:nth-child(5),
  .pp-xml-lines-table td:nth-child(5) {
    width: 6%;
    white-space: nowrap;
  }

  /* Precio */
  .pp-xml-lines-table th:nth-child(6),
  .pp-xml-lines-table td:nth-child(6) {
    width: 10%;
    white-space: nowrap;
  }

  /* Descuento */
  .pp-xml-lines-table th:nth-child(7),
  .pp-xml-lines-table td:nth-child(7) {
    width: 8%;
    white-space: nowrap;
  }

  /* Total */
  .pp-xml-lines-table th:nth-child(8),
  .pp-xml-lines-table td:nth-child(8) {
    width: 9%;
    white-space: nowrap;
  }
}


/* Tablet / móvil:
   la tabla mantiene ancho operativo y puede desplazarse.
   No comprimimos columnas hasta volverlas ilegibles. */

@media (max-width: 1100px) {

  #pp-xml-dialog.pp-xml-dialog {
    width: calc(100vw - 24px);
    max-width: none;
    box-sizing: border-box;
  }

  .pp-xml-lines-wrap {
    overflow-x: auto;
  }

  .pp-xml-lines-table {
    width: 100%;
    min-width: 920px;
    table-layout: auto;
  }

  .pp-xml-lines-table th,
  .pp-xml-lines-table td {
    white-space: nowrap;
  }

  .pp-xml-lines-table .pp-xml-description {
    min-width: 240px;
    white-space: normal;
  }
}

/* END PAYDOC_XML_MODAL_WIDE_V1 */


/* ==========================================================
   PAYDOC_XML_COLUMN_V1
   Pago proveedores > Documentos pendientes
   ========================================================== */

#payment-providers-section
.pp-v2-xml-pending-table {
  width: 100%;
  table-layout: fixed;
}

/* Tipo */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(1) {
  width: 13%;
}

/* Número */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(2) {
  width: 13%;
}

/* XML */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(3) {
  width: 5%;
  text-align: center;
}

/* Emisión */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(4) {
  width: 12%;
}

/* Destino */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(5) {
  width: 20%;
}

/* Estado */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(6) {
  width: 22%;
}

/* Importe */
#payment-providers-section
.pp-v2-xml-pending-table th:nth-child(7) {
  width: 15%;
  text-align: right;
}

#payment-providers-section
.pp-v2-xml-pending-table
.pp-v2-xml-detail-cell {
  text-align: center;
  white-space: nowrap;
}

#payment-providers-section
.pp-v2-xml-pending-table
td:nth-child(7) {
  text-align: right;
}

/* END PAYDOC_XML_COLUMN_V1 */

/* =========================================================
   PERMISSIONS ERP V4 - ACCORDION
   ========================================================= */

.permissions-v3 .permission-tree {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.permissions-v3 .permission-tree-module {
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
}

.permissions-v3 .permission-tree-module-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
}

.permissions-v3 .permission-tree-module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.permissions-v3 .permission-tree-chevron {
  width: 14px;
  flex: 0 0 auto;
}

.permissions-v3 .permission-tree-chevron::before {
  content: "▸";
}

.permissions-v3
.permission-tree-module.is-open
.permission-tree-chevron::before {
  content: "▾";
}

.permissions-v3 .permission-tree-module-title {
  min-width: 0;
  font-weight: 600;
}

.permissions-v3 .permission-tree-summary {
  margin-left: auto;
  white-space: nowrap;
  font-size: 0.86em;
  opacity: 0.72;
}

.permissions-v3 .permission-tree-parent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.permissions-v3 .permission-tree-children {
  padding: 4px 12px 10px 34px;
}

.permissions-v3 .permission-tree-children[hidden] {
  display: none !important;
}

.permissions-v3 .permission-tree-child {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
}

.permissions-v3
.permission-tree-module.is-parent-disabled {
  opacity: 0.58;
}


/* Ticket interno compacto V2 */
.ticket-preview-row.ticket-preview-compact {
  display: block;
}

.ticket-preview-mainline {
  display: grid;
  grid-template-columns:
    max-content minmax(0, 1fr) max-content max-content;
  align-items: baseline;
  column-gap: 8px;
  font-size: 16px;
  line-height: 1.25;
}

.ticket-preview-code,
.ticket-preview-qty,
.ticket-preview-status {
  white-space: nowrap;
}

.ticket-preview-description {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ticket-preview-location {
  margin-top: 5px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 600;
}

/* ==========================================================
   N3 ADMIN IMPRESORAS MULTI-PC V1
   ========================================================== */

#inventory-printers-section .printer-fleet-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

#inventory-printers-section .printer-fleet-toolbar > div:first-child {
  display: grid;
  gap: 3px;
}

#inventory-printers-section .printer-fleet-toolbar span {
  color: var(--muted);
  font-size: .86rem;
}

#printer-fleet-enrollment-status[data-state="open"] {
  font-weight: 700;
}

.printer-fleet-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.printer-fleet-layout {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.4fr);
  gap: 12px;
  padding: 12px 14px;
  background: #f7f9fb;
}

.printer-fleet-panel,
.printer-fleet-routes {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.printer-fleet-routes {
  margin: 0 14px 14px;
}

.printer-fleet-panel-title {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.printer-fleet-panel-title span {
  color: var(--muted);
  font-size: .82rem;
}

.printer-fleet-agent-list {
  max-height: 430px;
  overflow-y: auto;
}

.printer-fleet-agent {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.printer-fleet-agent:last-child {
  border-bottom: 0;
}

.printer-fleet-agent:hover,
.printer-fleet-agent.is-selected {
  background: #f4f8fc;
}

.printer-fleet-agent.is-selected {
  box-shadow: inset 3px 0 0 var(--blue);
}

.printer-fleet-agent-main,
.printer-fleet-agent-side {
  display: grid;
  gap: 3px;
}

.printer-fleet-agent-main span,
.printer-fleet-agent-main small,
.printer-fleet-agent-side > span:not(.printer-fleet-state) {
  color: var(--muted);
  font-size: .78rem;
}

.printer-fleet-agent-main small {
  overflow-wrap: anywhere;
}

.printer-fleet-agent-side {
  justify-items: end;
  align-content: start;
  min-width: 132px;
}

.printer-fleet-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1f4;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}

.printer-fleet-state[data-state="ACTIVE"] {
  background: #e8f5ec;
}

.printer-fleet-state[data-state="PENDING_APPROVAL"] {
  background: #fff5d9;
}

.printer-fleet-state[data-state="REVOKED"] {
  background: #f3e9e9;
}

.printer-fleet-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.printer-fleet-meta > div {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  background: #fff;
}

.printer-fleet-meta span {
  color: var(--muted);
  font-size: .75rem;
}

.printer-fleet-meta strong {
  overflow-wrap: anywhere;
  font-size: .85rem;
}

.printer-fleet-subtitle {
  padding: 10px 12px 6px;
}

.printer-fleet-printer-list {
  max-height: 230px;
  overflow-y: auto;
  padding: 0 12px 10px;
}

.printer-fleet-printer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 6px;
}

.printer-fleet-printer > div {
  display: grid;
  gap: 2px;
}

.printer-fleet-printer span {
  color: var(--muted);
  font-size: .78rem;
}

.printer-default-badge {
  align-self: center;
  font-weight: 700;
  white-space: nowrap;
}

.printer-assignment-form {
  display: grid;
  grid-template-columns:
    minmax(150px, .8fr)
    minmax(220px, 1.4fr)
    minmax(150px, 1fr)
    minmax(130px, .8fr)
    auto;
  gap: 9px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.printer-assignment-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.printer-assignment-form select,
.printer-assignment-form input {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.printer-fleet-route-table {
  width: 100%;
}

.printer-fleet-route-row {
  display: grid;
  grid-template-columns: 1fr 1fr .8fr 1.3fr;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
}

.printer-fleet-route-row.is-head {
  border-top: 0;
  background: #fbfdff;
  color: var(--muted);
  font-weight: 700;
}

.printer-fleet-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: .84rem;
}

@media (max-width: 1100px) {
  .printer-fleet-layout {
    grid-template-columns: 1fr;
  }

  .printer-assignment-form {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  #inventory-printers-section .printer-fleet-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .printer-fleet-toolbar-actions {
    width: 100%;
  }

  .printer-fleet-agent {
    flex-direction: column;
  }

  .printer-fleet-agent-side {
    justify-items: start;
  }

  .printer-fleet-meta,
  .printer-assignment-form {
    grid-template-columns: 1fr;
  }

  .printer-fleet-route-row {
    grid-template-columns: 1fr 1fr;
  }
}


/* ==========================================================
   N3 IMPRESORAS SIMPLE V2
   ========================================================== */

#inventory-printers-section .printer-simple-shell {
  max-width: 760px;
  padding: 18px 14px;
}

#inventory-printers-section .printer-simple-form {
  display: grid;
  grid-template-columns:
    minmax(180px, .8fr)
    minmax(300px, 1.5fr)
    auto;
  gap: 12px;
  align-items: end;
}

#inventory-printers-section .printer-simple-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#inventory-printers-section .printer-simple-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

#inventory-printers-section .printer-simple-current {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
}

#inventory-printers-section .printer-simple-current span {
  color: var(--muted);
  font-size: .78rem;
}

#inventory-printers-section .printer-simple-current strong {
  font-size: .92rem;
}

@media (max-width: 760px) {
  #inventory-printers-section .printer-simple-form {
    grid-template-columns: 1fr;
  }
}



/* ============================================================
   QUOTE_WORKBENCH_V1
   Gestión de cotizaciones - maqueta frontend
   ============================================================ */

.quote-workbench-view {
  width: 100%;
}

.quote-workbench-shell {
  width: 100%;
  padding: 20px 22px 28px;
  box-sizing: border-box;
}

.quote-workbench-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
}

.quote-workbench-toolbar > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quote-workbench-heading {
  font-size: 20px;
  line-height: 1.2;
}

.quote-workbench-subtitle,
.quote-workbench-section-title span,
.quote-workbench-modal-head span {
  font-size: 13px;
  opacity: 0.68;
}

.quote-workbench-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quote-workbench-document {
  display: grid;
  grid-template-columns:
    minmax(130px, 1.1fr)
    minmax(110px, 0.8fr)
    minmax(130px, 0.9fr)
    minmax(170px, 1.2fr)
    minmax(170px, 1.2fr);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  margin-top: 16px;
  overflow: hidden;
  background: #fff;
}

.quote-workbench-document-cell {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid rgba(15, 23, 42, 0.11);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quote-workbench-document-cell:last-child {
  border-right: 0;
}

.quote-workbench-document-cell span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.58;
}

.quote-workbench-document-cell strong {
  font-size: 14px;
  min-height: 18px;
}

.quote-workbench-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
}

.quote-workbench-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.quote-workbench-client-grid {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.8fr)
    minmax(300px, 2fr)
    minmax(170px, 1fr);
  gap: 12px;
}

.quote-workbench-client-grid label,
.quote-workbench-entry label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}

.quote-workbench-client-grid input,
.quote-workbench-entry input,
.quote-workbench-observation textarea,
.quote-workbench-modal-search input,
.quote-workbench-discount-row input {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 6px;
  box-sizing: border-box;
}

.quote-workbench-client-grid input,
.quote-workbench-entry input,
.quote-workbench-modal-search input {
  height: 38px;
  padding: 7px 10px;
}

.quote-workbench-client-grid input:focus,
.quote-workbench-entry input:focus,
.quote-workbench-observation textarea:focus,
.quote-workbench-modal-search input:focus,
.quote-workbench-discount-row input:focus {
  outline: 2px solid color-mix(
    in srgb,
    var(--blue) 25%,
    transparent
  );
  border-color: var(--blue);
}

.quote-workbench-entry {
  display: grid;
  grid-template-columns:
    22ch
    minmax(320px, 1fr)
    90px
    auto
    auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}

.quote-workbench-entry button {
  min-height: 38px;
}

.quote-workbench-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 7px;
}

.quote-workbench-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 690px;
  background: #fff;
}

.quote-workbench-table th,
.quote-workbench-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  text-align: left;
  vertical-align: middle;
}

.quote-workbench-table th {
  font-size: 12px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.035);
  white-space: nowrap;
}

.quote-workbench-table td {
  font-size: 13px;
}

.quote-workbench-table th.number,
.quote-workbench-table td.number {
  text-align: right;
}

.quote-workbench-empty-row td {
  padding: 28px 12px;
  text-align: center;
  opacity: 0.58;
}

.quote-workbench-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: stretch;
}

.quote-workbench-observation textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  padding: 9px 10px;
}

.quote-workbench-totals {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
}

.quote-workbench-total-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0;
  align-items: center;
}

.quote-workbench-discount-row > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.quote-workbench-discount-row input {
  width: 74px;
  height: 34px;
  padding: 5px 8px;
  text-align: right;
}

.quote-workbench-discount-help {
  text-align: right;
  font-size: 11px;
  opacity: 0.6;
  padding-bottom: 5px;
}

.quote-workbench-grand-total {
  margin-top: 7px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.14);
  font-size: 17px;
}

.quote-workbench-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.quote-workbench-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 20px 30px;
  background: rgba(15, 23, 42, 0.34);
  box-sizing: border-box;
}

.quote-workbench-modal-overlay[hidden] {
  display: none;
}

.quote-workbench-modal {
  width: min(1000px, 100%);
  max-height: 78vh;
  overflow: auto;
  background: #fff;
  border-radius: 9px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 18px;
  box-sizing: border-box;
}

.quote-workbench-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}

.quote-workbench-modal-head > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quote-workbench-modal-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .quote-workbench-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-workbench-document {
    grid-template-columns: 1fr 1fr;
  }

  .quote-workbench-document-cell {
    border-bottom: 1px solid rgba(15, 23, 42, 0.11);
  }

  .quote-workbench-client-grid,
  .quote-workbench-bottom {
    grid-template-columns: 1fr;
  }

  .quote-workbench-entry {
    grid-template-columns: 1fr 90px;
  }
}

@media (max-width: 600px) {
  .quote-workbench-shell {
    padding: 14px;
  }

  .quote-workbench-document,
  .quote-workbench-entry {
    grid-template-columns: 1fr;
  }

  .quote-workbench-footer-actions,
  .quote-workbench-toolbar-actions {
    justify-content: stretch;
  }

  .quote-workbench-footer-actions button,
  .quote-workbench-toolbar-actions button {
    flex: 1;
  }
}


.quote-workbench-description-field input[readonly] {
  background: rgba(15, 23, 42, 0.025);
  cursor: default;
}

/* PDF-COT-05 - Modal post guardado */
.pdf-choice-actions-after-save {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-choice-primary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pdf-choice-primary-row button {
  width: 100%;
  min-height: 34px;
  font: inherit;
  font-weight: 600;
}

.pdf-choice-actions-after-save > button {
  width: 100%;
}

@media (max-width: 560px) {
  .pdf-choice-primary-row {
    grid-template-columns: 1fr;
  }
}


/* OC-MANUAL-15B: selector de proveedor compatible con CSP */
.oc-manual-provider-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  padding: min(10vh, 70px) 16px 24px;
  background: rgba(15, 23, 42, 0.50);
}

.oc-manual-provider-dialog {
  display: block;
  box-sizing: border-box;
  flex: 0 1 600px;
  width: min(600px, 100%);
  min-width: 0;
  max-height: 80vh;
  overflow: auto;
  border: 1px solid #dbe6ef;
  border-radius: 12px;
  background: #ffffff;
  color: #182536;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.oc-manual-provider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid #dbe6ef;
}

.oc-manual-provider-header strong {
  color: #173f82;
  font-size: 1rem;
}

.oc-manual-provider-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.86rem;
}

.oc-manual-provider-content {
  padding: 18px 20px 22px;
}

.oc-manual-provider-content input[data-oc-manual-query] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #182536;
  font: inherit;
}

.oc-manual-provider-content [data-oc-manual-results] {
  margin-top: 14px;
  max-height: 46vh;
  overflow-y: auto;
}


/* ANOTACIONES V1 - Componente compartido */
.replenishment-annotation-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.product-annotation-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid #b9c9d7;
  border-radius: 4px;
  background: #eef5fa;
  color: #205b83;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.product-annotation-trigger:hover {
  background: #dceef9;
}

.product-annotation-overlay[hidden] {
  display: none !important;
}

.product-annotation-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 25, 35, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.product-annotation-modal {
  background: #fff;
  color: #172635;
  width: min(100%, 520px);
  max-height: 92vh;
  overflow: auto;
  border-radius: 12px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, .28);
}

.product-annotation-header,
.product-annotation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8ef;
}

.product-annotation-header h3 {
  font-size: 17px;
  margin: 0;
}

.product-annotation-close {
  font-size: 24px;
  cursor: pointer;
}

.product-annotation-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.product-annotation-body label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}

.product-annotation-body input,
.product-annotation-body select,
.product-annotation-body textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 36px;
  padding: 8px;
  border: 1px solid #b9c9d7;
  border-radius: 6px;
  font: inherit;
}

.product-annotation-body [readonly] {
  background: #f3f5f8;
}

.product-annotation-status {
  font-size: 12px;
  color: #5c6875;
}

.product-annotation-footer {
  border-top: 1px solid #e2e8ef;
  border-bottom: 0;
  justify-content: flex-end;
}

.product-annotation-footer button {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.product-annotation-footer button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.replenishment-annotation-cell {
  gap: 5px;
  white-space: nowrap;
}


/* OC-ERP-VISUAL-CSP-V1: indicador visual de exportación ERP */
.saved-po-erp-activity {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(25, 40, 63, 0.30);
}

.saved-po-erp-activity-panel {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 380px;
  max-width: 90vw;
  padding: 26px 30px;
  background: #fff;
  color: #1e293b;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.saved-po-erp-activity-icon {
  font-size: 34px;
  margin-bottom: 12px;
  animation: savedPoErpHourglass 1.2s ease-in-out infinite alternate;
}

.saved-po-erp-activity-panel strong {
  display: block;
  font-size: 17px;
}

.saved-po-erp-activity-description {
  margin-top: 10px;
  color: #64748b;
  font-size: 13px;
}

@keyframes savedPoErpHourglass {
  from { transform: rotate(0deg); opacity: .65; }
  to { transform: rotate(180deg); opacity: 1; }
}


/* STOCK-EMPRESA-COMPRA-02D / columna informativa */
#purchase-view .purchase-table-wrap tbody td.purchase-stock-empresa {
  background: #FFF8E1;
  color: #554B2A;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
#purchase-view .purchase-table-wrap tbody td.purchase-stock-empresa-negative {
  color: #A12626;
}


/* REPOSICION-VERDE-01D: anotacion ERP confirmada */
#replenishment-results tr.replenishment-erp-annotation td {
  background: #dff3dc;
}
