/* ════════════════════════════════════════════════════════════
   Nexunova RMS — Sale Modal + Schedule Engine Styles v1.0
   Append to: css/components.css (or load as separate sheet)
════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   SELL MODAL — Layout
══════════════════════════════════════════════ */
.sell-md .mb.sell-mb {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  max-height: 78vh;
  overflow: hidden;
}

.sell-left {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--canvas);
}

.sell-right {
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}

/* ── Section blocks in left panel ── */
.sell-sec {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line2);
}
.sell-sec:last-child { border-bottom: none; margin-bottom: 0; }

.sell-sec-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--t4);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Form row helpers ── */
.fg-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.fg-row .fg { margin-bottom: 0; }
.fg-2 { flex: 1; min-width: 0; }
.fg-3 { flex: 1; min-width: 0; }
.fg-4 { flex: 1; min-width: 0; }
.fg   { margin-bottom: 8px; }

.fl {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t3);
  margin-bottom: 4px;
}
.inp {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--line);
  border-radius: var(--rm);
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
.inp.mono  { font-family: var(--mono); }

/* ══════════════════════════════════════════════
   DOWN PAYMENT ROWS
══════════════════════════════════════════════ */
.dp-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--rm);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.dp-row:hover { border-color: var(--brand3); }
.dp-row .fg-row { margin-bottom: 0; }

/* ══════════════════════════════════════════════
   KPI STRIP
══════════════════════════════════════════════ */
.sell-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex-shrink: 0;
}
.sell-kpi {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--brand);
  border-radius: var(--rm);
  padding: 10px 12px;
  transition: border-bottom-color 0.2s;
}
.skpi-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--t4);
  margin-bottom: 5px;
}
.skpi-val {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════
   SCHEDULE PREVIEW TABLE
══════════════════════════════════════════════ */
.sell-sched-hd {
  font-size: 11px;
  font-weight: 700;
  color: var(--t2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line2);
  flex-shrink: 0;
}

.sell-sched-wrap {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--rm);
  background: var(--canvas);
  min-height: 120px;
}

.sell-sched-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--t4);
}

/* ── Validation error box ── */
.sell-err-box {
  background: var(--err-bg);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--rm);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--err);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ══════════════════════════════════════════════
   SCHEDULE TABLE  (shared: modal preview + unit detail)
══════════════════════════════════════════════ */
.ss-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.ss-tbl thead th {
  background: var(--surface2);
  padding: 7px 10px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t3);
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ss-tbl thead th:first-child { border-radius: var(--rs) 0 0 0; }
.ss-tbl thead th:last-child  { border-radius: 0 var(--rs) 0 0; }
.ss-tbl thead th.r,
.ss-tbl tbody td.r { text-align: right; }

.ss-tbl tbody tr {
  border-bottom: 1px solid var(--line2);
  transition: background 0.1s;
}
.ss-tbl tbody tr:hover { background: var(--surface2); }
.ss-tbl tbody td {
  padding: 6px 10px;
  vertical-align: middle;
  color: var(--t2);
}

/* ── DP row highlight ── */
.ss-dp-row { background: rgba(99,102,241,0.04); }
.ss-dp-row:hover { background: rgba(99,102,241,0.08) !important; }
.ss-dp-lbl { font-weight: 600; color: var(--brand); }

/* ── Overdue row ── */
.ss-overdue-row { background: rgba(239,68,68,0.03); }
.ss-overdue-row:hover { background: rgba(239,68,68,0.06) !important; }

/* ── Col helpers ── */
.ss-no    { width: 32px; text-align: center; color: var(--t4); font-size: 10px; }
.ss-date  { white-space: nowrap; }
.ss-label { max-width: 160px; }
.ss-debit,
.ss-bal   { text-align: right; white-space: nowrap; }

/* ── Status badges ── */
.ss-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.ss-paid     { background: var(--ok-bg);   color: var(--ok);   }
.ss-partial  { background: var(--warn-bg); color: var(--warn); }
.ss-overdue  { background: var(--err-bg);  color: var(--err);  }
.ss-upcoming { background: var(--surface2);color: var(--t3);   }

/* ── Footer totals row ── */
.ss-total-row td {
  padding: 8px 10px;
  background: var(--surface2);
  border-top: 1.5px solid var(--line);
  font-size: 11px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE — Modal collapses to single column
   below 680px
══════════════════════════════════════════════ */
@media (max-width: 680px) {
  .sell-md .mb.sell-mb {
    grid-template-columns: 1fr;
    max-height: 85vh;
    overflow-y: auto;
  }
  .sell-left {
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-y: visible;
  }
  .sell-right {
    overflow-y: visible;
  }
  .sell-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
