:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f8f2ed;
  background: #10100f;
  --surface: #191816;
  --muted: #b7aca2;
  --border: #39332e;
  --primary: #f3ab8b;
  --teal: #61c5a5;
  --track: #2e2a26;
  --radius: .8rem;
  --chart-label: 7rem;
  --chart-value: 4.1rem;
  --chart-gap: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, dl, dd, ul { margin: 0; }
body { line-height: 1.5; }

a:focus-visible,
.table-scroll:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

.container {
  width: min(85rem, calc(100% - 5rem));
  margin-inline: auto;
}

.topbar {
  border-bottom: 1px solid var(--border);
}

.topbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 4.3rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: inherit;
  font-size: 1.07rem;
  font-weight: 720;
  text-decoration: none;
  letter-spacing: -.025em;
}
.brand-customer { color: var(--muted); font-weight: 550; overflow-wrap: anywhere; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1rem; }
.logout { color: var(--primary); font-size: .875rem; text-decoration-thickness: 1px; text-underline-offset: .22em; }
.logout:hover { color: #ffd2be; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: .62rem;
  background: var(--primary);
  color: #231815;
  font-size: .9rem;
  font-weight: 800;
}

.dashboard { padding-block: 2rem 3.75rem; }
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem 1.25rem;
  margin-bottom: 1.55rem;
}

