:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #d9e0e6;
  --text: #16202a;
  --muted: #64717f;
  --teal: #087f7b;
  --teal-dark: #066864;
  --green: #217a45;
  --nav: #18242e;
  --nav-2: #22313d;
  --shadow: 0 12px 26px rgba(21, 32, 42, 0.08);
  --safe-catalog-width: clamp(260px, var(--catalog-width, 350px), min(680px, calc(100vw - 760px)));
  --safe-inventory-width: clamp(260px, var(--inventory-width, 340px), min(680px, calc(100vw - 780px)));
  --safe-quote-product-width: clamp(250px, var(--quote-product-width, 330px), min(680px, calc(100vw - 780px)));
  --safe-finance-date-width: clamp(240px, var(--finance-date-width, 300px), min(680px, calc(100vw - 800px)));
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body.login-required {
  min-height: 100vh;
  overflow: hidden;
}

body.login-required .app-shell {
  display: none;
}

.hidden {
  display: none !important;
}

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

.app-shell {
  min-height: 100vh;
  min-width: 0;
}

.login-screen {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(24, 36, 46, 0.95), rgba(6, 104, 100, 0.88)),
    #18242e;
  color: #eef5f6;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: 22px;
  align-items: stretch;
}

.login-hero,
.login-form-panel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
}

.login-hero {
  min-height: 430px;
  background: rgba(255, 255, 255, 0.08);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-row .brand-mark {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}

.login-hero h1 {
  margin: 26px 0 8px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-hero p,
.login-stat small,
.login-form-panel p,
.login-form-panel label {
  color: #c7d6dc;
}

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

.login-stat {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.login-stat strong,
.login-stat small {
  display: block;
}

.login-stat strong {
  font-size: 22px;
}

.login-form-panel {
  background: #fff;
  color: var(--text);
  padding: 28px;
}

.login-form-panel h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-form-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-form-panel label {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 12px;
}

.login-form-panel select,
.login-form-panel input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.login-form-panel .pos-pin-input {
  -webkit-text-security: disc;
}

.login-form-panel .primary-action {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.login-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 11px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  background: var(--nav);
  color: #eef5f6;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(16, 24, 32, 0.18);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f3b23e;
  color: #121820;
  font-weight: 800;
  flex: 0 0 42px;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0;
}

.brand-meta,
.sync-panel span,
.eyebrow,
.muted-label,
.panel p {
  color: var(--muted);
  font-size: 12px;
}

.app-header .brand-meta,
.app-header .sync-panel span {
  color: #aebcc6;
}

.nav-list {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  scrollbar-width: none;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  background: transparent;
  color: #d7e1e7;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  font-size: 14px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--nav-2);
  color: #ffffff;
}

.nav-item.active {
  background: #f3b23e;
  color: #121820;
  box-shadow: 0 0 0 1px rgba(243, 178, 62, 0.28), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.nav-item.active .nav-icon {
  background: rgba(18, 24, 32, 0.16);
  color: #121820;
}

.header-account-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.header-account-badge {
  min-width: 142px;
  max-width: 190px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 7px 10px;
  color: #eef5f6;
  cursor: pointer;
  text-align: left;
}

.header-account-badge strong,
.header-account-badge span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account-badge span {
  color: #aebcc6;
  font-size: 12px;
}

.header-account-badge:hover {
  border-color: rgba(243, 178, 62, 0.6);
  background: rgba(243, 178, 62, 0.12);
}

.header-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  z-index: 35;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  padding: 10px;
}

.header-account-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: #fff;
  transform: rotate(45deg);
}

.header-account-menu-head {
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 10px;
  margin-bottom: 8px;
}

.header-account-menu-head strong,
.header-account-menu-head span,
.header-account-menu-row span,
.header-account-menu-row strong {
  display: block;
}

.header-account-menu-head span,
.header-account-menu-row span {
  color: var(--muted);
  font-size: 12px;
}

.header-account-menu-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 9px;
  margin-bottom: 10px;
}

.header-menu-logout {
  width: 100%;
  min-height: 38px;
  border: 1px solid #f3b23e;
  border-radius: 8px;
  background: #f3b23e;
  color: #121820;
  font-weight: 800;
  cursor: pointer;
}

.header-menu-logout:hover {
  background: #e6a52f;
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 13px;
}

.sync-panel {
  box-sizing: border-box;
  width: 132px;
  flex: 0 0 132px;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 9px;
  display: flex;
  gap: 7px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  color: #d7e1e7;
  font-size: 12px;
  white-space: nowrap;
  min-width: 116px;
  cursor: pointer;
  position: relative;
}

.sync-panel > div:not(.sync-dot) {
  min-width: 0;
  width: 100%;
}

.sync-panel strong,
.sync-panel span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-panel:hover,
.sync-panel:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.device-status-panel {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  position: relative;
}

.device-status-chip {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #d7e1e7;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
  appearance: none;
}

.device-status-chip:hover,
.device-status-chip:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.device-test-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 240px;
  border: 1px solid #cfdbe3;
  border-radius: 8px;
  background: #fff;
  color: #101820;
  box-shadow: 0 16px 34px rgba(16, 24, 32, 0.18);
  padding: 12px;
}

.device-test-popover.hidden {
  display: none;
}

.device-test-popover h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.device-test-popover p {
  color: #52677a;
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 10px;
}

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

.device-test-actions button,
.device-test-link {
  min-height: 32px;
  border-radius: 7px;
  padding: 0 10px;
  font-size: 12px;
}

.device-test-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.device-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a98a5;
  box-shadow: 0 0 0 3px rgba(138, 152, 165, 0.13);
  flex: 0 0 8px;
}

.device-status-chip.online .device-status-dot {
  background: #65d18f;
  box-shadow: 0 0 0 3px rgba(101, 209, 143, 0.13);
}

.device-status-chip.warning .device-status-dot {
  background: #f3b23e;
  box-shadow: 0 0 0 3px rgba(243, 178, 62, 0.16);
}

.device-status-chip.offline .device-status-dot,
.device-status-chip.unknown .device-status-dot {
  background: #8a98a5;
  box-shadow: 0 0 0 3px rgba(138, 152, 165, 0.13);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a98a5;
  box-shadow: 0 0 0 3px rgba(138, 152, 165, 0.13);
  flex: 0 0 8px;
}

.sync-panel.synced .sync-dot {
  background: #65d18f;
  box-shadow: 0 0 0 3px rgba(101, 209, 143, 0.13);
}

.sync-panel.pending .sync-dot,
.sync-panel.syncing .sync-dot {
  background: #f3b23e;
  box-shadow: 0 0 0 3px rgba(243, 178, 62, 0.16);
}

.sync-panel.failed .sync-dot {
  background: #e05d5d;
  box-shadow: 0 0 0 3px rgba(224, 93, 93, 0.16);
}

.sync-panel.offline .sync-dot,
.sync-panel.unknown .sync-dot {
  background: #8a98a5;
  box-shadow: 0 0 0 3px rgba(138, 152, 165, 0.13);
}

.sync-panel span {
  max-width: 100%;
}

.sync-popover {
  position: absolute;
  top: 58px;
  right: 330px;
  z-index: 70;
  width: 320px;
  max-width: calc(100vw - 24px);
  border: 1px solid #cfdbe3;
  border-radius: 8px;
  background: #fff;
  color: #101820;
  box-shadow: 0 16px 34px rgba(16, 24, 32, 0.18);
  padding: 12px;
}

.sync-popover.hidden {
  display: none;
}

.sync-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sync-popover-header h3,
.sync-conflict-list h4 {
  font-size: 14px;
}

.sync-detail-list {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.sync-detail-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.sync-detail-line span,
.sync-conflict-item span,
.sync-conflict-item small,
.sync-popover-note {
  color: #52677a;
}

.sync-conflict-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.sync-conflict-item {
  display: grid;
  gap: 2px;
  border: 1px solid #f1c7c7;
  border-radius: 8px;
  background: #fff7f7;
  padding: 8px;
  font-size: 12px;
}

.sync-popover > button {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
}

.workspace {
  min-width: 0;
  padding: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
}

.sale-header-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, max-content));
  align-items: center;
  gap: 8px;
  justify-content: start;
  grid-column: 1;
  grid-row: 2;
}

