.workspace-body:has(> .sales-workspace) { background: #fff; }
.sales-workspace {
  --text: #161b1f;
  --text-strong: #101417;
  --muted: #58616a;
  --primary: #087d67;
  --primary-dark: #006651;
  --primary-soft: #e2f3ed;
  --primary-tint: #edf8f4;
  --line: #cfd6da;
  --line-strong: #adb8c0;
  --panel-muted: #f0f1f2;
  display: grid; gap: 24px; min-width: 0; color: var(--text); font-size: 16px;
}
.sales-workspace button { color: var(--text); border-color: var(--line-strong); box-shadow: none; }
.sales-workspace button:hover:not(:disabled) { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-tint); }
.sales-workspace button.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.sales-workspace button.primary:hover:not(:disabled) { color: #fff; background: var(--primary-dark); border-color: var(--primary-dark); }
.sales-workspace :is(button, input, select):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.sales-workspace input::placeholder { color: var(--muted); opacity: 1; }
.sales-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sales-toolbar > input[type=search] { flex: 1; min-width: 220px; max-width: 460px; }
.sales-toolbar > [data-sales-history] { margin-left: auto; }
.sales-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sales-section-head h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; color: var(--text-strong); font-size: 22px; font-weight: 750; }
.sales-section-head h2::before { content: ''; width: 5px; height: 22px; border-radius: 3px; background: var(--primary); flex-shrink: 0; }
.sales-section-head h2 small { padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 650; }
.sales-notice { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-alt); color: var(--muted); }
.sales-category { margin-top: 14px; }
.sales-category:first-child { margin-top: 0; }
.sales-category-toggle, .sales-model-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; gap: 12px; }
.sales-category-toggle { background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; padding: 8px 0; font-weight: 700; }
.sales-category-toggle small, .sales-model-toggle small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.sales-models { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.sales-model + .sales-model { border-top: 1px solid var(--line); }
.sales-model-toggle { border: 0; border-radius: 0; background: var(--panel); padding: 9px 14px; font-weight: 700; }
.sales-model-toggle[aria-expanded=true] { background: var(--primary-soft); }
.sales-workspace .table-wrap { border: 1px solid var(--line); border-radius: 8px; scroll-padding-bottom: 0; box-shadow: 0 1px 2px rgba(16, 24, 32, .06); }
/* The rental spreadsheet reserves a bottom scrollbar area; these compact tables do not. */
.sales-workspace .table-wrap::after { content: none; display: none; }
.sales-workspace .sales-model .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.sales-workspace table { width: 100%; border-collapse: collapse; min-width: 720px; }
.sales-workspace th, .sales-workspace td { padding: 9px 14px; font-size: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
.sales-workspace th { height: 40px; background: var(--panel-muted); color: var(--text-strong); font-weight: 700; white-space: nowrap; }
.sales-workspace td { height: 48px; vertical-align: middle; }
.sales-workspace tbody tr:last-child td { border-bottom: 0; }
.sales-device-table td:first-child { font-weight: 600; white-space: nowrap; }
.sales-workspace .row-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sales-workspace .row-actions button { padding: 5px 12px; min-height: 32px; background: #fff; color: var(--text); border-color: var(--line-strong); font-size: 15px; white-space: nowrap; }
/* Keep primary actions stronger than the shared .row-actions button rule. */
.sales-workspace .row-actions button.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.sales-workspace button:is([data-sales-register], [data-sales-confirm], [data-sales-new], [data-sales-history], [data-sales-new-create]) { color: var(--primary-dark); border-color: var(--primary); background: #fff; font-weight: 700; }
.sales-workspace button:disabled { color: #69757f; background: #f0f2f3; border-color: #cbd3d9; cursor: not-allowed; opacity: 1; }
.sales-workspace .row-actions button:disabled { color: #69757f; background: #f0f2f3; border-color: #cbd3d9; }
.sales-workspace tbody tr:hover td { background: #f4faf7; }
.sales-workspace .sales-selected-row td, .sales-workspace .sales-selected-row:hover td { background: var(--primary-soft); }
.sales-workspace td.sales-price { color: var(--primary-dark); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-condition { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #d9f0df; color: #1b642f; font-size: 14px; font-weight: 700; white-space: nowrap; }
.sales-pending { display: table; color: #ad351d; background: #fff0e9; border: 1px solid #f3c4b6; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 650; margin-top: 4px; }
.sales-pending::before { content: '!'; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 5px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; line-height: 1; }
.sales-new-table td > small, .sales-history td > small { display: block; margin-top: 3px; }
.sales-configuration { padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.sales-config-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 28%); gap: 24px; }
.sales-config-line { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 12px; margin: 10px 0; }
.sales-config-line > span { color: var(--text-strong); font-weight: 650; }
.sales-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sales-options button { min-height: 38px; }
.sales-config-line .sales-options button { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; background: #fff; font-weight: 600; }
.sales-config-line .sales-options button::before { content: ''; width: 17px; height: 17px; border: 1.5px solid #98a4ae; border-radius: 50%; flex-shrink: 0; background: #fff; }
.sales-config-line .sales-options button[aria-pressed=true] { background: var(--primary-soft); border-color: var(--primary); color: var(--text-strong); box-shadow: inset 0 0 0 1px var(--primary); }
.sales-config-line .sales-options button[aria-pressed=true]::before { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px #fff; }
.sales-option-price { color: var(--primary-dark); font-weight: 750; }
.sales-toolbar .sales-options button { font-weight: 650; }
.sales-toolbar .sales-options button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: #fff; }
.sales-addon-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.sales-addon-options label, .sales-checkbox { display: flex; align-items: center; gap: 9px; }
.sales-addon-options input[type=checkbox], .sales-checkbox input[type=checkbox] { width: auto; min-height: auto; margin: 0; flex-shrink: 0; accent-color: var(--primary); }
.sales-addon-options label { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; }
.sales-addon-options label:has(input:checked) { color: var(--primary-dark); border-color: var(--primary); background: var(--primary-soft); font-weight: 650; }
.sales-addon-options input[type=checkbox] { width: 18px; height: 18px; }
.sales-delivery { background: var(--panel-muted); border-radius: 7px; padding: 10px 14px; line-height: 1.8; font-weight: 500; }
.sales-config-total { border-left: 1px solid var(--line); padding-left: 24px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.sales-config-total > span { color: var(--text-strong); font-weight: 600; }
.sales-config-total strong { font-size: clamp(34px, 3.1vw, 44px); line-height: 1.15; letter-spacing: -.5px; color: var(--primary-dark); font-weight: 750; font-variant-numeric: tabular-nums; }
.sales-config-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sales-config-actions button { flex: 1; padding: 9px 12px; }
.sales-configuration p.muted, .sales-new-section > p.muted { font-size: 13px; margin: 8px 0 0; }
.sales-extra-lenses { margin: 12px 0; }
.sales-extra-lenses summary { color: var(--muted); }
.sales-inline-form { display: flex; gap: 8px; margin-top: 10px; }
.sales-inline-form select { min-width: 0; flex: 1; }
.sales-attached-lens { padding: 6px 0; }
.sales-attached-lens button { margin-left: 10px; }
.sales-device-fields { min-width: 0; padding: 12px 16px 16px; border: 1px solid var(--line); border-radius: 8px; }
.sales-device-fields legend { color: var(--text-strong); font-weight: 600; padding: 0 6px; }
.sales-device-fields > p { margin: 0 0 12px; font-size: 13px; }
.sales-checkbox { margin: 16px 0; line-height: 1.7; }
.sales-sale-preview { padding: 12px 14px; margin-bottom: 16px; background: var(--panel-muted); border-radius: 7px; }
.sales-sale-preview p { margin: 4px 0; }
.sales-sale-preview > strong { display: block; margin-top: 10px; color: var(--primary-dark); }
.modal.sales-history-modal { width: min(1200px, calc(100vw - 40px)); max-width: 1200px; }
.sales-history .table-wrap { max-height: 55vh; overflow: auto; margin: 0 16px 16px; width: calc(100% - 32px); }
.sales-history #saleHistoryFilter { display: flex; flex-wrap: wrap; align-items: flex-end; width: calc(100% - 32px); margin: 16px; padding: 0; border: 0; box-shadow: none; }
.sales-history #saleHistoryFilter .form-field { max-width: 220px; }
.sales-history th, .sales-history td { padding: 10px 12px; }
.sales-history-summary { display: flex; flex-wrap: wrap; gap: 14px 24px; margin: 12px 16px; font-variant-numeric: tabular-nums; }
.sales-history-summary span { font-weight: 600; }
.sales-history > p { font-size: 13px; margin: 12px 16px; }
.sales-record-detail { padding: 16px; }
.sales-record-detail section { padding: 10px 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sales-record-detail p { margin: 6px 0; }
.sales-pending-records { margin-top: 16px; }
.sales-pending-records button { margin-left: 10px; }
#deviceSaleForm > .sales-sale-preview, #deviceSaleForm > .sales-checkbox { margin: 16px; }
#saleProfileForm > p, #saleCostForm > p, #saleVoidForm > p, #saleVoidForm > .form-field { margin: 16px; }
@media (max-width: 1100px) {
  .sales-config-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .sales-config-total { border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .sales-config-total strong { margin-right: auto; }
  .sales-config-actions { margin-top: 0; }
}
@media (max-width: 600px) {
  .sales-toolbar > input[type=search] { flex-basis: 100%; max-width: none; }
  .sales-section-head h2 { font-size: 18px; }
  .sales-config-line { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .sales-addon-options { grid-template-columns: minmax(0, 1fr); }
  .sales-configuration { padding: 14px; }
  .sales-device-fields { padding: 10px; }
  .sales-workspace th, .sales-workspace td { padding: 9px 10px; }
}
