/* Clozit admin — Sales (#514 slice 7). Layout and tokens from the owner-approved Portal-Sales mockup. */

.sales-main { gap: 20px; }
.sales-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: flex; gap: 6px; background: var(--hairline); padding: 4px; border-radius: 12px; }
.seg-btn { height: 34px; padding: 0 12px; border: none; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 700; color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: #FFFFFF; }
.sales-select { min-width: 0; height: 42px; }
.sales-custom { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; justify-content: flex-end; }
.sales-date-field { display: flex; flex-direction: column; gap: 4px; }
.sales-date { height: 42px; width: 160px; }
.sales-range-note { flex: 1 1 100%; margin: 0; text-align: right; font-size: 13px; color: var(--danger); }
.kpi-failed { grid-column: 1 / -1; background: var(--card); border-radius: 16px; }
.sales-csv { height: 42px; padding: 0 16px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 28px; font-weight: 600; }
.kpi-cmp { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.kpi-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kpi-row b { white-space: nowrap; }
.kpi-line { line-height: 1.45; }
.kpi-line b { white-space: nowrap; } /* "▼ 7.1%" never splits; the words beside it may wrap */

/* ---------- chart panels ---------- */
.panel { margin: 0; background: var(--card); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: baseline; }
.panel-title { margin: 0; font-size: 16px; font-weight: 700; }
.panel-note { font-size: 12px; color: var(--ink-2); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key-swatch { width: 10px; height: 10px; border-radius: 3px; }
.key-market { background: #2F78B0; }
.key-popup { background: #C2603F; }
.key-offline { background: #4F7A4A; }
.key-line { width: 16px; height: 2px; background: #2F78B0; }
.key-dash { width: 16px; height: 0; border-top: 2px dashed #8C8784; }
.readout { font-size: 13px; min-height: 18px; }
.chart-box { width: 100%; min-width: 0; }
.chart { display: block; font-family: var(--sans); }
.chart .bar { cursor: default; outline: none; }
.chart .bar:focus-visible .band { stroke: var(--ink); stroke-width: 2; }
.chart .hit { outline: none; }
.chart .hit:focus-visible { stroke: var(--ink); stroke-width: 2; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* A one-day range has no period to compare a line against: the by-day table takes the row alone. */
.pair.pair-single { grid-template-columns: minmax(0, 1fr); }
.scroll-x { overflow-x: auto; }

/* ---------- last 7 days ---------- */
.week-table { min-width: 400px; }
.week-grid { display: grid; grid-template-columns: 1.2fr 0.7fr 1fr 1fr 1fr 0.8fr 0.8fr; gap: 8px; padding: 9px 0; font-size: 13px; border-bottom: 1px solid var(--hairline); }
.week-grid.table-head { padding: 0 0 8px; font-size: 11px; }

/* ---------- transactions ---------- */
.tx-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tx-search { flex: 0 1 260px; height: 38px; border-radius: 10px; }
.tx-search input { font-size: 13px; }
.chip-sm { height: 34px; padding: 0 12px; font-size: 12px; }
/* The mockup's ten columns, with fixed widths where the content is fixed (a time, a ref, a price,
   the 128px pill) so the whole row fits a 1280px window beside the sidebar: 946px. Narrower, the
   box scrolls. */
.tx-table { min-width: 980px; }
.tx-grid { display: grid; grid-template-columns: 108px 64px 96px minmax(100px, 1.6fr) minmax(72px, 0.9fr) minmax(72px, 0.9fr) 52px 64px 72px 64px 128px; gap: 8px; padding: 11px 0; font-size: 13px; border-bottom: 1px solid var(--hairline); align-items: center; }
.tx-grid.table-head { padding: 0 0 10px; font-size: 11px; align-items: end; }
.tx-grid > div:first-child { white-space: nowrap; }
.ch { display: flex; align-items: center; gap: 6px; }
.ch-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.ch-marketplace { background: #2F78B0; }
.ch-popup { background: #C2603F; }
.ch-offline { background: #4F7A4A; }
.tx-pill { width: 128px; letter-spacing: 0.6px; padding: 4px 0; }
.tx-completed { background: #D8F3DC; color: #1E4D38; }
.tx-awaiting_approval { background: #D4E6EB; color: #25475C; }
.tx-in_progress { background: #FFF3CD; color: #5C4100; }
.tx-cancelled { background: #F6DED6; color: #7A2E17; }
.tx-released { background: #EFEEEA; color: #48312A; }
.tx-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); }
.tx-pager { display: flex; gap: 8px; }
.tx-pager .btn:disabled { color: var(--outline); }

@media (max-width: 1100px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 24px; }
  .panel { padding: 16px 14px; }
  .sales-controls { width: 100%; }
  .seg { flex: 1 1 100%; }
  .seg-btn { flex: 1 1 0; }
  .sales-select { flex: 1 1 auto; }
  .tx-tools { width: 100%; }
  .tx-search { flex: 1 1 100%; }
}
