:root {
  --bg: #f6f1e8;
  --bg-alt: #efe7d9;
  --panel: #fffdf8;
  --panel-alt: #f7f1e6;
  --panel-strong: #ede4d4;
  --border: rgba(23, 32, 51, 0.12);
  --border-strong: rgba(23, 32, 51, 0.22);
  --grid: rgba(70, 80, 106, 0.16);
  --text: #172033;
  --muted: #6d768a;
  --muted-strong: #4a5367;
  --accent: #2354ff;
  --accent-deep: #1a2f70;
  --accent-warm: #ff7a59;
  --success: #2c7b57;
  --shadow: 0 20px 52px rgba(23, 32, 51, 0.1);
  --shadow-soft: 0 10px 28px rgba(23, 32, 51, 0.07);
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(35, 84, 255, 0.1), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(255, 122, 89, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
}

a {
  color: var(--accent-deep);
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

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

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(2rem, 3vw, 3.35rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.2;
}

h3 {
  font-size: 1.2rem;
  line-height: 1.25;
}

code {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  background: rgba(23, 32, 51, 0.06);
  color: var(--text);
  word-break: break-all;
}

canvas {
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 18px 24px 0;
}

.topbar__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.08em;
  box-shadow: 0 16px 30px rgba(35, 84, 255, 0.22);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-title {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted-strong);
  font-weight: 650;
}

.topnav a:hover {
  color: var(--accent);
  background: rgba(35, 84, 255, 0.08);
}

.topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 32, 51, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.crumbs span {
  color: var(--muted);
}

.hero,
.card,
.metric-card {
  animation: rise-in 420ms ease both;
}

.hero,
.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 380px);
  gap: 28px;
  padding: 34px;
  margin-bottom: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 122, 89, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.95), rgba(247, 241, 230, 0.96));
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(35, 84, 255, 0.12) 0%, rgba(35, 84, 255, 0) 70%);
  pointer-events: none;
}

.hero--compact h1 {
  font-size: clamp(1.85rem, 3vw, 3rem);
}

.hero__copy,
.hero__aside {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lede {
  max-width: 60ch;
  margin-top: 14px;
  color: var(--muted-strong);
  font-size: 1.05rem;
  line-height: 1.7;
}

.supporting,
.helper {
  color: var(--muted);
  line-height: 1.65;
}

.supporting {
  margin-top: 14px;
}

.helper {
  margin-top: 14px;
  font-size: 0.92rem;
}

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(35, 84, 255, 0.14);
  border-radius: 16px;
  background: rgba(35, 84, 255, 0.08);
  color: var(--muted-strong);
}

.feature-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.feature-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.feature-item strong,
.hero-panel strong {
  font-size: 1.14rem;
  line-height: 1.25;
}

.feature-item span {
  color: var(--muted);
  line-height: 1.65;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(26, 47, 112, 0.96), rgba(35, 84, 255, 0.86));
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-panel__label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.78;
}

.hero-panel p {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.65;
}

.hero-panel .button.secondary,
.hero-panel .button.ghost {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.hero-panel .button.secondary:hover,
.hero-panel .button.ghost:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-links--stack {
  flex-direction: column;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 650;
}

.hero-links a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  font-weight: 650;
}

.range:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.range.active {
  border-color: #fff;
  background: #fff;
  color: var(--accent-deep);
}

.range.active:hover {
  color: var(--accent-deep);
}

.content-grid,
.dashboard-grid,
.insights-grid,
.project-grid,
.stack-grid,
.link-grid,
.metric-grid,
.kpi-grid,
.engagement-grid,
.subpanel-grid {
  display: grid;
  gap: 20px;
}

.content-grid--home {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 420px);
  align-items: start;
}

.content-grid--settings {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  align-items: start;
}

.card {
  padding: 28px;
  margin-bottom: 20px;
}

.card--accent {
  background: linear-gradient(180deg, rgba(248, 243, 235, 0.98), rgba(255, 250, 244, 0.98));
}

.card--wide {
  grid-column: span 2;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-alt);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
  text-decoration: none;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(23, 32, 51, 0.08);
}

.button.primary,
button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #4f75ff);
  color: #fff;
  box-shadow: 0 16px 28px rgba(35, 84, 255, 0.2);
}

.button.primary:hover,
button.primary:hover {
  color: #fff;
}

.button.secondary,
button.secondary {
  border-color: rgba(35, 84, 255, 0.16);
  background: rgba(35, 84, 255, 0.08);
  color: var(--accent-deep);
}

.button.ghost,
button.ghost {
  background: transparent;
  color: var(--muted-strong);
  box-shadow: none;
}

.button.subtle,
button.subtle {
  min-height: 40px;
  padding: 0 14px;
}

