/* Realty Metrics AI — theme.css
   Uses --accent and --accent2 CSS custom properties set by base.html
   from per-tenant branding in tenants.json. */

:root {
  --text:            #1a1a1a;
  --muted:           #666;
  --bg:              #f7f7f7;
  --panel:           #ffffff;
  --border:          #e0e0e0;
  --error:           #b3261e;
  --success:         #146c43;
  --shadow:          0 1px 3px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 3px solid var(--accent);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 40px; height: 40px; object-fit: contain; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-subtitle { font-size: 12px; color: var(--muted); }

.site-nav { display: flex; gap: 20px; align-items: center; }
.site-nav a { color: var(--text); text-decoration: none; font-size: 14px; }
.site-nav a:hover { color: var(--accent); }
.user-chip { font-size: 13px; color: var(--muted); padding: 4px 10px; background: var(--bg); border-radius: 12px; }

/* Main + footer */
.site-main { max-width: 1400px; margin: 24px auto; padding: 0 24px; }
.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Hero (welcome page) */
.hero { max-width: 720px; margin: 60px auto; text-align: center; }
.hero h1 { font-size: 36px; margin-bottom: 12px; color: var(--accent); }
.tagline { font-size: 18px; color: var(--text); margin-bottom: 32px; }
.hero-note { font-size: 15px; color: var(--muted); margin-bottom: 12px; }
.hero-note code { background: var(--panel); padding: 2px 6px; border-radius: 4px; }
.hero-note-small { font-size: 13px; color: var(--muted); }

/* Auth card */
.auth-card {
  max-width: 380px;
  margin: 60px auto;
  padding: 32px;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card label { display: block; font-size: 14px; }
.auth-card input {
  width: 100%; margin-top: 4px;
  padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 4px;
}

/* Buttons */
button, .btn-primary, .btn-secondary, .btn-ghost {
  cursor: pointer; font-family: inherit; font-size: 14px;
  padding: 8px 16px; border-radius: 4px; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--panel); color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

/* Portal layout */
.portal-grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; }
@media (max-width: 900px) { .portal-grid { grid-template-columns: 1fr; } }

.input-panel, .result-panel {
  background: var(--panel);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.input-panel h2, .result-panel h2 { margin-top: 0; font-size: 18px; }
.input-panel h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 20px 0 8px; }
.input-panel label { display: block; font-size: 13px; margin-bottom: 8px; }
.input-panel input {
  width: 100%; margin-top: 3px; padding: 6px 8px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 4px;
}
.field-group { padding-bottom: 12px; }
.address-results { margin-top: 8px; max-height: 140px; overflow-y: auto; font-size: 12px; }
.address-results .match { padding: 4px 6px; cursor: pointer; border-bottom: 1px solid var(--border); }
.address-results .match:hover { background: var(--bg); }

/* Results */
.result-headline { display: flex; gap: 24px; padding: 12px 0 20px; border-bottom: 1px solid var(--border); }
.metric { flex: 1; }
.metric-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.metric-value { font-size: 22px; font-weight: 600; color: var(--accent); }

.drivers-table, .comps-table, .history-table {
  width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px;
}
.drivers-table th, .drivers-table td,
.comps-table th, .comps-table td,
.history-table th, .history-table td {
  padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border);
}
.drivers-table th, .comps-table th, .history-table th {
  background: var(--bg); font-weight: 600; font-size: 12px; text-transform: uppercase;
}

/* Admin */
.admin-section table { width: 100%; max-width: 500px; border-collapse: collapse; margin-bottom: 24px; }
.admin-section td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.admin-section td:first-child { font-weight: 600; color: var(--muted); width: 40%; }

/* Platform (Super User) */
.impersonation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: #7c2d12;   /* deep amber — visually distinct from any tenant accent */
  color: #fff5eb;
  font-size: 13px;
  border-bottom: 2px solid #451a03;
}
.impersonation-banner button {
  color: #fff5eb;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
}
.impersonation-banner button:hover {
  background: rgba(255,255,255,0.1);
}
.impersonation-banner code {
  background: rgba(0,0,0,0.2);
  padding: 1px 6px;
  border-radius: 3px;
}

.platform-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.platform-card {
  border-top: 3px solid #1e293b;
}
.small-note {
  font-size: 12px;
  margin-top: 24px;
  text-align: center;
}
.platform-console {
  max-width: 960px;
  margin: 24px auto;
  padding: 24px;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.tenant-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.tenant-table th, .tenant-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tenant-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}
.tenant-table code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.platform-actions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Utility */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); font-size: 13px; margin-top: 8px; }
.toggle { display: block; margin-bottom: 12px; font-size: 13px; }
