:root {
  --brand: #2E2D57;
  --brand-strong: #232246;
  --brand-soft: #f0f0f7;
  --aqua: #25B0D3;
  --aqua-strong: #168aa7;
  --aqua-soft: #e9f8fb;
  --ink: #171927;
  --ink-soft: #5d6675;
  --panel: #ffffff;
  --panel-muted: #fbfcfc;
  --panel-raised: #ffffff;
  --paper: #f7f8f8;
  --paper-soft: #EAEAEA;
  --line: #d8dde3;
  --field: #ffffff;
  --field-disabled: #f3f5f7;
  --table-header: #f7f8f8;
  --table-row: #ffffff;
  --table-row-alt: #fbfcfc;
  --table-row-hover: #eef7f9;
  --quote-section-header-bg: #f3f5f7;
  --quote-section-header-border: #d8dde3;
  --quote-section-header-text: #171927;
  --quote-section-header-meta: #5d6675;
  --quote-info-surface: #ffffff;
  --quote-input-surface: #f7fcfd;
  --quote-items-surface: #ffffff;
  --quote-subsection-surface: #fbfcfc;
  --quote-subsection-border: #d8dde3;
  /* Puturebuilt Operational UI Motif aliases. These resolve through the
     existing theme tokens so dark and light modes retain identical geometry. */
  --pb-op-canvas: var(--paper);
  --pb-op-surface-info: var(--panel);
  --pb-op-surface-working: var(--panel-raised);
  --pb-op-surface-data: var(--panel);
  --pb-op-surface-subsection: var(--panel-muted);
  --pb-op-surface-inspector: var(--panel);
  --pb-op-text: var(--ink);
  --pb-op-text-muted: var(--ink-soft);
  --pb-op-border: var(--line);
  --pb-op-border-subsection: var(--line);
  --pb-op-divider: var(--line);
  --pb-op-focus: var(--aqua);
  --pb-op-space-1: 4px;
  --pb-op-space-2: 8px;
  --pb-op-space-3: 12px;
  --pb-op-space-4: 16px;
  --pb-op-radius-card: 8px;
  --pb-op-radius-subsection: 6px;
  --nav: #2E2D57;
  --nav-2: #3a3869;
  --nav-3: #232246;
  --green: #dcefd7;
  --green-ink: #1f5d37;
  --warning: #b87514;
  --warning-soft: #fff7e6;
  --danger: #9f3d25;
  --danger-soft: #fff2ed;
  --shadow: 0 16px 40px rgba(46, 45, 87, 0.09);
}

body[data-theme="dark"] {
  --brand: #d8dee8;
  --brand-strong: #080a0f;
  --brand-soft: #171a21;
  --aqua: #25B0D3;
  --aqua-strong: #78ddf0;
  --aqua-soft: #102831;
  --ink: #f0f3f6;
  --ink-soft: #9ba6b4;
  --panel: #171b22;
  --panel-muted: #12161c;
  --panel-raised: #1c2129;
  --paper: #07090d;
  --paper-soft: #1c2129;
  --line: #353d49;
  --field: #10141a;
  --field-disabled: #0b0f14;
  --table-header: #1c2129;
  --table-row: #14181f;
  --table-row-alt: #181d25;
  --table-row-hover: #202731;
  --quote-section-header-bg: #1c2129;
  --quote-section-header-border: #353d49;
  --quote-section-header-text: #f0f3f6;
  --quote-section-header-meta: #9ba6b4;
  --quote-info-surface: #171b22;
  --quote-input-surface: #16242a;
  --quote-items-surface: #1a1f27;
  --quote-subsection-surface: #14191f;
  --quote-subsection-border: #353d49;
  /* Re-resolve motif aliases inside the dark theme. Custom properties inherit
     their computed value, so the root aliases alone would retain light values. */
  --pb-op-canvas: var(--paper);
  --pb-op-surface-info: var(--panel);
  --pb-op-surface-working: var(--panel-raised);
  --pb-op-surface-data: var(--panel);
  --pb-op-surface-subsection: var(--panel-muted);
  --pb-op-surface-inspector: var(--panel);
  --pb-op-text: var(--ink);
  --pb-op-text-muted: var(--ink-soft);
  --pb-op-border: var(--line);
  --pb-op-border-subsection: var(--line);
  --pb-op-divider: var(--line);
  --pb-op-focus: var(--aqua);
  --nav: #08090d;
  --nav-2: #151820;
  --nav-3: #050608;
  --green: #102d20;
  --green-ink: #9be7b4;
  --warning: #f1bd69;
  --warning-soft: #32240f;
  --danger: #f2a08c;
  --danger-soft: #341914;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI Variable", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.public-page {
  min-height: 100vh;
}

.public-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.public-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.public-brand {
  width: fit-content;
  margin-bottom: 0;
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--nav);
}

.public-layout {
  align-items: flex-start;
}

.portal-deliveries-panel {
  margin-top: 18px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  height: 100dvh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  overflow: hidden;
}

/* Release 2: official Sales Order register and read-only detail drawer. */
.sales-orders-register-panel {
  min-width: 0;
}

.sales-orders-filters {
  grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
}

.sales-orders-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.sales-orders-table {
  min-width: 1320px;
}

.sales-orders-table td,
.sales-orders-table th {
  vertical-align: top;
}

.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent, #18a9c6);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.sales-order-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  background: rgb(4 10 18 / 58%);
}

.sales-order-drawer-backdrop.hidden {
  display: none;
}

.sales-order-drawer {
  width: min(720px, 94vw);
  height: 100%;
  overflow-y: auto;
  background: var(--panel, #141a22);
  border-left: 1px solid var(--border, #344150);
  box-shadow: -20px 0 50px rgb(0 0 0 / 28%);
  padding: 24px;
}

.sales-order-drawer:focus {
  outline: 3px solid var(--accent, #18a9c6);
  outline-offset: -3px;
}

.sales-order-drawer-status {
  margin: 0 0 18px;
}

.sales-order-linked-records {
  border-top: 1px solid var(--border, #344150);
  margin-top: 20px;
  padding-top: 16px;
}

.sales-order-linked-records h3 {
  margin: 0 0 8px;
}

.sales-order-linked-records p {
  line-height: 1.7;
  margin: 0;
}

@media (max-width: 1100px) {
  .sales-orders-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sales-orders-filters {
    grid-template-columns: 1fr;
  }

  .sales-order-drawer {
    width: 100%;
    padding: 18px;
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 8px;
  color: #f8fbfb;
  background: linear-gradient(180deg, var(--nav), var(--nav-3));
  overflow: hidden;
}

.brand {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 40px;
  margin-bottom: 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.brand-subtitle {
  margin-top: 2px;
  color: #c8d5de;
  font-size: 11px;
  text-transform: lowercase;
}

.nav-list {
  display: grid;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

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

.nav-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(37, 176, 211, 0.32);
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group[hidden] {
  display: none !important;
}

.nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 5px 2px;
  border: 0;
  color: #a9dcea;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-section-toggle::after {
  content: "+";
  color: rgba(169, 220, 234, 0.7);
  font-size: 13px;
  line-height: 1;
}

.nav-group.is-open .nav-section-toggle::after {
  content: "-";
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
  color: #ffffff;
}

.nav-group-items {
  display: grid;
  gap: 3px;
}

.nav-group:not(.is-open) .nav-group-items {
  display: none;
}

.superseded-row {
  opacity: 0.64;
}

.superseded-row td:first-child strong::after {
  content: " Superseded";
  display: inline-block;
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #e1e8ee;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item[hidden] {
  display: none !important;
}

.nav-item:hover,
.nav-item.active {
  background: var(--nav-2);
  border-color: rgba(37, 176, 211, 0.28);
  color: #ffffff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--aqua);
}

.nav-icon {
  width: 26px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(37, 176, 211, 0.13);
  color: #9fe8f7;
  font-size: 10px;
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  min-height: 32px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #bdc8d4;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #62d46f;
}

.workspace {
  min-width: 0;
  height: 100dvh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 8px 10px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--aqua-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
  font-weight: 650;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-quote-action {
  display: none;
}

body[data-view="quotation"] .topbar-quote-action {
  display: inline-flex;
  align-items: center;
}

.user-avatar {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(37, 176, 211, 0.34);
  border-radius: 50%;
  color: var(--brand);
  background: var(--aqua-soft);
  font-size: 11px;
  font-weight: 700;
}

.cloud-status {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--panel-raised);
  font-size: 12px;
  font-weight: 600;
}

.role-disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
}

.cloud-status.online {
  border-color: #b8dcc0;
  color: var(--green-ink);
  background: #eef8ef;
}

.cloud-status.error {
  border-color: #d76b6b;
  color: #9b2f2f;
  background: #fff0f0;
}

.icon-button,
.primary-action,
.secondary-action {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  color: var(--ink);
  font-size: 22px;
}

.primary-action {
  padding: 0 12px;
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}

.primary-action:hover {
  border-color: var(--aqua-strong);
  background: linear-gradient(135deg, var(--brand), var(--aqua-strong));
}

.secondary-action {
  padding: 0 11px;
  color: var(--ink);
  background: var(--panel-raised);
  font-weight: 700;
}

.secondary-action:hover {
  border-color: var(--aqua);
  color: var(--brand);
  background: var(--aqua-soft);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 34, 51, 0.45);
  overflow-y: auto;
}

.cloud-retry {
  white-space: nowrap;
}

.cloud-conflict-action {
  white-space: nowrap;
  border-color: rgba(177, 56, 35, 0.4);
  color: var(--danger);
}

.auth-modal.hidden {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.auth-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.cloud-conflict-card {
  position: relative;
  width: min(640px, 100%);
}

#sales-order-close-modal {
  z-index: 1300;
}

.sales-order-close-card {
  position: relative;
  width: min(640px, 100%);
}

.sales-order-close-lines .mini-table-wrap {
  max-height: min(34vh, 260px);
  overflow: auto;
}

#sales-order-close-error {
  margin: 0;
  color: var(--danger);
}

.cloud-conflict-card .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-raised);
  cursor: pointer;
}

.cloud-conflict-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.cloud-conflict-details div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.cloud-conflict-details dt {
  color: var(--ink-soft);
  font-weight: 700;
}

.cloud-conflict-details dd {
  margin: 0;
  color: var(--ink);
}

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

.cloud-recovery-card { width: min(820px, 100%); max-height: min(88vh, 850px); overflow: auto; }
.cloud-recovery-list { display: grid; gap: 8px; max-height: 48vh; overflow: auto; margin: 14px 0; }
.cloud-recovery-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 230px); gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-soft); }
.cloud-recovery-row strong, .cloud-recovery-row span { display: block; }
.cloud-recovery-row span { color: var(--ink-soft); font-size: 0.88rem; }
.cloud-recovery-row select { width: 100%; min-height: 36px; }
@media (max-width: 560px) { .cloud-recovery-row { grid-template-columns: 1fr; } }

.si-details-card {
  width: min(620px, 100%);
}

.si-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.si-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
}

.si-detail-row.wide {
  grid-column: 1 / -1;
}

.si-detail-label {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.si-detail-value {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.si-detail-value.is-missing {
  color: var(--warning);
  font-style: italic;
}

.si-copy-button {
  min-width: 52px;
  padding: 6px 9px;
  font-size: 12px;
}

@media (max-width: 520px) {
  .si-details-grid {
    grid-template-columns: 1fr;
  }

  .si-detail-row.wide {
    grid-column: auto;
  }
}

.quick-delivery-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.quick-payment-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.walk-in-transaction-card {
  width: min(760px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.walk-in-transaction-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.walk-in-transaction-summary > div,
.walk-in-transaction-total-row {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
}

.walk-in-transaction-summary span,
.walk-in-transaction-total-row span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.walk-in-transaction-summary strong,
.walk-in-transaction-total-row strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.walk-in-transaction-lines-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.walk-in-transaction-lines {
  width: 100%;
  min-width: 590px;
  margin: 0;
}

.walk-in-transaction-lines th,
.walk-in-transaction-lines td {
  padding: 8px 9px;
}

.walk-in-transaction-lines th:not(:first-child),
.walk-in-transaction-lines td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.walk-in-transaction-totals {
  width: min(320px, 100%);
  display: grid;
  gap: 6px;
  margin-left: auto;
}

.walk-in-transaction-total-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.walk-in-transaction-total-row.is-total {
  border-top: 2px solid var(--brand);
  background: var(--aqua-soft);
}

@media (max-width: 560px) {
  .walk-in-transaction-summary {
    grid-template-columns: 1fr;
  }
}

.quick-delivery-source {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--aqua-soft);
}

.quick-delivery-source span,
.quick-delivery-source small {
  color: var(--ink-soft);
  font-size: 12px;
}

.quick-delivery-source strong {
  color: var(--ink);
}

.quick-payment-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
}

.quick-payment-balance span {
  color: var(--ink-soft);
  font-size: 12px;
}

.quick-payment-balance strong {
  color: var(--green-ink);
  font-size: 16px;
}

.quick-delivery-lines {
  max-height: min(36vh, 300px);
  overflow-y: auto;
  padding-right: 2px;
}

.delivery-fill-button {
  margin-top: -4px;
}

.quick-delivery-card .auth-actions {
  flex-wrap: wrap;
}

.quick-delivery-card .auth-actions #quick-delivery-fill-all {
  margin-right: auto;
}

.auth-help {
  margin: -2px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.dependency-review-card {
  width: min(780px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dependency-review-summary,
.dependency-review-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.dependency-review-note.status-success {
  color: var(--green-ink);
}

.dependency-review-note.status-danger {
  color: var(--danger);
}

.dependency-review-content {
  display: grid;
  gap: 10px;
  min-height: 0;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-color: var(--ink-soft) transparent;
  scrollbar-width: thin;
}

.dependency-review-card .panel-header,
.dependency-review-card .dependency-review-summary,
.dependency-review-card .dependency-review-note,
.dependency-review-card .dependency-review-actions {
  flex: 0 0 auto;
}

.dependency-review-card .dependency-review-content {
  flex: 0 1 auto;
  min-height: 120px;
}

.dependency-review-confirmation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.dependency-review-confirmation label {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.dependency-review-confirmation input {
  width: 100%;
}

.dependency-review-confirmation .controlled-purge-acknowledgement {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.dependency-review-confirmation .controlled-purge-acknowledgement input {
  width: auto;
  margin-top: 2px;
}

.dependency-review-confirmation .auth-help {
  grid-column: 1 / -1;
}

.dependency-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.dependency-group-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
}

.dependency-group-header strong {
  font-size: 13px;
}

.dependency-group table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.dependency-group th,
.dependency-group td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: left;
  overflow-wrap: anywhere;
}

.dependency-group tr:last-child td {
  border-bottom: 0;
}

.dependency-group th {
  color: var(--ink);
  font-weight: 650;
}

.dependency-empty {
  padding: 9px 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.dependency-review-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr auto;
  gap: 8px;
}

.dependency-review-actions button {
  min-height: 38px;
}

.dependency-review-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.purge-history-table th:nth-child(1) { width: 140px; }
.purge-history-table th:nth-child(2) { width: 160px; }
.purge-history-table th:nth-child(3) { width: 130px; }
.purge-history-table th:nth-child(5) { width: 150px; }
.purge-history-table th:nth-child(6) { width: 110px; }

.purge-audit-details-card {
  width: min(860px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
}

.purge-audit-details-content {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.purge-audit-detail-block {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
}

.purge-audit-detail-block summary {
  padding: 9px 10px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 650;
}

.purge-audit-detail-block pre {
  max-height: 280px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .auth-modal {
    place-items: start center;
    padding: 12px;
  }

  .dependency-review-card {
    max-height: calc(100vh - 24px);
  }

  .dependency-review-content {
    max-height: 48vh;
  }

  .dependency-review-actions {
    grid-template-columns: 1fr;
  }

  .dependency-review-confirmation {
    grid-template-columns: 1fr;
  }

  .dependency-review-confirmation .auth-help {
    grid-column: auto;
  }
}

.view {
  display: none;
}

.view.active {
  display: block;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 88px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric.warning {
  background: var(--warning-soft);
}

.metric-label,
.metric small,
.quote-strip span,
.split-list span,
.total-list span,
.terms-box span,
.doc-number span,
.report-note {
  color: var(--ink-soft);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.dashboard-grid,
.reports-grid,
.records-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

.department-dashboard-shell {
  min-height: 0;
  padding: 12px;
}

.dashboard-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 14px;
  margin-bottom: 5px;
}

.dashboard-live-note {
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.dashboard-tab {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-tab:hover,
.dashboard-tab:focus-visible {
  border-color: var(--aqua);
  color: var(--ink);
  outline: none;
}

.dashboard-tab.active {
  border-color: var(--aqua);
  background: color-mix(in srgb, var(--aqua) 12%, var(--panel));
  color: var(--ink);
}

.dashboard-panels,
.dashboard-panel {
  min-width: 0;
}

.dashboard-panel {
  display: grid;
  gap: 12px;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-metric {
  min-width: 0;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  border-top: 2px solid color-mix(in srgb, var(--aqua) 60%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 86%, var(--paper-soft));
}

.dashboard-metric span,
.dashboard-metric small {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
}

.dashboard-metric strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.dashboard-metric-warning {
  border-top-color: var(--warning);
}

.dashboard-metric-aqua {
  border-top-color: var(--aqua);
  background: color-mix(in srgb, var(--aqua) 6%, var(--panel));
}

.dashboard-metric-success {
  border-top-color: var(--green-ink);
  background: color-mix(in srgb, var(--green-ink) 6%, var(--panel));
}

.dashboard-metric-danger {
  border-top-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--panel));
}

.dashboard-metric-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.dashboard-metric-label i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: color-mix(in srgb, var(--aqua) 72%, var(--line));
}

.dashboard-metric-success .dashboard-metric-label i { background: var(--green-ink); }
.dashboard-metric-warning .dashboard-metric-label i { background: var(--warning); }
.dashboard-metric-danger .dashboard-metric-label i { background: var(--danger); }

.dashboard-stock-strip,
.dashboard-stock-table-section {
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.dashboard-section-heading.compact {
  align-items: center;
  margin-bottom: 7px;
}

.dashboard-section-heading.compact button,
.dashboard-stock-table button {
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.dashboard-stock-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-stock-summary-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border-left: 3px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, var(--paper-soft));
}

.dashboard-stock-summary-item span { color: var(--ink-soft); font-size: 11px; }
.dashboard-stock-summary-item strong { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.dashboard-stock-summary-item.success { border-color: var(--green-ink); }
.dashboard-stock-summary-item.warning { border-color: var(--warning); }
.dashboard-stock-summary-item.danger { border-color: var(--danger); }
.dashboard-stock-summary-item.muted { border-color: var(--ink-soft); }

.dashboard-stock-table-wrap { overflow: auto; }
.dashboard-stock-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.dashboard-stock-table th { padding: 6px 7px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 10px; text-align: left; text-transform: uppercase; }
.dashboard-stock-table td { padding: 7px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); color: var(--ink); }
.dashboard-stock-table td:nth-child(n + 2), .dashboard-stock-table th:nth-child(n + 2) { text-align: right; }
.dashboard-stock-table td:last-child, .dashboard-stock-table th:last-child { width: 1%; white-space: nowrap; }

.stock-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-status-pill.success { border-color: color-mix(in srgb, var(--green-ink) 56%, var(--line)); color: var(--green-ink); background: color-mix(in srgb, var(--green) 34%, transparent); }
.stock-status-pill.warning { border-color: color-mix(in srgb, var(--warning) 58%, var(--line)); color: var(--warning); background: var(--warning-soft); }
.stock-status-pill.danger { border-color: color-mix(in srgb, var(--danger) 58%, var(--line)); color: var(--danger); background: var(--danger-soft); }
.stock-status-pill.muted { color: var(--ink-soft); background: color-mix(in srgb, var(--paper-soft) 45%, transparent); }

.stock-card-success { border-left: 3px solid var(--green-ink); }
.stock-card-warning { border-left: 3px solid var(--warning); }
.stock-card-danger { border-left: 3px solid var(--danger); }
.stock-card-muted { border-left: 3px solid var(--ink-soft); }
.stock-row-warning td { background: color-mix(in srgb, var(--warning-soft) 40%, transparent); }
.stock-row-danger td { background: color-mix(in srgb, var(--danger-soft) 35%, transparent); }

body[data-theme="dark"] .dashboard-metric-aqua { background: #0d1d25; }
body[data-theme="dark"] .dashboard-metric-success { background: #0d2018; }
body[data-theme="dark"] .dashboard-metric-warning { background: #211a0e; }
body[data-theme="dark"] .dashboard-metric-danger { background: #241311; }
body[data-theme="dark"] .dashboard-stock-summary-item { background: #11151c; }
body[data-theme="dark"] .stock-card { background: var(--panel); }
body[data-theme="dark"] .stock-row-warning td { background: rgba(241, 189, 105, 0.06); }
body[data-theme="dark"] .stock-row-danger td { background: rgba(242, 160, 140, 0.07); }

.dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(230px, 0.45fr);
  gap: 18px;
  align-items: start;
}

.dashboard-queue-section,
.dashboard-quick-links {
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.dashboard-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}

.dashboard-section-heading .eyebrow {
  margin-bottom: 1px;
}

.dashboard-section-heading h3,
.dashboard-quick-links h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.dashboard-section-heading > span {
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.dashboard-queue-list {
  display: grid;
}

.dashboard-queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

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

.dashboard-queue-copy {
  min-width: 0;
}

.dashboard-queue-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.dashboard-queue-title strong {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-queue-copy p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.dashboard-queue-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 10px;
  white-space: nowrap;
}

.dashboard-queue-badge.aqua {
  border-color: color-mix(in srgb, var(--aqua) 58%, var(--line));
  color: var(--aqua-strong);
}

.dashboard-queue-badge.warning {
  border-color: color-mix(in srgb, var(--warning) 60%, var(--line));
  color: var(--warning);
}

.dashboard-queue-badge.danger {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--line));
  color: var(--danger);
}

.dashboard-queue-badge.success {
  border-color: color-mix(in srgb, var(--green-ink) 58%, var(--line));
  color: var(--green-ink);
}

.dashboard-queue-action,
.dashboard-quick-links button {
  min-height: 29px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.dashboard-queue-action:hover,
.dashboard-queue-action:focus-visible,
.dashboard-quick-links button:hover,
.dashboard-quick-links button:focus-visible {
  border-color: var(--aqua);
  color: var(--aqua-strong);
  outline: none;
}

.dashboard-queue-action.primary {
  border-color: var(--aqua);
  background: color-mix(in srgb, var(--aqua) 10%, var(--panel));
}

.dashboard-quick-links > div {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.dashboard-quick-links button {
  width: 100%;
  text-align: left;
}

.dashboard-empty {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

#quotations-view .records-layout {
  grid-template-columns: minmax(0, 3fr) minmax(250px, 1fr);
  align-items: start;
}

.supplier-grid,
.supplier-workspace {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
  gap: 8px;
  align-items: start;
}

.supplier-page-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.supplier-tab {
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.supplier-tab:hover,
.supplier-tab:focus-visible {
  border-color: var(--aqua);
  color: var(--text);
  outline: none;
}

.supplier-tab.active {
  border-color: color-mix(in srgb, var(--aqua) 62%, var(--line));
  background: color-mix(in srgb, var(--aqua) 12%, var(--panel));
  color: var(--text);
}

.supplier-tab-panel[hidden] {
  display: none;
}

.form-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

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

.report-detail-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.report-filter-panel {
  margin-top: 10px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.report-filter-grid label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.report-filter-grid input,
.report-filter-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--field);
  font: inherit;
  text-transform: none;
}

.report-filter-note {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.report-profit-list {
  max-width: 520px;
}

.panel {
  padding: 10px;
}

.panel-header,
.document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--green-ink);
  background: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.quote-strip,
.split-list,
.total-list,
.terms-box {
  display: grid;
  gap: 6px;
}

.terms-editor label {
  min-height: auto;
  padding: 0;
  color: var(--ink-soft);
}

.terms-editor textarea {
  min-height: 64px;
}

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

.quote-strip div,
.split-list div,
.terms-box div {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.section-divider {
  height: 1px;
  margin: 10px 0;
  background: var(--line);
}

.order-detail-panel {
  display: grid;
  gap: 12px;
}

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

.detail-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
}

.detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
}

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

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

.mini-table th,
.mini-table td {
  padding: 5px;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mini-table th:first-child,
.mini-table td:first-child {
  width: 44%;
}

.po-draft-lines {
  display: grid;
  gap: 8px;
}

.po-draft-total {
  margin-top: 0;
}

.selected-row {
  background: var(--aqua-soft);
}

.quotation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(292px, 22vw, 330px);
  gap: 8px;
  align-items: start;
}

.quotation-panel {
  display: grid;
  gap: 5px;
  overflow: visible;
}

.document-card {
  display: grid;
  gap: 5px;
  overflow: visible;
}

#quotation-view .document-card {
  padding: 6px;
  border-color: rgba(46, 45, 87, 0.18);
  background: var(--panel);
}

.quotation-head {
  margin-bottom: 0;
  padding: 0 2px 3px;
  border-bottom: 1px solid rgba(46, 45, 87, 0.16);
}

.document-details-card {
  background: var(--panel-raised);
  border-color: rgba(46, 45, 87, 0.12);
}

.readonly-field {
  min-height: 25px;
  display: flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #f6fbfd;
  font-weight: 600;
}

.quote-nav-row {
  display: grid;
  grid-template-columns: minmax(58px, auto) minmax(78px, auto) minmax(180px, 1fr) minmax(58px, auto) minmax(58px, auto);
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-soft);
}

.quote-nav-row > div {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 0;
}

.quote-nav-row span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.quote-nav-row strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-nav-row .small-action {
  min-height: 26px;
  padding: 3px 7px;
  font-size: 11px;
}

.quote-nav-row .small-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.section-card {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-muted);
}

.section-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.section-card-head h3,
.section-title h3 {
  margin: 0;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.inline-actions .secondary-action {
  min-height: 32px;
}

.quote-entry-card {
  background: var(--panel-muted);
  border-color: rgba(37, 176, 211, 0.2);
  overflow: visible;
}

.doc-number {
  text-align: right;
}

.doc-number strong {
  display: block;
  margin-top: 2px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 6px;
  margin-bottom: 6px;
}

.quote-detail-grid {
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  margin-bottom: 0;
}

#quotation-view .quote-detail-grid label:nth-child(1) {
  grid-column: 1 / span 2;
}

#quotation-view .quote-detail-grid label:nth-child(2) {
  grid-column: 1 / span 2;
}

#quotation-view .quote-detail-grid label:nth-child(3) {
  grid-column: 3 / span 2;
}

#quotation-view .quote-detail-grid label:nth-child(4),
#quotation-view .quote-detail-grid label:nth-child(5) {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 560;
}

.span-2 {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--field);
  font-weight: 500;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 176, 211, 0.26);
  border-color: var(--aqua);
}

.stack-form {
  display: grid;
  gap: 8px;
}

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

.full-button {
  width: 100%;
  justify-content: center;
}

.hidden-control {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.typeahead-field {
  position: relative;
  display: grid;
}

.typeahead-list {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 50;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-raised);
  box-shadow: 0 14px 30px rgba(46, 45, 87, 0.16);
}

.typeahead-field.open .typeahead-list {
  display: grid;
  gap: 3px;
}

.typeahead-option {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel-raised);
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.typeahead-option:hover,
.typeahead-option:focus {
  outline: none;
  background: var(--aqua-soft);
}

.typeahead-option span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.typeahead-empty {
  padding: 8px 9px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.action-gap {
  margin-top: 8px;
}

.option-check {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-raised);
  font-size: 13px;
  font-weight: 600;
}

.option-check input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--aqua);
}

.visual-signature-toggle {
  grid-column: 1 / -1;
  min-height: 24px;
  padding: 4px 7px;
  font-size: 11px;
}

.import-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.import-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.data-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.data-actions-grid,
.data-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.data-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.data-count-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.data-count-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.data-count-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.data-health-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-health-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper-soft);
  color: var(--ink);
}

