.sales-management-v2 {
  --sales-green-950: var(--store-theme-dark);
  --sales-green-900: var(--store-theme);
  --sales-green-700: var(--store-theme-light);
  --sales-green-100: var(--store-theme-faint);
  --sales-red: #e42d3b;
  --sales-border: #e2e8e5;
  --sales-muted: #748078;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: stretch;
  gap: 16px;
  padding-bottom: 34px;
  color: #18221e;
}
.sales-management-list{display:grid;min-width:0;align-content:start;gap:16px}.sales-management-main .sales-page-hidden-action{display:none!important}

#view.sales-management-page.ticket-system-page { padding-top: 0; }
#view.sales-management-page {
  animation: none;
  transform: none;
  will-change: auto;
}
#view.sales-management-page.ticket-system-page::before,
#view.sales-management-page.ticket-system-page::after { display: none; content: none; }

.sales-management-main header { height: 76px; margin-bottom: 20px; gap: 10px; }
.sales-management-main header h2 { font-size: 24px; font-weight: 750; letter-spacing: 0; }
.sales-management-main .topbar-title { gap: 18px; }
.sales-management-main .topbar-context { gap: 0; padding-left: 18px; }
.sales-management-main .topbar-context span:empty { display: none; }
.sales-management-main header > .ghost,
.sales-management-main .sales-header-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #d7e1dc;
  border-radius: 8px;
  background: #fff;
  color: #006b4d;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: none;
}
.sales-management-main header > .ghost { margin-left: 0; }
.sales-management-main header > #qrBtn { margin-left: auto; }
.sales-management-main .sales-header-create {
  min-width: 148px;
  min-height: 40px;
  margin-left: 20px;
  border-color:var(--store-theme);
  background:var(--store-theme);
  color: #fff;
  box-shadow:0 7px 16px color-mix(in srgb,var(--store-theme) 22%,transparent);
  cursor: pointer;
}

.sales-management-v2 *,
.sales-management-v2 *::before,
.sales-management-v2 *::after,
.sales-summary-drawer *,
.sales-summary-drawer *::before,
.sales-summary-drawer *::after { box-sizing: border-box; }
.sales-management-v2.module-bounce,
.sales-management-v2 .row-bounce,
.sales-summary-drawer.module-bounce {
  animation: none;
  transform: none;
  will-change: auto;
}
.sales-management-v2 button,
.sales-management-v2 input,
.sales-management-v2 select,
.sales-summary-drawer button { font: inherit; }