.scan-box {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.sale-header-actions .scan-box {
  min-width: 0;
}

.sale-scan-corner {
  justify-self: end;
  align-self: start;
  width: clamp(260px, 32vw, 380px);
  max-width: 100%;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.scan-input-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.scan-input-combo input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.scan-add-button {
  min-width: 54px;
  height: 38px;
  min-height: 38px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-inline: 12px;
}

.sale-header-actions > button {
  min-width: 0;
  white-space: nowrap;
}

.scanner-status {
  min-height: 14px;
  color: #7a8794;
  font-size: 11px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-status.ok {
  color: var(--teal);
  font-weight: 700;
}

.scanner-status.error {
  color: #b42318;
  font-weight: 700;
}

.scanner-status.listening {
  color: #217a45;
  font-weight: 700;
}

.scanner-status.scanned {
  color: var(--teal);
  font-weight: 800;
}

#new-sale-order {
  min-width: 136px;
}

input,
select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  min-width: 0;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  min-width: 0;
  resize: vertical;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.view {
  display: none;
  min-width: 0;
}

.active-view {
  display: block;
}

.pos-grid {
  display: grid;
  grid-template-columns: var(--safe-catalog-width) 10px minmax(0, 1fr) minmax(280px, 320px);
  gap: 14px;
  align-items: start;
  min-height: calc(100vh - 120px);
  min-width: 0;
}

.pos-main-stack {
  grid-column: 3 / 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

.module-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
  min-width: 0;
}

.inventory-grid {
  display: grid;
  grid-template-columns: var(--safe-inventory-width) 10px minmax(0, 1fr) minmax(280px, 320px);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.panel-header {
  min-height: 44px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-header > div {
  min-width: 0;
}

.panel-header.compact {
  align-items: center;
}

.product-panel {
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.product-panel > .panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px 14px;
}

.button-row,
.control-row,
.filter-row,
.catalog-toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.control-row label,
.side-panel label,
.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.control-row label {
  min-width: 130px;
  flex: 1;
}

.product-panel .control-row {
  margin-bottom: 0;
}

.product-panel > .panel-header,
.product-panel > .control-row {
  flex: 0 0 auto;
}

.primary-action,
.secondary-action,
.checkout-button,
.payment-button,
.add-line-button,
.copy-info-button {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

.primary-action,
.checkout-button,
.add-line-button {
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.primary-action:hover,
.checkout-button:hover,
.add-line-button:hover {
  background: var(--teal-dark);
}

.secondary-action {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}

.full-width {
  width: 100%;
}

.catalog-panel {
  min-height: 0;
  height: calc(100dvh - 116px);
  max-height: calc(100dvh - 116px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.inventory-tree-panel {
  box-sizing: border-box;
  min-height: 0;
  height: calc(100dvh - 116px);
  max-height: calc(100dvh - 116px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inventory-table-panel {
  box-sizing: border-box;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 116px);
  max-height: calc(100dvh - 116px);
  overflow: hidden;
}

.inventory-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.inventory-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}

.inventory-table {
  min-width: max-content;
  table-layout: auto;
  width: max-content;
}

.inventory-table th,
.inventory-table td {
  box-sizing: border-box;
  min-width: 128px;
  white-space: normal;
  text-align: center;
  vertical-align: middle;
}

.inventory-table tr.selected-inventory-row td {
  background: #eef8f6;
}

.inventory-table tr.inventory-low-stock-row td {
  background: #fff0f6;
}

.inventory-table tr.inventory-zero-stock-row td {
  background: #ffb8b8;
}

.inventory-table tr.selected-inventory-row.inventory-low-stock-row td {
  background: #ffe6f1;
}

.inventory-table tr.selected-inventory-row.inventory-zero-stock-row td {
  background: #ffaaaa;
}

.inventory-table th,
.sale-table th {
  position: relative;
  padding-right: 14px;
}

.inventory-table [data-column-id="sku"],
.inventory-table [data-column-id="category"],
.inventory-table [data-column-id="color"],
.inventory-table [data-column-id="sizeCapacity"],
.inventory-table [data-column-id="packsPerBox"],
.inventory-table [data-column-id="piecesPerPack"] {
  min-width: 132px;
}

.inventory-table [data-column-id="imageUrl"] {
  min-width: 120px;
}

.inventory-table td[data-column-id="imageUrl"] {
  height: 83px;
  padding: 4px;
}

.inventory-table [data-column-id="name"] {
  min-width: 240px;
}

.inventory-image-thumb {
  display: block;
  width: 100%;
  height: 75px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef3f6;
  image-rendering: auto;
}

.inventory-image-empty {
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.inventory-image-editor {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.inventory-image-editor .inventory-image-thumb {
  height: 90px;
}

.inventory-image-file {
  width: 100%;
  min-width: 0;
  font-size: 11px;
}

.inventory-image-status {
  display: block;
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 31, 44, 0.58);
}

.image-editor-dialog {
  width: min(840px, 96vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(13, 31, 44, 0.35);
  padding: 16px;
}

.image-editor-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.image-editor-header h2 {
  margin: 0;
  font-size: 18px;
}

.image-editor-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.image-editor-stage {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f6;
  padding: 10px;
}

#image-editor-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  border-radius: 6px;
  background: #ffffff;
  cursor: grab;
  touch-action: none;
}

#image-editor-canvas:active {
  cursor: grabbing;
}

.image-editor-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.image-editor-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.image-editor-controls input {
  width: 100%;
}

.inventory-table [data-column-id="abbreviatedName"],
.inventory-table [data-column-id="retailQuantity"],
.inventory-table [data-column-id="wholesaleQuantity"],
.inventory-table [data-column-id="wholesalePrice"],
.inventory-table [data-column-id="stock"],
.inventory-table [data-column-id="stockInHistory"],
.inventory-table [data-column-id="lowStockThreshold"],
.inventory-table [data-column-id="wholesaleRule"],
.inventory-table [data-column-id="cost"] {
  min-width: 170px;
}

.stock-history-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.stock-history-line {
  display: grid;
  gap: 2px;
  line-height: 1.25;
}

.stock-history-line strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.stock-history-line span {
  color: var(--muted);
  font-size: 11px;
}

.column-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 8px;
  margin: -4px 0 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
}

.column-control-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 7px;
  cursor: grab;
}

.column-control-row.dragging {
  opacity: 0.55;
  border-color: var(--teal);
}

.column-drag-handle {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.column-control-row label {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}

.column-pin-option {
  padding-left: 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
}

.column-pin-option:has(input:checked) {
  color: var(--teal-dark);
}

.inventory-table tbody tr {
  --inventory-sticky-background: #ffffff;
}

.inventory-table tbody tr.inventory-row-ready {
  --inventory-sticky-background: #f1fbf6;
}

.inventory-table tbody tr.selected-inventory-row {
  --inventory-sticky-background: #eef8f6;
}

.inventory-table tbody tr.inventory-low-stock-row {
  --inventory-sticky-background: #fff0f6;
}

.inventory-table tbody tr.selected-inventory-row.inventory-low-stock-row {
  --inventory-sticky-background: #ffe6f1;
}

.inventory-table tbody tr.inventory-zero-stock-row,
.inventory-table tbody tr.selected-inventory-row.inventory-zero-stock-row,
.inventory-table tbody tr.inventory-row-ready.inventory-zero-stock-row {
  --inventory-sticky-background: #ffb8b8;
}

.inventory-table .inventory-pinned-column,
.inventory-table .inventory-edit-action-sticky {
  position: sticky;
}

.inventory-table thead .inventory-pinned-column,
.inventory-table thead .inventory-edit-action-sticky {
  z-index: 6;
  background: var(--surface-2);
}

.inventory-table tbody .inventory-pinned-column,
.inventory-table tbody .inventory-edit-action-sticky {
  z-index: 2;
  background: var(--inventory-sticky-background);
}

.inventory-table .inventory-edit-action-sticky {
  left: 0;
}

.inventory-table .inventory-last-pinned-column {
  box-shadow: 5px 0 7px -6px rgba(13, 31, 44, 0.75);
}

.column-control-row label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-panel-hint {
  color: var(--muted);
  font-size: 12px;
  margin: -4px 0 10px;
}

.column-sort-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 2px 4px;
}

.quote-header-sort {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.quote-header-sort .sort-state {
  margin-left: 10px;
}

.quote-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.quote-list-tools input {
  min-width: 0;
}

.quote-filter-row th {
  background: #fff;
  padding: 6px;
}

.quote-filter-row input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.column-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.sort-state {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid #a1adb7;
}

.sort-state.active.asc {
  border-bottom-color: var(--teal);
}

.sort-state.active.desc {
  border-bottom: 0;
  border-top: 7px solid var(--teal);
}

.column-filter-row th {
  background: #ffffff;
  padding: 4px 5px;
}

.column-filter-input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 4px;
  font-size: 11px;
}

.inventory-tree-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.inventory-edit-action {
  display: none;
}

body.inventory-editing .inventory-tree-actions {
  grid-template-columns: 1fr 1fr;
}

body.inventory-editing .inventory-edit-action {
  display: block;
}

body.inventory-editing #toggle-inventory-edit,
body.inventory-editing .inventory-tree-actions #collapse-inventory {
  grid-column: 1 / -1;
}

.danger-action {
  color: #b42318;
}

.catalog-count {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: #e3f4ed;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  padding: 0 9px;
  margin-bottom: 12px;
}

.panel-resizer {
  align-self: stretch;
  min-height: 650px;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
  position: relative;
}

.panel-resizer::before {
  content: "";
  position: absolute;
  inset: 0 4px;
  border-radius: 999px;
  background: #c7d1da;
}

.panel-resizer:hover::before,
.panel-resizer:focus-visible::before,
body.resizing-catalog .panel-resizer::before,
body.resizing-inventory .panel-resizer::before,
body.resizing-quote-product .panel-resizer::before,
body.resizing-finance-date .panel-resizer::before {
  background: var(--teal);
}

body.resizing-catalog,
body.resizing-inventory,
body.resizing-quote-product,
body.resizing-finance-date {
  cursor: col-resize;
  user-select: none;
}

.catalog-layout {
  display: flex;
  flex: 1 1 58%;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.catalog-toolbar {
  margin-bottom: 4px;
}

.catalog-toolbar input {
  flex: 1;
  min-width: 180px;
}

#catalog-search {
  flex-basis: 100%;
}

.catalog-sort-toggle {
  min-width: 54px;
}

.catalog-sort-toggle.active-sort-toggle {
  border-color: var(--teal);
  background: #eef8f7;
  color: var(--teal);
  font-weight: 800;
}

.product-tree {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

#catalog-body {
  max-height: none;
}

.window-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.window-collapse-toggle {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--teal);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.window-collapse-toggle:hover {
  border-color: var(--teal);
  background: #eef8f7;
}

.recent-sales-panel {
  margin-top: 0;
  min-height: 0;
  display: flex;
  flex: 1 1 42%;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.catalog-layout.window-collapsed,
.recent-sales-panel.window-collapsed {
  flex: 0 0 auto;
  min-height: 0;
}

.catalog-layout.window-collapsed .catalog-toolbar,
.catalog-layout.window-collapsed #catalog-body,
.recent-sales-panel.window-collapsed .recent-sales-header,
.recent-sales-panel.window-collapsed #recent-sales-count,
.recent-sales-panel.window-collapsed #recent-sales-tree {
  display: none;
}

.recent-sales-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.recent-sales-header h3 {
  margin: 0;
  font-size: 15px;
}

.recent-sales-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.recent-sales-header .secondary-action {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.recent-sales-tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 8px;
}

.recent-sales-day {
  display: grid;
}

.recent-sales-day-button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-weight: 700;
}

.recent-sales-day-button:hover,
.recent-sales-day.open > .recent-sales-day-button {
  background: #eaf2f2;
  color: var(--teal);
}

.recent-sales-list {
  display: grid;
  gap: 5px;
  margin: 4px 0 8px 28px;
  padding-left: 10px;
  border-left: 1px solid #cdd7df;
}

.recent-sales-order {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.recent-sales-order.selected {
  border-color: #8abfbc;
  background: #f0f8f7;
}

.recent-sales-order-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}

.recent-sales-order-main strong,
.recent-sales-order-main span,
.recent-sales-order-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-sales-order-main strong {
  font-size: 11px;
}

.recent-sales-order-main span,
.recent-sales-order-main small {
  color: var(--muted);
  font-size: 10px;
}

.recent-sales-order-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.recent-sales-order-footer em {
  color: var(--teal);
  font-style: normal;
  font-weight: 800;
  font-size: 11px;
}

.recent-sales-reprint,
.recent-sales-quote {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 22px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.recent-sales-reprint:hover,
.recent-sales-quote:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.inventory-tree {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
}

.inventory-tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}

body.inventory-editing .inventory-tree-row {
  grid-template-columns: minmax(0, 1fr) 28px;
}

body.product-info-editing .inventory-tree-row {
  grid-template-columns: minmax(0, 1fr) 28px;
}

body.inventory-editing.product-info-editing .inventory-tree-row {
  grid-template-columns: minmax(0, 1fr) 28px 28px;
}

.tree-category.selected {
  background: #dfeeee;
  color: var(--teal);
}

.inventory-product-link.selected {
  background: #eaf2f2;
  color: var(--teal);
  border-radius: 5px;
}

.tree-add-product,
.tree-delete-level {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.tree-add-product {
  color: var(--teal);
}

.tree-add-product:hover {
  background: #e3f4ed;
  border-color: #b9e3d8;
}

.tree-delete-level {
  color: #b42318;
}

.tree-delete-level:hover {
  background: #fff0ed;
  border-color: #ffd3cc;
}

.inventory-tree-product {
  padding: 3px 4px;
}

.inventory-product-link {
  width: 100%;
}

.tree-group {
  display: grid;
}

body.inventory-editing .tree-group[data-category] {
  cursor: grab;
}

#catalog-body .tree-group[data-category] {
  cursor: grab;
}

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

.catalog-category-row .tree-category {
  min-width: 0;
}

.catalog-order-controls {
  display: none;
  gap: 2px;
}

#catalog-body.catalog-sort-enabled .catalog-order-controls {
  display: flex;
}

.catalog-move-button {
  width: 22px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.catalog-move-button:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal);
  background: #eef8f7;
}

.catalog-move-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tree-group.dragging {
  opacity: 0.55;
}

.tree-group.drag-over > .inventory-tree-row .tree-category {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

#catalog-body .tree-group.drag-over > .catalog-category-row .tree-category {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.tree-category {
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-weight: 700;
}

.tree-category.editable {
  cursor: grab;
}

.tree-category:hover,
.tree-group.open > .tree-category {
  background: #eaf2f2;
  color: var(--teal);
}

.tree-caret {
  color: #51616f;
  font-size: 12px;
  text-align: center;
}

.folder-icon {
  width: 15px;
  height: 11px;
  border-radius: 2px;
  background: #d99b31;
  box-shadow: 0 -4px 0 -1px #f1bf61;
}

.tree-category-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-level-name-input {
  width: 100%;
  height: 28px;
  min-width: 0;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
  font-weight: 800;
}

.inventory-level-name-input:focus {
  border-color: var(--teal);
  background: #ffffff;
  outline: none;
}

.tree-count {
  min-width: 22px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dfe7ed;
  color: #324250;
  font-size: 11px;
}

.tree-children {
  display: grid;
  gap: 4px;
  margin: 4px 0 8px 28px;
  padding-left: 10px;
  border-left: 1px solid #cdd7df;
}

.tree-product {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 5px 6px;
  display: grid;
  gap: 4px;
}

.tree-product.open {
  background: #ffffff;
  border-color: #b8cbd4;
}

.tree-product-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.tree-product-toggle {
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  min-height: 28px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.tree-product-toggle span:last-child {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 12px;
  line-height: 1.3;
}

.tree-product-stock {
  flex: 0 0 86px;
  max-width: 86px;
  border: 1px solid #cdd7df;
  border-radius: 999px;
  padding: 3px 6px;
  background: #f4f8fa;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-product strong {
  font-size: 12px;
  margin-right: 4px;
}

.tree-product-meta {
  display: grid;
  gap: 3px;
  padding: 6px 0 4px 20px;
  color: var(--muted);
  font-size: 11px;
  user-select: text;
}

.tree-product .add-line-button {
  min-height: 28px;
  padding: 0 10px;
}

.copy-info-button {
  justify-self: start;
  min-height: 28px;
  margin-top: 4px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.copy-info-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.empty-tree {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}

.inventory-table th,
.inventory-table td {
  text-align: center;
  vertical-align: middle;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
}

.empty-table-cell {
  color: var(--muted);
  text-align: center;
  height: 96px;
}

.inventory-edit-action-cell {
  box-sizing: border-box;
  min-width: 118px;
  width: 118px;
  text-align: left;
  white-space: nowrap;
}

.inventory-edit-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 7px;
  font-size: 12px;
  background: #ffffff;
  text-align: center;
}

.row-confirm-button,
.row-delete-button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.row-confirm-button {
  background: #e3f4ed;
  color: var(--teal);
}

.row-delete-button {
  background: #fff0ed;
  color: #b42318;
  margin-left: 4px;
}

.inventory-row-ready td {
  background: #f1fbf6;
}

.inventory-table tr.inventory-low-stock-row td {
  background: #fff0f6;
}

.inventory-table tr.inventory-zero-stock-row td,
.inventory-table tr.selected-inventory-row.inventory-zero-stock-row td,
.inventory-table tr.inventory-row-ready.inventory-zero-stock-row td {
  background: #ffb8b8 !important;
}

.inventory-table tr.inventory-zero-stock-row td:first-child {
  border-left: 4px solid #d92d20;
}

.sale-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.sale-summary {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding-top: 10px;
}

.sale-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px 10px;
  display: grid;
  gap: 5px;
  min-height: 58px;
}

.sale-summary span {
  color: var(--muted);
  font-size: 12px;
}

.sale-summary strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.sale-grand-total strong {
  color: var(--teal);
  font-size: 20px;
}

.sale-text-panel {
  display: grid;
  gap: 6px;
  align-self: start;
  margin-top: 0;
  width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sale-text-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sale-text-header span {
  color: var(--muted);
  font-size: 12px;
}

.compact-action {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 13px;
}

.sale-text-panel textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  font: 14px/1.55 "Segoe UI", Arial, sans-serif;
  white-space: pre-wrap;
}

.sale-table {
  table-layout: auto;
  width: max-content;
  min-width: max-content;
}

.sale-table th,
.sale-table td {
  box-sizing: border-box;
  white-space: normal;
}

.sale-table tr.stock-overdraw-row td,
.quote-table tr.stock-overdraw-row td {
  background: #fff6c7;
}

.sale-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.sale-table th[data-column-id="qtyDetail"],
.sale-table td[data-column-id="qtyDetail"] {
  padding-left: 18px;
  white-space: normal;
}

.sale-table th[data-column-id="qty"],
.sale-table th[data-column-id="qtyDetail"] {
  color: #0e7490;
  font-size: 13px;
  font-weight: 900;
  background: #ecfeff;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}

.column-resize-handle:hover::after,
.column-resize-handle.active::after {
  background: var(--teal);
}

body.resizing-column {
  cursor: col-resize;
  user-select: none;
}

.qty-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 276px;
}

.sale-qty-control {
  grid-template-columns: 1fr;
  gap: 7px;
  max-width: 196px;
}

.sale-qty-row {
  grid-template-columns: 38px 30px minmax(76px, 92px) 30px;
  gap: 6px;
}

.sale-qty-row span {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.qty-group {
  display: grid;
  grid-template-columns: 32px 24px 46px 24px;
  gap: 4px;
  align-items: center;
}

.qty-group span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.qty-button,
.delete-line-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  min-height: 30px;
  cursor: pointer;
  font-weight: 800;
}

.sale-qty-row .qty-button {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

.qty-button:disabled,
.delete-line-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.qty-input {
  appearance: textfield;
  box-sizing: border-box;
  width: 100%;
  min-width: 76px;
  max-width: 92px;
  height: 30px;
  padding: 0 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.qty-input:disabled {
  color: var(--muted);
  background: #eef3f6;
  cursor: not-allowed;
}

.qty-equation {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.sale-qty-detail {
  display: grid;
  gap: 2px;
  color: #164e63;
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.sale-qty-detail strong {
  display: block;
  color: #0e7490;
  font-size: 15px;
  font-weight: 900;
}

.sale-qty-detail span {
  display: block;
  color: #0f766e;
  font-size: 14px;
  font-weight: 900;
}

.delete-line-button {
  color: #b73535;
  width: 64px;
}

.checkout-panel {
  min-height: 530px;
}

.status-pill {
  color: var(--green);
  background: #e8f5ee;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.totals {
  margin: 10px 0 16px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.totals dt {
  color: var(--muted);
}

.totals dd {
  margin: 0;
  font-weight: 800;
}

.totals div:nth-child(3) dd {
  color: var(--teal);
  font-size: 22px;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.payment-button {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.payment-button.active {
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 700;
}

.payment-button[data-payment="Terms"] {
  grid-column: 1 / -1;
}

.cash-change-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.cash-change-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.cash-change-panel input {
  width: 100%;
}

.cash-change-panel div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
}

.cash-change-panel strong {
  color: var(--teal);
  font-size: 18px;
}

.terms-panel {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.terms-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.terms-panel .sale-account-search-label {
  grid-column: 1 / -1;
}

.terms-panel .cod-temporary-name-label {
  grid-column: 1 / -1;
}

.terms-due-date {
  grid-column: 1 / -1;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.terms-panel .full-width {
  grid-column: 1 / -1;
}

.checkout-button {
  width: 100%;
  height: 46px;
}

.receipt-preview,
.conversion-box {
  margin-top: 14px;
  border: 1px dashed #b8c3cc;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.receipt-preview p,
.conversion-box span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.receipt-slip {
  margin-top: 10px;
  padding: 10px 8px;
  background: #fffdf4;
  color: #1f252b;
  border: 1px solid #e2dccb;
  border-radius: 4px;
  font-family: "Courier New", Consolas, monospace;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

.receipt-store {
  font-size: 15px;
  line-height: 1.15;
  margin-bottom: 3px;
}

.receipt-line {
  border-top: 1px solid #3b3b3b;
  margin: 8px 0 6px;
}

.receipt-ticket,
.receipt-row,
.receipt-total-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.receipt-ticket {
  font-size: 15px;
}

.receipt-ticket strong,
.receipt-row strong,
.receipt-total-row strong {
  text-align: right;
  font-weight: 400;
}

.receipt-items-head,
.receipt-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 58px;
  gap: 6px;
  text-align: left;
}

.receipt-items-head {
  margin-bottom: 4px;
}

.receipt-item {
  margin: 5px 0;
}

.receipt-item span:nth-child(2) {
  overflow-wrap: anywhere;
}

.receipt-item span:last-child {
  text-align: right;
}

.receipt-total-row {
  font-size: 17px;
  justify-content: flex-end;
}

.receipt-total-row span {
  min-width: 92px;
  text-align: right;
}

.receipt-total-row strong {
  min-width: 80px;
  font-size: 23px;
}

.receipt-gap {
  height: 12px;
}

.receipt-centered,
.receipt-thanks {
  text-align: center;
}

.receipt-thanks {
  margin: 18px 0;
  font-size: 15px;
}

.filter-row {
  margin-bottom: 12px;
}

.filter-row input {
  flex: 1;
  min-width: 240px;
}

.filter-row .secondary-action {
  flex: 0 0 auto;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

#inventory .side-panel {
  box-sizing: border-box;
  height: calc(100dvh - 116px);
  max-height: calc(100dvh - 116px);
  overflow: auto;
}

.stock-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.stock-panel-header p {
  margin-top: 5px;
  overflow-wrap: anywhere;
}

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

.stock-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  display: grid;
  gap: 4px;
  min-height: 82px;
}

.stock-metric span,
.stock-metric small,
.stock-product-card span,
.stock-category-row small {
  color: var(--muted);
  font-size: 12px;
}

.stock-metric strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.stock-product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #ffffff;
}

.stock-product-card strong {
  overflow-wrap: anywhere;
}

.stock-history-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.stock-history-section h3 {
  margin-top: 0;
}

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

.stock-history-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-left: 4px solid #8998a4;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
}

.stock-history-card.stock-history-in {
  border-left-color: var(--teal);
  background: #f0fbf8;
}

.stock-history-card.stock-history-set {
  border-left-color: #f0b43c;
  background: #fffbf0;
}

.stock-history-card div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.stock-history-card strong {
  color: var(--ink);
  font-size: 14px;
}

.stock-history-card span,
.stock-history-card small {
  color: var(--muted);
  font-size: 11px;
}

.stock-entry-form {
  display: grid;
  gap: 12px;
}

.stock-adjust-form {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.stock-entry-form h3 {
  margin-top: 2px;
}

.stock-inline-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stock-entry-preview {
  margin-top: 0;
}

.stock-notice {
  border: 1px dashed #b8c3cc;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  padding: 10px;
}

.stock-category-list {
  display: grid;
  gap: 8px;
}

.stock-category-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  background: #ffffff;
}

.stock-category-row span {
  font-weight: 800;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.plain-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

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

.metric-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 6px;
  min-height: 86px;
  box-shadow: var(--shadow);
}

.metric-panel span {
  color: var(--muted);
  font-size: 12px;
}

.metric-panel strong {
  font-size: 21px;
}

.metric-panel small {
  color: var(--muted);
  font-size: 12px;
}

.finance-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1.35fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.finance-chart-card {
  min-height: 108px;
}

.finance-mini-chart {
  min-height: 66px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
}

.finance-chart-card:nth-child(3) .finance-mini-chart {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.finance-bar-wrap {
  display: grid;
  gap: 4px;
  align-items: end;
  min-width: 0;
}

.finance-bar-wrap span {
  width: 100%;
  min-height: 8px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #0f9c91, #087f7b);
}

.finance-bar-wrap small {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-layout {
  display: grid;
  grid-template-columns: var(--safe-finance-date-width) 10px minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.finance-date-panel,
.finance-receipt-panel {
  max-height: calc(100vh - 222px);
  overflow: auto;
}

.finance-date-tree {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-2);
}

.finance-date-filter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.finance-date-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.finance-date-filter input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.finance-date-node {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  min-height: 34px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  padding: 6px 8px;
}

.finance-date-node:hover,
.finance-date-node.active-date-scope,
#finance-all-dates.active-date-scope {
  background: #eaf6f4;
  color: var(--teal);
  font-weight: 800;
}

.finance-toggle {
  width: 18px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 800;
}

.finance-toggle:hover {
  background: #d9ece9;
  color: var(--teal);
}

.finance-date-node strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-date-node em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.finance-month-list,
.finance-day-list {
  margin-left: 18px;
  border-left: 1px solid #cfd9e2;
  padding-left: 7px;
}

.finance-sales-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.finance-sales-panel > .panel-header,
.finance-sales-tools {
  flex: 0 0 auto;
}

.finance-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.finance-selected-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.finance-selected-label {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.finance-toolbar-action {
  min-height: 34px;
  border: 1px solid var(--teal);
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.finance-toolbar-action:hover:not(:disabled) {
  background: var(--teal-dark);
}

.finance-toolbar-action:disabled {
  border-color: var(--line);
  background: #edf2f5;
  color: #8a99a7;
  cursor: not-allowed;
}

.danger-toolbar-action:not(:disabled) {
  border-color: #d73434;
  background: #d73434;
}

.danger-toolbar-action:hover:not(:disabled) {
  background: #b91f1f;
}

.finance-sales-tools {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(260px, 360px);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 10px;
}

.finance-filter-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.finance-filter-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 9px 10px;
  min-width: 0;
}

.finance-filter-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.finance-filter-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
}

.finance-filter-summary small {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.finance-summary-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid #cbdde5;
  border-radius: 999px;
  background: #ffffff;
  padding: 2px 6px;
  color: #415568;
  white-space: nowrap;
}

#finance-order-search {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
}

.finance-table-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 255px);
  flex: 1 1 auto;
  min-height: 260px;
  padding-bottom: 18px;
  scroll-padding-bottom: 18px;
  scrollbar-gutter: stable;
}

.finance-table {
  min-width: 1080px;
}

.finance-table tbody tr {
  cursor: pointer;
}

.finance-table td span {
  color: var(--muted);
  font-size: 12px;
}

.finance-table tr.selected-finance-row td {
  background: #eef8f6;
}

.finance-receipt-slip {
  margin-top: 0;
}

.product-analysis-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.product-analysis-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.product-analysis-filter-panel,
.product-analysis-detail-panel {
  max-height: calc(100vh - 222px);
  overflow: auto;
}

.analysis-date-filter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.analysis-date-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.analysis-date-filter input,
#analysis-product-search {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

#analysis-product-search {
  margin-top: 10px;
}

.analysis-category-tree {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-2);
}

.analysis-category-node {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  padding: 7px 8px;
}

.analysis-category-node span,
.analysis-category-node small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-category-node small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.analysis-category-node strong {
  min-width: 26px;
  border-radius: 999px;
  background: #e2edf3;
  text-align: center;
  font-size: 12px;
  padding: 3px 7px;
}

.analysis-category-node:hover,
.analysis-category-node.active-analysis-category {
  background: #eaf6f4;
  color: var(--teal);
  font-weight: 800;
}

.product-analysis-table-panel {
  min-width: 0;
}

.analysis-table-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 292px);
}

.analysis-table {
  min-width: 1180px;
}

.analysis-table tbody tr {
  cursor: pointer;
}

.analysis-table td span,
.analysis-table td small {
  color: var(--muted);
}

.analysis-table tr.selected-analysis-row td {
  background: #eef8f6;
}

.analysis-trend {
  min-height: 132px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(28px, 1fr);
  gap: 7px;
  align-items: end;
  overflow-x: auto;
  padding-top: 8px;
}

.analysis-trend-bar {
  display: grid;
  gap: 5px;
  align-items: end;
  min-width: 28px;
}

.analysis-trend-bar span {
  display: block;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #0f9c91, #087f7b);
}

.analysis-trend-bar small {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.cash-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cash-management-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.cash-date-panel,
.cash-control-panel {
  max-height: calc(100vh - 222px);
  overflow: auto;
}

.cash-date-filter {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.cash-date-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.cash-date-filter input,
.cash-control-panel input,
.cash-control-panel select,
.cash-control-panel textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.cash-control-panel textarea {
  min-height: 92px;
  resize: vertical;
}

.cash-date-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cash-date-list {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-2);
}

.cash-date-node {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  padding: 8px;
}

.cash-date-node small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.cash-date-node:hover,
.cash-date-node.active-cash-date {
  background: #eaf6f4;
  color: var(--teal);
  font-weight: 800;
}

.cash-detail-panel {
  min-width: 0;
}

.cash-closing-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 280px;
}

.cash-status-pill {
  display: grid;
  gap: 2px;
  min-width: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 7px 10px;
}

.cash-status-pill span {
  color: var(--muted);
  font-size: 11px;
}

.cash-status-pill strong {
  font-size: 13px;
  line-height: 1.1;
}

.cash-status-pill small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.cash-status-pill.success {
  border-color: #a9dfca;
  background: #eefbf5;
}

.cash-status-pill.success strong {
  color: #047857;
}

.cash-status-pill.error {
  border-color: #fecaca;
  background: #fff1f2;
}

.cash-status-pill.error strong,
.cash-status-pill.error small {
  color: #b91c1c;
}

.cash-method-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.cash-method-card {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #f8fbfd;
  padding: 14px;
}

.cash-card-opening {
  border-left-color: #64748b;
}

.cash-card-income {
  border-left-color: #0f8f83;
}

.cash-card-summary {
  border-left-color: #2563eb;
}

.cash-method-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cash-method-card strong {
  display: block;
  margin: 7px 0 9px;
  font-size: 23px;
  line-height: 1.1;
}

.cash-method-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cash-method-detail em {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbdde5;
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 8px;
  color: #31485d;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.cash-method-detail .cash-chip-cash {
  border-color: #0f8f83;
  background: #d8f3ee;
  color: #075f59;
}

.cash-method-detail .cash-chip-gcash {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.cash-method-detail .cash-chip-qr,
.cash-method-detail .cash-chip-online {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
}

.cash-method-detail .cash-chip-taken {
  border-color: #dc2626;
  background: #fee2e2;
  color: #b91c1c;
}

.cash-table-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 392px);
}

.cash-table {
  min-width: 860px;
}

.cash-table td span {
  color: var(--muted);
  font-size: 12px;
}

.cash-table-amount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
}