.data-health-list .health-ok {
  border-color: rgba(22, 163, 74, 0.26);
  background: rgba(22, 163, 74, 0.12);
  color: var(--green-ink);
}

.data-health-list .health-warning {
  border-color: rgba(217, 119, 6, 0.35);
  background: var(--warning-soft);
  color: var(--warning);
}

.data-audit-panel {
  grid-column: 1 / -1;
}

.data-audit-panel table {
  min-width: 900px;
}

.health-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}

.health-overview-panel,
.health-issues-panel,
.health-information-panel,
.health-purge-panel {
  grid-column: 1;
}

.health-finding-detail {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.health-guide-panel {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.health-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.health-intro {
  margin: 0 0 10px;
  padding: 0 0 10px;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.health-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.health-metric span {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Page titles already orient the user; these legacy labels only repeat it. */
.workspace .eyebrow {
  display: none;
}

.health-metric strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
}

.health-table th:nth-child(1) { width: 104px; }
.health-table th:nth-child(2) { width: 150px; }
.health-table th:nth-child(4) { width: 31%; }

.health-severity-ok,
.health-severity-repairable,
.health-severity-warning,
.health-severity-informational,
.health-severity-conflict,
.health-severity-critical {
  border: 1px solid var(--line);
}

.health-severity-ok {
  color: var(--green-ink);
  background: var(--green);
}

.health-severity-repairable {
  color: var(--brand);
  border-color: rgba(37, 176, 211, 0.35);
  background: var(--aqua-soft);
}

.health-severity-warning {
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--warning-soft);
}

.health-severity-informational {
  color: var(--ink-soft);
  background: var(--paper-soft);
}

.health-severity-conflict {
  color: var(--danger);
  border-color: rgba(177, 56, 35, 0.32);
  background: var(--danger-soft);
}

.health-severity-critical,
.danger-pill {
  color: var(--danger);
  border-color: rgba(177, 56, 35, 0.32);
  background: var(--danger-soft);
}

.health-scope-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.secondary-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-raised);
  font-weight: 600;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: var(--aqua);
  color: var(--brand);
  background: var(--aqua-soft);
}

.danger-action {
  min-height: 29px;
  padding: 0 8px;
  border: 1px solid #e3b6a8;
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.small-action {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel-raised);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.row-actions .small-action,
.row-actions .danger-action {
  width: auto;
  min-width: 64px;
}

.strong-action {
  border-color: var(--aqua);
  color: var(--brand);
  background: var(--aqua-soft);
}

.voided-row {
  opacity: 0.62;
}

.warning-row {
  background: var(--warning-soft);
}

.quote-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(110px, 0.3fr) 76px minmax(110px, 0.32fr) 58px;
  gap: 6px;
  align-items: end;
  margin-bottom: 0;
}

.quote-tools.area-mode {
  grid-template-columns: minmax(260px, 1fr) minmax(110px, 0.3fr) 76px minmax(110px, 0.32fr) 58px;
}

.quote-tools .primary-action {
  min-width: 58px;
  padding: 0 8px;
}

#quote-quick-unit {
  color: var(--ink-soft);
  background: #f8fafb;
  text-transform: uppercase;
}

.muted-cell {
  color: var(--ink-soft);
}

.delivery-lines {
  display: grid;
  gap: 8px;
}

.delivery-line {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.delivery-line-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
}

.delivery-line-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.table-section {
  margin-top: 0;
  border: 1px solid rgba(46, 45, 87, 0.13);
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel-muted);
}

.section-title {
  min-height: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 3px 7px;
  color: var(--brand);
  background: #f1f4f4;
  border-bottom: 1px solid rgba(46, 45, 87, 0.12);
}

.section-title.dark {
  background: #f3f4f6;
}

#quotation-view .section-title {
  border-left: 3px solid var(--aqua);
}

#quotation-view .section-title.dark {
  border-left-color: var(--brand);
}

.section-title span {
  color: var(--ink-soft);
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-top: 0;
}

.table-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 7px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--panel-raised);
}

.table-tools input {
  width: min(360px, 100%);
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 500;
}

.table-tools select {
  min-height: 30px;
  padding: 5px 24px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--field);
  font-size: 12px;
  font-weight: 500;
}

.quotation-table-tools {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(130px, 0.48fr) minmax(130px, 0.48fr) auto;
  gap: 6px;
}

.quotation-table-tools input {
  width: 100%;
}

.table-tools span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.sortable-heading {
  cursor: pointer;
  user-select: none;
}

.sortable-heading::after {
  content: " ⇅";
  color: var(--ink-soft);
  font-weight: 600;
}

.sortable-heading.sort-asc::after {
  content: " ↑";
}

.sortable-heading.sort-desc::after {
  content: " ↓";
}

.table-filter-hidden {
  display: none;
}

.table-section .table-wrap {
  border: 0;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

#quotation-view table {
  min-width: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 3px 5px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  white-space: normal;
}

th {
  color: var(--ink);
  background: var(--paper-soft);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

/* Screen tables use close surface tones to support long-row scanning in dark mode. */
.view .table-wrap tbody tr {
  background: var(--table-row);
}

.view .table-wrap tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

.view .table-wrap tbody tr:hover:not(.selected-row):not(.warning-row):not(.voided-row):not(.superseded-row) {
  background: var(--table-row-hover);
}

#quotation-view th {
  color: var(--brand);
  background: var(--table-header);
  text-align: center;
}

#quotation-view td {
  font-size: 12px;
  vertical-align: middle;
}

#quotation-view td input {
  min-height: 22px;
  padding: 2px 6px;
}

#quotation-view .quote-line-table-section th:nth-child(1),
#quotation-view .quote-line-table-section td:nth-child(1) {
  width: 44%;
}

#quotation-view .quote-line-table-section th:nth-child(2),
#quotation-view .quote-line-table-section td:nth-child(2) {
  width: 12%;
}

#quotation-view .quote-line-table-section th:nth-child(3),
#quotation-view .quote-line-table-section td:nth-child(3) {
  width: 11%;
}

#quotation-view .quote-line-table-section th:nth-child(4),
#quotation-view .quote-line-table-section td:nth-child(4) {
  width: 13%;
}

#quotation-view .quote-line-table-section th:nth-child(5),
#quotation-view .quote-line-table-section td:nth-child(5) {
  width: 14%;
}

#quotation-view .quote-line-table-section th:nth-child(6),
#quotation-view .quote-line-table-section td:nth-child(6) {
  width: 6%;
  text-align: center;
}

#quotation-view .quote-line-table-section td:nth-child(2) > input,
#quotation-view .quote-line-table-section td:nth-child(3) .qty-cell > input:not(.manual-toggle),
#quotation-view .quote-line-table-section td:nth-child(4) .price-cell > input:not(.manual-toggle) {
  width: 100%;
}

#quotation-view .materials-table-section th:nth-child(1),
#quotation-view .materials-table-section td:nth-child(1) {
  width: 31%;
}

#quotation-view .materials-table-section th:nth-child(2),
#quotation-view .materials-table-section td:nth-child(2) {
  width: 12%;
}

#quotation-view .materials-table-section th:nth-child(3),
#quotation-view .materials-table-section td:nth-child(3) {
  width: 11%;
}

#quotation-view .materials-table-section th:nth-child(4),
#quotation-view .materials-table-section td:nth-child(4) {
  width: 12%;
}

#quotation-view .materials-table-section th:nth-child(5),
#quotation-view .materials-table-section td:nth-child(5) {
  width: 13%;
}

#quotation-view .materials-table-section th:nth-child(6),
#quotation-view .materials-table-section td:nth-child(6) {
  width: 15%;
}

#quotation-view .materials-table-section th:nth-child(7),
#quotation-view .materials-table-section td:nth-child(7) {
  width: 6%;
  text-align: center;
}

#quotation-view .materials-table-section td:nth-child(2) > input,
#quotation-view .materials-table-section td:nth-child(5) .price-cell > input:not(.manual-toggle) {
  width: 100%;
}

#quotation-view .materials-table-section .qty-cell,
#quotation-view .materials-table-section .price-cell {
  width: 100%;
}

#quotation-view .materials-table-section .qty-cell {
  grid-template-columns: minmax(98px, 1fr) 42px;
}

#quotation-view .materials-table-section .price-cell {
  grid-template-columns: minmax(82px, 1fr) 42px;
}

#quotation-view .materials-table-section .qty-cell .override-toggle,
#quotation-view .materials-table-section .price-cell .override-toggle {
  justify-self: end;
}

#quotation-view .materials-table-section .qty-cell > input:not(.manual-toggle),
#quotation-view .materials-table-section .price-cell > input:not(.manual-toggle) {
  min-width: 0;
}

#quotation-view .quote-line-table-section td:nth-child(2) > input,
#quotation-view .materials-table-section .qty-cell > input:not(.manual-toggle) {
  min-width: 98px;
}

#quotation-view .materials-table-section .manual-toggle {
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  padding: 0;
}

#quotation-view tbody tr {
  background: var(--table-row);
}

#quotation-view .computed-value {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

#quotation-view .quote-area-preview {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

#quotation-view tbody tr:nth-child(even) {
  background: var(--table-row-alt);
}

#quotation-view .quote-line-table-section td:nth-child(2),
#quotation-view .quote-line-table-section td:nth-child(3),
#quotation-view .quote-line-table-section td:nth-child(4),
#quotation-view .quote-line-table-section td:nth-child(5) {
  text-align: center;
}

#quotation-view .quote-line-table-section td:nth-child(5) {
  font-variant-numeric: tabular-nums;
}

#quotation-view .quote-line-table-section .item-cell {
  text-align: left;
  line-height: 1.25;
}

td input {
  min-height: 27px;
  padding: 3px 5px;
  text-align: right;
}

.item-cell {
  min-width: 260px;
}

#quotations-view .table-wrap,
#quotation-view .table-wrap,
#orders-view .table-wrap,
#statements-view .table-wrap,
#ledger-view .table-wrap,
#inventory-view .table-wrap,
#suppliers-view .table-wrap,
#supplier-orders-view .table-wrap,
#supplier-receiving-view .table-wrap,
#expenses-view .table-wrap {
  overflow-x: visible;
}

#quotations-view table,
#quotation-view table,
#orders-view table,
#statements-view table,
#ledger-view table,
#inventory-view table,
#suppliers-view table,
#supplier-orders-view table,
#supplier-receiving-view table,
#expenses-view table {
  min-width: 0;
  table-layout: fixed;
}

#quotations-view th,
#quotations-view td,
#quotation-view th,
#quotation-view td,
#orders-view th,
#orders-view td,
#statements-view th,
#statements-view td,
#ledger-view th,
#ledger-view td,
#inventory-view th,
#inventory-view td,
#suppliers-view th,
#suppliers-view td,
#supplier-orders-view th,
#supplier-orders-view td,
#supplier-receiving-view th,
#supplier-receiving-view td,
#expenses-view th,
#expenses-view td {
  padding: 5px 5px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
  font-size: 12px;
}

#quotations-view .item-cell,
#quotation-view .item-cell,
#orders-view .item-cell,
#statements-view .item-cell,
#ledger-view .item-cell,
#inventory-view .item-cell,
#suppliers-view .item-cell,
#supplier-orders-view .item-cell,
#supplier-receiving-view .item-cell,
#expenses-view .item-cell {
  min-width: 0;
}

#quotations-view td input,
#quotation-view td input,
#orders-view td input,
#statements-view td input,
#ledger-view td input,
#suppliers-view td input,
#supplier-orders-view td input,
#supplier-receiving-view td input,
#expenses-view td input {
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#quotations-view .small-action,
#quotation-view .danger-action,
#orders-view .small-action,
#orders-view .danger-action,
#suppliers-view .small-action,
#suppliers-view .danger-action,
#supplier-orders-view .small-action,
#supplier-orders-view .danger-action,
#supplier-receiving-view .small-action,
#supplier-receiving-view .danger-action,
#expenses-view .danger-action {
  min-width: 0;
  width: 100%;
  padding: 0 6px;
}

#quotations-view .row-actions .small-action,
#quotations-view .row-actions .danger-action {
  width: auto;
  padding: 0 7px;
}

#quotations-view th:nth-child(1),
#quotations-view td:nth-child(1) {
  width: 14%;
}

#quotations-view th:nth-child(2),
#quotations-view td:nth-child(2) {
  width: 15%;
}

#quotations-view th:nth-child(3),
#quotations-view td:nth-child(3) {
  width: 18%;
}

#quotations-view th:nth-child(4),
#quotations-view td:nth-child(4) {
  width: 9%;
}

#quotations-view th:nth-child(5),
#quotations-view td:nth-child(5) {
  width: 10%;
}

#quotations-view th:nth-child(6),
#quotations-view td:nth-child(6) {
  width: 17%;
}

#quotations-view th:nth-child(7),
#quotations-view td:nth-child(7) {
  width: 17%;
}

#quotations-view .latest-dr-label {
  display: inline-block;
  margin-top: 4px;
  color: var(--brand);
  font-weight: 600;
}

#quotations-view {
  overflow: hidden;
}

.quotation-register-panel {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  gap: 7px;
  padding: 10px;
  overflow: hidden;
}

.quotation-register-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0 0 7px;
}

.quotation-register-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quotation-register-heading-actions .primary-action {
  min-height: 32px;
  padding: 5px 14px;
}

.quotation-register-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.quotation-register-kpis button {
  min-width: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--paper-soft);
  text-align: left;
  cursor: pointer;
}

.quotation-register-kpis button:hover,
.quotation-register-kpis button.active {
  border-color: var(--aqua);
  box-shadow: inset 3px 0 0 var(--aqua);
}

.quotation-register-kpis span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 550;
}

.quotation-register-kpis strong {
  font-size: 21px;
  font-weight: 650;
}

.quotation-quick-views {
  display: flex;
  gap: 4px;
  padding-bottom: 1px;
  overflow-x: auto;
}

.quotation-quick-views button {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}

.quotation-quick-views button:hover,
.quotation-quick-views button.active {
  border-color: var(--aqua);
  color: var(--ink);
  background: var(--aqua-soft);
}

.quotation-register-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(150px, 0.9fr) repeat(2, minmax(120px, 0.65fr)) repeat(2, minmax(145px, 0.85fr)) auto;
  gap: 6px;
  align-items: end;
}

.quotation-register-filters label {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.quotation-register-filters label > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 550;
}

.quotation-register-filters input,
.quotation-register-filters select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  font-weight: 500;
}

.quotation-filter-clear {
  min-height: 30px;
  padding: 4px 12px;
}

.quotation-register-table-wrap {
  min-height: 0;
  overflow: visible;
  border-top: 1px solid var(--line);
  border-radius: 6px;
}

.quotation-register-table {
  min-width: 1380px;
  table-layout: fixed;
}

.quotation-register-table thead {
  position: sticky;
  z-index: 5;
  top: 0;
}

.quotation-register-table th,
.quotation-register-table td {
  padding: 6px 7px;
  vertical-align: middle;
  white-space: normal;
}

.quotation-register-table th {
  height: 32px;
  text-align: left;
}

.quotation-register-table th button {
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.quotation-register-table th button::after {
  content: " ⇅";
  color: var(--ink-soft);
  font-size: 9px;
}

.quotation-register-table th button.active::after {
  content: " ↑";
  color: var(--aqua);
}

.quotation-register-table th button.active[data-direction="desc"]::after {
  content: " ↓";
}

#quotations-view .quotation-register-table th:nth-child(1),
#quotations-view .quotation-register-table td:nth-child(1) { width: 11%; }
#quotations-view .quotation-register-table th:nth-child(2),
#quotations-view .quotation-register-table td:nth-child(2) { width: 14%; }
#quotations-view .quotation-register-table th:nth-child(3),
#quotations-view .quotation-register-table td:nth-child(3) { width: 8%; }
#quotations-view .quotation-register-table th:nth-child(4),
#quotations-view .quotation-register-table td:nth-child(4) { width: 9%; text-align: right; }
#quotations-view .quotation-register-table th:nth-child(5),
#quotations-view .quotation-register-table td:nth-child(5) { width: 10%; text-align: right; }
#quotations-view .quotation-register-table th:nth-child(6),
#quotations-view .quotation-register-table td:nth-child(6) { width: 10%; }
#quotations-view .quotation-register-table th:nth-child(7),
#quotations-view .quotation-register-table td:nth-child(7) { width: 10%; }
#quotations-view .quotation-register-table th:nth-child(8),
#quotations-view .quotation-register-table td:nth-child(8) { width: 8%; }
#quotations-view .quotation-register-table th:nth-child(9),
#quotations-view .quotation-register-table td:nth-child(9) { width: 20%; text-align: right; }

.quotation-register-row {
  min-height: 48px;
  cursor: pointer;
}

.quotation-register-row.quotation-number-history-row {
  cursor: default;
}

.quotation-register-row:hover,
.quotation-register-row:focus {
  outline: none;
  background: var(--aqua-soft);
}

.quotation-register-row td > strong,
.quotation-register-row .muted-cell,
.quotation-register-row .latest-dr-label {
  display: block;
}

.quotation-register-row td > strong {
  font-weight: 600;
}

.quotation-register-row .muted-cell,
.quotation-register-row .latest-dr-label {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.25;
}

.quotation-register-row .open-balance {
  color: var(--warning);
  font-weight: 650;
}

#quotations-view .quotation-register-row .pill {
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid transparent;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
}

