@charset "UTF-8";

.sales-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 22px;
}
.sales-controls > div, .sales-controls > label { display: flex; align-items: center; gap: 10px; }
.sales-controls label { color: #536478; font-size: .875rem; font-weight: 550; }
.sales-controls input[type="month"] {
  display: block;
  width: 182px;
  max-width: 100%;
  min-height: 43px;
  padding: 8px 12px;
  border: 1px solid #d8e1e6;
  border-radius: 8px;
  background: #fff;
  color: #354b5d;
  font-size: .9375rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.sales-controls input[type="month"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .65; }
.sales-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #dfe7e8; border-radius: 10px; background: #eaf0f0; }
.sales-controls .sales-tabs { gap: 4px; }
.sales-tab { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 9px 19px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #697a85; font-size: .875rem; font-weight: 550; line-height: 1.4; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.sales-tab:hover { background: #f6f9f8; color: #396f65; }
.sales-tab.active { border-color: #d9e5e0; background: #fff; color: #16786b; font-weight: 650; box-shadow: 0 1px 3px rgb(34 69 59 / 4%); }

.sales-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 19px; }
.sales-stat-card { min-width: 0; padding: 22px 23px 19px; border: 1px solid var(--line, #e4e9ed); border-radius: 13px; background: #fff; }
.sales-stat-label { display: block; margin: 0 0 12px; color: #657586; font-size: .875rem; font-weight: 550; line-height: 1.6; }
.sales-stat-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; color: #24394c; font-size: clamp(1.375rem, 1.9vw, 1.875rem); font-weight: 720; letter-spacing: -.04em; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sales-stat-value small, .sales-stat-value > span { color: #788795; font-size: .875rem; font-weight: 450; letter-spacing: 0; }
.sales-stat-foot { display: block; margin: 0; color: #7b8895; font-size: .8125rem; line-height: 1.65; word-break: keep-all; }
.sales-stat-card.profit { border-color: #cce5dc; background: #edf7f2; }
.sales-stat-card.profit .sales-stat-label { color: #477f6c; }
.sales-stat-card.profit .sales-stat-value { color: #1c775f; }
.sales-stat-card.profit .sales-stat-value small, .sales-stat-card.profit .sales-stat-value > span { color: #5a8b78; }
.sales-stat-card.profit .sales-stat-foot { color: #668d7d; }
.sales-amount { color: #344b5d; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.015em; white-space: nowrap; }
.sales-amount.negative, .sales-stat-value.negative, .sales-stat-card.profit .sales-stat-value.negative { color: #ae4d5b; }
.sales-amount small { color: #798694; font-size: .8125rem; font-weight: 450; }

.sale-status { display: inline-flex; align-items: center; justify-content: center; min-height: 27px; padding: 4px 9px; border-radius: 6px; color: #6e7d89; background: #eef2f5; font-size: .8125rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.sale-status.contracted { color: #4f73a1; background: #edf3fa; }
.sale-status.delivered { color: #2e7c63; background: #e7f4ec; }
.sale-status.cancelled { color: #84757c; background: #f2edef; }
.sales-summary-note { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 7px 16px; margin: 0 0 22px; padding: 13px 16px; border: 1px solid #e2e7eb; border-radius: 9px; background: #f8fafb; color: #74818d; font-size: .875rem; line-height: 1.7; }
.sales-summary-note p { margin: 0; }
.sales-summary-note strong { color: #586c7b; font-weight: 600; }
.sales-summary-note .sales-amount { color: #71808d; font-weight: 550; }

.sales-modal { width: min(860px, 100%); max-height: calc(100dvh - 48px); }
.sales-modal .modal-head { padding: 23px 27px; }
.sales-modal .modal-body { padding: 26px 27px; }
.sales-modal .modal-footer { padding: 17px 27px; }
.sales-modal .field-grid { gap: 18px 22px; }
.sales-modal .field input[type="number"] { font-variant-numeric: tabular-nums; }
.sales-modal .field input[type="date"] { font-variant-numeric: tabular-nums; }
.sale-form-section { margin-bottom: 25px; padding-bottom: 24px; border-bottom: 1px solid #e8edef; }
.sale-form-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.sale-section-title { margin: 0 0 14px; color: #344d5f; font-size: .9375rem; line-height: 1.6; font-weight: 650; letter-spacing: -.015em; }
.sale-section-note { margin: -5px 0 18px; color: #7c8996; font-size: .875rem; line-height: 1.75; word-break: keep-all; }
.sale-form-section > .field-grid:last-child { margin-bottom: 0; }
.sale-form-section > .field + .field { margin-top: 18px; }
.sale-actions { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.sale-actions .button { margin: 0; }
.sales-link-box { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 17px 18px; margin-bottom: 21px; border: 1px solid #d9e9e2; border-radius: 10px; background: #f4f9f6; color: #53796a; font-size: .875rem; line-height: 1.7; }
.sales-link-box .field { margin: 0; }
.sales-link-box .field label { color: #4b7365; }
.sales-link-box p { margin: 0; }
.sales-link-box strong { color: #376957; font-weight: 600; }
.sales-link-box .button, .sales-link-box .link-button { align-self: flex-start; }
.sales-info { margin: 0 0 20px; padding: 13px 16px; border: 1px solid #dce7ec; border-radius: 9px; background: #f3f8fa; color: #617c8d; font-size: .875rem; line-height: 1.75; }
.sales-info p { margin: 0; }
.sales-info p + p { margin-top: 5px; }
.sales-owner-note { margin: 9px 0 0; color: #7a8794; font-size: .875rem; line-height: 1.7; word-break: keep-all; }
.sales-owner-note strong { color: #526d76; font-weight: 600; }

.sales-calculation { margin: 0 0 22px; padding: 17px 20px; border: 1px solid #d4e5dd; border-radius: 11px; background: #f2f8f4; }
.calc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 7px 0; color: #668072; font-size: .875rem; line-height: 1.65; }
.calc-row > :first-child { min-width: 0; }
.calc-row > :last-child { flex-shrink: 0; color: #445f51; font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.calc-row .sales-amount.negative { color: #a6535f; }
.calc-total { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-top: 10px; padding: 16px 0 2px; border-top: 1px solid #d7e6dd; color: #3c6e59; font-size: .9375rem; font-weight: 650; line-height: 1.6; }
.calc-total > :last-child { min-width: 0; color: #1c765a; font-size: 1.5rem; font-weight: 720; line-height: 1.4; font-variant-numeric: tabular-nums; text-align: right; letter-spacing: -.035em; overflow-wrap: anywhere; }
.calc-total .negative { color: #ae4d5b; }
.calc-total small { color: #658a74; font-size: .875rem; font-weight: 450; letter-spacing: 0; }

.sales-history-list { margin: 0; padding: 0; list-style: none; }
.sales-history-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; padding: 15px 0; border-bottom: 1px solid #e9edef; font-size: .875rem; line-height: 1.7; }
.sales-history-row:first-child { padding-top: 0; }
.sales-history-row:last-child { padding-bottom: 0; border-bottom: 0; }
.sales-history-row p { margin: 0; }
.sales-history-row strong { color: #47606e; font-weight: 600; }
.sales-history-row time { color: #7f8c98; font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-history-row > div { min-width: 0; }

@media (min-width: 1600px) {
  .sales-stats-grid { gap: 20px; }
  .sales-stat-card { padding: 24px 25px 21px; }
}
@media (max-width: 1200px) {
  .sales-stats-grid { gap: 12px; }
  .sales-stat-card { padding: 19px 17px 17px; }
  .sales-stat-value { font-size: 1.5rem; }
}
@media (max-width: 1000px) and (min-width: 901px) {
  .sales-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .sales-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .sales-controls { gap: 12px; margin-bottom: 18px; }
  .sales-controls > div:not(.sales-tabs) { flex-wrap: wrap; }
  .sales-controls .sales-tabs { flex: 1 1 100%; order: 2; }
  .sales-tab { flex: 1; min-height: 40px; padding: 10px 12px; }
  .sales-controls input[type="month"] { width: 175px; font-size: 1rem; }
  .sales-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 15px; }
  .sales-stat-card { padding: 17px 14px 15px; border-radius: 11px; }
  .sales-stat-label { margin-bottom: 9px; }
  .sales-stat-value { gap: 3px; margin-bottom: 7px; font-size: clamp(1.125rem, 4.9vw, 1.5rem); letter-spacing: -.045em; }
  .sales-stat-value small, .sales-stat-value > span { font-size: .875rem; }
  .sales-summary-note { margin-bottom: 18px; padding: 12px 14px; }
  .sales-modal { width: 100%; max-height: calc(100dvh - 24px); }
  .sales-modal .modal-head { padding: 20px; }
  .sales-modal .modal-body { padding: 21px 20px; }
  .sales-modal .modal-footer { padding: 15px 20px; }
  .sales-modal .field-grid { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .sale-form-section { margin-bottom: 22px; padding-bottom: 21px; }
  .sales-calculation { padding: 15px 16px; }
  .calc-row { gap: 13px; }
  .calc-total { gap: 12px; padding-top: 14px; }
  .calc-total > :last-child { font-size: 1.375rem; }
  .sales-link-box { padding: 15px 16px; }
  .sale-actions { gap: 6px; }
  .sale-actions .button.small { padding: 7px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .sales-tab { transition: none; }
}
@media print {
  .sales-controls, .sale-actions { display: none; }
  .sales-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sales-stat-card { break-inside: avoid; }
  .sales-stat-card.profit, .sales-calculation { background: #fff; }
}

.sale-commission-item { border:1px solid var(--border,#dbe5e8);border-radius:10px;padding:16px;margin:12px 0;background:#fbfdfd; }
.sale-commission-item h4 { margin:0 0 14px;font-size:14px;color:#183a40; }
.commission-breakdown { font-size:11px;line-height:1.8;margin:8px 0;white-space:normal;min-width:190px; }
.commission-breakdown > div { display:flex;justify-content:space-between;gap:12px; }
.commission-breakdown strong { white-space:nowrap; }
#sale-split-commission[hidden],#sale-total-commission[hidden] { display:none; }
