:root {
  color-scheme: light;
  --ink: #22324b;
  --muted: #4d6078;
  --line: #d5e3ee;
  --purple: #5434a2;
  --lavender: #f0ebfd;
  --teal: #127b81;
  --paper: #fff;
  --sky: #edf6fc;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky);
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #7b59da; outline-offset: 3px; }
h1, h2, p { margin: 0; }
p { color: var(--muted); line-height: 1.55; }
h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); letter-spacing: -.055em; line-height: 1.05; }
h2 { font-size: 1.22rem; line-height: 1.3; letter-spacing: -.025em; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner, .workspace { width: min(100% - 48px, 1160px); margin-inline: auto; }
.topbar-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; font-weight: 700; white-space: nowrap; }
.brand span { border-left: 1px solid var(--line); padding-left: 14px; }
.wordmark { width: 146px; height: auto; display: block; }
.workspace { padding-block: 48px 60px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 28px; }
.page-heading h1 { margin: 5px 0 10px; }
.status { font-size: .88rem; font-weight: 700; color: var(--teal); }
.period { display: flex; align-items: center; padding: 4px; gap: 2px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.period button { border: 0; font-size: .88rem; white-space: nowrap; color: var(--muted); background: transparent; padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.period button[aria-pressed="true"] { background: var(--lavender); color: var(--purple); }
.secondary, .primary { border-radius: 12px; padding: 10px 15px; min-height: 44px; font-weight: 700; }
.secondary { background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.primary { background: var(--purple); color: white; border: 1px solid transparent; }
.primary:hover { background: #442787; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 5px 17px rgba(29, 63, 95, .055); }
.metric { padding: 20px; display: grid; align-content: start; gap: 8px; }
.metric h2 { font-size: .95rem; letter-spacing: 0; color: var(--muted); }
.metric strong { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.05; letter-spacing: -.045em; }
small, .detail { font-size: .88rem; color: var(--muted); line-height: 1.45; }
.metric.premium { background: #f5f0ff; border-color: #e3d8fa; }
.metric.premium strong { color: var(--purple); }
.main-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 18px; }
.panel { padding: 23px; min-width: 0; }
.panel-title { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 18px; }
.panel-title p { margin-top: 3px; font-size: .94rem; }
.panel-title strong { font-size: 1.75rem; color: var(--purple); letter-spacing: -.04em; }
.chart { min-height: 170px; }
.chart canvas { display: block; width: 100%; height: 185px; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .88rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.violet { background: #724ac3; }
.teal { background: var(--teal); margin-left: 12px; }
.funnel { padding: 0; margin: 0 0 12px; list-style: none; display: grid; gap: 12px; }
.funnel li { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; font-size: .95rem; }
.funnel progress { grid-column: 1 / -1; width: 100%; height: 8px; appearance: none; border: 0; border-radius: 5px; background: var(--lavender); overflow: hidden; }
.funnel progress::-webkit-progress-bar { background: var(--lavender); border-radius: 5px; }
.funnel progress::-webkit-progress-value { background: #7954c9; border-radius: 5px; }
.funnel progress::-moz-progress-bar { background: #7954c9; border-radius: 5px; }
.breakdown { display: grid; gap: 9px; margin: 0; }
.breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid #edf1f7; }
.breakdown > div:last-child { border: 0; padding-bottom: 0; }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; text-align: right; font-weight: 700; }
.parents { margin-top: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th, td { border-bottom: 1px solid #e8eef5; padding: 12px 13px 12px 0; font-size: .92rem; }
th { color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; }
details { margin-top: 16px; color: var(--muted); }
summary { cursor: pointer; font-size: .9rem; font-weight: 700; }
.empty { margin-block: 14px; padding: 15px; border-radius: 12px; background: var(--sky); }
.error { margin-block: 10px; color: #a02448; }
.signin, .initial { min-height: 100svh; display: grid; place-items: center; padding: 20px; }
.initial { color: var(--muted); }
.signin-card { width: min(100%, 408px); border-radius: 28px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 18px 46px #36367714; padding: 34px; }
.signin-card .wordmark { width: 170px; margin-bottom: 25px; }
.signin-card h1 { font-size: 2.25rem; margin-bottom: 8px; }
.signin form { display: grid; gap: 10px; margin-top: 23px; }
.signin label { font-weight: 700; font-size: .92rem; }
.signin input { width: 100%; min-height: 46px; border: 1px solid #b7cede; border-radius: 12px; padding: 8px 12px; color: var(--ink); background: #f7faff; }
.signin form .primary { margin-top: 4px; }

@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 665px) {
  .topbar-inner, .workspace { width: calc(100% - 28px); }
  .workspace { padding-top: 29px; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 18px; }
  .main-grid { grid-template-columns: 1fr; }
  .metric, .panel { padding: 16px; border-radius: 17px; }
  .metrics { gap: 10px; }
  .brand .wordmark { width: 112px; }
  .brand { gap: 8px; }
  .brand span { padding-left: 8px; }
  .signin-card { padding: 24px; }
}
