:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --border: #334155;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

/* --- Login --- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#login-form {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border);
}
#login-form h1 { font-size: 18px; margin: 0 0 8px; }
#login-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}
#login-form button {
  background: var(--accent);
  color: #0f172a;
  border: none;
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.error { color: var(--red); font-size: 13px; min-height: 16px; margin: 0; }

/* --- App --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 20px; margin: 0; }
.header-right { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 14px; }
.header-right button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 16px 28px;
}
.toolbar input[type="date"] {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 6px;
}
.toolbar select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
}
.toolbar button {
  background: var(--surface-2);
  color: var(--text);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

table { width: 100%; border-collapse: collapse; padding: 0 28px; }
#offers-table { margin: 0 28px; width: calc(100% - 56px); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--surface); }
tr { cursor: pointer; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-PENDING_APPROVAL { background: rgba(251,191,36,0.15); color: var(--amber); }
.badge-QUEUED_FOR_SEND, .badge-SENT { background: rgba(56,189,248,0.15); color: var(--accent); }
.badge-ACCEPTED { background: rgba(74,222,128,0.15); color: var(--green); }
.badge-REJECTED, .badge-BLOCKED, .badge-DEAD, .badge-WITHDRAWN { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-COUNTERED { background: rgba(148,163,184,0.15); color: var(--text-dim); }

#empty-state { text-align: center; color: var(--text-dim); padding: 40px; }

/* --- Modal --- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer;
}
.modal-content h2 { margin-top: 0; }
.detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row span:first-child { color: var(--text-dim); }
.block-reasons { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); border-radius: 8px; padding: 12px; margin: 12px 0; font-size: 13px; }
.block-reasons li { margin: 4px 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 10px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; }
.btn-approve { background: var(--green); color: #052e16; }
.btn-reject { background: var(--red); color: #450a0a; }
.doc-link { color: var(--accent); text-decoration: none; }

/* --- Nav --- */
.nav-tabs { display: flex; gap: 4px; padding: 0 28px; border-bottom: 1px solid var(--border); }
.nav-tabs button {
  background: none; border: none; color: var(--text-dim); padding: 12px 16px;
  font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent;
}
.nav-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* --- Dashboard --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; padding: 20px 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.stat-card .stat-num { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat-card.warn .stat-num { color: var(--amber); }
.stat-card.error .stat-num { color: var(--red); }

/* --- Bulk actions --- */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 28px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.bulk-bar span { color: var(--text-dim); font-size: 13px; }
.bulk-bar button { background: var(--surface-2); color: var(--text); border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.bulk-bar .btn-approve { background: var(--green); color: #052e16; font-weight: 600; }
.bulk-bar .btn-reject, .bulk-bar .btn-dead { background: var(--red); color: #450a0a; font-weight: 600; }
td.checkbox-col, th.checkbox-col { width: 32px; }

/* --- Health view --- */
.health-table td, .health-table th { font-size: 13px; }
.alert-row td { color: var(--amber); }
.section-title { padding: 20px 28px 4px; font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

/* --- Agents view --- */
.hint { padding: 0 28px 12px; font-size: 13px; color: var(--text-dim); max-width: 720px; }
.agent-email-input { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 220px; }
.agent-email-saved { color: var(--green); font-size: 12px; }

/* --- Detail modal extras --- */
.modal-content.wide { width: min(720px, 94vw); }
.property-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; }
.timeline { list-style: none; padding: 0; margin: 8px 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline .ts { color: var(--text-dim); font-size: 11px; }
.modal-actions.wrap { flex-wrap: wrap; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-dead { background: var(--red); color: #450a0a; }

/* Admin view */
.admin-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 16px; align-items: start; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.admin-list li:hover { background: #f3f4f6; }
#admin-editor { width: 100%; min-height: 420px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; box-sizing: border-box; }
#admin-errors { white-space: pre-wrap; }
@media (max-width: 800px) { .admin-grid { grid-template-columns: 1fr; } }

/* Offer history: collapsed by default in the detail modal */
details.history { margin-top: 16px; }
details.history > summary { cursor: pointer; color: var(--muted, #9ca3af); font-size: 13px; }

/* --- Dashboard --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; padding: 24px 28px 8px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; border-top: 3px solid var(--surface-2); }
.kpi-link { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.kpi-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.kpi-value { font-size: 32px; font-weight: 700; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-dim); }
.kpi-accent { border-top-color: var(--accent); }
.kpi-amber { border-top-color: var(--amber); }
.kpi-amber .kpi-value { color: var(--amber); }
.kpi-red { border-top-color: var(--red); }
.kpi-red .kpi-value { color: var(--red); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 8px 28px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.panel-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 14px; }
.dash-systems { margin: 8px 28px 28px; }

.bar-row { display: grid; grid-template-columns: 140px 1fr 60px; align-items: center; gap: 12px; padding: 7px 0; cursor: pointer; }
.bar-row:hover .bar-label { color: var(--text); }
.bar-label { font-size: 13px; color: var(--text-dim); }
.bar-track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; }
.bar-accent { background: var(--accent); }
.bar-amber { background: var(--amber); }
.bar-red { background: var(--red); }
.bar-green { background: var(--green); }
.bar-num { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }

.reason-row { display: flex; gap: 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.reason-row:last-child { border-bottom: none; }
.reason-num { min-width: 52px; text-align: right; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }

.system-row { display: flex; flex-wrap: wrap; gap: 12px; }
.system-pill { display: flex; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; min-width: 200px; }
.system-name { font-size: 13px; font-weight: 600; }
.system-sub { font-size: 12px; color: var(--text-dim); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

@media (max-width: 800px) {
  .dash-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 50px; }
}

/* --- Offer detail (2026-09-27 redesign) --- */
.modal-content.wide { width: min(780px, 94vw); padding: 0 0 24px; }
.modal-content.wide > #modal-body { padding: 0 28px; }
.modal-content.wide .modal-close { z-index: 2; background: rgba(15,23,42,0.75); border-radius: 50%; width: 34px; height: 34px; line-height: 30px; padding: 0; }
.modal-content.wide .property-photo { display: block; width: calc(100% + 56px); margin: 0 -28px 20px; max-height: 260px; border-radius: 12px 12px 0 0; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 0 0 18px; padding-right: 40px; }
#modal-body > .detail-head:first-child { padding-top: 28px; }
.detail-head h2 { font-size: 22px; margin: 0 0 4px; }
.detail-sub { color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.detail-head .badge { white-space: nowrap; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.hero-stat { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.hero-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.hero-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.hero-accent { border-color: rgba(56,189,248,0.5); }
.hero-accent .hero-value { color: var(--accent); }
.hero-green .hero-value { color: var(--green); }
.hero-red .hero-value { color: var(--red); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.chip-green { background: rgba(74,222,128,0.15); color: var(--green); }
.chip-accent { background: rgba(56,189,248,0.15); color: var(--accent); }
.chip-amber { background: rgba(251,191,36,0.15); color: var(--amber); }
.chip-red { background: rgba(248,113,113,0.15); color: var(--red); }
.detail-section { border: 1px solid var(--border); border-radius: 10px; padding: 4px 16px 8px; margin-bottom: 14px; overflow: hidden; }
.detail-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); padding: 12px 0 6px; }
.calc-line { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 8px 0; border-bottom: 1px solid rgba(51,65,85,0.6); font-size: 14px; }
.calc-line:last-child { border-bottom: none; }
.calc-label { color: var(--text-dim); }
.calc-label small { display: block; font-size: 12px; color: var(--text-dim); opacity: 0.8; margin-top: 2px; }
.calc-value { text-align: right; font-variant-numeric: tabular-nums; }
.calc-value small { font-size: 12px; color: var(--text-dim); font-weight: 400; margin-left: 8px; }
.calc-sub .calc-label, .calc-sub .calc-value { color: var(--text); font-weight: 600; }
.calc-total { background: rgba(56,189,248,0.08); margin: 6px -16px -8px; padding: 12px 16px; border-bottom: none; }
.calc-total .calc-label { color: var(--text); font-weight: 600; }
.calc-total .calc-value { color: var(--accent); font-size: 18px; font-weight: 700; }
.muted { color: var(--text-dim); }
details.collapsible > summary { cursor: pointer; padding: 12px 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
details.collapsible > summary small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; }
.comps-table { width: 100%; padding: 0; margin: 0 0 6px; }
.comps-table th, .comps-table td { padding: 7px 6px; font-size: 12px; }
.comps-table tr { cursor: default; }
.comps-table tr:hover td { background: transparent; }
.comps-table .num { text-align: right; font-variant-numeric: tabular-nums; }
details.remarks { padding: 8px 0 4px; font-size: 13px; }
details.remarks summary { cursor: pointer; color: var(--text-dim); }
details.remarks p { line-height: 1.55; color: var(--text); margin: 8px 0 0; }
details.history { border-top: 1px solid var(--border); padding-top: 12px; }
details.history > summary { margin-bottom: 6px; }
.btn-small { background: var(--accent); color: #0f172a; border: none; padding: 5px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; }
.doc-link { font-weight: 600; }
@media (max-width: 600px) {
  .modal-content.wide > #modal-body { padding: 0 16px; }
  .modal-content.wide .property-photo { width: calc(100% + 32px); margin: 0 -16px 16px; }
  .detail-head { flex-direction: column; gap: 8px; }
  .calc-line { flex-wrap: wrap; }
}

/* Offer queue pagination */
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 14px 28px 28px; color: var(--text-dim); font-size: 13px; }
.pager-btns { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pager button { background: var(--surface); color: var(--text); border: 1px solid var(--border); min-width: 34px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pager button:hover:not(:disabled) { border-color: var(--accent); }
.pager button.active { background: var(--accent); color: #0f172a; border-color: var(--accent); font-weight: 600; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager-gap { padding: 0 4px; }

.tag-special { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: rgba(74,222,128,0.15); color: var(--green); white-space: nowrap; }
.tag-review-multi, .tag-review-contractor { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag-review-multi { background: rgba(167,139,250,0.18); color: #8b5cf6; }
.tag-review-contractor { background: rgba(251,146,60,0.18); color: #ea580c; }
.review-facts { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.review-notes { font-size: 11px; color: var(--amber); margin-top: 2px; }
.kpi-green { border-top-color: var(--green); }
.kpi-green .kpi-value { color: var(--green); }

#search-input { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; min-width: 280px; font-size: 14px; }
#search-input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 600px) { #search-input { min-width: 0; width: 100%; } }

/* Review tab (Card 12) */
#review-table ul.reasons { margin: 0; padding-left: 16px; font-size: 13px; }
#review-table td.nowrap { white-space: nowrap; }
#review-table td.nowrap button { margin: 2px 0; }

/* --- Hot list (2026-10-03) --- */
.hot-wrap { padding: 20px 28px 40px; max-width: 1500px; }
.hot-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hot-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.hot-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.hot-kpis { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.hot-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.hot-kpi .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.hot-kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hot-kpi.due .v { color: var(--red); }
.hot-kpi.counter .v { color: var(--amber); }
.hot-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.hot-filters button { background: transparent; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.hot-filters button.on { background: var(--accent); border-color: var(--accent); color: #0f172a; font-weight: 600; }
.hot-list { display: flex; flex-direction: column; gap: 10px; }
.hot-card { display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(260px, 2fr) minmax(220px, 1fr); gap: 18px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.hot-card.is-due { border-left-color: var(--red); }
.hot-card.is-positive { border-left-color: var(--green); }
.hot-card.is-due.is-positive { border-left-color: var(--red); }
.hot-addr { font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none; }
.hot-addr:hover { color: var(--accent); }
.hot-money { margin-top: 6px; font-size: 13px; color: var(--text-dim); line-height: 1.6; font-variant-numeric: tabular-nums; }
.hot-money b { color: var(--text); font-weight: 600; }
.hot-counter { display: inline-block; margin-top: 6px; background: rgba(251,191,36,.12); color: var(--amber); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.hot-agent { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.hot-agent b { color: var(--text); font-weight: 600; }
.hot-chip { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-right: 6px; vertical-align: 1px; }
.hot-chip.positive { background: rgba(74,222,128,.15); color: var(--green); }
.hot-chip.maybe { background: rgba(251,191,36,.15); color: var(--amber); }
.hot-chip.seller { background: rgba(96,165,250,.15); color: #60a5fa; }
.hot-card.is-seller { border-left-color: #60a5fa; }
.hot-card.is-seller.is-due { border-left-color: var(--red); }
.hot-kpi.won .v { color: var(--green); }
.hot-status { display: inline-block; margin-top: 6px; background: var(--surface-2); color: var(--text-dim); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.hot-status.bad { background: rgba(248,113,113,.12); color: var(--red); }
.hot-sync { margin: 14px 2px 0; font-size: 12px; color: var(--text-dim); }
.hot-quote { font-size: 13.5px; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.hot-quote.open { -webkit-line-clamp: unset; }
.hot-when { margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.hot-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hot-due { font-size: 13px; font-weight: 600; text-align: right; }
.hot-due.late { color: var(--red); }
.hot-due small { display: block; font-weight: 400; color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.hot-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.hot-actions a, .hot-actions button { font-size: 12.5px; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; cursor: pointer; line-height: 1.2; }
.hot-actions .primary { background: var(--green); border-color: var(--green); color: #052e16; font-weight: 600; }
.hot-actions .ghost-danger { background: transparent; color: var(--red); border-color: rgba(248,113,113,.4); }
.hot-reply-box { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 12px; }
.hot-reply-box textarea { width: 100%; min-height: 130px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font: inherit; font-size: 13.5px; }
.hot-reply-box .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.hot-empty { padding: 40px; text-align: center; color: var(--text-dim); background: var(--surface); border-radius: 10px; border: 1px dashed var(--border); }
@media (max-width: 900px) {
  .hot-wrap { padding: 16px; }
  .hot-kpis { grid-template-columns: repeat(2, 1fr); }
  .hot-card { grid-template-columns: 1fr; gap: 10px; }
  .hot-side { align-items: stretch; }
  .hot-due { text-align: left; }
  .hot-actions { justify-content: flex-start; }
}
.zillow-link { font-size: 11px; margin-left: 4px; color: var(--accent); white-space: nowrap; }
.tag-review-raise { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: rgba(34,197,94,0.18); color: #16a34a; }
.raise-btn { padding: 2px 8px; font-size: 11px; margin-left: 6px; }

/* ======================================================================================================
   Polish (2026-10-10: "offer system ko professional, clean, attractive") -- same dark theme, refined.
   Overrides only; delete this block to return to the previous look.
   ====================================================================================================== */
:root {
  --bg: #0b1220;
  --surface: #121b2d;
  --surface-2: #1b2640;
  --text: #e6edf7;
  --text-dim: #8fa3c0;
  --accent: #3fb6f5;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --border: #22304a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.18);
}
body { font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(63,182,245,0.07), transparent 60%), var(--bg); background-attachment: fixed; }
::selection { background: rgba(63,182,245,0.35); }
* { scrollbar-width: thin; scrollbar-color: #2b3a57 transparent; }

/* login */
#login-form { width: 360px; padding: 36px 32px; border-radius: 16px; box-shadow: var(--shadow); text-align: center; background: linear-gradient(180deg, #16213a, #121b2d); }
#login-form .login-logo { width: 56px; height: 56px; margin: 0 auto 6px; display: block; border-radius: 14px; box-shadow: 0 6px 20px rgba(225,29,29,0.35); }
#login-form h1 { font-size: 20px; margin: 6px 0 0; }
#login-form .login-sub { margin: 0 0 10px; color: var(--text-dim); font-size: 13px; }
#login-form input { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; transition: border-color .15s, box-shadow .15s; }
#login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63,182,245,0.18); }
#login-form button { border-radius: 10px; padding: 11px; font-size: 14px; transition: filter .15s; }
#login-form button:hover { filter: brightness(1.08); }

/* header + nav */
header { position: sticky; top: 0; z-index: 20; padding: 12px 28px; background: rgba(11,18,32,0.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand-wrap { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 15px; letter-spacing: 0.01em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 4px 14px rgba(225,29,29,0.35); }
.brand b { color: var(--accent); font-weight: 700; }
.brand-sep { width: 1px; height: 22px; background: var(--border); }
header h1 { font-size: 17px; font-weight: 600; color: var(--text); }
.header-right #whoami { background: var(--surface); border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; }
.header-right button { border-radius: 8px; transition: background .15s, border-color .15s; }
.header-right button:hover { background: var(--surface-2); border-color: #33476b; }
.nav-tabs { position: sticky; top: 55px; z-index: 19; background: rgba(11,18,32,0.85); backdrop-filter: blur(10px); gap: 2px; padding: 6px 24px; overflow-x: auto; }
.nav-tabs button { border: none; border-radius: 8px; padding: 8px 14px; font-weight: 500; color: var(--text-dim); transition: background .15s, color .15s; white-space: nowrap; border-bottom: none; }
.nav-tabs button:hover { background: var(--surface); color: var(--text); }
.nav-tabs button.active { background: rgba(63,182,245,0.12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(63,182,245,0.35); }

/* toolbar / filters */
.toolbar { margin: 16px 28px 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); gap: 10px 14px; flex-wrap: wrap; align-items: center; }
.toolbar label { color: var(--text-dim); font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.toolbar select, .toolbar input, .toolbar input[type="date"], .toolbar input[type="search"] { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; transition: border-color .15s, box-shadow .15s; }
.toolbar select:focus, .toolbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63,182,245,0.15); }
.toolbar input[type="search"] { min-width: 260px; }
.toolbar button, #refresh-btn { background: var(--surface-2); border: 1px solid #2c3c5c; color: var(--text); border-radius: 8px; padding: 7px 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.toolbar button:hover, #refresh-btn:hover { background: #24324f; }

/* tables as cards */
#offers-table, .health-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: var(--shadow); }
.health-table { margin: 0 28px; width: calc(100% - 56px); }
th { background: #0f1828; color: var(--text-dim); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; padding: 11px 12px; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid #1a2540; padding: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tr:hover td { background: #16213a; }
#offers-table td:nth-child(2) { font-weight: 500; }
td.checkbox-col input, th.checkbox-col input { accent-color: var(--accent); width: 15px; height: 15px; }

/* badges */
.badge { border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; }
.badge-PENDING_APPROVAL { border-color: rgba(251,191,36,0.3); }
.badge-QUEUED_FOR_SEND, .badge-SENT { border-color: rgba(63,182,245,0.3); }
.badge-ACCEPTED { border-color: rgba(74,222,128,0.3); }
.badge-REJECTED, .badge-BLOCKED, .badge-DEAD, .badge-WITHDRAWN { border-color: rgba(248,113,113,0.3); }
.badge-COUNTERED { background: rgba(167,139,250,0.14); color: #c4b5fd; border-color: rgba(167,139,250,0.3); }

/* buttons */
.btn-approve, .btn-reject, .btn-dead, .btn-secondary, .btn-small { border-radius: 8px; transition: filter .15s, transform .05s; }
.btn-approve:hover, .btn-reject:hover, .btn-dead:hover, .btn-secondary:hover, .btn-small:hover { filter: brightness(1.1); }
.btn-approve:active, .btn-reject:active, .btn-dead:active { transform: translateY(1px); }
.bulk-bar { margin: 0 28px 12px; padding: 10px 14px; background: linear-gradient(90deg, rgba(63,182,245,0.12), rgba(63,182,245,0.04)); border: 1px solid rgba(63,182,245,0.35); border-radius: var(--radius); }
.bulk-bar button { border-radius: 8px; }

/* dashboard */
.kpi { border-radius: 14px; background: linear-gradient(180deg, #152037, #121b2d); box-shadow: var(--shadow); border-top-width: 3px; }
.kpi-value { font-size: 30px; letter-spacing: -0.01em; }
.kpi-link:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.panel { border-radius: 14px; box-shadow: var(--shadow); background: linear-gradient(180deg, #141e33, #121b2d); }
.bar-track { background: #0d1525; height: 9px; }
.system-pill { border-radius: 12px; padding: 10px 14px; background: #0f1828; }
.stat-card { border-radius: 14px; box-shadow: var(--shadow); }
.section-title { font-weight: 600; letter-spacing: 0.06em; }

/* modal */
.modal { background: rgba(3,7,15,0.62); backdrop-filter: blur(4px); }
.modal-content { border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 30px 80px rgba(0,0,0,0.5); background: linear-gradient(180deg, #152037, #111a2c); }
.modal-close { border-radius: 50%; transition: background .15s; }
.modal-close:hover { background: var(--surface-2); }
.property-photo { border-radius: 12px; }

/* pager, links, misc */
.pager button { border-radius: 8px; transition: background .15s; }
a { color: var(--accent); }
.zillow-link { opacity: 0.85; }
.zillow-link:hover { opacity: 1; }

/* the admin list had light-theme colours inside the dark app */
.admin-list li { border-bottom-color: var(--border); border-radius: 8px; }
.admin-list li:hover { background: var(--surface-2); }
#admin-editor { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }

@media (max-width: 800px) {
  header { padding: 10px 14px; }
  .brand span, .brand-sep { display: none; }
  .nav-tabs { top: 51px; padding: 6px 10px; }
  .toolbar, .bulk-bar { margin-left: 12px; margin-right: 12px; }
  #offers-table, .health-table { margin: 0 12px; width: calc(100% - 24px); }
}
.badge { white-space: nowrap; }
#offers-table, .health-table { padding: 0; }
#offers-table td:last-child { color: var(--text-dim); }

/* 2026-10-13: the offer detail card opened under the sticky header + tabs (z-index 20/19 vs 10) so its top and the
   close button were hidden. The overlay now sits above them, the card starts below the header, and the close button
   stays pinned while the card scrolls. */
.modal { z-index: 60; align-items: flex-start; padding: 112px 16px 24px; }
.modal-content { max-height: calc(100vh - 136px); }
.modal-content.wide .modal-close { position: sticky; top: 12px; float: right; margin: 12px 12px -46px 0; z-index: 5; color: var(--text); }
@media (max-width: 700px) { .modal { padding: 96px 8px 12px; } .modal-content { max-height: calc(100vh - 108px); } }

/* Off-market offer form (2026-10-14) */
.om-modal { width: min(660px, 94vw); padding: 24px 26px 0; }
.om-modal h2 { margin: 0 32px 6px 0; font-size: 20px; }
.om-intro { margin: 0 0 6px; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.om-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px; }
.om-form .om-section { grid-column: 1 / -1; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.om-form .om-section:first-child { margin-top: 4px; }
.om-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); min-width: 0; }
.om-form .om-hint { font-weight: 400; opacity: .8; }
.om-form .om-l { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.om-form input:not([type=checkbox]), .om-form select { font: inherit; font-size: 14px; font-weight: 400; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; box-sizing: border-box; }
.om-form input::placeholder { color: #64748b; }
.om-form input:focus, .om-form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.18); }
.om-form .om-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.om-form .om-check input { width: 16px; height: 16px; accent-color: var(--green); }
.om-form .om-note { margin: 0; font-size: 12.5px; color: var(--amber); }
.om-span1 { grid-column: span 1; } .om-span2 { grid-column: span 2; } .om-span3 { grid-column: span 3; } .om-span6 { grid-column: 1 / -1; }
.om-form .hidden { display: none !important; }
.om-footer { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 8px -26px 0; padding: 14px 26px 18px; background: var(--surface); border-top: 1px solid var(--border); }
.om-footer .btn-approve { padding: 10px 20px; border: 0; border-radius: 8px; font-weight: 700; cursor: pointer; }
.om-footer .btn-approve:disabled { opacity: .6; cursor: wait; }
@media (max-width: 620px) {
  .om-modal { padding: 20px 16px 0; }
  .om-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .om-span1, .om-span2 { grid-column: span 1; } .om-span3 { grid-column: 1 / -1; }
  .om-footer { margin: 8px -16px 0; padding: 12px 16px 16px; }
  .om-footer .btn-approve { width: 100%; }
}

/* ======================================================================================================
   Light theme + left sidebar (2026-10-16: "UI acha karo, header side bar mein, background white, professional,
   attractive"). Overrides only -- delete this block (and restore nav.js) to return to the dark look.
   ====================================================================================================== */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --text-dim: #64748b;
  --accent: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --border: #e3e8ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 4px 16px rgba(15,23,42,0.05);
}
body { background: var(--bg); color: var(--text); }
::selection { background: rgba(37,99,235,0.18); }
* { scrollbar-color: #cbd5e1 transparent; }

/* login */
#login-screen { background: radial-gradient(900px 500px at 15% 0%, rgba(37,99,235,0.10), transparent 60%), linear-gradient(180deg, #f8fafc, #eef2f8); }
#login-form { background: #fff; box-shadow: 0 20px 50px rgba(15,23,42,0.10); border-color: var(--border); }
#login-form input { background: #f8fafc; }
#login-form input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
#login-form button, .btn-small, .pager button.active, .hot-filters button.on { color: #fff; }

/* the in-app tab strip is now the sidebar (nav.js) */
#app-screen > .nav-tabs { display: none; }
header { background: rgba(255,255,255,0.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 14px 28px; box-shadow: 0 1px 0 rgba(15,23,42,0.02); }
header .brand, header .brand-sep { display: none; }
header h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.header-right #whoami { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }
.header-right button { background: #fff; color: var(--text); border-color: var(--border); }
.header-right button:hover { background: var(--surface-2); border-color: #cfd8e3; }

/* toolbar / filters */
.toolbar { background: #fff; box-shadow: var(--shadow); }
.toolbar select, .toolbar input, .toolbar input[type="date"], .toolbar input[type="search"] { background: #fff; }
.toolbar select:focus, .toolbar input:focus, #search-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.toolbar button, #refresh-btn { background: #fff; border-color: var(--border); color: var(--text); }
.toolbar button:hover, #refresh-btn:hover { background: var(--surface-2); }
#search-input { background: #fff; }

/* tables */
th { background: #f8fafc; color: #64748b; }
td { border-bottom-color: #eef2f6; }
tr:hover td { background: #f6f9ff; }
.calc-line { border-bottom-color: #eef2f6; }

/* badges + chips: readable on white */
.badge-PENDING_APPROVAL { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.badge-QUEUED_FOR_SEND, .badge-SENT { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.badge-ACCEPTED { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.badge-REJECTED, .badge-BLOCKED, .badge-DEAD, .badge-WITHDRAWN { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.badge-COUNTERED { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.chip { background: var(--surface-2); color: var(--text); }
.chip-green, .hot-chip.positive, .tag-special { background: #dcfce7; color: #15803d; }
.chip-accent { background: #dbeafe; color: #1d4ed8; }
.chip-amber, .hot-chip.maybe, .hot-counter { background: #fef3c7; color: #92400e; }
.chip-red, .hot-status.bad { background: #fee2e2; color: #b91c1c; }
.hot-chip.seller { background: #e0f2fe; color: #0369a1; }

/* buttons */
.btn-approve, .bulk-bar .btn-approve, .hot-actions .primary, .act .ok { background: var(--green); color: #fff; }
.btn-reject, .btn-dead, .bulk-bar .btn-reject, .bulk-bar .btn-dead { background: var(--red); color: #fff; }
.btn-secondary, .bulk-bar button, .hot-actions a, .hot-actions button { background: #fff; color: var(--text); border: 1px solid var(--border); }
.bulk-bar { background: linear-gradient(90deg, #eff6ff, #f8fbff); border-color: #bfdbfe; }

/* dashboard cards */
.kpi, .panel, .stat-card, .hot-kpi, .hot-card { background: #fff; box-shadow: var(--shadow); }
.kpi-link:hover { box-shadow: 0 10px 28px rgba(15,23,42,0.10); }
.bar-track { background: #eef2f7; }
.system-pill { background: #f8fafc; }
.hero-stat { background: #f8fafc; }
.hero-accent { border-color: #bfdbfe; }
.calc-total { background: #eff6ff; }
.block-reasons { background: #fef2f2; border-color: #fecaca; }

/* modal */
.modal { background: rgba(15,23,42,0.40); padding-top: 72px; }
.modal-content { background: #fff; box-shadow: 0 30px 80px rgba(15,23,42,0.22); }
.modal-content.wide .modal-close { background: rgba(255,255,255,0.92); box-shadow: 0 2px 8px rgba(15,23,42,0.15); }

/* forms inside the app */
.agent-email-input, .hot-reply-box textarea, #admin-editor, .om-form input:not([type=checkbox]), .om-form select { background: #fff; }
.om-form input::placeholder { color: #94a3b8; }
.hot-empty { background: #fff; }

@media (max-width: 900px) {
  header { position: static; }
}

/* Agent block list (2026-10-16) */
.bl-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 28px 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.bl-add input, .bl-add select { background: #fff; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; }
.bl-add #bl-ids { min-width: 220px; } .bl-add #bl-names { min-width: 240px; } .bl-add #bl-reason { min-width: 220px; flex: 1; }
#bl-table { margin-bottom: 24px; }
@media (max-width: 800px) { .bl-add { margin: 0 12px 12px; } }
