/* Internal analytics dashboard. Shares the landing site's palette so it reads
   as the same product, but it is a dense tool rather than a marketing page. */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ink: #0E1B1A;
  --cream: #FBF6EE;
  --cream-dark: #F1E9D8;
  --teal: #0F766E;
  --teal-bright: #14B8A6;
  --coral: #FF5B4A;
  --amber: #D9922B;
  --text: #16211F;
  --text-soft: #5B6B67;
  --white: #FFFFFF;
  --line: rgba(14, 27, 26, 0.1);
  --radius: 14px;
  --shadow: 0 4px 24px rgba(14, 27, 26, 0.06);
}

body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
}

.muted { color: var(--text-soft); font-size: 13px; }
.error { color: var(--coral); font-size: 13px; }
[hidden] { display: none !important; }

/* ── Sign-in ─────────────────────────────────────────────────────────────── */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 8px;
}

.auth-card h1 { font-size: 22px; }
.auth-card p { margin-bottom: 12px; }
.auth-card label { font-size: 13px; font-weight: 600; margin-top: 8px; }

input, select {
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: inherit;
}

input:focus, select:focus {
  outline: 2px solid var(--teal-bright);
  outline-offset: 1px;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 14px;
}

.primary {
  margin-top: 16px;
  background: var(--teal);
  color: var(--white);
  font-weight: 600;
}

.primary:hover { background: #0c5f59; }

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-soft);
}

.ghost:hover { background: var(--cream-dark); }

/* ── Chrome ──────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; letter-spacing: -0.01em; }
.brand .muted { font-weight: 400; }

.tabs { display: flex; gap: 4px; }

.tab {
  background: transparent;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 14px;
}

.tab:hover { background: var(--cream-dark); }
.tab.is-active { background: var(--ink); color: var(--cream); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); }

.banner {
  margin: 16px 24px 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #FDECEA;
  color: #8B2F25;
  font-size: 14px;
}

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.view { display: none; }
.view.is-active { display: grid; gap: 20px; }

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px 24px;
}

.panel h2 { font-size: 16px; margin-bottom: 4px; }
.panel > .muted { margin-bottom: 16px; max-width: 68ch; }

.chart { position: relative; height: 300px; margin-top: 12px; }

.controls { display: flex; gap: 20px; flex-wrap: wrap; margin: 12px 0 4px; }
.controls label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }

/* ── KPI cards ───────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}

.card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.card .label { font-size: 13px; color: var(--text-soft); }

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

tbody tr:hover { background: var(--cream); }

.empty { padding: 24px 0; color: var(--text-soft); font-size: 14px; }

/* ── Day-of-week heatmap ─────────────────────────────────────────────────── */

.grid-heatmap {
  display: grid;
  grid-template-columns: max-content repeat(7, minmax(40px, 1fr));
  gap: 3px;
  margin-top: 12px;
  font-size: 12px;
}

.grid-heatmap .head {
  color: var(--text-soft);
  font-weight: 600;
  text-align: center;
  padding: 4px 0;
}

.grid-heatmap .row-label {
  color: var(--text-soft);
  padding-right: 10px;
  align-self: center;
  white-space: nowrap;
}

.grid-heatmap .cell {
  aspect-ratio: 2 / 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--cream-dark);
  font-variant-numeric: tabular-nums;
}

/* ── Map ─────────────────────────────────────────────────────────────────── */

#map {
  height: 460px;
  border-radius: var(--radius);
  margin-top: 12px;
  background: var(--cream-dark);
}

.map-toggle { display: flex; gap: 18px; font-size: 13px; }
.map-toggle label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#map-note { margin-top: 10px; }