.cash-method-pill {
  display: inline-flex;
  border-radius: 999px;
  background: #eaf6f4;
  color: var(--teal);
  padding: 4px 8px;
  font-weight: 800;
  font-size: 12px;
}

.cash-collection-log {
  margin-top: 14px;
}

.cash-collection-log h3 {
  margin: 0 0 8px;
}

.cash-collection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.cash-collection-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.cash-adjustment-amount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.cash-adjustment-in strong {
  color: var(--teal);
}

.cash-adjustment-out strong {
  color: #b42318;
}

.cash-closing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
  padding: 11px;
  margin-bottom: 12px;
}

.cash-closing-card h3 {
  margin: 0 0 8px;
}

.cash-closing-card h4 {
  margin: 10px 0 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cash-closing-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 7px 0;
}

.cash-closing-card div:first-of-type {
  border-top: 0;
}

.cash-closing-card span {
  color: var(--muted);
  font-size: 12px;
}

.cash-closing-card strong {
  text-align: right;
}

.cash-report-settings {
  gap: 10px;
}

.cash-report-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
}

.inline-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.inline-status.success {
  color: var(--teal);
  font-weight: 700;
}

.inline-status.error {
  color: #b42318;
  font-weight: 700;
}

.inline-status.warning {
  color: #a15c00;
  font-weight: 700;
}