.button.small,
button.small {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.button.wide,
button.wide {
  width: 100%;
}

.button.is-copied,
button.is-copied {
  border-color: rgba(44, 123, 87, 0.28);
  background: rgba(44, 123, 87, 0.12);
  color: var(--success);
}

.inline {
  display: inline;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.field.grow {
  flex: 1;
  min-width: 220px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder {
  color: #9ca5b7;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(35, 84, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(35, 84, 255, 0.12);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.form-panel {
  position: sticky;
  top: 118px;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 246, 238, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.project-card h3 a {
  color: var(--text);
}

.project-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(35, 84, 255, 0.09);
  color: var(--accent-deep);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
}

.detail-row span:first-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-row strong {
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.detail-row--stack {
  flex-direction: column;
}

.project-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
}

.project-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.project-stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-stat strong {
  color: var(--text);
  font-size: 1.16rem;
  line-height: 1.1;
}

.code-block {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--accent-deep);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted-strong);
  line-height: 1.65;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.meta-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.meta-pill span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-pill strong {
  color: var(--text);
  font-size: 0.94rem;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.metric-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 241, 230, 0.92));
  box-shadow: var(--shadow-soft);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: 2.2rem;
  font-weight: 780;
  letter-spacing: -0.04em;
}

.metric-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.95fr);
  align-items: start;
  margin-bottom: 20px;
}

.chart-card {
  margin-bottom: 20px;
}

.chart-frame {
  position: relative;
  width: 100% !important;
  height: 310px;
  margin-top: 10px;
}

.chart-frame canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.realtime-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-height: 300px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(26, 47, 112, 0.98), rgba(35, 84, 255, 0.9));
  color: #fff;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.realtime-shell.is-inactive {
  background: linear-gradient(180deg, rgba(73, 80, 94, 0.98), rgba(112, 121, 137, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.realtime-shell > .muted {
  color: rgba(255, 255, 255, 0.72);
}

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

.realtime-metric {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
}

.realtime-metric .label {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.realtime-metric .value {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
  font-weight: 780;
  letter-spacing: -0.04em;
}

.realtime-stamp {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
}

.link-grid {
  gap: 12px;
}

.nav-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 236, 224, 0.94));
  color: var(--text);
}

.nav-tile:hover {
  border-color: rgba(35, 84, 255, 0.2);
  box-shadow: 0 14px 24px rgba(35, 84, 255, 0.1);
  color: var(--accent-deep);
}

.nav-tile strong {
  font-size: 1rem;
}

.nav-tile span {
  color: var(--muted);
  line-height: 1.6;
}

.insights-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.data {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.data th,
.data td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--grid);
  text-align: left;
  vertical-align: top;
}

.data th {
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.data tbody tr:hover {
  background: rgba(35, 84, 255, 0.035);
}

.data tbody tr:last-child td {
  border-bottom: none;
}

.data--summary {
  min-width: 0;
  table-layout: fixed;
}

.data--summary th:not(:first-child),
.data--summary td:not(:first-child) {
  width: 104px;
}

.data td:first-child {
  overflow-wrap: anywhere;
}

.data th:not(:first-child),
.data td:not(:first-child) {
  white-space: nowrap;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(35, 84, 255, 0.14);
  border-radius: 999px;
  background: rgba(35, 84, 255, 0.08);
  color: var(--accent-deep);
  font-weight: 700;
}

.tag:hover {
  background: rgba(35, 84, 255, 0.14);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 430px);
  gap: 20px;
  align-items: start;
  min-height: calc(100vh - 170px);
}

.login-panel {
  align-self: stretch;
}

.muted {
  color: var(--muted);
}

/* ---------- project dashboard: compact header ---------- */

.project-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 20px;
  align-items: center;
  padding: 22px 26px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 122, 89, 0.08), transparent 32%),
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(247, 241, 230, 0.92));
  box-shadow: var(--shadow-soft);
}

.project-head h1 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  letter-spacing: -0.025em;
}

.project-head__sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.project-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-head__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.project-head__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.project-head__link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(35, 84, 255, 0.16);
  border-radius: 999px;
  background: rgba(35, 84, 255, 0.06);
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 650;
}

.project-head__link:hover {
  background: rgba(35, 84, 255, 0.14);
  color: var(--accent-deep);
}

.project-head .ranges {
  justify-content: flex-end;
}

.project-head .range {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted-strong);
}

.project-head .range:hover {
  background: rgba(35, 84, 255, 0.08);
  color: var(--accent-deep);
}

.project-head .range.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ---------- dashboard tabs ---------- */

.dashboard-tabs-shell {
  margin-bottom: 20px;
}

.dashboard-tabs {
  position: sticky;
  top: 102px;
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  scrollbar-width: thin;
}

.dashboard-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 750;
  box-shadow: none;
}