.quotation-register-pagination {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
}

.quotation-register-pagination > div {
  display: flex;
  gap: 5px;
}

.quotation-register-pagination button {
  min-height: 28px;
  padding: 4px 10px;
}

.quotation-stage-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}

#quotations-view .quotation-stage-stack .pill {
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid transparent;
  font-size: 10px;
  line-height: 1.25;
}

.pill.status-draft,
.pill.status-neutral {
  border-color: var(--line) !important;
  color: var(--ink-soft) !important;
  background: var(--paper-soft) !important;
}

.pill.status-info {
  border-color: rgba(37, 176, 211, 0.3) !important;
  color: var(--brand) !important;
  background: var(--aqua-soft) !important;
}

.pill.status-success {
  border-color: rgba(47, 133, 90, 0.25) !important;
  color: var(--green-ink) !important;
  background: var(--green) !important;
}

.pill.status-warning {
  border-color: rgba(180, 83, 9, 0.25) !important;
  color: #8a3f08 !important;
  background: var(--warning-soft) !important;
}

.pill.status-danger {
  border-color: rgba(177, 56, 35, 0.25) !important;
  color: var(--danger) !important;
  background: var(--danger-soft) !important;
}

.quotation-row-actions {
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

#quotations-view .quotation-row-actions .small-action {
  min-width: 46px;
  padding: 0 8px;
  white-space: nowrap;
}

#quotations-view .quotation-row-actions .strong-action {
  min-width: 52px;
}

#quotations-view .quotation-row-actions .quick-payment-action {
  border-color: rgba(37, 176, 211, 0.5);
  color: var(--aqua-strong);
}

.row-action-menu {
  position: relative;
}

.row-action-menu summary {
  min-width: 52px;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel-raised);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}

.row-action-menu summary::-webkit-details-marker {
  display: none;
}

.row-action-menu summary::after {
  content: "  v";
  color: var(--ink-soft);
  font-size: 9px;
}

.row-action-menu[open] summary {
  border-color: var(--aqua);
  box-shadow: 0 0 0 2px rgba(37, 176, 211, 0.12);
}

.row-action-menu-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  width: 150px;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-raised);
  box-shadow: 0 10px 24px rgba(46, 45, 87, 0.16);
}

#quotations-view .row-action-menu-list .small-action,
#quotations-view .row-action-menu-list .danger-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.quotation-workflow-panel {
  position: sticky;
  top: 0;
}

.workflow-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.workflow-count-grid div {
  min-height: 58px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-soft);
}

.workflow-count-grid span {
  display: block;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.workflow-count-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--brand);
  font-size: 18px;
}

.suppliers-table th:nth-child(1), .suppliers-table td:nth-child(1) { width: 24%; }
.suppliers-table th:nth-child(2), .suppliers-table td:nth-child(2) { width: 13%; }
.suppliers-table th:nth-child(3), .suppliers-table td:nth-child(3) { width: 11%; }
.suppliers-table th:nth-child(4), .suppliers-table td:nth-child(4) { width: 16%; }
.suppliers-table th:nth-child(5), .suppliers-table td:nth-child(5) { width: 8%; }
.suppliers-table th:nth-child(6), .suppliers-table td:nth-child(6) { width: 12%; }
.suppliers-table th:nth-child(7), .suppliers-table td:nth-child(7) { width: 8%; }
.suppliers-table th:nth-child(8), .suppliers-table td:nth-child(8) { width: 8%; }

.supplier-orders-table th:nth-child(1), .supplier-orders-table td:nth-child(1) { width: 17%; }
.supplier-orders-table th:nth-child(2), .supplier-orders-table td:nth-child(2) { width: 18%; }
.supplier-orders-table th:nth-child(3), .supplier-orders-table td:nth-child(3) { width: 10%; }
.supplier-orders-table th:nth-child(4), .supplier-orders-table td:nth-child(4),
.supplier-orders-table th:nth-child(5), .supplier-orders-table td:nth-child(5),
.supplier-orders-table th:nth-child(6), .supplier-orders-table td:nth-child(6) { width: 10%; }
.supplier-orders-table th:nth-child(7), .supplier-orders-table td:nth-child(7) { width: 10%; }
.supplier-orders-table th:nth-child(8), .supplier-orders-table td:nth-child(8) { width: 8%; }
.supplier-orders-table th:nth-child(9), .supplier-orders-table td:nth-child(9) { width: 7%; }

.supplier-receipts-table th:nth-child(1), .supplier-receipts-table td:nth-child(1),
.supplier-receipts-table th:nth-child(2), .supplier-receipts-table td:nth-child(2) { width: 15%; }
.supplier-receipts-table th:nth-child(3), .supplier-receipts-table td:nth-child(3) { width: 22%; }
.supplier-receipts-table th:nth-child(4), .supplier-receipts-table td:nth-child(4) { width: 12%; }
.supplier-receipts-table th:nth-child(5), .supplier-receipts-table td:nth-child(5) { width: 18%; }
.supplier-receipts-table th:nth-child(6), .supplier-receipts-table td:nth-child(6),
.supplier-receipts-table th:nth-child(7), .supplier-receipts-table td:nth-child(7) { width: 9%; }

.supplier-payments-table th:nth-child(1), .supplier-payments-table td:nth-child(1) { width: 15%; }
.supplier-payments-table th:nth-child(2), .supplier-payments-table td:nth-child(2) { width: 14%; }
.supplier-payments-table th:nth-child(3), .supplier-payments-table td:nth-child(3) { width: 20%; }
.supplier-payments-table th:nth-child(4), .supplier-payments-table td:nth-child(4) { width: 12%; }
.supplier-payments-table th:nth-child(5), .supplier-payments-table td:nth-child(5) { width: 13%; }
.supplier-payments-table th:nth-child(6), .supplier-payments-table td:nth-child(6) { width: 16%; }
.supplier-payments-table th:nth-child(7), .supplier-payments-table td:nth-child(7) { width: 10%; }

#materials-body tr > *:nth-child(1),
#installation-body tr > *:nth-child(1),
#finishing-body tr > *:nth-child(1) {
  width: 36%;
}

#materials-body tr > *:nth-child(2),
#materials-body tr > *:nth-child(3),
#materials-body tr > *:nth-child(4),
#materials-body tr > *:nth-child(5),
#materials-body tr > *:nth-child(6) {
  width: 12.8%;
}

#orders-view th:nth-child(1),
#orders-view td:nth-child(1) {
  width: 20%;
}

#orders-view th:nth-child(2),
#orders-view td:nth-child(2) {
  width: 14%;
}

#orders-view th:nth-child(3),
#orders-view td:nth-child(3),
#orders-view th:nth-child(4),
#orders-view td:nth-child(4),
#orders-view th:nth-child(5),
#orders-view td:nth-child(5) {
  width: 11%;
}

#orders-view th:nth-child(6),
#orders-view td:nth-child(6),
#orders-view th:nth-child(7),
#orders-view td:nth-child(7),
#orders-view th:nth-child(8),
#orders-view td:nth-child(8) {
  width: 8%;
}

#orders-view th:nth-child(9),
#orders-view td:nth-child(9) {
  width: 10%;
}

#expenses-view th:nth-child(1),
#expenses-view td:nth-child(1) {
  width: 18%;
}

#expenses-view th:nth-child(2),
#expenses-view td:nth-child(2) {
  width: 10%;
}

#expenses-view th:nth-child(3),
#expenses-view td:nth-child(3),
#expenses-view th:nth-child(4),
#expenses-view td:nth-child(4),
#expenses-view th:nth-child(5),
#expenses-view td:nth-child(5) {
  width: 13%;
}

#expenses-view th:nth-child(6),
#expenses-view td:nth-child(6),
#expenses-view th:nth-child(7),
#expenses-view td:nth-child(7),
#expenses-view th:nth-child(8),
#expenses-view td:nth-child(8) {
  width: 10%;
}

.qty-cell,
.price-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.override-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.manual-toggle {
  width: 14px;
  height: 14px;
  accent-color: var(--aqua);
}

.theme-toggle {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(37, 176, 211, 0.38);
  border-radius: 999px;
  color: var(--brand);
  background: var(--aqua-soft);
  font-weight: 700;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--aqua);
  color: var(--aqua-strong);
}

body[data-theme="dark"] .workspace,
body[data-theme="dark"] .view.active {
  background: var(--paper);
}

body[data-theme="dark"] .sidebar {
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 176, 211, 0.15), transparent 28%),
    linear-gradient(180deg, #2E2D57 0%, #24234b 48%, #15152d 100%);
  border-right: 1px solid rgba(37, 176, 211, 0.22);
}

body[data-theme="dark"] .nav-item {
  color: #d7e3ec;
}

body[data-theme="dark"] .nav-item:hover,
body[data-theme="dark"] .nav-item.active {
  background: rgba(72, 69, 128, 0.72);
  border-color: rgba(37, 176, 211, 0.42);
}

body[data-theme="dark"] .metric,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .summary-card,
body[data-theme="dark"] .section-card,
body[data-theme="dark"] .detail-grid div,
body[data-theme="dark"] .data-count-card,
body[data-theme="dark"] .import-card,
body[data-theme="dark"] .option-check,
body[data-theme="dark"] .delivery-line,
body[data-theme="dark"] .table-section,
body[data-theme="dark"] .stock-card,
body[data-theme="dark"] .auth-card,
body[data-theme="dark"] .public-brand {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .health-metric {
  border-color: var(--line);
  background: #11151c;
}

body[data-theme="dark"] .health-severity-repairable {
  color: #b9edf7;
  border-color: rgba(37, 176, 211, 0.38);
  background: #102831;
}

body[data-theme="dark"] .health-severity-warning {
  color: var(--warning);
  border-color: rgba(241, 189, 105, 0.35);
  background: var(--warning-soft);
}

body[data-theme="dark"] .health-severity-informational {
  color: var(--ink-soft);
  background: #11151c;
}

body[data-theme="dark"] .health-severity-conflict {
  color: var(--danger);
  border-color: rgba(242, 160, 140, 0.35);
  background: var(--danger-soft);
}

body[data-theme="dark"] .health-severity-critical,
body[data-theme="dark"] .danger-pill {
  color: var(--danger);
  border-color: rgba(242, 160, 140, 0.35);
  background: var(--danger-soft);
}

body[data-theme="dark"] .metric.warning,
body[data-theme="dark"] .warning-row {
  background: var(--warning-soft);
}

body[data-theme="dark"] .selected-row {
  background: #1b2931;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .readonly-field,
body[data-theme="dark"] .input-affix,
body[data-theme="dark"] .table-tools input,
body[data-theme="dark"] .table-tools select,
body[data-theme="dark"] .report-filter-grid input,
body[data-theme="dark"] .report-filter-grid select {
  border-color: var(--line);
  color: var(--ink);
  background: var(--field);
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #7f90a3;
}

body[data-theme="dark"] input:disabled,
body[data-theme="dark"] select:disabled,
body[data-theme="dark"] textarea:disabled,
body[data-theme="dark"] #quote-quick-unit {
  color: var(--ink-soft);
  background: var(--field-disabled);
}

body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .secondary-action,
body[data-theme="dark"] .small-action,
body[data-theme="dark"] .row-action-menu summary,
body[data-theme="dark"] .theme-toggle {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel-raised);
}

body[data-theme="dark"] .secondary-action:hover,
body[data-theme="dark"] .small-action:hover,
body[data-theme="dark"] .row-action-menu summary:hover,
body[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--aqua);
  color: var(--aqua-strong);
  background: var(--table-row-hover);
}

body[data-theme="dark"] .primary-action {
  border-color: var(--aqua);
  color: #f5fbff;
  background: var(--panel-raised);
}

body[data-theme="dark"] .primary-action:hover {
  background: var(--table-row-hover);
}

body[data-theme="dark"] .cloud-status {
  border-color: var(--line);
  color: var(--ink-soft);
  background: var(--panel-raised);
}

body[data-theme="dark"] .cloud-status.online {
  border-color: rgba(155, 229, 177, 0.28);
  color: var(--green-ink);
  background: #132c22;
}

body[data-theme="dark"] .cloud-status.error {
  border-color: rgba(245, 142, 142, 0.58);
  color: #ffb4b4;
  background: #32191d;
}

body[data-theme="dark"] .user-avatar {
  color: var(--aqua-strong);
  background: #0d171d;
}

body[data-theme="dark"] .typeahead-list,
body[data-theme="dark"] .typeahead-option,
body[data-theme="dark"] .row-action-menu-list {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel-raised);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .typeahead-option:hover,
body[data-theme="dark"] .typeahead-option:focus,
body[data-theme="dark"] .row-action-menu-list button:hover {
  background: var(--table-row-hover);
}

body[data-theme="dark"] th,
body[data-theme="dark"] #quotation-view th {
  color: #dfe8ef;
  background: var(--paper-soft);
}

body[data-theme="dark"] td,
body[data-theme="dark"] th {
  border-bottom-color: var(--line);
}

body[data-theme="dark"] .table-wrap {
  border-color: var(--line);
}

body[data-theme="dark"] .section-title,
body[data-theme="dark"] #quotation-view .section-title,
body[data-theme="dark"] #quotation-view .section-title.dark {
  border-color: var(--line);
  background: var(--panel-raised);
}

body[data-theme="dark"] #quotation-view .document-card,
body[data-theme="dark"] #quotation-view .summary-card,
body[data-theme="dark"] #quotation-view .document-actions-card {
  border-color: var(--line);
  background: var(--panel);
}

body[data-theme="dark"] #quotation-view .summary-card.terms-editor,
body[data-theme="dark"] .quote-entry-card {
  border-color: rgba(37, 176, 211, 0.22);
  background: #11151c;
}

body[data-theme="dark"] .summary-card.terms-box div,
body[data-theme="dark"] .quote-strip div,
body[data-theme="dark"] .split-list div,
body[data-theme="dark"] .terms-box div {
  border-color: var(--line);
  background: transparent;
}

body[data-theme="dark"] .total-list {
  border-top-color: var(--line);
}

body[data-theme="dark"] .grand-total {
  color: #edf7ee;
  background: #102d20;
}

body[data-theme="dark"] .pill.status-draft,
body[data-theme="dark"] .pill.status-neutral {
  border-color: var(--line) !important;
  color: var(--ink-soft) !important;
  background: var(--panel-raised) !important;
}

body[data-theme="dark"] .pill.status-info {
  border-color: rgba(37, 176, 211, 0.38) !important;
  color: #b9edf7 !important;
  background: #102831 !important;
}

body[data-theme="dark"] .pill.status-success {
  border-color: rgba(155, 229, 177, 0.28) !important;
  color: var(--green-ink) !important;
  background: var(--green) !important;
}

body[data-theme="dark"] .pill.status-warning {
  border-color: rgba(241, 189, 105, 0.35) !important;
  color: var(--warning) !important;
  background: var(--warning-soft) !important;
}

body[data-theme="dark"] .pill.status-danger,
body[data-theme="dark"] .danger-action {
  border-color: rgba(242, 160, 140, 0.35) !important;
  color: var(--danger) !important;
  background: var(--danger-soft) !important;
}

body[data-theme="dark"] .auth-modal {
  background: rgba(5, 8, 16, 0.72);
}

body[data-theme="dark"] .mini-table-wrap {
  border-color: var(--line);
}

body[data-theme="dark"] .voided-row {
  opacity: 0.52;
}

body[data-theme="dark"] #quotations-view .latest-dr-label {
  color: #8fdff0;
}

body[data-theme="dark"] #quotations-view .records-layout .panel,
body[data-theme="dark"] .quotation-workflow-panel {
  background: var(--panel);
}

body[data-theme="dark"] #quotations-view tr:not(.selected-row):hover {
  background: var(--table-row-hover);
}

body[data-theme="dark"] .table-tools {
  background: transparent;
}

body[data-theme="dark"] .workflow-count-grid div {
  border-color: var(--line);
  background: var(--panel-raised);
}

body[data-theme="dark"] .workflow-count-grid strong {
  color: #cbd3df;
}

body[data-theme="dark"] .row-action-menu[open] summary {
  border-color: var(--aqua);
  box-shadow: 0 0 0 2px rgba(37, 176, 211, 0.12);
}

body[data-theme="dark"] .topbar-quote-action,
body[data-theme="dark"] .document-actions-card .primary-action {
  border-color: var(--aqua);
  background: #101318;
}

/* Inventory investigation workspace */
#inventory-view > .inventory-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

#inventory-view .inventory-summary-item {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

#inventory-view .inventory-summary-item:hover,
#inventory-view .inventory-summary-item.active {
  border-color: var(--aqua);
  background: var(--panel-raised);
}

#inventory-view .inventory-summary-item:focus-visible,
#inventory-view .inventory-balance-section th.sortable-heading:focus-visible,
#inventory-view .inventory-movement-panel th.sortable-heading:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

#inventory-view .inventory-summary-item span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

#inventory-view .inventory-summary-item strong {
  font-size: 18px;
}

#inventory-view .inventory-workspace {
  grid-template-columns: minmax(0, 2.4fr) minmax(320px, 1fr);
  align-items: start;
}

#inventory-view .inventory-adjustment-panel {
  align-self: start;
  height: max-content;
}

#inventory-view .inventory-register-panel,
#inventory-view .inventory-adjustment-panel,
#inventory-view .inventory-movement-panel {
  min-width: 0;
}

#inventory-view .inventory-balance-section,
#inventory-view .inventory-movement-panel {
  min-width: 0;
}

#inventory-view .inventory-balance-section .table-wrap,
#inventory-view .inventory-movement-panel .table-wrap {
  overflow-x: auto;
}

#inventory-view .inventory-balance-section table {
  min-width: 760px;
  table-layout: auto;
}

#inventory-view .inventory-movement-panel table {
  min-width: 900px;
  table-layout: auto;
}

#inventory-view .inventory-balance-section th,
#inventory-view .inventory-balance-section td,
#inventory-view .inventory-movement-panel th,
#inventory-view .inventory-movement-panel td {
  white-space: nowrap;
  overflow-wrap: normal;
}

#inventory-view .inventory-balance-section th:first-child,
#inventory-view .inventory-balance-section td:first-child,
#inventory-view .inventory-balance-section th:nth-child(3),
#inventory-view .inventory-balance-section td:nth-child(3),
#inventory-view .inventory-balance-section th:nth-child(4),
#inventory-view .inventory-balance-section td:nth-child(4),
#inventory-view .inventory-balance-section th:nth-child(5),
#inventory-view .inventory-balance-section td:nth-child(5) {
  text-align: left;
}

#inventory-view .inventory-product-cell {
  min-width: 235px;
  white-space: normal;
}

#inventory-view .inventory-on-hand-cell {
  min-width: 125px;
}

#inventory-view .inventory-status-cell {
  min-width: 145px;
  white-space: normal;
}

#inventory-view .inventory-last-movement-cell {
  min-width: 185px;
  white-space: normal;
}

#inventory-view .inventory-action-cell {
  width: 1%;
  min-width: 122px;
}

#inventory-view .inventory-secondary-meta {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.3;
}

#inventory-view .inventory-movement-context {
  display: grid;
  gap: 2px;
  white-space: normal;
}

#inventory-view .inventory-movement-panel th,
#inventory-view .inventory-movement-panel td {
  text-align: left;
}

#inventory-view .inventory-movement-panel th:nth-child(4),
#inventory-view .inventory-movement-panel td:nth-child(4),
#inventory-view .inventory-movement-panel th:nth-child(5),
#inventory-view .inventory-movement-panel td:nth-child(5) {
  text-align: right;
}

#inventory-view .table-tools[data-table-tools="inventory-ledger-body"] {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .55fr) minmax(150px, .55fr) auto auto;
}

@media (max-width: 1100px) {
  #inventory-view .inventory-workspace {
    grid-template-columns: 1fr;
  }

  #inventory-view .inventory-adjustment-panel {
    width: 100%;
  }
}

@media (max-width: 760px) {
  #inventory-view > .inventory-summary-strip {
    grid-template-columns: 1fr;
  }

  #inventory-view .table-tools[data-table-tools="inventory-balance-body"],
  #inventory-view .table-tools[data-table-tools="inventory-ledger-body"] {
    grid-template-columns: 1fr;
  }

  #inventory-view .inventory-balance-section table,
  #inventory-view .inventory-movement-panel table {
    min-width: 760px;
  }

  #inventory-view .inventory-movement-panel table {
    min-width: 900px;
  }
}

body[data-theme="dark"] .topbar-quote-action:hover,
body[data-theme="dark"] .document-actions-card .primary-action:hover {
  background: #14212a;
}

.summary-panel {
  position: sticky;
  top: 0;
  display: grid;
  gap: 5px;
  align-content: start;
}

.summary-card {
  padding: 6px;
  border: 1px solid rgba(37, 176, 211, 0.18);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(46, 45, 87, 0.05);
}

#quotation-view .summary-card {
  padding: 5px;
  background: var(--panel);
}

#quotation-view .summary-card.terms-editor {
  background: var(--panel-muted);
  border-color: rgba(37, 176, 211, 0.22);
}

#quotation-view .document-actions-card {
  border-color: rgba(46, 45, 87, 0.2);
  background: var(--panel);
}