.positive-amount {
  color: var(--teal);
}

.negative-amount {
  color: #b42318;
}

.cash-drawer-total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
  padding: 11px;
  margin-bottom: 10px;
}

.cash-drawer-total span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.cash-drawer-total strong {
  font-size: 20px;
  color: var(--teal);
}

.cash-denomination-list {
  display: grid;
  gap: 8px;
}

.cash-denomination-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
}

.cash-denomination-row span,
.cash-denomination-row strong {
  font-size: 13px;
}

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

.system-safety-panel {
  margin-top: 14px;
}

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

.safety-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.safety-actions span {
  color: var(--muted);
  font-size: 12px;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  cursor: pointer;
}

.file-action input {
  display: none;
}

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

.safety-log-grid h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.safety-log-list {
  display: grid;
  gap: 6px;
}

.safety-log-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--surface-2);
  display: grid;
  gap: 2px;
}

.safety-log-row strong,
.safety-log-row span,
.safety-log-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.safety-log-row strong {
  font-size: 13px;
}

.safety-log-row span,
.safety-log-row small {
  color: var(--muted);
  font-size: 12px;
}

.customer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(280px, 320px);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.customer-main-panel {
  min-width: 0;
  display: grid;
  gap: 14px;
}

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

.customer-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  display: grid;
  gap: 5px;
}