.sales-kind-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:0;
  padding:0;
  overflow:hidden;
  border:1px solid var(--sales-border);
  border-radius:12px;
  background:#fff;
  box-shadow:0 7px 22px rgba(20,55,43,.055);
}
.sales-kind-card {
  display: flex;
  align-items: center;
  min-height: 114px;
  gap: 18px;
  padding: 20px 22px;
  border:0;
  border-right:1px solid var(--sales-border);
  border-radius:0;
  background: #fff;
  color: #17221d;
  text-align: left;
  box-shadow:none;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.sales-kind-card:last-child{border-right:0}
.sales-kind-card:hover,
.sales-kind-card.active{border-color:transparent;box-shadow:none}.sales-kind-card:hover:not(.active){background:var(--store-theme-faint)}
.sales-kind-card.active{background:linear-gradient(135deg,var(--store-theme-dark),var(--store-theme));color:#fff}
.sales-kind-icon {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  place-items: center;
  border-radius: 50%;
  background: #f1f3f2;
  color: #151b18;
}
.sales-kind-card.active .sales-kind-icon{background:#fff;color:var(--store-theme)}
.sales-kind-icon svg,
.sales-stat-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sales-kind-copy {
  display: grid;
  min-width: 0;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 2px;
}
.sales-kind-copy strong { font-size: 15px; font-weight: 750; }
.sales-kind-copy > b { color: #111714; font-size: 25px; line-height: 1.1; }
.sales-kind-card.active .sales-kind-copy>b{color:#fff}.sales-kind-card.active .sales-kind-copy small{color:rgba(255,255,255,.78)}
.sales-kind-copy small {
  grid-column: 1 / -1;
  color: var(--sales-muted);
  font-size: 12px;
  white-space: nowrap;
}

.sales-filter-panel,
.sales-stat-card,
.sales-list-panel {
  border: 1px solid var(--sales-border);
  background: #fff;
  box-shadow: 0 7px 22px rgba(20, 55, 43, .045);
}
.sales-filter-panel { padding:14px 16px;border-radius:9px; }
.sales-filter-grid {
  display: grid;
  grid-template-columns: minmax(250px, 1.75fr) minmax(142px, .92fr) minmax(142px, .92fr) minmax(132px, .84fr) minmax(132px, .84fr) auto;
  align-items: center;
  gap: 10px;
}
.sales-filter-grid input,
.sales-filter-grid select {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid #dce3df;
  border-radius: 7px;
  background: #fff;
  color: #27332e;
  outline: none;
}
.sales-filter-grid input:focus,
.sales-filter-grid select:focus { border-color: #7db39f; box-shadow: 0 0 0 3px rgba(0, 107, 77, .08); }
.sales-filter-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sales-filter-actions button,
.sales-list-actions button,
.sales-drawer-actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #dce3df;
  border-radius: 8px;
  background: #fff;
  color: #254c3e;
  cursor: pointer;
}
.sales-filter-actions .sales-search-button {
  min-width: 56px;
  border-color: var(--sales-green-900);
  background: var(--sales-green-900);
  color: #fff;
  box-shadow: 0 5px 12px rgba(0, 107, 77, .16);
}
.sales-filter-actions [data-sales-more] { padding-inline: 9px; border-color: transparent; }
.sales-more-filter {
  display: none;
  margin-top: 12px;
  padding: 12px 2px 0;
  border-top: 1px solid var(--sales-border);
  color: var(--sales-muted);
  font-size: 13px;
}
.sales-more-filter.open { display: block; }
.sales-more-filter label { display:grid;grid-template-columns:auto minmax(220px,360px);align-items:center;gap:10px;max-width:470px;color:#384941;font-weight:650; }
.sales-more-filter input { min-height:40px;padding:0 12px;border:1px solid #dce3df;border-radius:7px;background:#fff;color:#27332e;outline:none; }
.sales-more-filter input:focus { border-color:#7db39f;box-shadow:0 0 0 3px rgba(0,107,77,.08); }

.sales-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sales-stat-card {
  display: grid;
  min-height:88px;
  grid-template-columns:40px minmax(0, 1fr);
  align-items: center;
  gap:12px;
  padding:13px 15px;
  border-radius:9px;
}
.sales-stat-icon {
  display: grid;
  width:40px;
  height:40px;
  place-items: center;
  border-radius: 50%;
  background: var(--sales-green-100);
  color: var(--sales-green-900);
}
.sales-stat-card.total .sales-stat-icon,
.sales-stat-card.profit .sales-stat-icon { background: #dcf5e8; color: #12a65f; }
.sales-stat-card.receivable.has-balance .sales-stat-icon { background: #ffeaed; color: var(--sales-red); }
.sales-stat-copy { min-width: 0; }
.sales-stat-copy small { display:block;margin-bottom:5px;color:var(--sales-muted);font-size:11px; }
.sales-stat-copy strong {
  display: block;
  overflow: hidden;
  color: #111814;
  font-size:20px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-stat-card.total .sales-stat-copy strong,
.sales-stat-card.profit .sales-stat-copy strong { color: var(--sales-green-900); }
.sales-stat-card.receivable.has-balance .sales-stat-copy strong { color: var(--sales-red); }

.sales-list-panel { min-width:0;overflow:visible;border-radius:9px; }
.sales-list-head {
  display: flex;
  min-height:68px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--sales-border);
}
.sales-list-head h3 { margin: 0; font-size: 17px; font-weight: 750; }
.sales-list-actions,
.sales-row-actions,
.sales-drawer-actions { display: flex; align-items: center; gap: 10px; }
.sales-result-count { margin-right: 8px; color: #4f5b55; font-size: 13px; }
.sales-button-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sales-column-menu,
.sales-action-menu,
.sales-drawer-export-menu { position: relative; }
.sales-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  min-width: 188px;
  padding: 7px;
  border: 1px solid var(--sales-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(21, 48, 38, .15);
}
.sales-popover[hidden] { display: none; }
.sales-popover button,
.sales-popover label {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #26352f;
  text-align: left;
  cursor: pointer;
}
.sales-popover button:hover,
.sales-popover label:hover { background: #f0f6f3; }
.sales-popover button.danger { color: #c72c35; }
.sales-floating-actions { position: fixed; z-index: 86; top: 0; right: auto; width: 220px; }

.sales-table-scroll { width: 100%; overflow-x: auto; overflow-y: visible; }
.sales-management-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.sales-management-table th,
.sales-management-table td {
  height:64px;
  padding:7px 10px;
  overflow: hidden;
  border-right: 1px solid #edf1ef;
  border-bottom: 1px solid #e8ecea;
  color: #26322d;
  font-size:12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sales-management-table th:last-child,
.sales-management-table td:last-child { border-right: 0; }
.sales-management-table thead th {
  position: relative;
  z-index: 6;
  height: 46px;
  background: #f7f9f8;
  color: #4c5852;
  font-size:11px;
  font-weight: 650;
  text-align: left;
}
.sales-management-table thead.sales-table-head-sticky th { box-shadow: 0 8px 12px rgba(18, 49, 38, .06); }
.sales-management-table tbody tr { background: #fff; transition: background-color .15s ease; }
.sales-management-table tbody tr:hover,
.sales-management-table tbody tr.selected { background: #edf8f3; }
.sales-management-table .col-address { width: 18%; }
.sales-management-table .col-date { width: 10%; }
.sales-management-table .col-number { width: 18%; }
.sales-management-table .col-creator { width: 9%; }
.sales-management-table .col-referrer { width: 10%; }
.sales-management-table .col-money,
.sales-management-table .col-payment,
.sales-management-table .col-profit { width: 11%; }
.sales-management-table .col-status { width: 9%; }
.sales-management-table .col-actions { width: 10%; }
.sales-number-cell strong { margin-right: 8px; color: #202c27; font-weight: 700; }
.sales-kind-badge,
.sales-status-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 2px 8px;
  border:1px solid var(--store-theme-border);
  border-radius: 999px;
  background:var(--store-theme-faint);
  color:var(--store-theme);
  font-size: 11px;
  font-weight: 650;
}
.sales-kind-badge.quote { border-color: #d2e1db; background: #f1f6f4; color: #42675a; }
.sales-kind-badge.deposit { border-color: #f0dac0; background: #fff7ed; color: #b8660e; }
.sales-status-badge.pending { border-color: #f3d5ae; background: #fff7ed; color: #c56908; }
.sales-status-badge.settled { border-color: #b9dfd1; background: #ebf8f3; color: #087153; }
.sales-payment-value.has-balance { color: var(--sales-red); font-weight: 700; }
.sales-profit-value { color: var(--sales-green-900); font-weight: 750; }
.sales-profit-value.loss { color: var(--sales-red); }
.sales-row-actions { justify-content: space-between; }
.sales-row-actions button {
  display: inline-grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--sales-green-900);
  font-weight: 700;
  cursor: pointer;
}
.sales-row-actions button:hover { background: #e6f3ee; }
.sales-empty-row td { height: 150px; color: var(--sales-muted); text-align: center; }

.sales-pagination {
  display: grid;
  min-height:60px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
}
.sales-page-size,
.sales-page-total { color:#52605a;font-size:12px; }
.sales-page-size b { font-weight: 650; }
.sales-page-total { text-align: right; }
.sales-page-buttons { display: flex; align-items: center; gap: 8px; }
.sales-management-main .sales-page-buttons button {
  position: static;
  min-width:31px;
  height:31px;
  padding: 0;
  border: 1px solid #dce4e0;
  border-radius:6px;
  background: #fff;
  color: #35443d;
  box-shadow: none;
  font-size:12px;
  font-weight: 600;
  line-height:29px;
  text-align: center;
  transform: none;
  cursor: pointer;
}
.sales-management-main .sales-page-buttons button::before,
.sales-management-main .sales-page-buttons button::after { display: none; content: none; }
.sales-management-main .sales-page-buttons button:not(:disabled):not(.active):hover {
  border-color: #83b5a3;
  background: #f3faf7;
  color: var(--sales-green-900);
}
.sales-management-main .sales-page-buttons button.active {
  border-color: var(--sales-green-900);
  background: var(--sales-green-900);
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 107, 77, .18);
}
.sales-management-main .sales-page-buttons button:disabled {
  border-color: #e7ece9;
  background: #fafbfa;
  color: #aab2ae;
  opacity: 1;
  cursor: default;
}
.sales-management-main .sales-page-buttons .sales-page-arrow { font: 400 22px/36px Arial, sans-serif; }
.sales-page-buttons > span { min-width: 22px; color: #75817b; text-align: center; }

.sales-summary-drawer {
  --sales-green-900: var(--store-theme);
  --sales-border: #e2e8e5;
  --sales-muted: #748078;
  position: relative;
  z-index: 1;
  top: auto;
  right: auto;
  bottom: auto;
  display: grid;
  width: 350px;
  min-height: 720px;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--sales-border);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(25,52,44,.075);
  transform: none;
  transition: none;
  will-change: auto;
}
.sales-drawer-head {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--sales-border);
}
.sales-drawer-head h3 { margin: 0; font-size: 17px; font-weight: 750; }
.sales-drawer-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #52605a;
  font-size: 25px;
  cursor: pointer;
}
.sales-drawer-close:hover { background: #f1f5f3; }
.sales-drawer-body { min-height: 0; overflow-y: auto; padding: 18px 20px; background: #fff; }
.sales-drawer-empty{display:grid;min-height:520px;place-items:center;align-content:center;gap:10px;color:var(--sales-muted);text-align:center}.sales-drawer-empty i{display:grid;width:54px;height:54px;place-items:center;border-radius:50%;background:var(--store-theme-faint);color:var(--store-theme)}.sales-drawer-empty svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:1.7}.sales-drawer-empty b{color:#53615b;font-size:14px}.sales-drawer-empty span{max-width:230px;font-size:11px;line-height:1.6}
.sales-drawer-loading,
.sales-drawer-error { display: grid; min-height: 180px; place-items: center; color: var(--sales-muted); text-align: center; }
.sales-drawer-order-head { padding: 2px 0 18px; border-bottom: 1px solid var(--sales-border); }
.sales-drawer-order-head strong { display: block; margin-bottom: 10px; color: #17211d; font-size: 20px; font-weight: 750; }
.sales-drawer-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.sales-drawer-section {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 19px 0;
  border: 0;
  border-bottom: 1px solid var(--sales-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.sales-drawer-section:last-child { border-bottom: 0; }
.sales-drawer-section h4 { margin: 0 0 1px; color: #202b26; font-size: 14px; font-weight: 750; }
.sales-drawer-field {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.sales-drawer-field span { color: var(--sales-muted); font-size: 13px; }
.sales-drawer-field b {
  color: #24302b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  text-align: right;
  overflow-wrap: anywhere;
}
.sales-drawer-money-grid { display: grid; gap: 15px; }
.sales-drawer-money-grid .sales-drawer-field b { font-size: 18px; font-weight: 700; }
.sales-drawer-field.receivable b { color: #e12635; }
.sales-drawer-field.profit b { color: var(--sales-green-900); }
.sales-drawer-field.deposit-money b { color: var(--sales-green-900); font-size: 20px; }
.sales-drawer-footer { padding: 15px 20px 20px; border-top: 1px solid var(--sales-border); background: #fff; }
.sales-drawer-actions { display: grid; grid-template-columns: 1fr; gap: 12px; }
.sales-drawer-actions .sales-drawer-full,
.sales-drawer-export-menu > button { width: 100%; min-height: 46px; }
.sales-drawer-actions .sales-drawer-full {
  border-color: var(--sales-green-900);
  background: var(--sales-green-900);
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 107, 77, .15);
}
.sales-drawer-export-menu .sales-popover { top: auto; right: 0; bottom: calc(100% + 8px); width: 230px; }
.sales-management-v2 [data-column-hidden="true"] { display: none; }

@media (max-width: 1600px) {
  .sales-management-v2 { grid-template-columns:minmax(0,1fr) 330px;gap:12px; }
  .sales-kind-card { min-height: 106px; padding: 18px 20px; }
  .sales-kind-icon { width: 56px; height: 56px; flex-basis: 56px; }
  .sales-filter-grid {
    grid-template-columns: minmax(215px, 1.55fr) repeat(2, minmax(132px, .9fr)) repeat(2, minmax(122px, .8fr)) auto;
  }
  .sales-stat-card { padding-inline: 18px; }
  .sales-summary-drawer { width:330px; }
}

@media (max-width: 1366px) {
  .sales-management-main { padding-inline: 18px; }
  .sales-management-main header > .ghost,
  .sales-management-main .sales-header-create { padding-inline: 12px; font-size: 12px; }
  .sales-management-main .sales-header-create { min-width: 130px; margin-left: 8px; }
  .sales-kind-switcher,
  .sales-stat-grid { gap: 10px; }
  .sales-kind-card { min-height: 100px; gap: 12px; padding: 16px; }
  .sales-kind-icon { width: 50px; height: 50px; flex-basis: 50px; }
  .sales-kind-copy small { overflow: hidden; text-overflow: ellipsis; }
  .sales-filter-grid {
    grid-template-columns:minmax(190px,1.5fr) repeat(2,minmax(120px,.9fr));
    gap: 8px;
  }
  .sales-filter-actions{gap:5px;justify-content:flex-end}
  .sales-filter-actions button { padding-inline: 10px; }
  .sales-stat-card {
    min-height: 96px;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 11px;
    padding: 16px 14px;
  }
  .sales-stat-icon { width: 46px; height: 46px; }
  .sales-stat-copy strong { font-size: clamp(20px, 1.7vw, 24px); }
  .sales-management-v2{grid-template-columns:minmax(0,1fr) 310px;gap:10px}
  .sales-summary-drawer { width:310px;min-height:680px }
}

@media (max-width: 1180px) and (min-width: 761px) {
  .sales-management-v2{grid-template-columns:1fr}.sales-summary-drawer{grid-row:1;width:auto;min-height:0}.sales-drawer-empty{min-height:180px}
  .sales-filter-grid {
    grid-template-columns: minmax(210px, 1.4fr) repeat(2, minmax(130px, 1fr)) repeat(2, minmax(120px, .85fr));
  }
  .sales-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 980px) and (min-width: 761px) {
  .sales-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sales-management-v2 { display: none; }
}

.sales-management-table .sales-quote-source { display: block; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; color: #63736b; font-size: 12px; line-height: 1.5; }
.sales-deposit-customer { display: grid; gap: 4px; }
.sales-deposit-customer strong { color: #1d2924; font-size: 14px; }
.sales-deposit-customer span { color: var(--sales-muted); font-size: 12px; line-height: 1.45; }
.sales-drawer-convert { min-height: 46px; border-color: var(--store-theme); background: var(--store-theme); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb,var(--store-theme) 18%,transparent); }

@media (min-width: 761px) {
  .sales-management-v2[data-sales-kind="deposit"] .sales-summary-drawer {
    position: fixed;
    z-index: 190;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    min-height: 0;
    height: 100dvh;
    border-width: 0 0 0 1px;
    border-radius: 0;
    box-shadow: -18px 0 42px rgba(18,49,38,.14);
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform .2s ease, opacity .2s ease;
  }
  .sales-management-v2[data-sales-kind="deposit"] .sales-summary-drawer.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }
}