.summary-card.terms-box div {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.summary-card.terms-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 5px;
}

.summary-card.terms-editor .panel-header,
.summary-card.terms-editor .compact-grid {
  grid-column: 1 / -1;
}

.summary-card.terms-editor .quote-remarks-field {
  grid-column: 1 / -1;
}

.summary-card.payment-terms-card {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: end;
}

.summary-card.payment-terms-card .payment-percent-grid {
  grid-column: auto;
  grid-row: span 2;
  grid-template-columns: minmax(0, 1fr);
}

.summary-card.payment-terms-card .payment-balance-due-field,
.summary-card.payment-terms-card .payment-due-date-field {
  grid-column: 2;
}

.summary-card.payment-terms-card .quote-terms-days-field {
  grid-column: 2;
}

.transaction-card {
  display: grid;
  gap: 4px;
}

.transaction-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.3;
}

#quotation-view .payment-terms-disabled {
  display: none;
}

#quotation-view .payment-terms-disabled input,
#quotation-view .payment-terms-disabled select {
  cursor: not-allowed;
}

.summary-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 5px;
}

.summary-panel .panel-header {
  margin-bottom: 0;
}

#quotation-view .summary-panel .panel-header h2 {
  display: block;
  color: var(--aqua-strong);
  font-size: 11px;
  font-weight: 700;
}

#quotation-view .summary-panel label {
  gap: 2px;
  font-size: 11px;
}

#quotation-view .summary-panel input,
#quotation-view .summary-panel select {
  min-height: 23px;
  padding: 2px 6px;
}

#quotation-view .summary-panel textarea {
  min-height: 42px;
  padding: 4px 6px;
}

#quotation-view .summary-panel .quote-remarks-field textarea {
  width: 100%;
  min-height: 48px;
  resize: vertical;
}

#quotation-view .summary-panel .input-affix {
  min-height: 23px;
}

#quotation-view .summary-panel .input-affix input {
  min-height: 21px;
  padding-top: 1px;
  padding-bottom: 1px;
}

.input-affix {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
}

.input-affix input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
}

.input-affix input:focus {
  outline: 0;
}

.total-list {
  padding-top: 3px;
  border-top: 1px solid var(--line);
}

.total-list div {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  min-height: 17px;
  font-size: 12px;
}

.discount-row strong {
  color: var(--green-ink);
}

.grand-total {
  margin-top: 3px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--green);
  align-items: center;
}

.grand-total strong {
  font-size: 16px;
}

.summary-panel .terms-box {
  padding-top: 6px;
  border-top: 0;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 5px;
}

.summary-actions .secondary-action,
.summary-actions .primary-action {
  min-height: 24px;
  padding: 0 7px;
}

.trash-action {
  display: inline-flex;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  font-size: 18px;
  line-height: 1;
}

.trash-action .trash-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.trash-action span:not(.trash-icon) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stock-card {
  min-height: 142px;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdfd;
}

.stock-card strong {
  font-size: 22px;
}

.stock-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.report-number {
  display: block;
  margin: 18px 0 8px;
  font-size: 26px;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  .workspace {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: visible;
  }

  .view.active {
    overflow: visible;
    padding-right: 0;
  }

  .nav-section-label {
    grid-column: 1 / -1;
    margin-top: 8px;
  }

  .sidebar-footer {
    display: none;
  }

  .quotation-layout,
  .dashboard-grid,
  .reports-grid,
  .report-detail-grid,
  .records-layout,
  .supplier-grid,
  .supplier-workspace,
  .data-management-grid {
    grid-template-columns: 1fr;
  }

  .health-workspace {
    grid-template-columns: 1fr;
  }

  .health-overview-panel,
  .health-issues-panel,
  .health-information-panel,
  .health-purge-panel,
  .health-guide-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .summary-panel {
    position: static;
  }
}

/* Keep the workspace dense on common laptop widths while preserving a
   dependable two-column quotation layout until the tablet breakpoint. */
@media (min-width: 1101px) and (max-width: 1439px) {
  .app-shell {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  .workspace {
    padding: 8px;
  }

  #quotation-view .quotation-layout {
    grid-template-columns: minmax(0, 1fr) minmax(292px, 300px);
  }

  #quotation-view .quote-tools,
  #quotation-view .quote-tools.area-mode {
    grid-template-columns: minmax(180px, 1fr) minmax(96px, 0.32fr) 70px minmax(96px, 0.34fr) 58px;
  }

  #quotation-view .summary-card {
    padding: 6px;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 10px 12px 16px;
  }

  .topbar,
  .panel-header,
  .document-head {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics-grid,
  .quote-strip,
  .inventory-grid,
  .data-actions-grid,
  .data-count-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .health-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .quotation-table-tools {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .quote-tools,
  .summary-form-grid,
  .report-filter-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}

/* Client-based Statement of Account workspace */
#statements-view .statement-workspace {
  grid-template-columns: minmax(0, 1.72fr) minmax(390px, 0.78fr);
  align-items: start;
}

#statements-view .statement-primary-stack {
  min-width: 0;
  display: grid;
  gap: 12px;
}

#statements-view .statement-print-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 8px;
}

#statements-view .statement-print-actions button {
  min-height: 36px;
}

#statements-view .statement-issue-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.35;
}

body[data-theme="dark"] #statement-issue-note {
  color: #aeb9c6;
}

#statements-view .issued-statements-table-wrap {
  max-height: 230px;
  overflow: auto;
}

#statements-view .issued-statements-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

#statements-view .issued-statements-void-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

#statements-view .issued-statements-void-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--aqua);
}

#statements-view .issued-statements-table {
  width: 100%;
  table-layout: fixed;
}

#statements-view .issued-statements-table th,
#statements-view .issued-statements-table td {
  padding: 7px 8px;
  font-size: 11px;
  vertical-align: middle;
}

#statements-view .issued-statements-table th:nth-child(1) { width: 19%; }
#statements-view .issued-statements-table th:nth-child(2) { width: 23%; }
#statements-view .issued-statements-table th:nth-child(3) { width: 12%; }
#statements-view .issued-statements-table th:nth-child(4) { width: 18%; }
#statements-view .issued-statements-table th:nth-child(5) { width: 7%; }
#statements-view .issued-statements-table th:nth-child(6) { width: 9%; }
#statements-view .issued-statements-table th:nth-child(7) { width: 12%; }

#statements-view .issued-statements-table td:last-child {
  text-align: center;
}

#statements-view .issued-statement-actions {
  display: inline-flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}

#statements-view .issued-statement-actions .small-action {
  min-height: 28px;
  padding: 4px 8px;
}

#statements-view .voided-statement-row {
  opacity: 0.7;
}

#statements-view .status-issued,
#statements-view .status-voided {
  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: 700;
  white-space: nowrap;
}

#statements-view .status-issued {
  color: var(--success);
  background: var(--success-soft);
}

#statements-view .status-voided {
  color: var(--danger);
  background: var(--danger-soft);
}

#statements-view .statement-void-status {
  display: grid;
  gap: 3px;
  justify-items: start;
}

#statements-view .statement-void-meta {
  max-width: 170px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.statement-void-card {
  width: min(560px, 100%);
}

.statement-void-summary,
.statement-void-notice {
  margin: 0;
  line-height: 1.45;
}

.statement-void-summary {
  color: var(--ink);
  font-weight: 600;
}

.statement-void-notice {
  color: var(--ink-soft);
  font-size: 12px;
}

.statement-void-card textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
}

#statements-view .statement-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#statements-view .statement-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

#statements-view .statement-selection-toolbar > div {
  display: flex;
  gap: 6px;
}

#statements-view .statement-selection-toolbar .small-action {
  width: auto;
  min-height: 30px;
  padding: 0 10px;
}

#statements-view .statement-orders-table-wrap {
  max-height: 310px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#statements-view .statement-orders-table {
  width: 100%;
  table-layout: fixed;
}

#statements-view .statement-orders-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper-soft);
}

#statements-view .statement-orders-table th,
#statements-view .statement-orders-table td {
  padding: 6px 5px;
  vertical-align: middle;
  font-size: 11px;
}

#statements-view .statement-orders-table th:nth-child(1),
#statements-view .statement-orders-table td:nth-child(1) { width: 3.5%; }
#statements-view .statement-orders-table th:nth-child(2),
#statements-view .statement-orders-table td:nth-child(2) { width: 12%; }
#statements-view .statement-orders-table th:nth-child(3),
#statements-view .statement-orders-table td:nth-child(3) { width: 14%; }
#statements-view .statement-orders-table th:nth-child(4),
#statements-view .statement-orders-table td:nth-child(4) { width: 8%; }
#statements-view .statement-orders-table th:nth-child(5),
#statements-view .statement-orders-table td:nth-child(5) { width: 9%; }
#statements-view .statement-orders-table th:nth-child(6),
#statements-view .statement-orders-table td:nth-child(6) { width: 10%; }
#statements-view .statement-orders-table th:nth-child(n+7),
#statements-view .statement-orders-table td:nth-child(n+7) { width: 10.875%; }

#statements-view .statement-orders-table .statement-include-cell {
  text-align: center;
}

#statements-view .statement-orders-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  min-height: 15px;
  margin: 0;
}

#statements-view .statement-orders-table .numeric-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#statements-view .statement-orders-table .pill {
  display: inline-flex;
  max-width: 100%;
  padding: 3px 6px;
  font-size: 10px;
  white-space: normal;
}

#statements-view .statement-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#statements-view .mini-table-wrap {
  overflow-x: auto;
}

#statements-view .mini-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#statements-view .mini-table th,
#statements-view .mini-table td {
  padding: 5px 4px;
  font-size: 10px;
  overflow-wrap: anywhere;
}

body[data-theme="dark"] #statements-view .statement-orders-table tr.selected-row {
  background: #151a20;
}

@media (max-width: 1450px) {
  .dashboard-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quotation-register-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quotation-register-filters .quotation-filter-search {
    grid-column: span 2;
  }

  #statements-view .statement-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  #statements-view .statement-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .department-dashboard-shell {
    padding: 9px;
  }

  .dashboard-toolbar,
  .dashboard-workspace {
    display: block;
  }

  .dashboard-live-note {
    display: block;
    margin-top: 3px;
  }

  .dashboard-metric-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-quick-links {
    margin-top: 12px;
  }

  .dashboard-queue-row {
    gap: 8px;
  }

  .dashboard-queue-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .quotation-register-panel {
    height: auto;
    overflow: visible;
  }

  #quotations-view {
    overflow: auto;
  }

  .quotation-register-kpis,
  .quotation-register-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quotation-register-toolbar,
  .quotation-register-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  #statements-view .statement-filter-grid,
  #statements-view .statement-summary-grid {
    grid-template-columns: 1fr;
  }

  #statements-view .statement-selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  #statements-view .statement-print-actions {
    grid-template-columns: 1fr;
  }
}

/* Quotation workspace refinement: keep data sections content-height and
   group supporting fields into one compact inspector rail. */
#quotation-view .quotation-layout {
  gap: 8px;
}

#quotation-view .document-card {
  gap: 6px;
  padding: 7px;
}

#quotation-view .document-details-card {
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 0;
  background: transparent;
}

#quotation-view .quote-nav-row {
  grid-template-columns: auto minmax(185px, 1fr) minmax(175px, 0.72fr) auto;
  gap: 5px;
  margin: 0 0 3px;
  padding: 3px 5px;
}

#quotation-view .quote-nav-row .small-action {
  min-height: 24px;
}

#quotation-view .quote-nav-current {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 0;
}

#quotation-view .quote-nav-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

#quotation-view .quote-nav-actions-end {
  justify-content: flex-end;
}

#quotation-view .quote-status-nav-field {
  min-width: 0;
  gap: 2px;
  font-size: 10px;
  text-transform: uppercase;
}

#quotation-view .quote-status-nav-field output {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 650;
  text-transform: none;
}

.quote-lifecycle-guidance {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

#quotation-view .quote-detail-grid label:nth-child(1) {
  grid-column: 1 / span 2;
}

#quotation-view .quote-detail-grid label:nth-child(2) {
  grid-column: 3 / span 2;
}

#quotation-view .quote-detail-grid label:nth-child(3),
#quotation-view .quote-detail-grid label:nth-child(4) {
  grid-column: span 2;
}

#quotation-view .quote-entry-card {
  padding: 6px 8px;
  border-radius: 7px;
}

#quotation-view #quote-quick-unit {
  background: var(--field);
}

#quotation-view #quote-quick-unit:disabled,
#quotation-view #quote-quick-area:disabled,
#quotation-view #quote-quick-qty:disabled,
#quotation-view #quote-quick-unit-price:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

#quotation-view .materials-table-section th:nth-child(1),
#quotation-view .materials-table-section td:nth-child(1) {
  width: 29%;
}

#quotation-view .materials-table-section th:nth-child(2),
#quotation-view .materials-table-section td:nth-child(2) {
  width: 22%;
}

#quotation-view .materials-table-section th:nth-child(3),
#quotation-view .materials-table-section td:nth-child(3) {
  width: 10%;
}

#quotation-view .materials-table-section th:nth-child(4),
#quotation-view .materials-table-section td:nth-child(4) {
  width: 8%;
}

#quotation-view .materials-table-section th:nth-child(5),
#quotation-view .materials-table-section td:nth-child(5) {
  width: 13%;
}

#quotation-view .materials-table-section th:nth-child(6),
#quotation-view .materials-table-section td:nth-child(6) {
  width: 14%;
}

#quotation-view .materials-table-section th:nth-child(7),
#quotation-view .materials-table-section td:nth-child(7) {
  width: 4%;
  text-align: center;
}

#quotation-view .materials-table-section th:nth-child(1),
#quotation-view .materials-table-section th:nth-child(2) {
  text-align: left;
}

#quotation-view .materials-table-section th:nth-child(3),
#quotation-view .materials-table-section th:nth-child(5),
#quotation-view .materials-table-section th:nth-child(6),
#quotation-view .materials-table-section td:nth-child(3),
#quotation-view .materials-table-section td:nth-child(5),
#quotation-view .materials-table-section .amount-cell {
  text-align: right;
}

#quotation-view .materials-table-section th:nth-child(4),
#quotation-view .materials-table-section td:nth-child(4) {
  text-align: center;
}

#quotation-view .pricing-basis {
  display: grid;
  gap: 1px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
}

#quotation-view .pricing-basis strong {
  font-weight: 600;
}

#quotation-view .pricing-basis small {
  color: var(--ink-soft);
  font-size: 10px;
}

#quotation-view .line-unit-cell {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

#quotation-view .summary-panel {
  top: 8px;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

/* Desktop quotation work area: supporting fields scroll independently while
   the document controls remain reachable at the bottom of the inspector. */
@media (min-width: 1101px) {
  .view.active {
    height: 100%;
    min-height: 0;
  }

  #quotation-view {
    overflow: hidden;
  }

  #quotation-view .quotation-layout {
    height: 100%;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
  }

  #quotation-view .quotation-panel {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  #quotation-view .document-card {
    min-height: 100%;
    min-width: 0;
    grid-template-rows: auto auto auto auto auto auto;
    align-content: start;
  }

  #quotation-view .document-card > * {
    min-height: 0;
    min-width: 0;
  }

  #quotation-view .materials-table-section {
    align-self: start;
  }

  #quotation-view #installation-section,
  #quotation-view #finishing-section {
    align-self: start;
  }

  #quotation-view .summary-panel {
    position: static;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  #quotation-view .summary-inspector-scroll {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #quotation-view .document-actions-card {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.1);
  }

  #quotation-view .quote-action-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 5px);
    z-index: 6;
    width: min(100%, 290px);
    margin: 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
  }
}

#quotation-view .summary-card {
  padding: 7px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#quotation-view .summary-card:last-child {
  border-bottom: 0;
}

#quotation-view .summary-card.terms-editor,
#quotation-view .document-actions-card {
  background: transparent;
  border-color: var(--line);
}

#quotation-view .document-actions-card .summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 5px;
}

#quotation-view .summary-actions .secondary-action,
#quotation-view .summary-actions .primary-action {
  min-height: 28px;
}

#quotation-view #quote-lifecycle-action,
#quotation-view #print-quote-button,
#quotation-view .quote-lifecycle-guidance {
  grid-column: 1 / -1;
}

#quotation-view .quote-action-more {
  grid-column: 1 / -1;
  position: relative;
}

#quotation-view .quote-action-more summary {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}

#quotation-view .quote-action-more summary::-webkit-details-marker {
  display: none;
}

#quotation-view .quote-action-more summary::after {
  content: "v";
  margin-left: 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

#quotation-view .quote-action-more[open] summary {
  border-color: var(--aqua);
}

#quotation-view .quote-action-more-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-raised);
}

#quotation-view .quote-action-more-menu .visual-signature-toggle {
  grid-column: 1 / -1;
}

#quotation-view input:focus-visible,
#quotation-view select:focus-visible,
#quotation-view textarea:focus-visible,
#quotation-view button:focus-visible,
#quotation-view summary:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  #quotation-view .quote-nav-row {
    grid-template-columns: 1fr 1fr;
  }

  #quotation-view .quote-nav-current,
  #quotation-view .quote-status-nav-field {
    grid-column: 1 / -1;
  }

  #quotation-view .quote-nav-actions,
  #quotation-view .quote-nav-actions-end {
    justify-content: stretch;
  }

  #quotation-view .quote-nav-actions .small-action {
    flex: 1;
  }
}

@media (max-width: 1100px) {
  #quotation-view .quotation-layout,
  #quotation-view .quotation-panel,
  #quotation-view .summary-panel,
  #quotation-view .summary-inspector-scroll {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #quotation-view .document-card {
    min-height: 0;
    grid-template-rows: none;
    align-content: normal;
  }

  #quotation-view .quote-action-more-menu {
    position: static;
    width: auto;
    margin-top: 4px;
    box-shadow: none;
  }
}

/* Quotation workspace hierarchy. Screen-only so printable layouts stay intact. */
@media screen {
  /* Shared screen-only quotation section motif. Theme tokens set the colors;
     the structure stays identical in light and dark modes. */
  #quotation-view .document-head.quotation-head,
  #quotation-view .quote-line-table-section .section-title {
    background: var(--quote-section-header-bg);
    border-color: var(--quote-section-header-border);
    color: var(--quote-section-header-text);
  }

  #quotation-view .document-head.quotation-head {
    align-items: center;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--quote-section-header-border);
    border-radius: 6px;
  }

  #quotation-view .quote-line-table-section {
    border-color: var(--quote-section-header-border);
  }

  #quotation-view .quote-line-table-section .section-title {
    min-height: 30px;
    padding: 5px 8px;
    border: 0;
    border-bottom: 1px solid var(--quote-section-header-border);
    border-left: 3px solid var(--aqua);
  }

  #quotation-view .quote-line-table-section .section-title.dark {
    border-left-color: var(--aqua);
  }

  #quotation-view .quote-line-table-section .section-title h3 {
    color: var(--quote-section-header-text);
  }

  #quotation-view .quote-line-table-section .section-title span,
  #quotation-view .quote-line-table-section .section-title small {
    color: var(--quote-section-header-meta);
  }

  #quotation-view .materials-table-section:not(:has(#materials-body > tr)) thead {
    display: none;
  }

  #quotation-view .document-head.quotation-head h2 {
    color: var(--ink);
    font-size: 15px;
    font-weight: 680;
    letter-spacing: 0;
  }

  #quotation-view .document-details-card {
    padding-bottom: 4px;
  }

  #quotation-view .quote-nav-current span,
  #quotation-view .quote-status-nav-field > span {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  #quotation-view .quote-nav-current strong {
    color: var(--ink);
    font-size: 17px;
    font-weight: 720;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
  }

  #quotation-view .quote-detail-grid {
    column-gap: 10px;
    row-gap: 4px;
  }

  #quotation-view .quote-detail-grid label,
  #quotation-view .quote-entry-card label,
  #quotation-view .summary-panel label {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
    gap: 3px;
    letter-spacing: 0.01em;
    line-height: 1.2;
  }

  #quotation-view .quote-detail-grid label {
    gap: 2px;
    font-size: 10.5px;
  }

  #quotation-view .quote-detail-grid input {
    min-height: 24px;
  }

  #quotation-view input,
  #quotation-view select,
  #quotation-view textarea {
    color: var(--ink);
    font-weight: 600;
  }

  #quotation-view input::placeholder,
  #quotation-view textarea::placeholder {
    color: var(--ink-soft);
    font-weight: 400;
    opacity: 0.78;
  }

  #quotation-view .quote-entry-card {
    background: var(--panel-muted);
    border-color: color-mix(in srgb, var(--aqua) 30%, var(--line));
    border-radius: 7px;
    padding: 6px 9px;
  }

  #quotation-view .quote-tools {
    align-items: end;
    gap: 8px;
  }

  #quotation-view .quote-tools > label:first-child {
    min-width: 0;
  }

  #quotation-view #quote-product-search {
    font-weight: 600;
  }

  #quotation-view #add-quote-line {
    align-self: end;
    min-width: 68px;
  }

  #quotation-view .quote-area-preview {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.25;
    margin-top: 4px;
  }

  #quotation-view .quote-line-table-section {
    background: var(--panel-muted);
    border-color: color-mix(in srgb, var(--line) 72%, transparent);
    box-shadow: none;
    margin-top: 0;
  }

  #quotation-view .quote-line-table-section .section-title {
    align-items: center;
    background: var(--table-header);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
    min-height: 30px;
    padding: 5px 8px;
  }

  #quotation-view .quote-line-table-section .section-title h3 {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
  }

  #quotation-view .quote-line-table-section .section-title span,
  #quotation-view .quote-line-table-section .section-title small {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 500;
  }

  #quotation-view .quote-line-table-section th {
    background: var(--table-header);
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.035em;
    line-height: 1.2;
  }

  #quotation-view .quote-line-table-section td {
    color: var(--ink);
    font-size: 12px;
    padding-bottom: 6px;
    padding-top: 6px;
    vertical-align: middle;
  }

  #quotation-view .quote-line-table-section tbody tr:nth-child(odd) {
    background: var(--table-row);
  }

  #quotation-view .quote-line-table-section tbody tr:nth-child(even) {
    background: var(--table-row-alt);
  }

  #quotation-view .quote-line-table-section tbody tr:hover,
  #quotation-view .quote-line-table-section tbody tr:focus-within {
    background: var(--table-row-hover);
  }

  #quotation-view .quote-line-table-section .item-cell {
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 680;
    line-height: 1.3;
    text-align: left;
  }

  #quotation-view .pricing-basis {
    color: var(--ink-soft);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
  }

  #quotation-view .pricing-basis strong {
    color: var(--ink);
    font-size: 11px;
    font-weight: 650;
  }

  #quotation-view .pricing-basis small,
  #quotation-view .line-unit-cell {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 600;
  }

  #quotation-view .amount-cell,
  #quotation-view .quote-line-table-section input[type="number"],
  #quotation-view .quote-line-table-section .computed-value {
    font-variant-numeric: tabular-nums;
  }

  #quotation-view .amount-cell {
    color: var(--ink);
    font-weight: 650;
    white-space: nowrap;
  }

  #quotation-view .quote-line-table-section .trash-action {
    background: transparent;
    border-color: transparent;
    color: var(--ink-soft);
    opacity: 0.74;
  }

  #quotation-view .quote-line-table-section .trash-action:hover,
  #quotation-view .quote-line-table-section .trash-action:focus-visible {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
    opacity: 1;
  }

  #quotation-view .materials-table-section th:nth-child(1),
  #quotation-view .materials-table-section td:nth-child(1) {
    width: 28%;
  }

  #quotation-view .materials-table-section th:nth-child(2),
  #quotation-view .materials-table-section td:nth-child(2) {
    width: 20%;
  }

  #quotation-view .materials-table-section th:nth-child(3),
  #quotation-view .materials-table-section td:nth-child(3) {
    width: 9%;
  }

  #quotation-view .materials-table-section th:nth-child(4),
  #quotation-view .materials-table-section td:nth-child(4) {
    width: 7%;
  }

  #quotation-view .materials-table-section th:nth-child(5),
  #quotation-view .materials-table-section td:nth-child(5) {
    width: 17%;
  }

  #quotation-view .materials-table-section th:nth-child(6),
  #quotation-view .materials-table-section td:nth-child(6) {
    width: 15%;
  }

  #quotation-view .materials-table-section .price-cell {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
  }

  #quotation-view .materials-table-section .price-cell .override-toggle {
    color: var(--ink-soft);
    font-size: 10px;
    opacity: 0.84;
  }

  #quotation-view .summary-panel {
    background: var(--panel);
    border-color: var(--line);
  }

  #quotation-view .summary-panel .summary-card {
    padding: 8px 9px;
  }

  #quotation-view .summary-panel .panel-header {
    margin-bottom: 5px;
  }

  #quotation-view .summary-panel .panel-header h2 {
    color: var(--ink);
    font-size: 12px;
    font-weight: 680;
    letter-spacing: 0;
  }

  #quotation-view .summary-panel .transaction-note,
  #quotation-view .summary-panel .helper-text {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.35;
  }

  #quotation-view .summary-panel .total-list,
  #quotation-view .summary-panel .grand-total {
    font-variant-numeric: tabular-nums;
  }

  #quotation-view .summary-panel .total-list > div {
    padding: 3px 0;
  }

  #quotation-view .summary-panel .total-list strong {
    color: var(--ink);
    font-weight: 650;
  }

  #quotation-view .summary-panel .grand-total {
    margin-top: 5px;
    padding: 7px 8px;
  }

  #quotation-view .summary-panel .grand-total strong {
    font-size: 17px;
    font-weight: 720;
  }

  #quotation-view .document-actions-card {
    background: var(--panel-raised);
  }

  #quotation-view .document-actions-card button {
    font-weight: 650;
  }

  #quotation-view :is(button, input, select, textarea):focus-visible {
    outline: 2px solid var(--aqua);
    outline-offset: 1px;
  }
}