.customer-metric span,
.customer-table td span,
.payment-row small {
  color: var(--muted);
  font-size: 12px;
}

.customer-metric strong {
  font-size: 18px;
}

.customer-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px;
  gap: 10px;
}

.customer-table-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.customer-table {
  min-width: 1040px;
}

.account-table {
  min-width: 1320px;
}

.soa-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.soa-toolbar select {
  min-height: 34px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 10px;
  font: inherit;
}

.soa-selection-summary {
  min-width: 76px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.soa-order-select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.customer-table tr[data-customer-id] {
  cursor: pointer;
}

.customer-table tr.selected-customer-row td {
  background: #eef8f6;
}

.account-ledger {
  display: grid;
  gap: 10px;
}

.ledger-scroll {
  max-height: 250px;
}

.customer-detail-panel,
.customer-actions-panel {
  max-height: calc(100vh - 128px);
  overflow: auto;
}

.customer-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.customer-card,
.customer-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.customer-card span {
  color: var(--muted);
  font-size: 12px;
}

.customer-settings label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.customer-settings textarea {
  min-height: 74px;
  resize: vertical;
}

.order-edit-input {
  width: 100%;
  min-width: 104px;
  min-height: 32px;
  padding: 0 8px;
}

.order-money-input {
  min-width: 112px;
}

.order-action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.order-paid-method {
  min-height: 30px;
  max-width: 92px;
  padding: 0 6px;
  font-size: 12px;
}

.small-action {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.payment-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

.payment-row small {
  grid-column: 1 / -1;
}

.account-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  background: #edf2f7;
  color: #415267;
  white-space: nowrap;
}

.status-overdue {
  background: #fff0ed;
  color: #b42318;
}

.status-due-soon {
  background: #fff7db;
  color: #8a5a00;
}

.status-cod-pending,
.status-pending-payment {
  background: #e8f0ff;
  color: #244b9b;
}

.status-clear,
.status-paid {
  background: #e3f4ed;
  color: var(--green);
}

.status-refunded,
.status-returned,
.status-voided {
  background: #ffe8ec;
  color: #b42318;
}

.quote-grid {
  display: grid;
  grid-template-columns: var(--safe-quote-product-width) 10px minmax(0, 1fr) minmax(280px, 320px);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.quote-product-panel,
.quote-template-panel,
.quote-customer-panel {
  max-height: calc(100vh - 128px);
  overflow: hidden;
}

.quote-product-panel,
.quote-customer-panel {
  display: flex;
  flex-direction: column;
}

.quote-product-panel .catalog-layout {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.quote-product-tree {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 322px);
  overflow: auto;
}

.quote-template-panel {
  height: calc(100vh - 128px);
  max-height: calc(100vh - 128px);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quote-template-panel > * {
  min-height: 0;
}

.quote-template-panel .panel-header {
  margin-bottom: 0;
}

.quote-action-row {
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}

.quote-action-row .primary-action,
.quote-action-row .secondary-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

#quote-convert-sale {
  min-width: 112px;
}

.quote-detail-area {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.quote-template-panel.details-collapsed .quote-detail-area {
  display: none;
}

#quote-detail-toggle {
  min-width: 86px;
}

.quote-company-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf4;
  display: grid;
  gap: 2px;
  padding: 7px 12px;
  text-align: center;
}

.quote-company-card strong {
  font-size: 16px;
}

.quote-company-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

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

.quote-customer-banner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef8f6;
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 7px 12px;
}

