/* ═══════════════════════════════════════════
   COLTONMKT DEALER DASHBOARD
   ═══════════════════════════════════════════ */

:root {
  --navy: #1F3864;
  --red: #C8372D;
  --teal: #4B8178;
  --dark: #1a1a1a;
  --gray-600: #555;
  --gray-400: #999;
  --gray-300: #bbb;
  --gray-200: #ddd;
  --gray-100: #f0f4f8;
  --white: #fff;
  --intel-bg: #f0f4f8;
  --intel-border: #b8c8d8;
  --card-border: #d0d5dd;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: #f5f6f8;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
}

/* ── PIN SCREEN ── */
.pin-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1F3864 0%, #2d5a9e 100%);
}
.pin-box {
  background: var(--white); border-radius: 12px; padding: 48px 40px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 380px; width: 90%;
}
.pin-logo { height: 40px; margin-bottom: 24px; }
.pin-box h2 { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.pin-box p { font-size: 14px; color: var(--gray-600); margin-bottom: 24px; }
#pin-input {
  width: 100%; padding: 14px 16px; font-size: 24px; font-family: var(--font);
  letter-spacing: 8px; text-align: center; border: 2px solid var(--gray-200);
  border-radius: 8px; outline: none; transition: border-color 0.2s;
}
#pin-input:focus { border-color: var(--navy); }
#pin-submit {
  width: 100%; padding: 14px; margin-top: 16px; font-size: 15px; font-weight: 600;
  font-family: var(--font); color: var(--white); background: var(--navy);
  border: none; border-radius: 8px; cursor: pointer; transition: background 0.2s;
}
#pin-submit:hover { background: #2d5a9e; }
.pin-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ── REPORT ── */
.report { max-width: 1080px; margin: 0 auto; padding: 24px 20px; padding-top: 80px; }

/* ── STICKY HEADER ── */
.report-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center;
  padding: 10px 24px; border-bottom: 3px solid var(--red);
  background: var(--white); box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-logo { height: 30px; }
.report-header h1 { font-size: 22px; font-weight: 700; color: var(--dark); }

/* ── DATE FILTER BAR ── */
.filter-bar {
  display: flex; gap: 6px; margin-bottom: 20px;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 8px; padding: 6px; width: fit-content;
}
.filter-pill {
  padding: 7px 16px; font-size: 13px; font-weight: 600; font-family: var(--font);
  border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--gray-600); transition: all 0.15s;
}
.filter-pill:hover { background: var(--gray-100); color: var(--dark); }
.filter-pill.active { background: var(--navy); color: var(--white); }

/* ── FILTER TRANSITION ── */
.leads-flash { opacity: 0.3; transition: opacity 0.15s; }
.leads-flash-done { opacity: 1; transition: opacity 0.25s; }

/* Section */
.section { margin-bottom: 32px; }
.section-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--gray-600); margin-bottom: 16px; }

/* ══════════════════════════════════════════
   LEAD CARDS
   ══════════════════════════════════════════ */
.lead-card {
  background: var(--white); border: 1.5px solid var(--card-border); border-radius: 8px;
  overflow: hidden; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
}
.lead-card.expanded { border-color: var(--navy); }