/* Keep quotation settings scrollable on desktop while the total and actions
   remain available at the bottom of the single inspector rail. */
@media (min-width: 1101px) {
  #quotation-view .document-card {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  #quotation-view .summary-panel {
    grid-template-rows: minmax(0, 1fr) auto auto;
  }

  #quotation-view .summary-inspector-scroll {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* Center-column information architecture: navigation is a compact toolbar,
   while details, encoding, and quotation data each have a distinct surface. */
@media screen {
  #quotation-view .document-card {
    gap: 8px;
  }

  #quotation-view .quote-navigation-strip {
    padding: 5px 7px;
    border: 1px solid var(--quote-section-header-border);
    border-radius: 7px;
    background: var(--quote-section-header-bg);
  }

  #quotation-view .quote-navigation-strip .quote-nav-row {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  #quotation-view .quote-workspace-card {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--quote-section-header-border);
    border-radius: 8px;
    box-shadow: none;
    overflow: visible;
  }

  #quotation-view .document-details-card {
    background: var(--quote-info-surface);
  }

  #quotation-view .quote-entry-card {
    background: var(--quote-input-surface);
    border-color: color-mix(in srgb, var(--aqua) 42%, var(--quote-section-header-border));
  }

  #quotation-view .quote-entry-card:focus-within {
    border-color: var(--aqua);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--aqua) 22%, transparent);
  }

  #quotation-view .quotation-items-card {
    display: grid;
    gap: 6px;
    background: var(--quote-items-surface);
    border-color: var(--quote-section-header-border);
  }

  #quotation-view .quote-workspace-card > .document-head {
    min-height: 30px;
    margin: 0;
    padding: 5px 8px;
    border: 0;
    border-bottom: 1px solid var(--quote-section-header-border);
    border-radius: 7px 7px 0 0;
    background: var(--quote-section-header-bg);
  }

  #quotation-view .quote-workspace-card > .document-head h2 {
    color: var(--quote-section-header-text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
  }

  #quotation-view .document-details-card .quote-detail-grid {
    margin: 0;
    padding: 7px 8px 8px;
  }

  #quotation-view .quote-entry-card .quote-tools {
    padding: 7px 8px 3px;
  }

  #quotation-view .quote-entry-card .quote-area-preview {
    margin: 1px 8px 7px;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section {
    margin: 0 6px 6px;
    border: 1px solid var(--quote-subsection-border);
    border-radius: 6px;
    background: var(--quote-subsection-surface);
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title {
    min-height: 28px;
    background: color-mix(in srgb, var(--quote-subsection-surface) 76%, var(--quote-section-header-bg));
    border-bottom-color: var(--quote-subsection-border);
    border-left-width: 2px;
    padding: 4px 7px;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title h3 {
    font-size: 12px;
    font-weight: 680;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title span,
  #quotation-view .quotation-items-card > .quote-line-table-section .section-title small {
    font-size: 9.5px;
  }
}

@media (min-width: 1101px) {
  #quotation-view .document-card {
    grid-template-rows: auto auto auto auto;
    align-content: start;
  }

  #quotation-view .quote-navigation-strip,
  #quotation-view .document-details-card,
  #quotation-view .quote-entry-card,
  #quotation-view .quotation-items-card {
    align-self: start;
  }
}

/* Quotation center consolidation: the document card owns layout and scrolling
   only. Its four child regions provide the visible information hierarchy. */
@media screen {
  #quotation-view .document-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #quotation-view .quote-navigation-strip {
    min-width: 0;
    padding: 5px 7px;
    border: 1px solid var(--quote-section-header-border);
    border-radius: 7px;
    background: var(--quote-section-header-bg);
    box-shadow: none;
  }

  #quotation-view .quote-navigation-strip .small-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
  }

  #quotation-view .quote-workspace-card {
    border: 1px solid var(--quote-section-header-border);
    border-radius: 8px;
    box-shadow: none;
  }

  #quotation-view .document-details-card {
    background: var(--quote-info-surface);
  }

  #quotation-view .quote-entry-card {
    background: var(--quote-input-surface);
    border-color: color-mix(in srgb, var(--aqua) 42%, var(--quote-section-header-border));
  }

  #quotation-view .quotation-items-card {
    background: var(--quote-items-surface);
  }

  #quotation-view .quote-workspace-card > .document-head {
    min-height: 31px;
    padding: 5px 8px;
    border: 0;
    border-bottom: 1px solid var(--quote-section-header-border);
    border-left: 3px solid var(--aqua);
    border-radius: 7px 7px 0 0;
    background: var(--quote-section-header-bg);
  }

  #quotation-view .quote-workspace-card > .document-head h2 {
    color: var(--quote-section-header-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section {
    border-color: color-mix(in srgb, var(--quote-subsection-border) 78%, transparent);
    background: var(--quote-subsection-surface);
    box-shadow: none;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title {
    min-height: 28px;
    padding: 4px 7px;
    border-bottom-color: var(--quote-subsection-border);
    border-left: 2px solid var(--aqua);
    background: color-mix(in srgb, var(--quote-subsection-surface) 76%, var(--quote-section-header-bg));
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title h3 {
    color: var(--quote-section-header-text);
    font-size: 12px;
    font-weight: 680;
  }

  #quotation-view .quotation-items-card > .quote-line-table-section .section-title :is(span, small) {
    color: var(--quote-section-header-meta);
    font-size: 9.5px;
  }
}

/* Empty categories are presentation-only. Existing renderers continue to own
   the quotation data and Installation/Finishing hidden state. */
@media screen {
  body[data-theme] #quotation-view .document-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #quotation-view .quotation-items-empty-state {
    display: none;
    margin: 0 8px 8px;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.35;
  }

  #quotation-view .materials-table-section:not(:has(#materials-body > tr)),
  #quotation-view #installation-section:not(:has(#installation-body > tr)),
  #quotation-view #finishing-section:not(:has(#finishing-body > tr)) {
    display: none;
  }

  #quotation-view .quotation-items-card:not(:has(.quote-line-table-section tbody > tr)) .quotation-items-empty-state {
    display: block;
  }
}

/* Final quotation visual normalization. These rules deliberately use the
   theme attribute so older dark-theme section styles cannot split the three
   item categories into different visual treatments. */
@media screen {
  body[data-theme] #quotation-view .quotation-items-card > .quote-line-table-section {
    border-color: color-mix(in srgb, var(--quote-subsection-border) 62%, transparent);
    border-radius: 6px;
    background: var(--quote-subsection-surface);
    box-shadow: none;
  }

  body[data-theme] #quotation-view .quotation-items-card > .quote-line-table-section .section-title,
  body[data-theme] #quotation-view .quotation-items-card > .quote-line-table-section .section-title.dark {
    min-height: 28px;
    padding: 4px 7px;
    border: 0;
    border-bottom: 1px solid var(--quote-subsection-border);
    border-left: 2px solid var(--aqua);
    border-radius: 0;
    background: color-mix(in srgb, var(--quote-subsection-surface) 76%, var(--quote-section-header-bg));
  }

  body[data-theme] #quotation-view .quotation-items-card > .quote-line-table-section .section-title h3 {
    color: var(--quote-section-header-text);
    font-size: 12px;
    font-weight: 680;
  }

  body[data-theme] #quotation-view .quotation-items-card > .quote-line-table-section .section-title :is(span, small) {
    color: var(--quote-section-header-meta);
    font-size: 9.5px;
  }

  body[data-theme] #quotation-view .quote-entry-card {
    background: var(--quote-input-surface);
    border-color: color-mix(in srgb, var(--aqua) 38%, var(--quote-section-header-border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--aqua) 10%, transparent);
  }

  body[data-theme] #quotation-view .quote-entry-card:focus-within {
    border-color: var(--aqua);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--aqua) 24%, transparent);
  }
}

@media (min-width: 1101px) {
  #quotation-view .summary-inspector-scroll {
    padding-bottom: 8px;
  }
}

/* Structural boundaries only: these sit between existing work regions without
   changing their grid ownership, scrolling, or card geometry. */
@media screen {
  #quotation-view .document-details-card + .quote-entry-card {
    position: relative;
    margin-top: 10px;
  }

  #quotation-view .document-details-card + .quote-entry-card::before {
    content: "";
    position: absolute;
    top: -10px;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--quote-section-header-border);
    pointer-events: none;
  }

  #quotation-view .document-details-card + .quote-entry-card::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--aqua);
    pointer-events: none;
  }

  #quotation-view .summary-inspector-scroll + .summary-card {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid var(--quote-section-header-border);
  }
}

/* Puturebuilt Operational UI Motif. These opt-in primitives are intentionally
   not applied yet; future page migrations adopt them one workspace at a time. */
.pb-op-card {
  min-width: 0;
  border: 1px solid var(--pb-op-border);
  border-radius: var(--pb-op-radius-card);
  background: var(--pb-op-surface-info);
  box-shadow: none;
}

.pb-op-card--info {
  background: var(--pb-op-surface-info);
}

.pb-op-card--working {
  border-color: color-mix(in srgb, var(--pb-op-focus) 42%, var(--pb-op-border));
  background: var(--pb-op-surface-working);
}

.pb-op-card--working:focus-within {
  border-color: var(--pb-op-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pb-op-focus) 22%, transparent);
}

.pb-op-card--data {
  background: var(--pb-op-surface-data);
}

.pb-op-card__header {
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: var(--pb-op-space-2);
  padding: 5px var(--pb-op-space-2);
  border-bottom: 1px solid var(--pb-op-border);
  border-left: 3px solid var(--pb-op-focus);
  border-radius: calc(var(--pb-op-radius-card) - 1px) calc(var(--pb-op-radius-card) - 1px) 0 0;
  color: var(--pb-op-text);
  background: var(--pb-op-surface-subsection);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.pb-op-subsection {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pb-op-border-subsection) 72%, transparent);
  border-radius: var(--pb-op-radius-subsection);
  background: var(--pb-op-surface-subsection);
}

.pb-op-subsection__header {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pb-op-space-2);
  padding: 4px 7px;
  border-bottom: 1px solid var(--pb-op-border-subsection);
  border-left: 2px solid var(--pb-op-focus);
  color: var(--pb-op-text);
  background: color-mix(in srgb, var(--pb-op-surface-subsection) 76%, var(--pb-op-surface-info));
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
}

.pb-op-subsection__meta,
.pb-op-empty {
  color: var(--pb-op-text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.pb-op-empty {
  margin: 0;
  padding: var(--pb-op-space-2);
}

.pb-op-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.pb-op-table th {
  color: var(--pb-op-text-muted);
  background: var(--pb-op-surface-subsection);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.pb-op-table th,
.pb-op-table td {
  padding: 4px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--pb-op-border) 72%, transparent);
}

.pb-op-table tbody tr:hover,
.pb-op-table tbody tr:focus-within {
  background: color-mix(in srgb, var(--pb-op-focus) 8%, transparent);
}

.pb-op-data-identity {
  color: var(--pb-op-text);
  font-weight: 650;
}

.pb-op-workflow-divider {
  position: relative;
  height: 2px;
  margin: var(--pb-op-space-3) var(--pb-op-space-2);
  background: var(--pb-op-divider);
}

.pb-op-workflow-divider::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40px;
  background: var(--pb-op-focus);
}

.pb-op-record-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pb-op-space-2);
  padding: 5px 7px;
  border: 1px solid var(--pb-op-border);
  border-radius: 7px;
  background: var(--pb-op-surface-subsection);
}

.pb-op-inspector {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  overflow: hidden;
  border: 1px solid var(--pb-op-border);
  border-radius: var(--pb-op-radius-card);
  background: var(--pb-op-surface-inspector);
}

.pb-op-inspector__settings {
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--pb-op-space-2);
  overscroll-behavior: contain;
}

.pb-op-inspector__summary {
  margin-top: var(--pb-op-space-2);
  padding-top: var(--pb-op-space-2);
  border-top: 2px solid var(--pb-op-divider);
}

.pb-op-inspector__actions {
  border-top: 1px solid var(--pb-op-border);
}

/* List/Register primitives are opt-in. They protect scan density while keeping
   filters, rows, and page navigation in their ordinary table workflow. */
.pb-op-register-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--pb-op-space-2);
}

.pb-op-register-summary button {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--pb-op-space-2);
  padding: 6px var(--pb-op-space-2);
  border: 1px solid var(--pb-op-border);
  border-radius: var(--pb-op-radius-subsection);
  color: var(--pb-op-text);
  background: var(--pb-op-surface-working);
  text-align: left;
  cursor: pointer;
}

.pb-op-register-summary button:hover,
.pb-op-register-summary button.active {
  border-color: var(--pb-op-focus);
  background: color-mix(in srgb, var(--pb-op-surface-working) 90%, var(--pb-op-focus));
  box-shadow: inset 3px 0 0 var(--pb-op-focus);
}

.pb-op-register-summary button:focus-visible {
  outline: 2px solid var(--pb-op-focus);
  outline-offset: 2px;
}

.pb-op-register-summary span {
  color: var(--pb-op-text-muted);
  font-size: 11px;
  font-weight: 550;
}

.pb-op-register-summary strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.pb-op-register-summary [data-quote-quick-view="attention"] strong {
  color: var(--warning);
}

.pb-op-filter-toolbar {
  min-width: 0;
}

.pb-op-register-table {
  font-variant-numeric: tabular-nums;
}

.pb-op-register-pagination {
  min-width: 0;
}

/* Purchase Orders controlled hybrid-workspace pilot. */
#supplier-orders-view [data-supplier-tab-panel="orders"] {
  align-items: start;
}

#supplier-orders-view .supplier-po-register,
#supplier-orders-view .supplier-po-composer {
  min-width: 0;
}

#supplier-orders-view .supplier-po-composer {
  padding: 0;
  overflow: hidden;
}

#supplier-orders-view .supplier-po-composer .panel-header {
  padding: 8px;
  border-bottom: 1px solid var(--pb-op-border);
}

#supplier-orders-view .supplier-po-composer .stack-form {
  display: grid;
  gap: 8px;
  padding: 8px;
}

#supplier-orders-view .supplier-po-section {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pb-op-border-subsection) 74%, transparent);
  border-radius: var(--pb-op-radius-subsection);
  background: var(--pb-op-surface-subsection);
}

#supplier-orders-view .supplier-po-section .pb-op-subsection__header {
  margin: 0;
}

#supplier-orders-view .supplier-po-section-body {
  display: grid;
  gap: 7px;
  padding: 7px;
}

#supplier-orders-view .supplier-po-add-item {
  border-color: color-mix(in srgb, var(--pb-op-focus) 42%, var(--pb-op-border));
  background: var(--pb-op-surface-working);
}

#supplier-orders-view .supplier-po-add-item:focus-within {
  border-color: var(--pb-op-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pb-op-focus) 22%, transparent);
}

#supplier-orders-view .supplier-po-add-controls {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr) auto;
  align-items: end;
  gap: 6px;
}

#supplier-orders-view .supplier-po-add-controls .secondary-action {
  min-height: 30px;
  white-space: nowrap;
}

#supplier-orders-view .supplier-po-commit {
  border-color: var(--pb-op-border);
}

#supplier-orders-view .po-draft-total {
  padding: 6px 0 0;
  border-top: 1px solid var(--pb-op-divider);
}

#supplier-orders-view .po-draft-total span {
  color: var(--pb-op-text-muted);
  font-size: 11px;
}

#supplier-orders-view .po-draft-total strong {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
}

#supplier-orders-view .supplier-po-table-wrap {
  overflow: auto;
  overscroll-behavior: contain;
}

#supplier-orders-view .supplier-orders-table {
  min-width: 1040px;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

#supplier-orders-view .supplier-orders-table th,
#supplier-orders-view .supplier-orders-table td {
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

#supplier-orders-view .supplier-orders-table th[data-sort-table] {
  cursor: pointer;
}

#supplier-orders-view .supplier-orders-table th[data-sort-table]:focus-visible {
  outline: 2px solid var(--pb-op-focus);
  outline-offset: -2px;
}

#supplier-orders-view .supplier-po-identity,
#supplier-orders-view .supplier-po-supplier {
  text-align: left;
}

#supplier-orders-view .supplier-po-identity strong,
#supplier-orders-view .supplier-po-supplier strong {
  color: var(--pb-op-text);
  font-weight: 680;
}

#supplier-orders-view .supplier-po-open-balance {
  color: var(--warning);
  font-weight: 700;
}

#supplier-orders-view .supplier-po-status {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

#supplier-orders-view .supplier-orders-table th:nth-child(1),
#supplier-orders-view .supplier-orders-table td:nth-child(1) { width: 16%; }
#supplier-orders-view .supplier-orders-table th:nth-child(2),
#supplier-orders-view .supplier-orders-table td:nth-child(2) { width: 18%; }
#supplier-orders-view .supplier-orders-table th:nth-child(3),
#supplier-orders-view .supplier-orders-table td:nth-child(3) { width: 8%; }
#supplier-orders-view .supplier-orders-table th:nth-child(4),
#supplier-orders-view .supplier-orders-table td:nth-child(4),
#supplier-orders-view .supplier-orders-table th:nth-child(5),
#supplier-orders-view .supplier-orders-table td:nth-child(5) { width: 8%; }
#supplier-orders-view .supplier-orders-table th:nth-child(6),
#supplier-orders-view .supplier-orders-table td:nth-child(6) { width: 10%; }
#supplier-orders-view .supplier-orders-table th:nth-child(7),
#supplier-orders-view .supplier-orders-table td:nth-child(7),
#supplier-orders-view .supplier-orders-table th:nth-child(8),
#supplier-orders-view .supplier-orders-table td:nth-child(8) { width: 10%; }
#supplier-orders-view .supplier-orders-table th:nth-child(9),
#supplier-orders-view .supplier-orders-table td:nth-child(9) { width: 12%; }

#supplier-orders-view .supplier-po-row-actions {
  flex-wrap: nowrap;
  align-items: center;
  white-space: nowrap;
}

#supplier-orders-view .supplier-po-row-actions .small-action {
  min-width: 46px;
  padding: 0 8px;
}

#supplier-orders-view .supplier-po-action-menu .row-action-menu-list {
  top: auto;
  bottom: calc(100% + 4px);
}

#supplier-orders-view .supplier-po-action-menu .danger-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

#supplier-orders-view .table-tools[data-table-tools="supplier-orders-body"] {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(125px, 0.45fr) minmax(125px, 0.45fr) auto auto;
  gap: 6px;
}