.quote-customer-banner span,
.quote-customer-banner small {
  color: var(--muted);
  font-size: 12px;
}

.quote-customer-banner strong {
  grid-column: 1;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.quote-customer-banner small {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  border-radius: 999px;
  background: #e3f4ed;
  color: var(--teal);
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.quote-meta-grid label,
.quote-customer-panel label,
.quote-customer-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.quote-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quote-template-panel.details-collapsed .quote-table-scroll {
  max-height: none;
}

.quote-table {
  min-width: 1160px;
}

.quote-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.quote-table th:nth-child(1),
.quote-table td:nth-child(1) {
  width: 310px;
}

.quote-table th:nth-child(2),
.quote-table td:nth-child(2) {
  width: 190px;
}

.quote-table th:nth-child(3),
.quote-table td:nth-child(3) {
  width: 190px;
}

.quote-table th:nth-child(5),
.quote-table td:nth-child(5) {
  width: 170px;
}

.quote-table th:nth-child(8),
.quote-table td:nth-child(8) {
  width: 92px;
}

.quote-qty-control {
  display: grid;
  gap: 5px;
}

.quote-qty-row {
  display: grid;
  grid-template-columns: 36px 26px 54px 26px;
  gap: 5px;
  align-items: center;
}

.quote-qty-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.quote-line-extra {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.quote-qty-detail {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
}

.quote-qty-detail strong {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quote-summary {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.quote-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px 10px;
  display: grid;
  gap: 5px;
  min-height: 58px;
}

.quote-summary span,
.quote-customer-card span {
  color: var(--muted);
  font-size: 12px;
}

.quote-summary strong,
.quote-customer-card strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.quote-grand-total strong {
  color: var(--teal);
  font-size: 20px;
}

.quote-customer-panel {
  gap: 12px;
  overflow: auto;
}

.quote-customer-picker {
  display: grid;
  gap: 8px;
}

.quote-customer-list,
.quote-history-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 6px;
  display: grid;
  gap: 5px;
}

.quote-customer-list {
  max-height: 230px;
  overflow: auto;
}

.quote-customer-group {
  display: grid;
  gap: 4px;
}

.quote-customer-group-button,
.quote-customer-row,
.quote-history-load,
.quote-history-delete {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.quote-customer-group-button {
  min-height: 32px;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
  padding: 0 8px;
}

.quote-customer-group-button:hover {
  background: #eaf2f2;
}

.quote-customer-group-button strong,
.quote-customer-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-customer-group-button em {
  border-radius: 999px;
  background: #dfe7ed;
  color: #324250;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
}

.quote-customer-group-list {
  display: grid;
  gap: 4px;
  margin-left: 18px;
  padding-left: 8px;
  border-left: 1px solid #cdd7df;
}

.quote-customer-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 7px 8px;
}

.quote-customer-row span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-customer-row:hover,
.quote-customer-row.selected {
  border-color: #b9d8d5;
  background: #eef8f6;
  color: var(--teal);
}

.quote-customer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.quote-customer-form {
  display: grid;
  gap: 10px;
}

.quote-customer-form textarea {
  min-height: 78px;
}

.quote-customer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 12px;
}

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

.quote-history-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.quote-history-header span {
  border-radius: 999px;
  background: #e3f4ed;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.quote-history-list {
  max-height: 260px;
  overflow: auto;
}

.quote-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 6px;
  align-items: stretch;
}

.quote-history-load {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
}

.quote-history-load span,
.quote-history-load em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.quote-history-load em {
  color: var(--teal);
  font-weight: 800;
}

.quote-history-item.selected .quote-history-load,
.quote-history-load:hover {
  border-color: #b9d8d5;
  background: #eef8f6;
}

.quote-history-delete {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff7f5;
  color: #b42318;
  font-size: 12px;
  text-align: center;
}

.permission-table td:not(:first-child) {
  font-weight: 700;
}

.nav-item:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.staff-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.staff-grid {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr) minmax(280px, 330px);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

.staff-log-panel {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.staff-account-list {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: calc(100vh - 315px);
  overflow: auto;
}

.staff-list-panel,
.staff-detail-panel,
.staff-session-panel,
.staff-log-panel {
  min-height: 0;
}

.staff-detail-panel,
.staff-session-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#staff-detail-form,
.staff-log-scroll {
  min-height: 0;
  overflow: auto;
}

#staff-detail-form {
  flex: 1 1 auto;
}

.staff-log-scroll {
  flex: 1 1 0;
}

.staff-account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.staff-account-card.selected,
.staff-account-card:hover {
  background: #eaf6f4;
  border-color: rgba(0, 138, 132, 0.35);
}

.staff-account-card span,
.staff-account-card small,
.staff-account-card em {
  display: block;
}

.staff-account-card small,
.staff-account-card em {
  color: var(--muted);
  font-size: 12px;
}

.staff-account-card em {
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.staff-account-card em.inactive {
  color: #b42318;
}

.staff-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.staff-form-grid label,
.staff-session-control label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.staff-form-grid input,
.staff-form-grid select,
.staff-session-control input,
.staff-session-control select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.staff-copy-permissions {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 0 0 12px;
}

.staff-copy-permissions label {
  display: grid;
  flex: 1 1 260px;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.staff-copy-permissions select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.staff-permission-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
}

.staff-permission-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.staff-permission-grid h3 {
  margin: 0 0 8px;
}

.staff-permission-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-size: 13px;
}

.staff-permission-row span {
  display: grid;
  gap: 2px;
}

.staff-permission-row small,
.staff-sensitive-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.staff-setting-block {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.staff-setting-block label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

.staff-setting-block select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 6px 8px;
  font: inherit;
  font-weight: 400;
}

.staff-setting-block small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.staff-permission-matrix {
  display: grid;
  gap: 6px;
}

.staff-permission-matrix-head,
.staff-permission-matrix-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(4, minmax(58px, 0.45fr));
  gap: 6px;
  align-items: center;
}