.dashboard-tab:hover {
  transform: none;
  border-color: rgba(35, 84, 255, 0.14);
  background: rgba(35, 84, 255, 0.06);
  color: var(--accent-deep);
  box-shadow: none;
}

.dashboard-tab.is-active {
  border-color: rgba(35, 84, 255, 0.2);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(35, 84, 255, 0.18);
}

.dashboard-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(35, 84, 255, 0.16);
}

.dashboard-tab-panel {
  animation: fade-in 240ms ease both;
}

/* ---------- KPI strip ---------- */

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.kpi {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 241, 230, 0.92));
  box-shadow: var(--shadow-soft);
  animation: rise-in 420ms ease both;
}

.kpi__label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.kpi__value {
  display: block;
  margin: 10px 0 6px;
  color: var(--text);
  font-size: 2rem;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.kpi__delta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.kpi__delta-caption {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.kpi__delta--up    { color: var(--success); }
.kpi__delta--down  { color: #c0392b; }
.kpi__delta--flat,
.kpi__delta--new,
.kpi__delta--none  { color: var(--muted-strong); }

.kpi__delta--up::before    { content: "▲"; font-size: 0.75em; margin-right: 2px; }
.kpi__delta--down::before  { content: "▼"; font-size: 0.75em; margin-right: 2px; }

/* ---------- engagement strip ---------- */

.engagement-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.engagement-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.engagement-cell__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.engagement-cell__value {
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 780;
  letter-spacing: -0.03em;
}

.engagement-cell__hint {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ---------- error dashboard ---------- */

.timing-card {
  border-color: rgba(35, 84, 255, 0.18);
}

.timing-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}

.timing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.timing-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.timing-chart-frame {
  position: relative;
  min-height: 310px;
  padding: 16px;
  border: 1px solid var(--grid);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.timing-chart-frame canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.timing-table {
  min-width: 860px;
}

.error-card {
  border-color: rgba(192, 57, 43, 0.18);
}

.error-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}

.error-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.error-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.75fr) minmax(220px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 22px;
}

.error-chart-frame {
  position: relative;
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--grid);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.error-chart-frame canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.error-table {
  min-width: 980px;
}

.severity {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.severity--warning {
  background: rgba(255, 183, 77, 0.22);
  color: #8a4e00;
}

.severity--error {
  background: rgba(192, 57, 43, 0.12);
  color: #9f2f25;
}

.severity--fatal {
  background: rgba(23, 32, 51, 0.92);
  color: #fff;
}

/* ---------- chart series toggles ---------- */

.series-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.series-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  box-shadow: none;
}

.series-toggle:hover {
  transform: none;
  box-shadow: none;
  background: rgba(35, 84, 255, 0.06);
}

.series-toggle.is-on.series-toggle--pageviews {
  border-color: var(--accent);
  background: rgba(35, 84, 255, 0.1);
  color: var(--accent-deep);
}

.series-toggle.is-on.series-toggle--uniques {
  border-color: var(--accent-warm);
  background: rgba(255, 122, 89, 0.14);
  color: #a23a1e;
}

.series-toggle.is-on.series-toggle--sessions {
  border-color: var(--success);
  background: rgba(44, 123, 87, 0.12);
  color: var(--success);
}

/* ---------- geography map ---------- */

.geo-map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 24px;
}

.geo-svg-map {
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--grid);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 22%, rgba(35, 84, 255, 0.12), transparent 24%),
    radial-gradient(circle at 78% 36%, rgba(255, 122, 89, 0.12), transparent 25%),
    linear-gradient(180deg, rgba(241, 247, 255, 0.96), rgba(255, 250, 244, 0.88));
}

.geo-svg-map .svgMap-container,
.geo-svg-map .svgMap-map-container,
.geo-svg-map .svgMap-map-wrapper {
  min-height: inherit;
  border-radius: inherit;
  background: transparent;
}

.geo-svg-map .svgMap-map-wrapper {
  padding-top: 52%;
}

.geo-svg-map .svgMap-country {
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 1.1;
  transition: fill 180ms ease, filter 180ms ease;
}

.geo-svg-map .svgMap-country:hover,
.geo-svg-map .svgMap-country.svgMap-active {
  filter: drop-shadow(0 8px 12px rgba(26, 47, 112, 0.22));
}

.geo-svg-map .svgMap-map-controls-wrapper {
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.geo-svg-map .svgMap-control-button {
  color: var(--accent-deep);
}

.geo-svg-map .svgMap-control-button:hover {
  background: rgba(35, 84, 255, 0.08);
}

.geo-map-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--grid);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  list-style: none;
}

.geo-map-list:empty::before {
  content: "Mapped countries appear here.";
  color: var(--muted);
  line-height: 1.5;
}

.geo-map-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--grid);
}

.geo-map-list li:last-child {
  border-bottom: none;
}