#supplier-orders-view .table-tools[data-table-tools="supplier-orders-body"] input {
  width: 100%;
}

#supplier-orders-view .table-tools-clear {
  min-height: 30px;
  padding: 5px 10px;
}

#supplier-orders-view .supplier-po-draft-table {
  min-width: 410px;
  table-layout: fixed;
}

#supplier-orders-view .supplier-po-draft-table th,
#supplier-orders-view .supplier-po-draft-table td {
  white-space: nowrap;
}

#supplier-orders-view .supplier-po-draft-table th:nth-child(1) { width: auto; }
#supplier-orders-view .supplier-po-draft-table th:nth-child(2) { width: 44px; }
#supplier-orders-view .supplier-po-draft-table th:nth-child(3) { width: 48px; }
#supplier-orders-view .supplier-po-draft-table th:nth-child(4) { width: 78px; }
#supplier-orders-view .supplier-po-draft-table th:nth-child(5) { width: 84px; }
#supplier-orders-view .supplier-po-draft-table th:nth-child(6) { width: 54px; }

#supplier-orders-view .supplier-po-draft-table td:nth-child(2),
#supplier-orders-view .supplier-po-draft-table td:nth-child(4),
#supplier-orders-view .supplier-po-draft-table td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#supplier-orders-view .supplier-po-draft-table:has(.po-draft-empty) thead {
  display: none;
}

#supplier-orders-view .mini-table-wrap:has(.supplier-po-draft-table .po-draft-empty) {
  overflow: hidden;
}

#supplier-orders-view .supplier-po-draft-table:has(.po-draft-empty) {
  min-width: 0;
  table-layout: auto;
}

#supplier-orders-view .po-draft-empty td {
  padding: 0;
  border-bottom: 0;
}

@media (min-width: 1200px) {
  #supplier-orders-view [data-supplier-tab-panel="orders"].supplier-workspace {
    grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 430px);
    gap: 10px;
  }
}

@media (min-width: 1500px) {
  #supplier-orders-view .supplier-orders-table {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 1199px) {
  #supplier-orders-view [data-supplier-tab-panel="orders"].supplier-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #supplier-orders-view .supplier-po-add-controls,
  #supplier-orders-view .table-tools[data-table-tools="supplier-orders-body"] {
    grid-template-columns: 1fr;
  }
}

/* First controlled register pilot: Quotations / Sales Orders only. */
#quotations-view .quotation-register-panel {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

#quotations-view .quotation-register-toolbar {
  margin: 0;
}

#quotations-view .quotation-register-table-wrap {
  overflow: auto;
  overscroll-behavior: contain;
}

#quotations-view .quotation-register-table {
  min-width: 1240px;
}

#quotations-view .quotation-register-table th,
#quotations-view .quotation-register-table td {
  white-space: nowrap;
}

#quotations-view .quotation-register-table td:nth-child(1),
#quotations-view .quotation-register-table td:nth-child(2),
#quotations-view .quotation-register-table td:nth-child(8),
#quotations-view .quotation-register-table td:nth-child(9) {
  white-space: normal;
}

#quotations-view .quotation-register-table th:nth-child(1),
#quotations-view .quotation-register-table td:nth-child(1) { width: 13%; }
#quotations-view .quotation-register-table th:nth-child(2),
#quotations-view .quotation-register-table td:nth-child(2) { width: 18%; }
#quotations-view .quotation-register-table th:nth-child(3),
#quotations-view .quotation-register-table td:nth-child(3) { width: 7%; }
#quotations-view .quotation-register-table th:nth-child(4),
#quotations-view .quotation-register-table td:nth-child(4) { width: 9%; }
#quotations-view .quotation-register-table th:nth-child(5),
#quotations-view .quotation-register-table td:nth-child(5) { width: 10%; }
#quotations-view .quotation-register-table th:nth-child(6),
#quotations-view .quotation-register-table td:nth-child(6) { width: 10%; }
#quotations-view .quotation-register-table th:nth-child(7),
#quotations-view .quotation-register-table td:nth-child(7) { width: 10%; }
#quotations-view .quotation-register-table th:nth-child(8),
#quotations-view .quotation-register-table td:nth-child(8) { width: 15%; }
#quotations-view .quotation-register-table th:nth-child(9),
#quotations-view .quotation-register-table td:nth-child(9) { width: 8%; }

#quotations-view .quotation-register-pagination button:disabled {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.48;
}

#quotations-view .quotation-register-row .item-cell > strong,
#quotations-view .quotation-register-row td:nth-child(2) > strong {
  color: var(--pb-op-text);
  font-weight: 680;
}

#quotations-view .quotation-register-row td:nth-child(2) {
  text-align: left;
}

#quotations-view .quotation-register-row .open-balance {
  color: var(--warning);
  font-weight: 700;
}

#quotations-view .quotation-register-row .numeric {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1450px) {
  #quotations-view .quotation-register-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #quotations-view .quotation-register-filters .quotation-filter-search {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .pb-op-register-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .pb-op-inspector {
    display: block;
    overflow: visible;
  }

  .pb-op-inspector__settings {
    overflow: visible;
  }
}

/* Receiving controlled hybrid-workspace pilot. The composer remains first in
   DOM order for keyboard/mobile flow while desktop grid areas keep the register
   on the left and receiving work on the right. */
#supplier-receiving-view .supplier-receiving-workspace {
  min-width: 0;
  grid-template-areas: "register composer";
  grid-template-columns: minmax(0, 1fr) clamp(400px, 30vw, 440px);
  gap: 10px;
  align-items: start;
}

#supplier-receiving-view .supplier-receiving-register {
  grid-area: register;
  min-width: 0;
  background: var(--pb-op-surface-data);
}

#supplier-receiving-view .supplier-receiving-composer {
  grid-area: composer;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

#supplier-receiving-view .supplier-receiving-composer > .panel-header {
  padding: 8px;
  border-bottom: 1px solid var(--pb-op-border);
}

#supplier-receiving-view .supplier-receiving-form {
  display: grid;
  gap: 8px;
  padding: 8px;
}

#supplier-receiving-view .supplier-receiving-section {
  min-width: 0;
  border-color: color-mix(in srgb, var(--pb-op-border-subsection) 74%, transparent);
}

#supplier-receiving-view .supplier-receiving-section .pb-op-subsection__header {
  margin: 0;
}

#supplier-receiving-view .supplier-receiving-section-body {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 7px;
}

#supplier-receiving-view .supplier-receiving-items {
  border-color: color-mix(in srgb, var(--pb-op-focus) 38%, var(--pb-op-border));
  background: var(--pb-op-surface-working);
}

#supplier-receiving-view .supplier-receiving-items:focus-within {
  border-color: var(--pb-op-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pb-op-focus) 20%, transparent);
}

#supplier-receiving-view .supplier-receiving-line-columns,
#supplier-receiving-view .supplier-receiving-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(95px, 0.55fr) minmax(125px, 0.7fr);
  gap: 6px;
  align-items: center;
}

#supplier-receiving-view .supplier-receiving-line-columns {
  padding: 4px 7px;
  border-bottom: 1px solid var(--pb-op-border-subsection);
  color: var(--pb-op-text-muted);
  background: var(--pb-op-surface-subsection);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  text-transform: uppercase;
}

#supplier-receiving-view .supplier-receiving-line-columns span:nth-child(2),
#supplier-receiving-view .supplier-receiving-line-columns span:nth-child(3) {
  text-align: right;
}

#supplier-receiving-view .supplier-receiving-lines {
  min-width: 0;
  display: grid;
}

#supplier-receiving-view .supplier-receiving-line {
  padding: 6px 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--pb-op-border) 72%, transparent);
  background: var(--pb-op-surface-subsection);
}

#supplier-receiving-view .supplier-receiving-line:last-child {
  border-bottom: 0;
}

#supplier-receiving-view .supplier-receiving-line:hover,
#supplier-receiving-view .supplier-receiving-line:focus-within {
  background: color-mix(in srgb, var(--pb-op-focus) 8%, var(--pb-op-surface-subsection));
}

#supplier-receiving-view .supplier-receiving-line:focus-within {
  box-shadow: inset 2px 0 0 var(--pb-op-focus);
}

#supplier-receiving-view .supplier-receiving-line-item {
  min-width: 0;
  color: var(--pb-op-text);
  line-height: 1.25;
}

#supplier-receiving-view .supplier-receiving-line-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 680;
}

#supplier-receiving-view .supplier-receiving-line-remaining,
#supplier-receiving-view .supplier-receiving-input-unit {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#supplier-receiving-view .supplier-receiving-line-remaining strong {
  color: var(--pb-op-text);
  font-weight: 650;
}

#supplier-receiving-view .supplier-receiving-line-remaining > span:last-child,
#supplier-receiving-view .supplier-receiving-input-unit > span {
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 650;
}

#supplier-receiving-view .supplier-receiving-line-input {
  min-width: 0;
  margin: 0;
}

#supplier-receiving-view .supplier-receiving-line-input input {
  width: 100%;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#supplier-receiving-view .supplier-receiving-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

#supplier-receiving-view .supplier-receiving-mobile-label {
  display: none;
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

#supplier-receiving-view .supplier-receiving-lines-empty {
  min-height: 34px;
  display: flex;
  align-items: center;
}

#supplier-receiving-view .supplier-receiving-commit .primary-action {
  min-height: 32px;
}

#supplier-receiving-view .supplier-receiving-commit {
  overflow: visible;
  border: 0;
  border-top: 2px solid var(--pb-op-border);
  border-radius: 0;
  background: transparent;
}

#supplier-receiving-view .supplier-receiving-commit .supplier-receiving-section-body {
  padding: 7px 0 0;
}

#supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 220px) auto auto;
  gap: 6px;
  align-items: center;
}

#supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] input,
#supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] select {
  width: 100%;
}

#supplier-receiving-view .table-tools-clear {
  min-height: 30px;
  padding: 5px 10px;
}

#supplier-receiving-view .supplier-receiving-table-wrap {
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
}

#supplier-receiving-view .supplier-receipts-table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

#supplier-receiving-view .supplier-receipts-table th,
#supplier-receiving-view .supplier-receipts-table td {
  padding: 5px 4px;
  white-space: nowrap;
}

#supplier-receiving-view .supplier-receipts-table th[data-sort-table] {
  cursor: pointer;
}

#supplier-receiving-view .supplier-receipts-table th[data-sort-table]:focus-visible {
  outline: 2px solid var(--pb-op-focus);
  outline-offset: -2px;
}

#supplier-receiving-view .supplier-receipt-identity,
#supplier-receiving-view .supplier-receipt-po,
#supplier-receiving-view .supplier-receipt-supplier {
  text-align: left;
}

#supplier-receiving-view .supplier-receipt-identity strong,
#supplier-receiving-view .supplier-receipt-po strong,
#supplier-receiving-view .supplier-receipt-supplier {
  color: var(--pb-op-text);
}

#supplier-receiving-view .supplier-receipt-identity strong {
  font-weight: 700;
}

#supplier-receiving-view .supplier-receipt-po strong,
#supplier-receiving-view .supplier-receipt-supplier {
  font-weight: 620;
}

#supplier-receiving-view .supplier-receipt-secondary {
  color: var(--pb-op-text-muted);
}

#supplier-receiving-view .supplier-receipt-line-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#supplier-receiving-view .supplier-receiving-status {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

#supplier-receiving-view .supplier-receipts-table th:nth-child(1),
#supplier-receiving-view .supplier-receipts-table td:nth-child(1) { width: 14%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(2),
#supplier-receiving-view .supplier-receipts-table td:nth-child(2) { width: 14%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(3),
#supplier-receiving-view .supplier-receipts-table td:nth-child(3) { width: 24%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(4),
#supplier-receiving-view .supplier-receipts-table td:nth-child(4) { width: 12%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(5),
#supplier-receiving-view .supplier-receipts-table td:nth-child(5) { width: 18%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(6),
#supplier-receiving-view .supplier-receipts-table td:nth-child(6) { width: 8%; }
#supplier-receiving-view .supplier-receipts-table th:nth-child(7),
#supplier-receiving-view .supplier-receipts-table td:nth-child(7) { width: 10%; }

#supplier-receiving-view .supplier-receipts-table td[colspan] {
  padding: 8px;
  color: var(--pb-op-text-muted);
  text-align: center;
}

@media (max-width: 1199px) {
  #supplier-receiving-view .supplier-receiving-workspace {
    grid-template-areas:
      "composer"
      "register";
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #supplier-receiving-view .supplier-receiving-line-columns {
    display: none;
  }

  #supplier-receiving-view .supplier-receiving-line {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 0.8fr);
  }

  #supplier-receiving-view .supplier-receiving-line-item {
    grid-column: 1 / -1;
  }

  #supplier-receiving-view .supplier-receiving-mobile-label {
    display: block;
  }

  #supplier-receiving-view .supplier-receiving-line-remaining,
  #supplier-receiving-view .supplier-receiving-line-input {
    display: grid;
    gap: 3px;
  }

  #supplier-receiving-view .supplier-receiving-line-remaining {
    grid-template-columns: auto auto auto;
    justify-content: start;
  }

  #supplier-receiving-view .supplier-receiving-line-remaining .supplier-receiving-mobile-label {
    grid-column: 1 / -1;
  }

  #supplier-receiving-view .supplier-receiving-details .compact-grid {
    grid-template-columns: 1fr;
  }

  #supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] input {
    grid-column: 1 / -1;
  }

  #supplier-receiving-view .table-tools[data-table-tools="supplier-receipts-body"] [data-table-count] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  #supplier-receiving-view .supplier-receiving-line,
  #supplier-receiving-view .supplier-receiving-details .compact-grid {
    grid-template-columns: 1fr;
  }

  #supplier-receiving-view .supplier-receiving-line-item,
  #supplier-receiving-view .supplier-receiving-line-remaining,
  #supplier-receiving-view .supplier-receiving-line-input {
    grid-column: 1;
  }
}

/* Walk-in Sale: page-scoped counter workspace. */
#walk-in-sale-view {
  min-width: 0;
  overflow: auto;
}

#walk-in-sale-view .walk-in-workspace {
  width: min(1220px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

#walk-in-sale-view .walk-in-primary-workspace,
#walk-in-sale-view .walk-in-inspector {
  min-width: 0;
  display: grid;
  gap: 10px;
}

#walk-in-sale-view .pb-op-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--pb-op-border);
  border-radius: var(--pb-op-radius-card);
  background: var(--pb-op-surface-info);
}

#walk-in-sale-view .pb-op-card__header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pb-op-border-subsection);
}

#walk-in-sale-view .pb-op-card__header h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
}

#walk-in-sale-view .pb-op-card__header .eyebrow {
  margin: 0 0 2px;
}

#walk-in-sale-view .walk-in-add-card {
  border-color: color-mix(in srgb, var(--pb-op-focus) 42%, var(--pb-op-border));
  background: var(--pb-op-surface-working);
}

#walk-in-sale-view .walk-in-add-card:focus-within {
  border-color: var(--pb-op-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pb-op-focus) 18%, transparent);
}

#walk-in-sale-view .walk-in-add-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(110px, 0.28fr) 90px minmax(145px, 0.35fr) auto;
  gap: 7px;
  align-items: end;
}

#walk-in-sale-view .walk-in-product-field {
  min-width: 0;
}

#walk-in-sale-view .walk-in-add-grid > label,
#walk-in-sale-view .walk-in-payment-grid > label,
#walk-in-sale-view .walk-in-customer-field,
#walk-in-sale-view .walk-in-discounts > label {
  min-width: 0;
  margin: 0;
}

#walk-in-sale-view .walk-in-customer-field {
  position: relative;
  z-index: 2;
}

#walk-in-sale-view .walk-in-customer-field .typeahead-list {
  z-index: 3;
}

#walk-in-sale-view .walk-in-customer-field.has-unselected-text input {
  border-color: var(--warning);
}

#walk-in-sale-view .walk-in-customer-selection-message {
  color: var(--warning);
  font-weight: 600;
}

#walk-in-sale-view .walk-in-customer-field > label {
  display: block;
  margin-bottom: 5px;
}

#walk-in-sale-view .walk-in-stock-summary {
  color: var(--pb-op-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

#walk-in-sale-view .walk-in-stock-summary.is-low {
  color: var(--warning);
  font-weight: 700;
}

#walk-in-sale-view .walk-in-items-card {
  background: var(--pb-op-surface-data);
}

#walk-in-sale-view .walk-in-items-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

#walk-in-sale-view .walk-in-items-table {
  min-width: 780px;
}

#walk-in-sale-view .walk-in-items-table th:nth-child(n+2):nth-child(-n+6),
#walk-in-sale-view .walk-in-items-table td:nth-child(n+2):nth-child(-n+6) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#walk-in-sale-view .walk-in-items-table th:last-child,
#walk-in-sale-view .walk-in-items-table td:last-child {
  width: 64px;
  text-align: center;
}

#walk-in-sale-view .walk-in-items-table .walk-in-item-name {
  min-width: 220px;
  color: var(--pb-op-text);
  font-weight: 700;
}

#walk-in-sale-view .walk-in-items-table input {
  width: 112px;
  min-width: 0;
  text-align: right;
}

#walk-in-sale-view .walk-in-stock-shortage td {
  background: color-mix(in srgb, var(--warning) 9%, transparent);
}

#walk-in-sale-view .walk-in-stock-shortage .walk-in-available {
  color: var(--warning);
  font-weight: 750;
}

#walk-in-sale-view .walk-in-empty {
  padding: 12px;
  text-align: center;
}

#walk-in-sale-view .walk-in-discounts {
  width: min(420px, 100%);
  margin: 9px 0 0 auto;
  padding-top: 8px;
  border-top: 1px solid var(--pb-op-border-subsection);
}

#walk-in-sale-view .walk-in-payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#walk-in-sale-view .walk-in-reference-field {
  grid-column: span 2;
}

#walk-in-sale-view .walk-in-summary-card {
  background: var(--panel-raised);
}

#walk-in-sale-view .walk-in-summary-rows {
  display: grid;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

#walk-in-sale-view .walk-in-summary-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--pb-op-text-muted);
}

#walk-in-sale-view .walk-in-summary-rows strong {
  color: var(--pb-op-text);
}

#walk-in-sale-view .walk-in-summary-total {
  margin-top: 3px;
  padding: 8px;
  border-top: 2px solid var(--pb-op-border);
  background: color-mix(in srgb, var(--green) 13%, transparent);
  color: var(--pb-op-text) !important;
}

#walk-in-sale-view .walk-in-summary-total strong {
  color: var(--green);
  font-size: 16px;
}

#walk-in-sale-view .walk-in-final-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 0;
  border-top: 2px solid var(--pb-op-border);
}

#walk-in-sale-view .walk-in-final-actions > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

#walk-in-sale-view .walk-in-final-actions span {
  color: var(--pb-op-text-muted);
  font-size: 11px;
}

#walk-in-sale-view .walk-in-final-actions .primary-action {
  min-width: 210px;
  min-height: 36px;
}

#walk-in-sale-view .walk-in-final-actions .primary-action:focus-visible,
#walk-in-sale-view .walk-in-add-grid .primary-action:focus-visible {
  outline: 2px solid var(--pb-op-focus);
  outline-offset: 2px;
}

#walk-in-sale-view .walk-in-action-state,
#walk-in-sale-view .walk-in-completion-card {
  min-width: 0;
}

#walk-in-sale-view .walk-in-action-state {
  display: grid;
  gap: 8px;
}

#walk-in-sale-view .walk-in-draft-actions,
#walk-in-sale-view .walk-in-completion-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#walk-in-sale-view .walk-in-draft-actions .primary-action {
  flex: 1 1 210px;
}

#walk-in-sale-view .walk-in-draft-actions .secondary-action {
  flex: 0 0 auto;
}

#walk-in-sale-view .walk-in-completion-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--pb-op-border));
  border-radius: var(--pb-op-radius-card);
  background: color-mix(in srgb, var(--green) 8%, var(--panel-raised));
  overflow: visible;
}

#walk-in-sale-view .walk-in-completion-card[hidden],
#walk-in-sale-view .walk-in-action-state[hidden] {
  display: none !important;
}

#walk-in-sale-form.walk-in-completion-confirmed .walk-in-payment-card,
#walk-in-sale-form.walk-in-completion-confirmed .walk-in-summary-card {
  display: none;
}

#walk-in-sale-view .walk-in-completion-heading {
  display: grid;
  gap: 2px;
}

#walk-in-sale-view .walk-in-completion-heading strong {
  color: var(--green);
  letter-spacing: .04em;
}

#walk-in-sale-view .walk-in-completion-details {
  display: grid;
  gap: 6px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

#walk-in-sale-view .walk-in-completion-details > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#walk-in-sale-view .walk-in-completion-details dt {
  color: var(--pb-op-text-muted);
}

#walk-in-sale-view .walk-in-completion-details dd {
  margin: 0;
  color: var(--pb-op-text);
  font-weight: 700;
  text-align: right;
}

#walk-in-sale-view .walk-in-completion-actions {
  display: grid;
  gap: 7px;
}

#walk-in-sale-view .walk-in-completion-actions .primary-action {
  width: 100%;
}

#walk-in-sale-view .walk-in-new-sale-action {
  margin-top: 2px;
}

#walk-in-sale-view .walk-in-aac-note {
  display: block;
  margin-top: 2px;
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 500;
}

/* The app shell owns viewport height. This desktop workspace only inherits
   that available space, keeping Sale Items as the single data-scroll region. */
