:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-border: #d6deea;
  --text: #1d2630;
  --muted: #5d6b7c;
  --accent: #1f7fa3;
  --accent-strong: #0f5670;
  --ink-soft: #e8eef6;
  --shadow: 0 18px 38px rgba(23, 43, 77, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    linear-gradient(180deg, rgba(31, 127, 163, 0.08), rgba(243, 246, 251, 0) 28%),
    linear-gradient(135deg, #f7fafc, #edf2f9 55%, #f7fbff);
  color: var(--text);
}

a {
  color: var(--accent-strong);
}

.page-shell {
  min-height: 100vh;
  padding: 24px;
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.landing-card {
  width: min(720px, 100%);
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.identity {
  display: grid;
  justify-items: end;
}

.identity-name {
  font-weight: 700;
}

.identity-email,
.filters-hint,
.narrative-text {
  color: var(--muted);
}

.logout-link,
.ghost-button,
.primary-button,
.mode-badge {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.mode-badge {
  cursor: default;
  color: var(--accent-strong);
  background: var(--ink-soft);
}

.landing-actions {
  margin-top: 24px;
}

.dashboard-main {
  display: grid;
  gap: 24px;
}

.top-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters-panel {
  display: grid;
  align-content: start;
  padding: 18px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.filter-group {
  display: grid;
  gap: 8px;
  margin: 0;
}

.filter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.filter-group span {
  font-weight: 700;
}

.filter-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.filter-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #fbfdff;
  font: inherit;
}

.narrative-panel {
  padding: 24px;
}

.freshness-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ink-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.js-plotly-plot .plotly .gtitle,
.js-plotly-plot .plotly .g-gtitle,
.js-plotly-plot .plotly .xtitle,
.js-plotly-plot .plotly .ytitle {
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

.links-block ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.chart-panel {
  padding: 20px;
  min-height: 380px;
}

.chart-surface {
  width: 100%;
  height: min(44vh, 420px);
}

.unauthorized-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.unauthorized-panel {
  padding: 24px;
  width: min(480px, 100%);
}

@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .session-meta {
    width: 100%;
    justify-content: space-between;
  }

  .identity {
    justify-items: start;
  }

  .chart-surface {
    height: 360px;
  }
}
