/* The Events Company - Revenue Portal
   Light, editorial, luxury aesthetic. Deep navy + warm white + gold accent.
   Standalone stylesheet - shares nothing with the operations app. */

:root {
  --bg: #f3f1ea;
  --surface: #ffffff;
  --surface-soft: #faf9f5;
  --ink: #17212e;
  --ink-soft: #3f4d5c;
  --muted: #8b94a1;
  --navy: #11283f;
  --navy-deep: #0a1b2b;
  --gold: #b08d4c;
  --gold-soft: #d8c79d;
  --line: #e4e0d5;
  --line-strong: #d4cfc1;
  --positive: #2f7d5b;
  --positive-soft: #edf7f1;
  --warning: #8a651c;
  --warning-soft: #faf4e6;
  --danger: #9a3526;
  --danger-soft: #fbecea;
  --info: #315c7d;
  --info-soft: #eef4f8;
  --shadow: 0 1px 2px rgba(17, 40, 63, 0.05), 0 8px 24px rgba(17, 40, 63, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.boot-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--muted);
  letter-spacing: 0.04em;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Badges ---------- */
.portal-badge,
.who-badge {
  --badge-color: var(--ink-soft);
  --badge-bg: var(--surface-soft);
  --badge-border: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 23px;
  padding: 3px 9px;
  border: 1px solid var(--badge-border);
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-color);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.045em;
  white-space: nowrap;
  vertical-align: middle;
}
.portal-badge.is-compact {
  min-height: 20px;
  padding: 2px 8px;
  font-size: 10px;
}
.portal-badge.is-neutral,
.who-badge {
  --badge-color: #657181;
  --badge-bg: #f5f5f2;
  --badge-border: #ddd9cf;
}
.portal-badge.is-success {
  --badge-color: #246b4c;
  --badge-bg: var(--positive-soft);
  --badge-border: #bfdccb;
}
.portal-badge.is-warning {
  --badge-color: var(--warning);
  --badge-bg: var(--warning-soft);
  --badge-border: #e4d2a6;
}
.portal-badge.is-danger {
  --badge-color: var(--danger);
  --badge-bg: var(--danger-soft);
  --badge-border: #e6c3bd;
}
.portal-badge.is-info {
  --badge-color: var(--info);
  --badge-bg: var(--info-soft);
  --badge-border: #c8d9e5;
}
.portal-badge.is-dark {
  --badge-color: #ffffff;
  --badge-bg: var(--navy);
  --badge-border: var(--navy);
}
.portal-badge.is-quiet { opacity: 0.62; }
.portal-badge.has-dot::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: '';
  flex: 0 0 auto;
  opacity: 0.82;
}

/* ---------- Wordmark ---------- */
.wordmark {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wordmark-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--navy);
}
.wordmark-rule {
  width: 38px;
  height: 2px;
  background: var(--gold);
}
.wordmark-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Login ---------- */
.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 408px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 44px 40px 36px;
}
.login-card .wordmark { align-items: center; margin-bottom: 28px; }
.login-card .wordmark-rule { margin: 2px auto 0; }
.login-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
  margin: 0 0 4px;
}
.login-hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 26px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--navy);
  background: var(--surface);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.btn-block { width: 100%; margin-top: 6px; }