@media (min-width: 1101px) and (min-height: 700px) {
  #walk-in-sale-view {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  #walk-in-sale-view .walk-in-workspace {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 28vw, 360px);
    align-items: stretch;
    overflow: hidden;
    padding-bottom: 0;
  }

  #walk-in-sale-view .walk-in-primary-workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 10px;
    /* The customer typeahead paints over following cards. Sale Items retains
       its dedicated data-scroll region, so this does not add page scrolling. */
    overflow: visible;
  }

  #walk-in-sale-view .walk-in-inspector {
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  #walk-in-sale-form.walk-in-completion-confirmed .walk-in-inspector {
    grid-template-rows: minmax(0, 1fr);
  }

  #walk-in-sale-form.walk-in-completion-confirmed .walk-in-final-actions {
    height: 100%;
    min-height: 0;
    padding-top: 0;
    border-top: 0;
    overflow: auto;
  }

  #walk-in-sale-form.walk-in-completion-confirmed .walk-in-completion-card {
    align-content: start;
    overflow: auto;
  }

  #walk-in-sale-view .walk-in-payment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #walk-in-sale-view .walk-in-customer-card .field-help,
  #walk-in-sale-view .walk-in-add-card .field-help {
    margin: 4px 0 0;
    font-size: 10px;
    line-height: 1.25;
  }

  #walk-in-sale-view .walk-in-items-card {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  #walk-in-sale-view .walk-in-items-table-wrap {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  #walk-in-sale-view .walk-in-items-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--pb-op-surface-data);
  }

  #walk-in-sale-view .walk-in-empty {
    align-self: start;
    margin: 0;
  }

  #walk-in-sale-view .walk-in-discounts {
    margin-top: 8px;
  }

  #walk-in-sale-view .walk-in-final-actions {
    align-self: end;
    min-width: 0;
    display: grid;
    gap: 6px;
    padding: 10px 0 0;
  }

  #walk-in-sale-view .walk-in-final-actions .primary-action {
    width: 100%;
  }
}

/* Short desktop windows safely fall back to page scrolling rather than
   clipping payment fields, summary values, recovery text, or final actions. */
@media (min-width: 1101px) and (max-height: 699px) {
  #walk-in-sale-view {
    overflow: auto;
  }
}

@media (max-width: 1100px) {
  #walk-in-sale-view {
    overflow: visible;
  }

}

@media (max-width: 900px) {
  #walk-in-sale-view .walk-in-add-grid {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.35fr) 90px;
  }

  #walk-in-sale-view .walk-in-product-field {
    grid-column: 1 / -1;
  }

  #walk-in-sale-view .walk-in-add-grid > label:nth-of-type(3) {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  #walk-in-sale-view .walk-in-workspace,
  #walk-in-sale-view .walk-in-primary-workspace,
  #walk-in-sale-view .walk-in-inspector {
    gap: 8px;
  }

  #walk-in-sale-view .walk-in-add-grid,
  #walk-in-sale-view .walk-in-payment-grid,
  #walk-in-sale-view .walk-in-discounts {
    grid-template-columns: 1fr;
  }

  #walk-in-sale-view .walk-in-product-field,
  #walk-in-sale-view .walk-in-add-grid > label:nth-of-type(3),
  #walk-in-sale-view .walk-in-reference-field {
    grid-column: 1;
  }

  #walk-in-sale-view .walk-in-final-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #walk-in-sale-view .walk-in-final-actions .primary-action {
    width: 100%;
  }
}

/* Delivery controlled List/Register and Create DR workspace refinement. */
#deliveries-view .deliveries-register-workspace {
  min-width: 0;
}

#deliveries-view .deliveries-register-panel {
  min-width: 0;
  background: var(--pb-op-surface-data);
}

#deliveries-view .deliveries-register-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

#deliveries-view .deliveries-register-header-actions .primary-action {
  min-height: 30px;
  white-space: nowrap;
}

#deliveries-view .table-tools[data-table-tools="deliveries-body"] {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(165px, 215px) auto auto;
  gap: 6px;
  align-items: center;
}

#deliveries-view .table-tools[data-table-tools="deliveries-body"] input,
#deliveries-view .table-tools[data-table-tools="deliveries-body"] select {
  width: 100%;
}

#deliveries-view .table-tools-clear {
  min-height: 30px;
  padding: 5px 10px;
}

#deliveries-view .deliveries-table-wrap {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

#deliveries-view .deliveries-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

#deliveries-view .deliveries-table th,
#deliveries-view .deliveries-table td {
  padding: 5px 4px;
  white-space: nowrap;
}

#deliveries-view .deliveries-table th[data-sort-table] {
  cursor: pointer;
}

#deliveries-view .deliveries-table th[data-sort-table]:focus-visible {
  outline: 2px solid var(--pb-op-focus);
  outline-offset: -2px;
}

#deliveries-view .deliveries-table th:nth-child(1),
#deliveries-view .deliveries-table td:nth-child(1) { width: 14%; }
#deliveries-view .deliveries-table th:nth-child(2),
#deliveries-view .deliveries-table td:nth-child(2) { width: 14%; }
#deliveries-view .deliveries-table th:nth-child(3),
#deliveries-view .deliveries-table td:nth-child(3) { width: 22%; }
#deliveries-view .deliveries-table th:nth-child(4),
#deliveries-view .deliveries-table td:nth-child(4) { width: 10%; }
#deliveries-view .deliveries-table th:nth-child(5),
#deliveries-view .deliveries-table td:nth-child(5) { width: 14%; }
#deliveries-view .deliveries-table th:nth-child(6),
#deliveries-view .deliveries-table td:nth-child(6) { width: 6%; }
#deliveries-view .deliveries-table th:nth-child(7),
#deliveries-view .deliveries-table td:nth-child(7) { width: 10%; }
#deliveries-view .deliveries-table th:nth-child(8),
#deliveries-view .deliveries-table td:nth-child(8) { width: 10%; }

#deliveries-view .delivery-identity,
#deliveries-view .delivery-order-number,
#deliveries-view .delivery-client {
  text-align: left;
}

#deliveries-view .delivery-identity strong,
#deliveries-view .delivery-order-number,
#deliveries-view .delivery-client {
  color: var(--pb-op-text);
}

#deliveries-view .delivery-identity strong {
  font-weight: 700;
}

#deliveries-view .delivery-order-number,
#deliveries-view .delivery-client {
  font-weight: 620;
}

#deliveries-view .delivery-secondary {
  color: var(--pb-op-text-muted);
}

#deliveries-view .delivery-line-count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#deliveries-view .delivery-status {
  min-height: 20px;
  padding: 2px 7px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

#deliveries-view .delivery-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

#deliveries-view .delivery-row-actions .small-action {
  min-width: 46px;
  padding: 0 8px;
}

#deliveries-view .delivery-action-menu .row-action-menu-list {
  position: fixed;
  z-index: 1000;
  top: var(--delivery-menu-top, 0);
  right: auto;
  bottom: auto;
  left: var(--delivery-menu-left, 0);
  visibility: hidden;
}

#deliveries-view .delivery-action-menu.is-positioned .row-action-menu-list {
  visibility: visible;
}

#deliveries-view .delivery-action-menu .row-action-menu-list .small-action,
#deliveries-view .delivery-action-menu .row-action-menu-list .danger-action {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

#create-delivery-view .create-delivery-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 27vw, 360px);
  gap: 10px;
  align-items: start;
}

#create-delivery-view .create-delivery-composer,
#create-delivery-view .create-delivery-inspector {
  min-width: 0;
}

#create-delivery-view .create-delivery-composer.panel {
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#create-delivery-view #delivery-form {
  display: grid;
  gap: 8px;
  padding: 0;
}

#create-delivery-view .create-delivery-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pb-op-border-subsection) 74%, transparent);
  border-radius: var(--pb-op-radius-subsection);
  background: var(--pb-op-surface-subsection);
}

#create-delivery-view .create-delivery-section .pb-op-subsection__header {
  margin: 0;
}

#create-delivery-view .create-delivery-section-body {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 7px;
}

#create-delivery-view .create-delivery-items {
  border-color: color-mix(in srgb, var(--pb-op-focus) 38%, var(--pb-op-border));
  background: var(--pb-op-surface-working);
}

#create-delivery-view .create-delivery-items:focus-within {
  border-color: var(--pb-op-focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pb-op-focus) 20%, transparent);
}

#create-delivery-view .create-delivery-line-columns,
#create-delivery-view .create-delivery-lines .delivery-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(95px, 0.55fr) minmax(125px, 0.7fr);
  gap: 6px;
  align-items: center;
}

#create-delivery-view .create-delivery-line-columns {
  padding: 4px 7px;
  border-bottom: 1px solid var(--pb-op-border-subsection);
  color: var(--pb-op-text-muted);
  background: var(--pb-op-surface-subsection);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  text-transform: uppercase;
}

#create-delivery-view .create-delivery-line-columns span:nth-child(2),
#create-delivery-view .create-delivery-line-columns span:nth-child(3) {
  text-align: right;
}

#create-delivery-view .create-delivery-lines {
  min-width: 0;
  gap: 0;
}

#create-delivery-view .create-delivery-lines .delivery-line {
  padding: 6px 7px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--pb-op-border) 72%, transparent);
  border-radius: 0;
  background: var(--pb-op-surface-subsection);
}

#create-delivery-view .create-delivery-lines .delivery-line:last-child {
  border-bottom: 0;
}

#create-delivery-view .create-delivery-lines .delivery-line:hover,
#create-delivery-view .create-delivery-lines .delivery-line:focus-within {
  background: color-mix(in srgb, var(--pb-op-focus) 8%, var(--pb-op-surface-subsection));
}

#create-delivery-view .create-delivery-lines .delivery-line:focus-within {
  box-shadow: inset 2px 0 0 var(--pb-op-focus);
}

#create-delivery-view .create-delivery-line-item {
  min-width: 0;
  color: var(--pb-op-text);
  line-height: 1.25;
}

#create-delivery-view .create-delivery-line-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 680;
}

#create-delivery-view .create-delivery-line-remaining,
#create-delivery-view .delivery-input-unit {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--pb-op-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#create-delivery-view .delivery-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

#create-delivery-view .delivery-input-unit input {
  width: 100%;
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#create-delivery-view .delivery-input-unit > span {
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

#create-delivery-view .create-delivery-line-remaining strong {
  color: var(--pb-op-text);
  font-weight: 650;
}

#create-delivery-view .create-delivery-line-remaining > span:last-child {
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 650;
}

#create-delivery-view .create-delivery-line-input {
  min-width: 0;
  margin: 0;
}

#create-delivery-view .create-delivery-mobile-label {
  display: none;
  color: var(--pb-op-text-muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

#create-delivery-view .create-delivery-final-actions {
  display: grid;
  gap: 6px;
  padding-top: 7px;
  border-top: 2px solid var(--pb-op-border);
}

#create-delivery-view .create-delivery-final-actions .primary-action {
  min-height: 32px;
}

#create-delivery-view .create-delivery-inspector {
  background: var(--pb-op-surface-information);
}

#create-delivery-view #create-dr-pending {
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#create-delivery-view #create-dr-pending > span {
  display: block;
  color: var(--pb-op-text);
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

@media (min-width: 1101px) {
  #deliveries-view {
    overflow: hidden;
  }

  #deliveries-view .deliveries-register-workspace,
  #deliveries-view .deliveries-register-panel {
    height: 100%;
    min-height: 0;
  }

  #deliveries-view .deliveries-register-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  #deliveries-view .deliveries-table-wrap {
    min-height: 0;
  }

  #deliveries-view .deliveries-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  #create-delivery-view .create-delivery-inspector {
    position: sticky;
    top: 0;
  }
}

@media (max-width: 1100px) {
  #create-delivery-view .create-delivery-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #deliveries-view .deliveries-register-header-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  #deliveries-view .table-tools[data-table-tools="deliveries-body"] {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #deliveries-view .table-tools[data-table-tools="deliveries-body"] input,
  #deliveries-view .table-tools[data-table-tools="deliveries-body"] [data-table-count] {
    grid-column: 1 / -1;
  }

  #create-delivery-view .create-delivery-line-columns {
    display: none;
  }

  #create-delivery-view .create-delivery-lines .delivery-line {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 0.8fr);
  }

  #create-delivery-view .create-delivery-line-item {
    grid-column: 1 / -1;
  }

  #create-delivery-view .create-delivery-line-remaining,
  #create-delivery-view .create-delivery-line-input {
    display: grid;
    gap: 3px;
  }

  #create-delivery-view .create-delivery-line-remaining {
    grid-template-columns: auto auto auto;
    justify-content: start;
  }

  #create-delivery-view .create-delivery-line-remaining .create-delivery-mobile-label {
    grid-column: 1 / -1;
  }

  #create-delivery-view .create-delivery-mobile-label {
    display: block;
  }

  #create-delivery-view .create-delivery-details .compact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  #create-delivery-view .create-delivery-lines .delivery-line,
  #create-delivery-view .create-delivery-details .compact-grid {
    grid-template-columns: 1fr;
  }

  #create-delivery-view .create-delivery-line-item,
  #create-delivery-view .create-delivery-line-remaining,
  #create-delivery-view .create-delivery-line-input {
    grid-column: 1;
  }
}

/* Read-only quotation history uses native dialog focus and Escape handling. */
.quotation-history-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
}
.quotation-history-dialog::backdrop { background: rgb(0 0 0 / 55%); }
.quotation-history-table { overflow: auto; max-height: 65vh; }
.quotation-history-table table { width: 100%; min-width: 760px; }
.quotation-history-table td { vertical-align: top; }

.quotation-history-table .muted-cell { display: block; margin-top: 4px; }
.cloud-editing-notice {
  margin: 0 16px 10px;
  padding: 10px 14px;
  border: 1px solid #c98d4f;
  border-radius: 8px;
  color: #f5c78c;
  background: #33251b;
}


/* Delivery receipt print options. */
#delivery-print-dialog { width: min(480px, calc(100vw - 32px)); }
#delivery-print-dialog .delivery-print-choice { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
#delivery-print-prices { width: 18px; height: 18px; margin: 0; flex: 0 0 18px; }
#delivery-print-error { color: var(--danger, #b42318); white-space: pre-line; }

.cloud-recovery-notice { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--panel); overflow-wrap: anywhere; }
.cloud-recovery-notice[hidden], #cloud-recovery-copies[hidden] { display:none; }
.cloud-recovery-notice button { margin: 6px; }
#cloud-recovery-copies { max-height: 35vh; overflow:auto; }
#cloud-recovery-copies details { padding: 8px; border-top:1px solid var(--line); }
#cloud-recovery-copies textarea { width:100%; min-height:100px; font-family:monospace; }
.cloud-recovery-notice { min-width:0; max-width:calc(100vw - 28px); box-sizing:border-box; }

/* Sales Order register: keep finance and common actions in view. */
#sales-orders-view .sales-orders-register-panel {
  container: sales-order-register / inline-size;
  min-width: 0;
}

#sales-orders-view .sales-orders-register-panel > .panel-header { align-items: center; }
#sales-orders-view .sales-orders-register-panel > .panel-header .muted-cell { margin: 2px 0 0; }
#sales-orders-view .sales-orders-filters {
  display: grid;
  grid-template-columns: minmax(230px, 1.7fr) minmax(520px, 4fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 7px;
}
#sales-orders-view .sales-orders-filters label,
#sales-orders-view .sales-order-register-tools label { display: grid; min-width: 0; gap: 2px; }
#sales-orders-view .sales-orders-filters label > span,
#sales-orders-view .sales-order-register-tools label > span { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
#sales-orders-view .sales-orders-filters input,
#sales-orders-view .sales-orders-filters select,
#sales-orders-view .sales-order-register-tools select { width: 100%; min-width: 0; min-height: 32px; padding: 4px 8px; }
#sales-orders-view .sales-orders-filters > button { min-height: 32px; white-space: nowrap; }
#sales-orders-view .sales-order-filter-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#sales-orders-view .sales-order-filter-toggle { display: none; }
#sales-orders-view .sales-order-balance-filter.active { border-color: var(--aqua); color: var(--brand); background: var(--aqua-soft); }
#sales-orders-view .sales-order-register-tools { display: flex; align-items: end; justify-content: flex-end; gap: 8px; margin-bottom: 7px; }
#sales-orders-view #sales-order-active-filters { min-width: 0; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sales-orders-view .sales-order-register-tools select { min-width: 155px; }
#sales-orders-view .sales-order-register-tools button { min-height: 32px; }
#sales-orders-view .sales-orders-table-wrap { overflow-x: hidden; border-top: 1px solid var(--line); }
#sales-orders-view .sales-orders-table { width: 100%; min-width: 0; table-layout: fixed; }
#sales-orders-view .sales-orders-table th,
#sales-orders-view .sales-orders-table td { padding: 8px 7px; text-align: left; white-space: normal; overflow-wrap: anywhere; vertical-align: middle; }
#sales-orders-view .sales-orders-table th:nth-child(1) { width: 15%; }
#sales-orders-view .sales-orders-table th:nth-child(2) { width: 21%; }
#sales-orders-view .sales-orders-table th:nth-child(3) { width: 14%; }
#sales-orders-view .sales-orders-table th:nth-child(4) { width: 18%; }
#sales-orders-view .sales-orders-table th:nth-child(5) { width: 19%; }
#sales-orders-view .sales-orders-table th:nth-child(6) { width: 13%; }
#sales-orders-view .sales-orders-table th button { padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; text-transform: inherit; cursor: pointer; }
#sales-orders-view .sales-orders-table th button.active { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
#sales-orders-view .sales-order-register-row { cursor: pointer; }
#sales-orders-view .sales-order-register-row.voided-row,
#sales-orders-view .sales-order-card.voided-row { opacity: 1; }
#sales-orders-view .sales-order-register-row:hover,
#sales-orders-view .sales-order-register-row:focus-visible { background: var(--table-row-hover); outline: 2px solid var(--aqua); outline-offset: -2px; }
#sales-orders-view .sales-order-cell-stack { display: grid; justify-items: start; gap: 3px; min-width: 0; line-height: 1.25; }
#sales-orders-view .sales-order-cell-stack > strong { font-weight: 700; }
#sales-orders-view .sales-order-cell-stack .muted-cell { display: block; min-width: 0; }
#sales-orders-view .sales-order-source-type { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
#sales-orders-view .sales-order-balance { display: grid; gap: 1px; font-size: 15px; font-variant-numeric: tabular-nums; }
#sales-orders-view .sales-order-balance span { color: var(--ink-soft); font-size: 10px; font-weight: 600; text-transform: uppercase; }
#sales-orders-view .sales-order-progress { display: grid; gap: 4px; }
#sales-orders-view .sales-order-progress > div { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
#sales-orders-view .sales-order-progress > div > span:first-child { color: var(--ink-soft); font-size: 10px; font-weight: 600; }
#sales-orders-view .sales-order-progress .pill,
#sales-orders-view .sales-order-cell-stack .pill { min-height: 20px; padding: 2px 7px; font-size: 10px; line-height: 1.2; }
#sales-orders-view .sales-order-progress .status-success { filter: saturate(0.68); }
#sales-orders-view .sales-order-row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
#sales-orders-view .sales-order-row-actions .small-action { width: 100%; min-width: 0; padding: 0 4px; }
#sales-orders-view .sales-orders-cards { display: none; }
#sales-orders-view .pb-op-register-pagination { margin-top: 8px; }

.sales-order-drawer-primary-actions,
.sales-order-management-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.sales-order-drawer-primary-actions { margin: 0 0 14px; }
.sales-order-management { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.sales-order-management h3 { margin: 0 0 10px; }
.sales-order-management .muted-cell { margin: 8px 0 0; line-height: 1.4; }
.sales-order-drawer-dismiss { margin-top: 14px; text-align: right; }

@container sales-order-register (max-width: 1120px) {
  #sales-orders-view .sales-orders-filters { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  #sales-orders-view .sales-order-filter-toggle { display: inline-flex; align-items: center; }
  #sales-orders-view .sales-order-filter-fields { display: none; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #sales-orders-view .filters-expanded .sales-order-filter-fields { display: grid; }
  #sales-orders-view .sales-orders-table-wrap { display: none; }
  #sales-orders-view .sales-orders-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #sales-orders-view .sales-order-card { min-width: 0; display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-raised); cursor: pointer; }
  #sales-orders-view .sales-order-card:hover,
  #sales-orders-view .sales-order-card:focus-visible { border-color: var(--aqua); outline: 2px solid var(--aqua); outline-offset: 1px; }
  #sales-orders-view .sales-order-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #sales-orders-view .sales-order-card-client { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
  #sales-orders-view .sales-order-card-source { display: grid; gap: 2px; overflow-wrap: anywhere; }
  #sales-orders-view .sales-order-card-source > span { color: var(--ink-soft); font-size: 10px; font-weight: 700; text-transform: uppercase; }
  #sales-orders-view .sales-order-card-amount { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; font-variant-numeric: tabular-nums; }
  #sales-orders-view .sales-order-card-amount strong { font-size: 16px; }
  #sales-orders-view .sales-order-card-amount > span { color: var(--ink-soft); }
  #sales-orders-view .sales-order-row-actions { margin-top: 3px; }
  #sales-orders-view .sales-order-row-actions .small-action { min-height: 34px; }
}

@container sales-order-register (max-width: 700px) {
  #sales-orders-view .sales-orders-filters { grid-template-columns: minmax(0, 1fr) auto auto; }
  #sales-orders-view .sales-order-search { grid-column: 1 / -1; }
  #sales-orders-view .sales-order-filter-fields { grid-template-columns: 1fr; }
  #sales-orders-view .sales-orders-cards { grid-template-columns: 1fr; }
  #sales-orders-view .sales-order-register-tools { flex-wrap: wrap; }
  #sales-orders-view #sales-order-active-filters { flex-basis: 100%; }
  #sales-orders-view .sales-order-register-tools label { flex: 1; }
}


#sales-order-closure-dialog { width: min(760px, calc(100vw - 32px)); overflow-y: auto; }
#sales-order-closure-form { display: grid; gap: 18px; }
#sales-order-closure-form label { display: grid; gap: 7px; font-weight: 600; }
#sales-order-closure-form input,
#sales-order-closure-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg, var(--panel)); color: var(--ink); font: inherit; }
#sales-order-closure-details { display: grid; gap: 14px; }
#sales-order-closure-details .mini-table-wrap { max-height: 30vh; overflow: auto; }


.quotation-owner-dialog{width:min(520px,calc(100vw - 32px));padding:24px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink)}.quotation-owner-dialog::backdrop{background:rgb(16 24 40 / 45%)}.quotation-send-summary{display:grid;grid-template-columns:1fr 1fr;gap:10px 16px}.quotation-send-summary dd{margin:0;text-align:right}.quotation-send-dialog .dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:20px}[id^="quotation-"][hidden],.quotation-send-dialog [hidden]{display:none!important}#quotation-connection-notice{padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel);font-size:12px}#quote-policy-actions{display:grid;gap:6px}#quote-policy-actions:empty{display:none}





