/* Sunstate Cooling & Heating — RMH Media Group Design Language */

:root {
  --bg-primary:   #0D0D0D;
  --bg-secondary: #161616;
  --bg-card:      #1A1A1A;
  --bg-card-hover:#222222;
  --border:       #2A2A2A;
  --gold:         #F59E0B;
  --gold-light:   #FCD34D;
  --gold-dim:     #92600A;
  --teal:         #2A7A8C;
  --teal-light:   #3B9DB5;
  --text-primary: #F0EDE8;
  --text-secondary:#A89F96;
  --text-muted:   #6B6560;
  --red:          #EF4444;
  --red-dim:      #7F1D1D;
  --green:        #10B981;
  --green-dim:    #064E3B;
  --amber:        #F59E0B;
  --amber-dim:    #78350F;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.nav-brand-icon {
  width: 36px;
  height: 36px;
}
.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.nav-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.nav-brand-tagline {
  font-size: 0.65rem;
  color: var(--teal-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}
.nav-links a.active {
  color: var(--gold);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
}

.rmh-badge {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.rmh-badge:hover { opacity: 0.9; }

/* ── Page Layout ────────────────────────────────────────────────────────── */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* ── KPI Hero Row ───────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.kpi-card.gold::before  { background: var(--gold); }
.kpi-card.teal::before  { background: var(--teal); }
.kpi-card.green::before { background: var(--green); }
.kpi-card.red::before   { background: var(--red); }

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text-primary);
}
.kpi-value.gold  { color: var(--gold); }
.kpi-value.teal  { color: var(--teal-light); }
.kpi-value.green { color: var(--green); }
.kpi-value.red   { color: var(--red); }
.kpi-trend {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.kpi-trend.up   { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* ── Grid Layouts ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
td.primary { color: var(--text-primary); font-weight: 500; }
td.gold    { color: var(--gold); font-weight: 600; }
td.teal    { color: var(--teal-light); }
td.red     { color: var(--red); font-weight: 600; }
td.green   { color: var(--green); }

/* ── Badges / Pills ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-red    { background: var(--red-dim);   color: #FCA5A5; }
.badge-gold   { background: var(--amber-dim); color: var(--gold); }
.badge-green  { background: var(--green-dim); color: #6EE7B7; }
.badge-teal   { background: rgba(42,122,140,0.25); color: var(--teal-light); }
.badge-gray   { background: #2A2A2A; color: var(--text-muted); }

/* ── Alert Cards ─────────────────────────────────────────────────────────── */
.alert-card {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.alert-card.critical {
  background: rgba(239,68,68,0.08);
  border-color: var(--red);
}
.alert-card.warning {
  background: rgba(245,158,11,0.08);
  border-color: var(--gold);
}
.alert-card.opportunity {
  background: rgba(16,185,129,0.08);
  border-color: var(--green);
}
.alert-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.alert-text { flex: 1; }
.alert-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.alert-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.alert-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Severity badge ─────────────────────────────────────────────────────── */
.sev-critical   { background: var(--red-dim); color: #FCA5A5; }
.sev-warning    { background: var(--amber-dim); color: var(--gold); }
.sev-opportunity { background: var(--green-dim); color: #6EE7B7; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart-container { position: relative; }
canvas { max-width: 100%; }

/* ── Progress bars ──────────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: var(--bg-secondary);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--gold);
  transition: width 0.4s ease;
}
.progress-bar.teal { background: var(--teal); }
.progress-bar.red  { background: var(--red); }
.progress-bar.green{ background: var(--green); }

/* ── Rating stars ────────────────────────────────────────────────────────── */
.stars { color: var(--gold); letter-spacing: -1px; }
.stars-empty { color: var(--border); }

/* ── Misc utils ─────────────────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8  { display: flex; align-items: center; gap: 8px; }
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

/* ── Churn risk segments ────────────────────────────────────────────────── */
.churn-seg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.churn-seg:last-child { border-bottom: none; }
.churn-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Filter bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--gold); }

/* ── Button ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-gold {
  background: var(--gold);
  color: #000;
}
.btn-gold:hover { background: var(--gold-light); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-teal {
  background: var(--teal);
  color: white;
}
.btn-teal:hover { background: var(--teal-light); }

/* ── Spotlight card ─────────────────────────────────────────────────────── */
.spotlight {
  border: 1px solid var(--teal);
  background: rgba(42,122,140,0.07);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.spotlight-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal-light);
  font-weight: 700;
  margin-bottom: 8px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 60px;
}
footer a { color: var(--gold); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page { padding: 20px 16px; }
}