.staff-permission-matrix-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.staff-permission-matrix-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px;
  cursor: pointer;
}

.staff-permission-matrix-row.selected {
  border-color: rgba(0, 138, 132, 0.55);
  background: #eaf7f4;
  box-shadow: inset 3px 0 0 var(--teal);
}

.staff-permission-matrix-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-permission-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  font-size: 12px;
}

.staff-permission-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-session-control {
  display: grid;
  gap: 12px;
  flex: 0 0 auto;
}

.staff-session-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 11px;
}

.staff-session-status span,
.staff-session-status small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.staff-session-status strong {
  display: block;
  margin: 4px 0;
}

.staff-log-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: none;
}

.staff-log-table {
  min-width: 520px;
}

.staff-session-panel .staff-log-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 11px;
}

.staff-session-panel .staff-log-table th,
.staff-session-panel .staff-log-table td {
  padding: 8px 6px;
  overflow-wrap: anywhere;
}

.staff-session-panel .staff-log-table .status-pill {
  font-size: 11px;
}

.role-control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  margin-bottom: 14px;
}

.role-control-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.role-control-panel select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}

.role-control-panel span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .app-header {
    grid-template-columns: minmax(176px, 190px) minmax(0, 1fr) auto auto auto;
    gap: 6px;
    padding: 8px 10px;
  }

  .brand-block {
    gap: 8px;
  }

  .brand-meta,
  .device-status-chip span {
    display: none;
  }

  .device-status-panel {
    gap: 5px;
  }

  .device-status-chip {
    width: 36px;
    justify-content: center;
    padding: 0;
  }

  .sync-panel {
    width: 112px;
    flex-basis: 112px;
    min-width: 112px;
    padding: 0 8px;
  }

  .sync-panel strong {
    max-width: 100%;
  }

  .header-account-badge {
    min-width: 118px;
    max-width: 136px;
    padding-inline: 8px;
  }

  .workspace {
    padding: 12px;
  }

  .pos-grid,
  .inventory-grid,
  .quote-grid,
  .finance-layout,
  .product-analysis-layout,
  .cash-management-layout,
  .customer-grid,
  .staff-grid,
  .module-layout {
    gap: 10px;
  }

  .panel {
    padding: 12px;
  }

  .pos-grid {
    grid-template-columns: var(--safe-catalog-width) 8px minmax(0, 1fr) minmax(280px, 300px);
  }
}

@media (max-height: 820px) and (min-width: 1101px) {
  .catalog-panel,
  .product-panel {
    height: calc(100dvh - 104px);
    max-height: calc(100dvh - 104px);
  }

  .catalog-panel {
    gap: 8px;
  }

  .catalog-panel .panel-header {
    min-height: 0;
    margin-bottom: 4px;
  }

  .catalog-panel .panel-header p,
  .recent-sales-header p {
    display: none;
  }

  .catalog-layout {
    flex-basis: 56%;
    gap: 6px;
  }

  .recent-sales-panel {
    flex-basis: 44%;
    gap: 6px;
  }

  .catalog-toolbar {
    gap: 6px;
    margin-bottom: 0;
  }

  #catalog-search {
    flex-basis: 100%;
  }

  .recent-sales-header {
    align-items: center;
  }

  .product-tree,
  .recent-sales-tree {
    padding: 6px;
  }
}

@media (max-width: 1420px) {
  .nav-item span:last-child {
    display: none;
  }

  .nav-item.active span:last-child {
    display: inline;
  }

  .catalog-panel {
    min-height: auto;
  }
}