/* Centralized diagnostics: normal workspace has only header and content rows. */
.workspace{grid-template-rows:auto minmax(0,1fr)}.workspace>.topbar{grid-row:1}.workspace>.view{grid-row:2}
.cloud-status[type="button"]{cursor:pointer;font-family:inherit;line-height:inherit;appearance:none}.cloud-status:focus-visible{outline:2px solid var(--aqua);outline-offset:3px}
.data-health-dot{display:inline-block;width:8px;height:8px;flex:0 0 8px;border-radius:50%;margin-left:8px;background:var(--warning)}.data-health-dot[data-level="green"]{background:var(--green-ink)}.data-health-dot[data-level="red"]{background:var(--danger)}
.cloud-diagnostics-panel:focus{outline:none}.cloud-diagnostics-panel:focus-visible{outline:2px solid var(--aqua)}.cloud-diagnostics-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px;margin:0 0 12px}.cloud-diagnostics-facts>div{min-width:0}.cloud-diagnostics-facts dt{font-size:12px;color:var(--ink-soft)}.cloud-diagnostics-facts dd{margin:3px 0 0;overflow-wrap:anywhere}.cloud-diagnostics-actions{display:flex;flex-wrap:wrap;gap:8px}.cloud-diagnostics-copy{padding:10px 0;border-top:1px solid var(--line);overflow-wrap:anywhere}.cloud-diagnostics-copy summary{cursor:pointer}.cloud-diagnostics-technical{margin-top:10px}.cloud-diagnostics-technical textarea{display:block;box-sizing:border-box;width:100%;min-height:160px;margin:8px 0}.cloud-diagnostics-error{color:#ef6859}.cloud-diagnostics-dialog{width:min(620px,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;padding:20px;box-sizing:border-box;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink)}.cloud-diagnostics-dialog::backdrop{background:rgb(0 0 0 / 45%)}.health-information-panel>summary{cursor:pointer;list-style:revert}.health-information-panel:not([open])>summary{margin-bottom:0}.health-table td{white-space:normal;overflow-wrap:anywhere}.health-table td:nth-child(3){min-width:220px}.health-table td:nth-child(4){min-width:220px}
@media(max-width:760px){.cloud-diagnostics-facts{grid-template-columns:1fr}.cloud-diagnostics-dialog{padding:14px}.health-information-panel>summary{flex-wrap:wrap;gap:6px}.cloud-diagnostics-copy summary{line-height:1.5}}

.health-workspace{min-width:0}.health-workspace>.panel{min-width:0;max-width:100%;box-sizing:border-box}.health-workspace>.cloud-diagnostics-panel{grid-column:1}.health-workspace .table-wrap{max-width:100%;overflow-x:auto}#health-view{min-width:0}
.data-health-nav-label{display:inline-flex;align-items:center;gap:8px}.data-health-nav-label>.data-health-dot{margin-left:0}
@media(max-width:1100px){.health-workspace{grid-template-columns:minmax(0,1fr)}}

/* Correction dialogs retain the operational motif with one body scroll owner. */
.walk-in-correction-dialog { box-sizing:border-box; width:min(960px,calc(100vw - 32px)); max-width:calc(100% - 32px); max-height:calc(100dvh - 32px); padding:0; overflow:hidden; }
.walk-in-correction-dialog *, .walk-in-correction-dialog *::before, .walk-in-correction-dialog *::after { box-sizing:border-box; }
.walk-in-correction-dialog form { display:flex; flex-direction:column; max-height:calc(100dvh - 34px); min-width:0; margin:0; }
.walk-in-correction-dialog .correction-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:20px 24px 12px; flex-shrink:0; }
.walk-in-correction-dialog .correction-header h2 { margin:0; font-size:20px; }
.walk-in-correction-dialog .correction-header p { margin:4px 0 0; color:var(--ink-soft); font-weight:600; }
.walk-in-correction-dialog .correction-stages { display:flex; gap:24px; list-style:none; padding:0 24px 12px; margin:0; border-bottom:1px solid var(--line); color:var(--ink-soft); flex-shrink:0; }
.walk-in-correction-dialog .correction-stages li { padding:4px 0; border-bottom:2px solid transparent; }
.walk-in-correction-dialog .correction-stages [aria-current=step] { color:var(--ink); border-color:var(--aqua); font-weight:700; }
.walk-in-correction-dialog .correction-scroll { min-height:0; min-width:0; overflow-y:auto; padding:16px 24px; overscroll-behavior:contain; }
.walk-in-correction-dialog .correction-section { padding:0 0 16px; margin:0 0 16px; border-bottom:1px solid var(--line); }
.walk-in-correction-dialog h3 { margin:0 0 8px; font-size:16px; }
.walk-in-correction-dialog .correction-section-heading { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.walk-in-correction-dialog .correction-section-heading h3 { margin:0; }
.walk-in-correction-dialog .correction-section-heading p, .walk-in-correction-dialog .correction-preview>p { margin:0; font-size:13px; color:var(--ink-soft); }
.walk-in-correction-dialog .table-wrap { max-width:100%; min-width:0; overflow-x:auto; }
.walk-in-correction-dialog table { width:100%; min-width:640px; margin:0; }
.walk-in-correction-dialog th, .walk-in-correction-dialog td { padding:8px; vertical-align:middle; }
.walk-in-correction-dialog th { font-size:11px; }
.walk-in-correction-dialog th:not(:first-child), .walk-in-correction-dialog .correction-money { text-align:right; font-variant-numeric:tabular-nums; }
.walk-in-correction-dialog .correction-identity { font-weight:600; }
.walk-in-correction-dialog .correction-meta { display:block; color:var(--ink-soft); font-size:12px; margin-top:4px; }
.walk-in-correction-dialog .correction-saved { color:var(--ink-soft); white-space:nowrap; }
.walk-in-correction-dialog input[type=number] { width:144px; max-width:100%; text-align:right; font-variant-numeric:tabular-nums; margin:0; }
.walk-in-correction-dialog input[type=checkbox] { width:18px; height:18px; flex-shrink:0; margin:0; }
.walk-in-correction-dialog .correction-select { width:64px; }
.walk-in-correction-dialog .correction-confirm { display:flex; align-items:flex-start; gap:8px; margin-top:12px; font-weight:400; color:var(--ink); }
.walk-in-correction-dialog .correction-confirm input { margin-top:2px; }
.walk-in-correction-dialog .correction-confirm small { display:block; color:var(--ink-soft); margin-top:4px; }
.walk-in-correction-dialog .correction-reason { display:grid; gap:8px; margin:0; }
.walk-in-correction-dialog textarea { margin:0; resize:vertical; min-height:64px; }
.walk-in-correction-dialog .correction-preview { padding:12px; background:var(--panel-muted); border-radius:8px; }
.walk-in-correction-dialog .correction-comparison { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin:12px 0 4px; }
.walk-in-correction-dialog .correction-comparison dt { color:var(--ink-soft); font-size:12px; }
.walk-in-correction-dialog .correction-comparison dd { display:flex; flex-direction:column; gap:4px; margin:6px 0 0; font-variant-numeric:tabular-nums; }
.walk-in-correction-dialog .correction-comparison dd span { color:var(--ink-soft); font-size:12px; }
.walk-in-correction-dialog .correction-comparison dd strong { font-size:16px; }
.walk-in-correction-dialog .correction-comparison dd small { display:inline-block; width:56px; color:var(--ink-soft); font-size:11px; font-weight:400; margin-right:4px; }
.walk-in-correction-dialog .correction-comparison-key { display:flex; gap:12px; color:var(--ink-soft); font-size:11px; }
.walk-in-correction-dialog .correction-comparison-key span:first-child::before { content:'First line: '; }
.walk-in-correction-dialog .correction-comparison-key span:last-child::before { content:'Second line: '; }
.walk-in-correction-dialog .correction-footer { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:8px; padding:12px 24px; border-top:1px solid var(--line); background:var(--panel); flex-shrink:0; }
.walk-in-correction-dialog .correction-footer>p { flex:1 1 220px; margin:0; align-self:center; font-size:12px; line-height:1.4; color:var(--ink-soft); }
.walk-in-correction-dialog .correction-footer-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:8px; }
.walk-in-correction-dialog button:disabled { cursor:not-allowed; opacity:0.5; }
.walk-in-correction-dialog .correction-availability { border:1px solid var(--warning); border-radius:8px; padding:12px; margin-bottom:16px; }
.walk-in-correction-dialog .correction-availability p { margin:0 0 8px; line-height:1.5; }
.walk-in-correction-dialog .correction-error-summary, .walk-in-correction-dialog .correction-discard { padding:12px; border:1px solid var(--danger); border-radius:8px; margin:0 0 16px; }
.walk-in-correction-dialog .correction-discard { margin-top:16px; }
.walk-in-correction-dialog .correction-discard p { margin:0 0 12px; }
.walk-in-correction-dialog .correction-discard>div { display:flex; gap:8px; flex-wrap:wrap; }
.walk-in-correction-dialog .correction-field-error { display:block; color:var(--danger); font-size:12px; margin-top:4px; }
.walk-in-correction-dialog [aria-invalid=true] { border-color:var(--danger); }
.walk-in-correction-dialog [hidden] { display:none!important; }
.walk-in-correction-dialog .correction-review-table { min-width:420px; }
.walk-in-correction-dialog .correction-history-entry { border-top:1px solid var(--line); padding:12px 0; }
.walk-in-correction-dialog .correction-history-actions { display:flex; flex-wrap:wrap; gap:8px; }
#walk-in-correction-history-dialog { padding:20px 24px; overflow-y:auto; }
#walk-in-correction-history-dialog .panel-header { display:flex; flex-direction:row; align-items:flex-start; justify-content:space-between; gap:12px; }
#walk-in-correction-history-dialog .panel-header h2 { margin:0; }
@media(max-width:760px) {
  .walk-in-correction-dialog .correction-header { padding:16px 16px 12px; }
  .walk-in-correction-dialog .correction-stages { padding:0 16px 8px; }
  .walk-in-correction-dialog .correction-scroll { padding:12px 16px; }
  .walk-in-correction-dialog .correction-footer { padding:12px 16px; }
  .walk-in-correction-dialog .correction-comparison { grid-template-columns:1fr; gap:12px; }
  .walk-in-correction-dialog .correction-comparison dd { flex-direction:row; align-items:baseline; justify-content:space-between; gap:8px; }
  .walk-in-correction-dialog .correction-comparison dd>span, .walk-in-correction-dialog .correction-comparison dd>strong { display:flex; flex-direction:column; gap:4px; white-space:nowrap; }
  .walk-in-correction-dialog .correction-comparison dd small { width:auto; margin:0; }
  .walk-in-correction-dialog .correction-comparison-key { display:none; }
}

.financial-void-dialog{box-sizing:border-box;width:min(600px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:24px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink);font:inherit;box-shadow:var(--shadow)}.financial-void-dialog [hidden]{display:none!important}.financial-cash-confirmation{display:flex;align-items:flex-start;gap:12px;margin:16px 0}.financial-cash-confirmation input{width:auto}.financial-void-dialog [data-financial-void-error]{color:var(--danger)}
/* Payment register / shared collection popup. The table owns horizontal overflow. */
.payments-register-layout { min-width: 0; }
#payments-view { min-width: 0; max-width: 100%; }
#payments-view .panel { min-width: 0; }
#payments-view .table-wrap { max-width: 100%; overflow-x: auto; }
.payment-register-actions, .payment-history-heading { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
#quick-payment-modal { z-index: 1300; padding: 12px; }
#quick-payment-modal .payment-entry-card { width: min(620px, 100%); max-height: calc(100dvh - 24px); padding: 0; display: flex; flex-direction: column; gap: 0; overflow: hidden; min-width: 0; }
.payment-entry-header, .payment-entry-footer { flex: 0 0 auto; padding: 12px 16px; background: var(--panel); }
.payment-entry-header { border-bottom: 1px solid var(--line); }
#quick-payment-modal .payment-entry-header { flex-direction: row; align-items: flex-start; flex-wrap: nowrap; }
.payment-entry-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 12px 16px; }
.payment-entry-body label, .payment-entry-body input, .payment-entry-body select { min-width: 0; max-width: 100%; }
.payment-entry-footer { border-top: 1px solid var(--line); gap: 6px; }
.payment-entry-footer p { margin: 0; overflow-wrap: anywhere; }
.payment-entry-footer p:empty { display: none; }
.payment-entry-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.payment-entry-summary span { display: block; color: var(--ink-soft); font-size: 12px; }
.payment-entry-summary strong { display: block; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#payment-entry-success { color: var(--green-ink); font-weight: 650; }
#payment-entry-error { color: var(--danger); }
.payment-entry-discard { padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
#quick-payment-modal [hidden] { display: none !important; }
@media (max-width: 760px) {
  #payments-view .panel-header { flex-wrap: wrap; gap: 8px; }
  .payment-register-actions { width: 100%; }
  .payment-entry-body .compact-grid { grid-template-columns: 1fr; }
  .payment-entry-header, .payment-entry-footer, .payment-entry-body { padding: 10px; }
  #quick-payment-modal { padding: 8px; }
  #quick-payment-modal .payment-entry-card { max-height: calc(100dvh - 16px); }
}

/* Quotation refinement: neutral blocked actions, contextual guidance and mobile shell. */
#quotation-view button:disabled, #quotations-view button:disabled {
  background: var(--panel-muted); border-color: var(--line); color: var(--ink-soft);
  cursor: not-allowed; box-shadow: none; opacity: .65;
}
#quotation-view [hidden] { display: none !important; }
.quotation-action-blocker { display: block; flex-basis: 100%; max-width: 240px; white-space: normal; color: var(--ink-soft); font-size: 11px; line-height: 1.35; }
#quote-fix-validity { grid-column: 1 / -1; justify-self: start; }
#mobile-nav-open, .quotation-mobile-summary { display: none; }
#mobile-navigation-dialog:not([open]) { display: none; }
#mobile-navigation-dialog { box-sizing: border-box; position: fixed; inset: 0 auto 0 0; margin: 0; width: min(320px, calc(100vw - 16px)); max-width: none; height: 100dvh; max-height: 100dvh; padding: 12px; border: 0; border-right: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--panel); overflow: hidden; }
#mobile-navigation-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
#mobile-navigation-dialog::backdrop { background: rgb(0 0 0 / 55%); }
#mobile-nav-close { align-self: flex-end; flex: 0 0 auto; }
#mobile-sidebar-slot { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#mobile-navigation-dialog .sidebar { position: static; height: auto; min-height: 0; overflow: visible; border-radius: 6px; }
#mobile-navigation-dialog .nav-list { display: grid; grid-template-columns: 1fr; overflow: visible; }
#mobile-account-controls { display: flex; flex: 0 0 auto; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
#mobile-navigation-dialog button { min-height: 36px; }
@media (min-width: 761px) and (max-width: 1100px) {
  .app-shell { grid-template-columns: 176px minmax(0, 1fr); }
  .app-shell > .sidebar { position: sticky; top: 0; height: 100dvh; min-height: 0; overflow: hidden; }
  .app-shell > .sidebar .nav-list { grid-template-columns: 1fr; overflow-y: auto; }
  #quotation-view .quote-tools, #quotation-view .quote-tools.area-mode { grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr) auto; }
  #quotation-view .quote-tools > label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  #mobile-nav-open { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; }
  .app-shell { display: block; min-width: 0; }
  .workspace { min-width: 0; padding: 8px; }
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
  .topbar > div:first-of-type { min-width: 0; }
  .topbar h1 { font-size: 18px; overflow-wrap: anywhere; }
  .topbar-actions { display: contents; }
  #cloud-status { max-width: 135px; white-space: normal; font-size: 11px; }
  .topbar .user-avatar { display: none; }
  #topbar-new-quote-button { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
  #quotation-view { min-width: 0; overflow: visible; }
  .quotation-mobile-summary { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
  .quotation-mobile-summary strong { margin-left: 6px; font-variant-numeric: tabular-nums; }
  #quotation-view :is(input,select,textarea,button), #quotation-view .document-actions-card { scroll-margin-block: 64px; }
  #quotation-view .table-wrap { position: relative; max-width: 100%; overflow-x: auto; }
  #quotation-view .quote-line-table-section table { min-width: 620px; }
}
@media print { #mobile-nav-open, #mobile-navigation-dialog, .quotation-mobile-summary { display: none !important; } }

#quotation-view #save-quote-button, #quotation-view #preview-si-button { grid-column: 1 / -1; }

#quotations-view .quotation-row-actions:has(.quotation-action-blocker) { display: grid; grid-template-columns: auto auto auto; min-width: 240px; }
#quotations-view .quotation-action-blocker { grid-column: 1 / -1; grid-row: 2; text-align: left; width: 100%; }

.quotation-field-error { display: block; color: var(--danger); font-size: 12px; line-height: 1.4; margin-top: 4px; white-space: normal; }
#quotation-view [data-quotation-validation-invalid] { border-color: var(--danger); }
.quotation-error-link { border: 0; padding: 2px 0; min-height: 28px; background: transparent; color: var(--ink); text-align: left; text-decoration: underline; white-space: normal; }
.quotation-error-link:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
#quotation-send-issues, #quotation-list-send-issues { padding: 10px 12px; border: 1px solid var(--danger); border-radius: 6px; }
#quotation-send-issues ul, #quotation-list-send-issues ul { margin: 6px 0 0; padding-left: 20px; }
#quotation-send-issues[hidden], #quotation-list-send-issues[hidden] { display: none !important; }

/* Payments: one operational register, client balances and existing receipt history. */
#payments-view .panel > .panel-header { position: sticky; top: 0; z-index: 20; background: var(--panel); padding-block: 12px; }
#payments-view [hidden] { display: none !important; }
.payments-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.payments-tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.payments-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--aqua); font-weight: 700; }
#payments-view :is(button,input,select):focus-visible,button.dashboard-metric:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
.receivables-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--line); margin-block: 10px 14px; }
.receivables-summary > div { display: grid; gap: 5px; padding: 12px; }
.receivables-summary span,.receivables-note,.receivable-order-identity span,.receivable-order dt { color: var(--ink-soft); font-size: 12px; }
.receivables-summary strong { font-size: 19px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.receivables-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.receivables-controls label:first-child { flex: 1 1 250px; max-width: 500px; }
.receivables-controls :is(input,select) { width: 100%; min-width: 0; }
.receivables-note { margin: 8px 0 14px; }
#receivables-availability { padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
#receivables-availability[data-kind="stale"] { border-color: var(--danger); }
.receivable-client-head,.receivable-client-row { display: grid; grid-template-columns: minmax(220px,1fr) repeat(3,minmax(115px,.45fr)) 100px; align-items: center; gap: 10px; padding: 10px; }
.receivable-client-head { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; }
.receivable-client-head > :not(:first-child),.receivable-client-row > :not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.receivable-client { border-top: 1px solid var(--line); }
.receivable-client-toggle { display: flex; gap: 8px; align-items: center; border: 0; background: transparent; text-align: left; padding: 4px 0; color: var(--ink); min-width: 0; }
.receivable-client-toggle strong { overflow-wrap: anywhere; }
.receivable-overdue { color: var(--danger); }
.receivables-mobile-label { display: none; }
.receivable-orders { padding: 6px 12px 12px; border-top: 1px solid var(--line); background: var(--panel-2,var(--panel)); }
.receivable-order { display: grid; grid-template-columns: minmax(130px,1fr) minmax(280px,1.4fr) minmax(160px,1fr); align-items: center; gap: 10px; padding: 12px 0; }
.receivable-order + .receivable-order { border-top: 1px solid var(--line); }
.receivable-order-identity { display: grid; gap: 4px; overflow-wrap: anywhere; }
.receivable-order dl { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 0; }
.receivable-order dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.receivable-order-due { font-size: 12px; overflow-wrap: anywhere; }
.receivable-order-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.receivables-pagination,.payments-history-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-block: 12px; }
.receivables-pagination > div { display: flex; gap: 6px; }
.receivables-pagination > span { font-size: 12px; color: var(--ink-soft); }
button.dashboard-metric { color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
@media(max-width:1100px) {
  .receivable-client-head,.receivable-client-row { grid-template-columns: minmax(160px,1fr) repeat(3,minmax(95px,.5fr)) 70px; gap: 6px; }
}
@media(max-width:1000px) {
  #payments-view .panel > .panel-header { align-items: center; }
  .payments-tabs button { flex: 1; padding-inline: 7px; }
  .receivables-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .receivables-summary > div { padding: 10px 6px; }
  .receivables-summary strong { font-size: 16px; }
  .receivable-client-head { display: none; }
  .receivable-client-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 12px 4px; }
  .receivable-client-toggle { grid-column: 1 / -1; }
  .receivable-client-row > :not(:first-child) { text-align: left; }
  .receivables-mobile-label { display: block; color: var(--ink-soft); font-size: 11px; margin-bottom: 3px; }
  .receivable-orders { padding-inline: 6px; }
  .receivable-order { display: flex; flex-direction: column; align-items: stretch; }
  .receivable-order dd { font-size: 13px; overflow-wrap: anywhere; }
  .receivable-order-actions { justify-content: flex-start; }
  .receivable-order-actions button { min-height: 40px; }
  .receivables-pagination { flex-wrap: wrap; }
}

/* One compact tab/action header replaces the repeated page title and tab row. */
#payments-view .panel > .payments-header { align-items:center; padding-block:2px 8px; margin-bottom:8px; gap:12px; border-bottom:1px solid var(--line); }
.payments-header .payments-tabs { margin-bottom:0; border-bottom:0; min-width:0; }
.payments-header .payments-tabs button { padding:8px 12px; }
#payments-view .receivables-summary { margin-block:0 10px; }
#payments-view .receivables-summary > div { padding:8px 12px; }
@media(max-width:760px) {
  #payments-view .panel > .payments-header { flex-direction:row; flex-wrap:wrap; gap:6px; }
  .payments-header .payments-tabs { flex:1 1 100%; }
  .payments-header .payment-register-actions { margin-left:auto; }
  #payments-view .receivables-summary > div { padding:8px 6px; }
}
