body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

/* ── App header (PFC-pattern sticky blue bar) ────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  background: var(--blue);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-nav);
}

.app-header-brand {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 18px;
  color: var(--white);
  letter-spacing: -0.01em;
}

.app-header-brand span {
  font-weight: 400;
  font-size: 14px;
  opacity: 0.65;
  margin-left: 4px;
  font-family: var(--font-sans);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: block;
}

.app-header-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* ── Ghost button (light background) ────────────────────────────────────── */

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--ease);
  font-family: var(--font-sans);
}

.btn-ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* Ghost on dark/blue background */
.btn-ghost-white {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: all var(--ease);
  font-family: var(--font-sans);
}

.btn-ghost-white:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ── KPI trend / status indicator ───────────────────────────────────────── */

.kpi-trend {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.kpi-trend-neutral {
  color: var(--text-muted);
  background: rgba(90, 106, 122, 0.10);
}

.kpi-trend-positive {
  color: var(--green);
  background: var(--green-bg);
}

.kpi-trend-negative {
  color: var(--orange);
  background: var(--red-bg);
}

/* ── Page shell (full-height flex column) ───────────────────────────────── */

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: var(--space-2xl) var(--space-xl);
}

.page-inner {
  max-width: 720px;
  margin: 0 auto;
}

/* ── User greeting ──────────────────────────────────────────────────────── */

.user-greeting {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.user-greeting-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 2px;
}

.user-greeting-email {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Nav sections ───────────────────────────────────────────────────────── */

.nav-section {
  margin-bottom: var(--space-2xl);
}

.nav-section-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.nav-item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all var(--ease);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}

.nav-item-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: var(--shadow-blue);
}

.nav-item-icon {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--ease);
}

.nav-item-btn:hover .nav-item-icon {
  color: var(--blue);
}

/* ── Embed page ─────────────────────────────────────────────────────────── */

.embed-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.embed-header {
  height: 48px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
}

.embed-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--ease);
}

.embed-back:hover {
  color: var(--blue);
}

.embed-content {
  flex: 1;
}

.embed-error {
  padding: var(--space-xl);
  color: var(--orange);
  font-family: monospace;
  font-size: 13px;
}

/* ── Health grid ────────────────────────────────────────────────────────── */

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  max-width: 680px;
}

/* ── Login ──────────────────────────────────────────────────────────────── */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0, 80, 180, 0.6) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 50, 140, 0.8) 0%, transparent 50%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 44px 44px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.login-logo {
  width: 160px;
  height: auto;
  margin: 0 auto 32px;
  display: block;
}

.login-divider {
  width: 32px;
  height: 3px;
  background: var(--blue);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-platform {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.google-btn-wrap {
  display: flex;
  justify-content: center;
}

.login-footer {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Form select (agent selector) ──────────────────────────────────────── */

.if {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
}

.if:focus {
  outline: none;
  border-color: var(--blue);
}

/* ── Agent platform ─────────────────────────────────────────────────────── */

.agent-wrap { max-width: 1320px; margin: 0 auto; padding: 24px; }

/* Tab bar (sticky below the app header) */
.tabs-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  overflow-x: auto;
  position: sticky;
  top: 56px; /* height of .app-header */
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.tabs-bar a {
  padding: 12px 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  transition: color .15s;
}

.tabs-bar a:hover { color: var(--blue); }
.tabs-bar a.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Period filter pills */
.period-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.period-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: all .15s;
}
.period-pill:hover { border-color: var(--blue); color: var(--blue); }
.period-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Score bands */
.band-top    { background: #c8edd9; color: #1a5e3a; }
.band-above  { background: #d0e4f8; color: #003a8e; }
.band-meets  { background: #fff3cd; color: #7a5a00; }
.band-below  { background: #ffd5d3; color: #8b1a14; }

.score-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* Scorecard table */
.scorecard-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.scorecard-table th {
  padding: 9px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  background: #f7f8fa;
  text-align: right;
  white-space: nowrap;
}
.scorecard-table th.left { text-align: left; }
.scorecard-table td {
  padding: 7px 10px;
  border-bottom: .5px solid var(--border);
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.scorecard-table td.left { text-align: left; font-weight: 500; }
.scorecard-table tr:hover td { background: rgba(0,58,142,0.03); }
.scorecard-table tr.total-row td {
  font-weight: 700;
  background: #f0f4fb;
  border-top: 1.5px solid rgba(0,58,142,.15);
  color: var(--blue);
}
.scorecard-scroll { overflow-x: auto; overflow-y: auto; max-height: 560px; }
.scorecard-scroll .scorecard-table thead th {
  /* Sticky header — opaque background (was bleeding through on scroll because
     the inherited #f7f8fa got composited under hover row tints). Solid var
     reference + a 1px shadow below the header to visually separate from rows. */
  position: sticky;
  top: 0;
  z-index: 6;
  background-color: var(--surface, #ffffff);
  background-image: linear-gradient(#f7f8fa, #f7f8fa);
  box-shadow: 0 1px 0 var(--border);
}
.scorecard-scroll .scorecard-table thead {
  background-color: var(--surface, #ffffff);
}