h1 {
  font-size: clamp(1.95rem, 4vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -.06em;
  font-weight: 750;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -.025em;
}

.snapshot {
  padding: .38rem .72rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  color: var(--muted);
  background: var(--surface);
  font-size: .875rem;
  white-space: nowrap;
}
.snapshot time { margin-left: .2rem; color: #f8f2ed; font-weight: 700; font-variant-numeric: tabular-nums; }
.demo-label { color: var(--muted); font-size: .875rem; }

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  width: fit-content;
  margin-bottom: 1.1rem;
  padding: .25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .65rem;
}
.view-tabs a { padding: .45rem .8rem; color: var(--muted); border-radius: .4rem; text-decoration: none; font-size: .875rem; font-weight: 650; }
.view-tabs a:hover { color: #fff; background: var(--track); }
.view-tabs a[aria-current] { color: #231815; background: var(--primary); }

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

.totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.total {
  padding: 1.15rem 1.45rem 1.25rem;
}

.total:first-child {
  background: #261e1a;
  border-color: #734f40;
}

.total dt { color: var(--muted); font-size: .9rem; font-weight: 650; }
.total:first-child dt { color: var(--primary); }
.total dd {
  margin-top: .24rem;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  font-weight: 740;
  line-height: 1.22;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.total dd.metric-note { color: var(--muted); font-size: .875rem; font-weight: 500; letter-spacing: 0; line-height: 1.4; }

.section, .status { padding: 1.45rem; }
.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.1rem;
  align-items: start;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .65rem;
  margin-top: 1rem;
  padding: 0;
  list-style: none;
}

.group-card {
  --group-color: #f3ab8b;
  --group-bg: #35251f;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--group-color);
  border-radius: .55rem;
  background: var(--group-bg);
}
.group-card:nth-child(4n + 2) { --group-color: #61c5a5; --group-bg: #1c332c; }
.group-card:nth-child(4n + 3) { --group-color: #b7aaff; --group-bg: #2a263c; }
.group-card:nth-child(4n + 4) { --group-color: #e1a5b1; --group-bg: #38252d; }
.group-card h3 { font-size: .925rem; overflow-wrap: anywhere; }
.group-size { margin: .15rem 0 0; font-size: 1.45rem; line-height: 1.3; font-weight: 720; font-variant-numeric: tabular-nums; }
.group-size span { font-size: .875rem; font-weight: 500; }
.group-revenue { margin: .3rem 0 0; color: #e4d7ce; font-size: .875rem; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem 1.25rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: .875rem;
}

.legend li { display: flex; align-items: center; gap: .45rem; }
.swatch { width: .72rem; height: .72rem; border-radius: .2rem; background: var(--bar-color); }
.customers { --bar-color: var(--primary); }
.revenue { --bar-color: var(--teal); }

.chart {
  list-style: none;
  margin-top: 1rem;
  padding: 0;
}

.chart-row {
  display: grid;
  grid-template-columns: var(--chart-label) minmax(0, 1fr);
  align-items: center;
  gap: var(--chart-gap);
  padding-block: .63rem;
  border-top: 1px solid var(--border);
}

.chart-row strong { font-size: .925rem; font-weight: 650; overflow-wrap: anywhere; }
.series { display: grid; gap: .2rem; }
.bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chart-value);
  align-items: center;
  gap: var(--chart-gap);
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.bar span { text-align: right; }

meter {
  display: block;
  width: 100%;
  height: .64rem;
  appearance: none;
  background: var(--track);
  border-radius: .2rem;
}

meter::-webkit-meter-bar { background: var(--track); border: 0; border-radius: .2rem; }
meter::-webkit-meter-optimum-value { background: var(--bar-color); border-radius: .2rem; }
meter::-moz-meter-bar { background: var(--bar-color); border-radius: .2rem; }

.chart-axis {
  margin: .2rem calc(var(--chart-value) + var(--chart-gap)) 0 calc(var(--chart-label) + var(--chart-gap));
}
.axis-labels {
  display: flex;
  justify-content: space-between;
  padding-top: .45rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.table-scroll {
  overflow-x: auto;
  margin-block: .9rem .65rem;
  border: 1px solid var(--border);
  border-radius: .6rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: .72rem .85rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
th:first-child { text-align: left; }
thead { background: #27231f; }
thead th { color: #dfd1c7; font-size: .875rem; font-weight: 650; }
tbody th { font-size: .94rem; font-weight: 650; }
tbody tr:nth-child(even) { background: #201e1a; }
tbody tr:last-child > * { border-bottom: 0; }
.table-note, .status p { color: var(--muted); }
.table-note { margin: 0; font-size: .875rem; }
.status p { margin: .5rem 0 0; }

.login-shell { display: grid; min-height: 100dvh; place-items: center; padding: 1.25rem; }
.login-card { width: min(100%, 25rem); padding: 2.4rem 2rem; text-align: center; }
.login-mark { width: 3.25rem; height: 3.25rem; margin: 0 auto 1.45rem; border-radius: .8rem; font-size: 1.15rem; }
.login-card h1 { font-size: 1.4rem; letter-spacing: -.025em; }
.login-customer { margin: .42rem 0 1.65rem; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.google-sign-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 2.75rem;
  padding: .55rem .8rem;
  border: 1px solid #dadce0;
  border-radius: .55rem;
  background: #fff;
  color: #1f1f1f;
  font-weight: 650;
  font-size: .875rem;
  text-decoration: none;
}
.google-sign-in:hover { background: #f0f3f8; }
.login-demo { margin: 1.1rem 0 0; }
.panel-note { color: var(--muted); font-size: .875rem; margin: .3rem 0 0; }
.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pairs-table :is(th, td):nth-child(2) { white-space: normal; }
.product-table th:first-child { white-space: normal; min-width: 7rem; }
.pairs-table td:nth-child(2) { text-align: left; }
.search-form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.search-form label { color: var(--muted); font-size: .875rem; }
.search-form input[type="search"], .search-form button {
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: var(--surface);
  color: inherit;
  font: inherit;
}
.search-form input[type="search"] { flex: 0 1 19rem; min-width: 0; }
.search-form button { border-color: #966952; }
.search-form button:hover { background: var(--track); cursor: pointer; }
.transitions { list-style: none; padding: 0; margin-top: .75rem; }
.transitions li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 6.2rem; align-items: center; gap: .5rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.transitions span { padding: .5rem; background: var(--track); border-radius: .4rem; border-inline-start: 2px solid var(--teal); }
.transitions small { color: var(--muted); font-size: .875rem; text-align: right; }

@media (max-width: 62rem) {
  .analysis-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 46rem) {
  :root { --chart-label: 5.2rem; --chart-value: 3.4rem; --chart-gap: .55rem; }
  .container { width: calc(100% - 2rem); }
  .dashboard { padding-block: 1.65rem 2.25rem; }
  .topbar-content { min-height: 3.65rem; }
  .page-heading { margin-bottom: 1.05rem; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .total, .section, .status { padding: 1rem; }
  th, td { padding-inline: .5rem; }
  thead th { white-space: normal; }
}

@media (max-width: 32rem) {
  .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-card { padding: .65rem .7rem; }
  .axis-labels span:nth-child(even) { display: none; }
}