/* Summary row */
.lead-summary {
  display: grid;
  grid-template-columns: 44px 1fr auto 32px;
  padding: 10px 14px;
  font-size: 12px;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.lead-summary:hover { background: #fafbfc; }

/* Lead type badge */
.lead-type-badge {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.lead-type-badge .material-icons-round { font-size: 18px; color: var(--white); }
.badge-call { background: #4CAF50; }
.badge-email { background: #42A5F5; }
.badge-text { background: #AB47BC; }
.badge-missed { background: #EF5350; }

/* Lead summary info */
.lead-summary-info { min-width: 0; }
.lead-summary-primary {
  font-weight: 600; font-size: 13px; color: var(--dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lead-summary-secondary { font-size: 11px; color: var(--gray-600); margin-top: 1px; }

/* Date */
.lead-summary-date { text-align: right; font-size: 11px; color: var(--gray-600); white-space: nowrap; }

/* Chevron */
.lead-chevron {
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-300); transition: transform 0.2s, color 0.2s;
}
.lead-chevron .material-icons-round { font-size: 22px; }
.lead-card.expanded .lead-chevron { transform: rotate(180deg); color: var(--navy); }

/* Detail panel */
.lead-detail { display: none; }
.lead-card.expanded .lead-detail { display: block; }

/* Contact + location info */
.lead-contact-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 10px 14px; font-size: 12px; gap: 8px;
  background: #fafbfc; border-top: 1px solid var(--gray-200);
}
.lead-contact-label {
  font-size: 9px; color: var(--gray-400); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 2px;
}
.lead-contact-value { font-weight: 600; font-size: 12px; color: var(--dark); }
.lead-contact-empty { color: var(--gray-300); font-style: italic; font-size: 11px; }

/* Phone/email action buttons */
.lead-action-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600; font-size: 12px; color: var(--navy);
  text-decoration: none; padding: 4px 10px;
  border: 1px solid var(--navy); border-radius: 6px;
  transition: background 0.15s;
}
.lead-action-link:hover { background: var(--gray-100); }
.lead-action-link .material-icons-round { font-size: 14px; }

/* Message callout row */
.lead-message-row {
  padding: 8px 14px; font-size: 12px; color: #333;
  background: #fff; border-top: 1px solid var(--gray-200);
}
.lead-message-row strong { color: var(--navy); margin-right: 6px; }
.lead-message-text { font-style: italic; color: var(--dark); }

/* Intel row — bulleted */
.lead-intel {
  background: var(--intel-bg); border-top: 1px solid var(--intel-border);
  padding: 10px 16px; font-size: 13px; line-height: 1.6; color: #333;
}
.lead-intel b { color: var(--dark); }
.intel-label { color: var(--navy); font-weight: 700; font-size: 12px; display: block; margin-bottom: 6px; }
.intel-list { list-style: none; padding: 0; margin: 0; }
.intel-list li {
  padding: 2px 0 2px 16px;
  position: relative;
  font-size: 12px;
  line-height: 1.5;
}
.intel-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
}

/* ── PRICING INTEL BAR (bottom of lead card) ── */
.lead-pricing-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 8px 14px;
  font-size: 11px;
  gap: 8px;
  border-top: 2px solid;
}
.lead-pricing-bar.tier-below5   { border-top-color: #4CAF50; background: #E8F5E9; }
.lead-pricing-bar.tier-atTypical { border-top-color: #8BC34A; background: #F1F8E9; }
.lead-pricing-bar.tier-above10  { border-top-color: #FFC107; background: #FFF8E1; }
.lead-pricing-bar.tier-above20  { border-top-color: #FF9800; background: #FFF3E0; }
.lead-pricing-bar.tier-wellAbove { border-top-color: #F44336; background: #FDE8E8; }
.lead-pricing-label {
  font-size: 9px; color: var(--gray-400); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 1px;
}
.lead-pricing-value { font-weight: 700; font-size: 13px; color: var(--dark); }

/* ══════════════════════════════════════════
   INVENTORY PRICING ANALYSIS
   ══════════════════════════════════════════ */
.inv-legend {
  display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; font-size: 11px; font-weight: 600;
}
.inv-legend-item { display: flex; align-items: center; gap: 4px; }
.inv-swatch { width: 14px; height: 14px; border-radius: 2px; display: inline-block; }
.inv-below5   { background: #C8E6C9; }
.inv-atTypical { background: #E8F5E9; }
.inv-above10  { background: #FFF8E1; }
.inv-above20  { background: #FCE4D6; }
.inv-wellAbove { background: #FADBD8; }

.inv-table-wrap { margin-bottom: 16px; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inv-table thead th {
  background: var(--navy); color: #fff; font-size: 11px; font-weight: 600;
  padding: 8px 6px; text-align: center;
}
.inv-table thead th.inv-th-truck { text-align: left; }
.inv-table tbody td {
  padding: 6px 6px; text-align: center; border-bottom: 1px solid #e0e0e0; font-size: 11px;
}
.inv-table tbody td:first-child { text-align: left; font-weight: 600; }
.inv-table tbody td.inv-diff { text-align: left; }
.inv-table tbody tr.inv-row-below5   { background: #C8E6C9; }
.inv-table tbody tr.inv-row-atTypical { background: #E8F5E9; }
.inv-table tbody tr.inv-row-above10  { background: #FFF8E1; }
.inv-table tbody tr.inv-row-above20  { background: #FCE4D6; }
.inv-table tbody tr.inv-row-wellAbove { background: #FADBD8; }
.inv-table tbody td.inv-leads-cell { font-weight: 700; }

.inv-footnotes {
  font-size: 11px; color: var(--gray-600); line-height: 1.6; margin-top: 8px;
}
.inv-footnotes p { margin-bottom: 4px; }

/* Footer */
.report-footer {
  text-align: center; padding: 32px 0 16px; font-size: 12px;
  color: var(--gray-400); border-top: 1px solid var(--gray-200); margin-top: 24px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .report { padding: 16px 12px; padding-top: 70px; }
  .lead-summary { grid-template-columns: 40px 1fr 32px; }
  .lead-summary-date { display: none; }
  .lead-contact-row { grid-template-columns: 1fr 1fr; }
  .report-header h1 { font-size: 18px; }
  .header-logo { height: 24px; }
}

@media (max-width: 480px) {
  .pin-box { padding: 32px 24px; }
  .filter-bar { flex-wrap: wrap; }
  .lead-contact-row { grid-template-columns: 1fr; }
}

@media print {
  body { background: white; }
  .pin-screen { display: none !important; }
  .report-header { position: static; box-shadow: none; }
  .report { padding-top: 0; }
  .lead-detail { display: block !important; }
  .report { max-width: 100%; padding: 0; }
  .inv-table tbody tr { break-inside: avoid; }
}