@media (max-width: 1420px) and (min-width: 1101px) {
  .app-shell {
    font-size: 13px;
  }

  .app-header {
    min-height: 62px;
  }

  .workspace {
    padding: 12px;
  }

  .pos-grid,
  .inventory-grid,
  .quote-grid,
  .finance-layout,
  .product-analysis-layout,
  .cash-management-layout,
  .customer-grid,
  .staff-grid {
    gap: 10px;
  }

  .panel {
    padding: 12px;
  }

  .primary-action,
  .secondary-action,
  .checkout-button,
  .payment-button,
  input,
  select {
    min-height: 34px;
    height: 34px;
  }

  .product-panel {
    gap: 8px;
  }

  .product-panel .panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 300px);
    grid-template-rows: auto auto;
    gap: 6px 10px;
    min-height: 0;
    margin-bottom: 0;
  }

  .product-panel .panel-header p {
    line-height: 1.25;
  }

  .sale-header-actions {
    display: grid;
    grid-template-columns:
      minmax(88px, 0.75fr)
      minmax(96px, 0.8fr)
      minmax(92px, 0.75fr);
    gap: 6px;
    align-items: center;
    justify-content: start;
    width: 100%;
  }

  .sale-header-actions > * {
    min-width: 0;
  }

  .sale-scan-corner {
    width: 100%;
  }

  .sale-scan-corner span {
    white-space: nowrap;
  }

  #new-sale-order,
  #sale-to-quote,
  #copy-sale-list {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .scan-add-button {
    width: auto;
    min-width: 44px;
    padding-inline: 8px;
  }

  .product-panel .control-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .product-panel .control-row label {
    min-width: 0;
  }

  .sale-table-scroll {
    flex: 1 1 120px;
  }

  .sale-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding-top: 8px;
  }

  .sale-summary div {
    min-height: 56px;
    padding: 7px 9px;
  }

  .sale-summary strong {
    font-size: 15px;
  }

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

  .sale-text-panel textarea {
    min-height: clamp(120px, 20dvh, 180px);
  }
}

@media (max-width: 1260px) and (min-width: 1101px) {
  .pos-grid {
    grid-template-columns: var(--safe-catalog-width) 8px minmax(0, 1fr) minmax(260px, 280px);
  }

  .sale-header-actions {
    grid-template-columns:
      minmax(78px, 0.75fr)
      minmax(90px, 0.85fr)
      minmax(86px, 0.8fr);
  }

  #new-sale-order,
  #sale-to-quote,
  #copy-sale-list,
  .scan-add-button {
    font-size: 12px;
  }

  .sale-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .sale-summary div {
    min-height: 50px;
    padding: 6px 7px;
  }

  .sale-text-panel textarea {
    min-height: 110px;
  }
}

@media (max-width: 1160px) and (min-width: 1101px) {
  .product-panel > .panel-header {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 250px);
  }

  .sale-header-actions {
    grid-template-columns:
      minmax(74px, 0.8fr)
      minmax(84px, 0.9fr)
      minmax(78px, 0.8fr);
  }

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

@media (min-width: 1101px) {
  .pos-grid,
  .inventory-grid,
  .quote-grid,
  .customer-grid,
  .finance-layout,
  .product-analysis-layout,
  .cash-management-layout,
  .staff-grid {
    height: calc(100dvh - 112px);
    min-height: 0;
    align-items: stretch;
  }

  .pos-main-stack {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .pos-main-stack > .product-panel {
    flex: 0 0 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
  }

  .pos-main-stack > .panel:not(.product-panel) {
    flex: 0 0 auto;
  }

  .catalog-panel,
  .checkout-panel,
  .inventory-tree-panel,
  .inventory-table-panel,
  .inventory-stock-panel,
  .quote-product-panel,
  .quote-template-panel,
  .quote-customer-panel,
  .customer-actions-panel,
  .customer-detail-panel,
  .finance-date-panel,
  .finance-receipt-panel,
  .product-analysis-filter-panel,
  .product-analysis-detail-panel,
  .cash-date-panel,
  .cash-control-panel,
  .staff-list-panel,
  .staff-detail-panel,
  .staff-session-panel {
    height: 100%;
    max-height: none;
    min-height: 0;
  }

  .inventory-tree-panel,
  .inventory-table-panel,
  .inventory-stock-panel,
  #inventory .side-panel {
    height: calc(100dvh - 112px);
  }

  .checkout-panel,
  .inventory-stock-panel,
  .quote-customer-panel {
    overflow: auto;
  }

  #inventory .side-panel {
    height: 100%;
    max-height: none;
    min-height: 0;
  }

  .customer-main-panel,
  .finance-sales-panel,
  .product-analysis-table-panel,
  .cash-report-panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .customer-main-panel {
    display: flex;
    flex-direction: column;
  }

  .customer-table-scroll {
    flex: 0 1 auto;
    min-height: 0;
  }

  .customer-main-panel > .customer-table-scroll {
    flex: 1 1 0;
  }

  .account-ledger {
    min-height: 0;
    flex: 1 1 0;
  }

  .ledger-scroll {
    max-height: none;
    min-height: 0;
    height: 100%;
  }

  #staff.active-view {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 112px);
    min-height: 0;
    overflow: hidden;
  }

  #staff .staff-summary-grid {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  #staff .staff-grid {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  .staff-list-panel,
  .staff-detail-panel,
  .staff-session-panel {
    height: auto;
    max-height: none;
  }

  .staff-list-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .staff-account-list {
    flex: 1 1 0;
    max-height: none;
    min-height: 0;
  }

  .staff-session-panel {
    gap: 12px;
    overflow: hidden;
  }

  .staff-log-panel {
    height: auto;
    max-height: none;
  }

  .finance-table-scroll {
    max-height: none;
    min-height: 0;
  }
}

@media (max-width: 1420px) and (min-width: 1101px) {
  .pos-grid,
  .inventory-grid,
  .quote-grid,
  .customer-grid,
  .finance-layout,
  .product-analysis-layout,
  .cash-management-layout,
  .staff-grid {
    height: calc(100dvh - 88px);
  }

  .inventory-tree-panel,
  .inventory-table-panel,
  .inventory-stock-panel,
  #inventory .side-panel {
    height: calc(100dvh - 88px);
  }

  #staff.active-view {
    height: calc(100dvh - 88px);
  }

  #staff .staff-summary-grid {
    gap: 10px;
    margin-bottom: 10px;
  }

  #staff .staff-grid {
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .product-panel > .panel-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-scan-corner {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
    width: min(100%, 320px);
  }

  .sale-header-actions {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 1100px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 300px;
  }

  .app-header {
    grid-template-columns: 210px minmax(0, 1fr) auto auto;
  }

  .sync-panel {
    display: none;
  }

  .module-layout {
    grid-template-columns: 1fr;
  }

  .customer-grid {
    grid-template-columns: 1fr;
  }

  .cash-management-layout {
    grid-template-columns: 1fr;
  }

  .finance-layout {
    grid-template-columns: 1fr;
  }

  .staff-grid {
    grid-template-columns: 1fr;
  }

  .staff-log-panel {
    grid-column: auto;
  }

  .staff-summary-grid,
  .staff-form-grid,
  .staff-permission-grid,
  .settings-grid,
  .safety-summary-grid,
  .safety-log-grid {
    grid-template-columns: 1fr;
  }

  .quote-grid {
    grid-template-columns: 1fr;
  }

  .customer-detail-panel,
  .customer-actions-panel,
  .quote-product-panel,
  .quote-template-panel,
  .quote-customer-panel {
    max-height: none;
  }

  .quote-template-panel {
    height: auto;
  }

  .quote-customer-panel {
    grid-column: auto;
  }

  .quote-product-tree,
  .quote-table-scroll {
    max-height: 65vh;
  }

  .quote-meta-grid,
  .quote-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-grid,
  .pos-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .product-panel {
    height: auto;
    max-height: none;
  }

  .pos-main-stack {
    grid-column: auto;
  }

  .inventory-table-panel {
    max-height: none;
  }

  .inventory-table-scroll {
    max-height: 65vh;
  }

  #inventory .side-panel {
    grid-column: auto;
  }

  .panel-resizer {
    display: none;
  }

  .finance-sales-panel,
  .finance-receipt-panel {
    grid-column: auto;
  }

  .checkout-panel {
    grid-column: auto;
  }

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

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

@media (max-width: 760px) {
  .login-screen {
    padding: 16px;
  }

  .login-hero,
  .login-form-panel {
    padding: 20px;
  }

  .login-stat-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: static;
    grid-template-columns: 1fr;
  }

  .brand-block {
    justify-content: start;
  }

  .nav-list {
    padding-bottom: 8px;
  }

  .workspace {
    padding: 12px;
  }

  .sale-header-actions {
    display: grid;
    align-items: center;
    justify-content: start;
  }

  .dashboard-grid,
  .settings-grid,
  .customer-toolbar,
  .customer-metrics,
  .quote-meta-grid,
  .quote-summary,
  .cash-summary-grid,
  .cash-method-breakdown {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 760px;
  }

  .catalog-panel,
  .product-panel,
  .wide-panel,
  .panel {
    overflow-x: auto;
  }
}
