/* ============================================================
   RealtyMail Financial Dashboard CSS
   Uses same design tokens as landing.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

body {
  background: var(--color-bg, #0d1117);
  color: var(--color-text, #e6edf3);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

:root {
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-surface-2: #1c2330;
  --color-border: #2a3444;
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 1100px;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: white;
}

.nav-logo span { color: var(--color-accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
  text-decoration: none;
}

/* ── Layout ─────────────────────────────────────────────────── */
.dashboard-container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px;
}

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.dashboard-header p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ── Current Month Banner ───────────────────────────────────── */
.metrics-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
}

.metric-card .metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric-card .metric-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.metric-card.revenue .metric-value { color: var(--color-success); }
.metric-card.adspend .metric-value { color: var(--color-warning); }
.metric-card.profit .metric-value  { color: var(--color-accent); }

/* ── Chart Section ──────────────────────────────────────────── */
.chart-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
}

.chart-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.chart-wrap {
  position: relative;
  height: 320px;
}

/* ── Historical Table ──────────────────────────────────────── */
.table-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 24px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}

tbody td {
  padding: 14px 24px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--color-surface-2); }

.positive { color: var(--color-success); }
.negative { color: var(--color-danger); }
.neutral  { color: var(--color-text-muted); }

/* ── Loading / Error states ─────────────────────────────────── */
.loading-row td { color: var(--color-text-muted); font-style: italic; }
.error-msg { color: var(--color-danger); font-size: 0.9rem; padding: 20px; text-align: center; }
.skeleton { opacity: 0.4; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.7; } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .metrics-banner { grid-template-columns: 1fr; }
  .chart-wrap { height: 240px; }
  .nav-links { display: none; }
}