.geo-map-list span {
  color: var(--muted-strong);
  font-weight: 650;
}

.geo-map-list strong {
  color: var(--text);
  font-size: 1.05rem;
}

.svgMap-tooltip {
  z-index: 20;
  font-family: inherit;
}

.svgMap-tooltip .svgMap-tooltip-content-container {
  border: 1px solid rgba(26, 47, 112, 0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* ---------- sub-panel grid (UTM / device / geo) ---------- */

.subpanel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.subpanel-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.subpanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--grid);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.subpanel__title {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subpanel .data {
  min-width: 0;
}

.subpanel .data th,
.subpanel .data td {
  padding: 10px 8px;
  font-size: 0.93rem;
}

/* ---------- realtime active-pages list ---------- */

.realtime-card {
  margin-bottom: 20px;
}

.realtime-card.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: auto;
  height: 100vh;
  max-width: none;
  margin: 0;
  overflow: auto;
  border-radius: 0;
  animation: none;
  transform: none;
}

body.realtime-expanded {
  overflow: hidden;
}

body.realtime-expanded .dashboard-tab-panel.is-active {
  position: relative;
  z-index: 1000;
  animation: none;
}

.realtime-card.is-expanded .realtime-shell {
  flex: 1;
  min-height: 0;
}

.realtime-card.is-expanded .realtime-graph__frame {
  min-height: 220px;
}

.realtime-status {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
  font-weight: 750;
}

.realtime-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa3b1;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.realtime-shell:not(.is-inactive) .realtime-status__dot {
  background: #9dffca;
  box-shadow: 0 0 0 4px rgba(157, 255, 202, 0.16);
}

.realtime-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: stretch;
}

.realtime-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.realtime-active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.realtime-active__label {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.realtime-active__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.realtime-active__list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.92rem;
}

.realtime-active__list li.muted {
  color: rgba(255, 255, 255, 0.56);
}

.realtime-active .path {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
}

.realtime-active .count {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.82rem;
  font-weight: 700;
}

.realtime-graphs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.realtime-graph {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.realtime-graph__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.realtime-graph__head span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.realtime-graph__head strong {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 780;
  letter-spacing: -0.03em;
}

.realtime-graph__frame {
  position: relative;
  flex: 1;
  min-height: 180px;
}

.realtime-graph__frame canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .topbar__inner {
    grid-template-columns: auto auto;
  }

  .topnav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .hero,
  .content-grid--home,
  .content-grid--settings,
  .dashboard-grid,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .project-head {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .project-head__actions,
  .project-head .ranges,
  .project-head__links {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .subpanel-grid,
  .subpanel-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .error-filters,
  .timing-filters,
  .error-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .timing-kpi-grid,
  .error-kpi-grid {
    grid-template-columns: 1fr;
  }

  .realtime-body {
    grid-template-columns: 1fr;
  }

  .geo-map-shell {
    grid-template-columns: 1fr;
  }

  .card--wide {
    grid-column: auto;
  }

  .form-panel {
    position: static;
    top: auto;
  }
}

@media (max-width: 720px) {
  :root {
    font-size: 14px;
  }

  .topbar {
    padding: 14px 14px 0;
  }

  .topbar__inner {
    grid-template-columns: 1fr auto;
    padding: 14px 16px;
    border-radius: 20px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .brand-subtitle {
    display: none;
  }

  .page {
    padding: 20px 14px 42px;
  }

  .hero,
  .card,
  .metric-card {
    border-radius: 22px;
  }

  .hero,
  .card {
    padding: 20px;
  }

  .metric-card {
    padding: 20px;
  }

  .chart-frame {
    height: 280px;
  }

  .dashboard-tabs {
    position: static;
  }

  .geo-svg-map {
    min-height: 260px;
  }

  .metric-grid,
  .metric-grid--three,
  .realtime-kpis,
  .realtime-graphs,
  .kpi-grid,
  .error-filters,
  .error-kpi-grid,
  .error-dashboard-grid,
  .timing-filters,
  .timing-kpi-grid,
  .timing-dashboard-grid,
  .subpanel-grid,
  .subpanel-grid--2 {
    grid-template-columns: 1fr;
  }

  .section-head,
  .project-card__top,
  .detail-row,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .meta-list {
    flex-direction: column;
  }

  .meta-pill,
  .meta-pill--code {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .data--summary th:not(:first-child),
  .data--summary td:not(:first-child) {
    width: 72px;
    text-align: right;
  }

  .button,
  button {
    width: 100%;
  }

  .card-actions .button,
  .card-actions button,
  .meta-pill .button,
  .meta-pill button,
  .realtime-expand,
  .svgMap-control-button,
  .topbar__actions .button,
  .topbar__actions button,
  .hero-links a,
  .topnav a {
    width: auto;
  }
}