.form-error {
  background: #fbecea;
  border: 1px solid #e6c3bd;
  color: #9a3526;
  font-size: 13px;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 14px;
}
.login-foot {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---------- App shell ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
/* One cohesive cluster of nav links */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-nav {
  text-decoration: none;
  padding: 9px 15px;
  font-size: 12.5px;
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn-nav:hover:not(:disabled) {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--surface-soft);
}
/* Insights matches the nav set; the gold dot is its only accent */
.insights-btn .insights-dot { margin-right: 1px; }
.insights-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 141, 76, 0.15);
}
.insights-btn:hover .insights-dot { box-shadow: 0 0 0 3px rgba(176, 141, 76, 0.28); }
/* Thin divider separating navigation from identity + sign-out */
.topbar-divider {
  width: 1px;
  align-self: stretch;
  min-height: 26px;
  background: var(--line);
  margin: 0 2px;
}
.topbar-user .who {
  text-align: right;
  line-height: 1.25;
}
.topbar-user .who-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.topbar-user .who-role { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }
/* Sign out reads as a quiet secondary action, not another nav link */
.btn-signout {
  padding: 9px 15px;
  font-size: 12.5px;
  color: var(--muted);
  border-color: transparent;
}
.btn-signout:hover:not(:disabled) {
  color: var(--navy);
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 28px 56px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-head h1 {
  font-size: 26px;
  font-weight: 600;
  color: var(--navy);
  margin: 6px 0 4px;
  letter-spacing: -0.01em;
}
.page-head .sub { font-size: 13px; color: var(--muted); }

/* ---------- Cards / sections ---------- */
.section { margin-top: 30px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px;
  margin-bottom: 18px;
}
.section-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}
.section-head .note { font-size: 12px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
}

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.kpi.kpi-feature { border-top: 3px solid var(--gold); }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-value {
  font-size: 30px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 10px;
  letter-spacing: -0.02em;
}
.kpi-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Scope rows ---------- */
.scope-list { display: flex; flex-direction: column; gap: 14px; }
.scope-row { display: grid; grid-template-columns: 132px 1fr 140px; align-items: center; gap: 16px; }
.scope-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.scope-name span { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.scope-track {
  height: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.scope-fill { height: 100%; background: var(--navy); border-radius: 6px 0 0 6px; }
.scope-fill.lead { background: var(--gold); }
.scope-amount { text-align: right; font-size: 14px; font-weight: 600; color: var(--navy); }
.scope-amount span { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- Trend chart ---------- */
.chart-wrap { width: 100%; overflow: hidden; }
.chart { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--navy); }
.chart-bar.lead { fill: var(--gold); }
.chart-axis { fill: var(--muted); font-size: 11px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-value { fill: var(--ink-soft); font-size: 10px; font-weight: 600; }

/* ---------- States ---------- */
.state-box {
  text-align: center;
  padding: 54px 24px;
  color: var(--muted);
}
.state-box.error { color: #9a3526; }
.state-box .btn { margin-top: 16px; }

.foot-note {
  margin-top: 38px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
}

/* ---------- Card variants ---------- */
.card.card-flush { padding: 6px 8px; }

/* ---------- Generic data table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table thead th.num { text-align: right; }
.data-table thead th.rank { width: 36px; text-align: center; }
.data-table tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-soft); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.num.strong { font-weight: 600; color: var(--navy); }
.data-table td.rank {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.data-table td.who { font-weight: 600; color: var(--navy); }

.leaderboard tbody tr:first-child td.rank {
  color: var(--gold);
  font-weight: 700;
}
.leaderboard tbody tr.is-inactive td.who {
  color: var(--ink-soft);
}
.leaderboard tbody tr.is-inactive td.num,
.leaderboard tbody tr.is-inactive td.num.strong {
  color: var(--ink-soft);
}
.leaderboard tbody tr.is-inactive .bar-fill {
  background: var(--line-strong);
}
.who-badge { margin-left: 8px; }

/* ---------- Leaderboard row interactivity + per-owner detail ---------- */
.leader-row { cursor: pointer; transition: background 0.12s ease; }
.leader-row:hover td { background: var(--surface-soft); }
.leader-row.is-expanded td { background: var(--surface-soft); }
.leader-row .who-hint {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  vertical-align: middle;
  display: inline-block;
  width: 12px;
  text-align: center;
}
.leader-row.is-expanded .who-hint { color: var(--navy); }
.leader-detail-row td {
  background: var(--bg);
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.btn-sm { padding: 7px 12px; font-size: 12px; }

.owner-detail {
  padding: 26px 28px 28px;
  background: var(--bg);
  border-top: 2px solid var(--gold);
}
.owner-detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.owner-detail-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.owner-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.owner-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px 14px;
}
.owner-kpi-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.owner-kpi-val {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.owner-kpi-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.owner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.owner-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px 18px;
}
.owner-block-wide { grid-column: 1 / -1; }
.owner-block-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px 6px;
}

/* ---- Year chart ---- */
.profile-chart {
  width: 100%;
  height: auto;
  display: block;
}
.profile-bar-rev { fill: var(--navy); }
.profile-bar-gp { fill: var(--gold); }
.profile-grid { stroke: var(--line); stroke-width: 1; }
.profile-axis-x, .profile-axis-y {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.profile-chart-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}
.swatch-rev { background: var(--navy); }
.swatch-gp { background: var(--gold); }
.legend-label { margin-right: 6px; }
.dt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.dt-leg { display: inline-flex; align-items: center; gap: 6px; }
.dt-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }

/* ---- Status mix ---- */
.status-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.status-seg { height: 100%; }
.status-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-legend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.status-legend-key { color: var(--ink); }
.status-legend-val {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---- Scope breakdown (per-owner) ---- */
.profile-scope-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-scope-row {
  display: grid;
  grid-template-columns: 130px 1fr 110px;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.profile-scope-name { color: var(--ink); font-weight: 600; }
.profile-scope-name span { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.profile-scope-track {
  height: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.profile-scope-fill { height: 100%; background: var(--navy); border-radius: 5px 0 0 5px; }
.profile-scope-amt {
  text-align: right;
  color: var(--navy);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.profile-scope-amt span { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }

/* ---- Mini tables (top clients / top deals) ---- */
.profile-mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.profile-mini-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.profile-mini-table th.num { text-align: right; }
.profile-mini-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.profile-mini-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.profile-mini-table td.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--navy);
}
.profile-mini-table td.muted { color: var(--muted); font-size: 11px; }
.profile-mini-table tbody tr:last-child td { border-bottom: none; }
.profile-mini-table tbody tr:hover td { background: var(--surface-soft); }

@media (max-width: 720px) {
  .owner-grid { grid-template-columns: 1fr; }
  .owner-detail { padding: 18px 16px 22px; }
  .profile-scope-row { grid-template-columns: 96px 1fr; }
  .profile-scope-amt { grid-column: 2; text-align: left; }
}

.bar-track {
  width: 100%;
  min-width: 80px;
  height: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill { height: 100%; background: var(--navy); border-radius: 4px 0 0 4px; }
.bar-fill.lead { background: var(--gold); }

/* ---------- Scorecard ---------- */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 16px;
}
.scorecard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.scorecard header { display: flex; flex-direction: column; gap: 2px; }
.scorecard-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.scorecard-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}
.scorecard-headline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.scorecard-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.scorecard-trend {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
}
.scorecard-trend .arrow { font-size: 10px; line-height: 1; }
.scorecard-trend.up { color: var(--positive); background: rgba(47, 125, 91, 0.10); }
.scorecard-trend.down { color: #9a3526; background: rgba(154, 53, 38, 0.08); }
.scorecard-trend.flat { color: var(--muted); background: var(--surface-soft); }
.scorecard-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.scorecard-list {
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.scorecard-list > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 12.5px;
}
.scorecard-list dt {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.scorecard-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}
.scorecard-list dd span {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
  font-size: 11.5px;
}

/* ---------- Seasonality heatmap ---------- */
.heatmap { display: flex; flex-direction: column; gap: 6px; }
.heat-row {
  display: grid;
  grid-template-columns: 54px 1fr 88px;
  align-items: center;
  gap: 12px;
}
.heat-row-head .heat-axis {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
}
.heat-row-head .heat-total { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.heat-year {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.heat-row.current .heat-year { color: var(--navy); font-weight: 700; }
.heat-row.current .heat-total { color: var(--navy); font-weight: 700; }
.heat-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}
.heat-cell {
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  position: relative;
  transition: transform 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.heat-cell.h0 { background: var(--surface-soft); }
.heat-cell.h1 { background: #e9e3d2; border-color: #ddd5bf; }
.heat-cell.h2 { background: #c8c3b3; border-color: #bab4a1; }
.heat-cell.h3 { background: #7a8aa1; border-color: #6f8094; }
.heat-cell.h4 { background: #2a4869; border-color: #21395a; }
.heat-cell.h5 { background: var(--navy); border-color: var(--navy-deep); }
.heat-cell.peak { outline: 2px solid var(--gold); outline-offset: 1px; }
.heat-cell:hover { transform: scale(1.07); cursor: default; z-index: 2; }
.heat-cell-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.heat-cell.h0 .heat-cell-label,
.heat-cell.h1 .heat-cell-label,
.heat-cell.h2 .heat-cell-label { color: var(--ink-soft); }
.heat-cell.h3 .heat-cell-label { color: var(--surface); }
.heat-cell.h4 .heat-cell-label,
.heat-cell.h5 .heat-cell-label { color: var(--surface); }
.heat-total {
  text-align: right;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.heat-legend {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.heat-legend .heat-cell {
  height: 12px;
  width: 18px;
  cursor: default;
}
.heat-legend .heat-cell:hover { transform: none; }
.heat-legend-label { padding: 0 4px; }

@media (max-width: 620px) {
  .page { padding: 22px 14px 44px; }

  /* Topbar: stack the brand, then identity + sign-out, then the nav wraps below */
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .topbar-user { flex-wrap: wrap; gap: 10px; row-gap: 12px; align-items: center; }
  .topbar-divider { display: none; }
  .topbar-user .who { order: 1; text-align: left; margin-right: auto; }
  .btn-signout { order: 2; }
  .topbar-nav { order: 3; width: 100%; flex-wrap: wrap; gap: 8px; }
  .topbar-nav .btn-nav { flex: 1 1 auto; justify-content: center; }

  /* Section heads: let the note drop to its own line instead of clipping */
  .section-head { flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
  .section-head .note { flex: 1 0 100%; }

  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* Revenue-by-property rows: name + amount on top, full-width bar below */
  .scope-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .scope-name { grid-column: 1; grid-row: 1; }
  .scope-amount { grid-column: 2; grid-row: 1; text-align: right; }
  .scope-track { grid-column: 1 / -1; grid-row: 2; margin-top: 6px; }

  /* Generic narrow-table collapse (owner detail, etc.) — header hidden, 2-col rows */
  .data-table thead { display: none; }
  .data-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .data-table tbody td { border: none; padding: 4px 6px; }
  .data-table td.rank { grid-column: 1; }
  .data-table td.who { grid-column: 1; }
  .data-table td.num { grid-column: 2; text-align: right; }

  /* Leaderboard keeps its columns + headers but scrolls horizontally — every
     number stays labeled instead of collapsing into an ambiguous stack. */
  .card.card-flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .leaderboard { min-width: 600px; }
  .leaderboard thead { display: table-header-group; }
  .leaderboard tbody tr { display: table-row; padding: 0; }
  .leaderboard tbody td { display: table-cell; border-bottom: 1px solid var(--line); padding: 10px 10px; }
  .leaderboard td.rank, .leaderboard td.who, .leaderboard td.num { grid-column: auto; }
  .leaderboard .leader-detail-row td { display: table-cell; }

  .heat-row { grid-template-columns: 42px 1fr 64px; gap: 8px; }
  .heat-cell { height: 18px; }
  .scorecard-list > div { grid-template-columns: 78px 1fr; }
}

/* ---------- Margin quality ---------- */
.mq-grid { display: flex; flex-direction: column; gap: 16px; }
.mq-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px 24px 20px;
}
.mq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.mq-margin { text-align: right; }
.mq-margin-val { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--navy); }
.mq-margin-val.neg { color: #9a3526; }
.mq-margin-val.warn { color: var(--gold); }
.mq-margin-lbl { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mq-bar {
  display: flex;
  width: 100%;
  height: 16px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.mq-seg { height: 100%; }
.mq-pos { background: var(--positive); }
.mq-zero { background: var(--gold-soft); }
.mq-neg { background: #9a3526; }
.mq-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 4px; }
.mq-legend-row { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); }
.mq-legend-row strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.mq-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.mq-dot.mq-pos { background: var(--positive); }
.mq-dot.mq-zero { background: var(--gold-soft); }
.mq-dot.mq-neg { background: #9a3526; }
.mq-muted { color: var(--muted); }
.mq-bleed, .mq-whatif {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  padding: 10px 0 0;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.mq-whatif { margin-top: 6px; padding-top: 6px; border-top: none; }
.mq-whatif.mq-clean { color: var(--muted); }
.mq-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 8px;
}
.mq-card .neg { color: #9a3526; }
.mq-card .pos { color: var(--positive); }
.mq-trend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mq-trend-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.mq-trend-row { display: flex; gap: 14px; }
.mq-trend-cell { text-align: center; min-width: 30px; }
.mq-trend-year { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.mq-trend-val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; color: var(--ink); }
.mq-trend-val.neg { color: #9a3526; }
.mq-trend-val.warn { color: var(--gold); }
.mq-trend-val.pos { color: var(--positive); }

@media (max-width: 620px) {
  .mq-head { flex-direction: column; }
  .mq-margin { text-align: left; }
  .mq-trend { flex-direction: column; align-items: flex-start; gap: 8px; }
}
