/* Lopay Localisation — palette and type from lopay-react (global.css tokens, Poppins). */

@font-face {
  font-family: Poppins;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/poppins-400.ttf') format('truetype');
}
@font-face {
  font-family: Poppins;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/poppins-500.ttf') format('truetype');
}
@font-face {
  font-family: Poppins;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/poppins-600.ttf') format('truetype');
}
@font-face {
  font-family: Poppins;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/poppins-700.ttf') format('truetype');
}

:root {
  --purple: #727aff;
  --purple-strong: #5a61e8;
  --purple-soft: rgba(114, 122, 255, 0.1);
  --teal: #03a8a9;
  --teal-soft: rgba(3, 168, 169, 0.1);
  --red: #dd2b2b;
  --red-soft: rgba(221, 43, 43, 0.08);
  --orange: #db5f2c;
  --orange-soft: rgba(219, 95, 44, 0.1);

  --bg: #f4f5f8;
  --panel: #ffffff;
  --panel-2: #f7f8f9;
  --text: #101010;
  --text-2: #5c6170;
  --text-3: #8a8a8a;
  --line: #eceef3;
  --line-strong: #e1e4eb;
  --code-bg: #17151c;
  --code-text: #e9e8f0;
  --shadow: 0 1px 2px rgba(16, 16, 16, 0.04), 0 4px 16px rgba(16, 16, 16, 0.04);
  --radius: 16px;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;

  color-scheme: light;
  font:
    13.5px/1.5 Poppins,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* `data-theme` is set by app.js from the theme switch — "System" resolves it from prefers-color-scheme. */
:root[data-theme='dark'] {
  --purple-soft: rgba(114, 122, 255, 0.18);
  --teal-soft: rgba(3, 168, 169, 0.18);
  --red-soft: rgba(221, 43, 43, 0.18);
  --orange-soft: rgba(219, 95, 44, 0.18);
  --bg: #141217;
  --panel: #1f1c24;
  --panel-2: #26222a;
  --text: #f4f3f7;
  --text-2: #b4b1be;
  --text-3: #85828f;
  --line: #2d2934;
  --line-strong: #3a3542;
  --code-bg: #110f14;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}
[data-theme='dark'] .sidebar .logo,
[data-theme='dark'] .signin-card .logo {
  filter: brightness(1.6);
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--purple);
  text-decoration: none;
}
a:hover {
  color: var(--purple-strong);
}
h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
code,
pre,
.mono {
  font-family: var(--mono);
  font-size: 12px;
}
.muted {
  color: var(--text-3);
}
.error {
  color: var(--red);
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
}
.kpis {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
svg.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ shell */

.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 22px;
}
.sidebar .logo {
  height: 24px;
}
.sidebar .product {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-top: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 500;
}
.nav-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--purple-soft);
  color: var(--purple);
}
.theme-switch {
  margin-top: auto;
  margin-bottom: 10px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-2);
}
.theme-switch button {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text-3);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.theme-switch button:hover {
  color: var(--text);
}
.theme-switch button[aria-pressed='true'] {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.theme-switch .icon {
  width: 16px;
  height: 16px;
}
.sidebar .me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  background: linear-gradient(135deg, var(--purple), var(--teal));
  color: #fff;
}
.me .who {
  min-width: 0;
  flex: 1;
}
.me .who div {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me .who small {
  color: var(--text-3);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
}
.icon-button {
  border: 0;
  background: none;
  color: var(--text-3);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-button:hover {
  background: var(--panel-2);
  color: var(--text);
}

main {
  padding: 28px 36px 64px;
  min-width: 0;
}
.page {
  max-width: 1320px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .titles {
  flex: 1;
  min-width: 260px;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--text-3);
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 12.5px;
  margin-bottom: 10px;
  color: var(--text-3);
}
.crumb:hover {
  color: var(--purple);
}

/* ------------------------------------------------------------------ controls */

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.segmented button {
  border: 0;
  background: none;
  font: inherit;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.on {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 1px 2px rgba(90, 97, 232, 0.4);
}
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--text-3);
}
.btn.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.btn.primary:hover {
  background: var(--purple-strong);
  border-color: var(--purple-strong);
}
.btn.success {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}
.field.grow {
  flex: 1;
  min-width: 240px;
}
.field.full {
  flex-basis: 100%;
}
.field.wide {
  min-width: 220px;
}
input,
select,
textarea {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
  background: var(--panel);
}
textarea {
  width: 100%;
  min-height: 104px;
  font-family: var(--mono);
  font-size: 12.5px;
  resize: vertical;
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  cursor: pointer;
}
.check input {
  accent-color: var(--purple);
  width: 16px;
  height: 16px;
}
.query {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  min-width: 0;
}
.card.flush {
  padding: 0;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.card.flush .card-head {
  padding: 18px 22px 0;
}
.card-head p {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 12px;
}
.card-head .titles {
  flex: 1;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi .label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
}
.kpi .label .dot {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}
.kpi .label .dot svg {
  width: 15px;
  height: 15px;
}
.kpi .value.pct {
  text-align: left;
  min-width: 0;
}
.kpi .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.kpi .sub {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tone-purple {
  background: var(--purple-soft);
  color: var(--purple);
}
.tone-teal {
  background: var(--teal-soft);
  color: var(--teal);
}
.tone-red {
  background: var(--red-soft);
  color: var(--red);
}
.tone-orange {
  background: var(--orange-soft);
  color: var(--orange);
}
.delta {
  font-weight: 600;
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 999px;
}
.delta.up {
  color: var(--teal);
  background: var(--teal-soft);
}
.delta.down {
  color: var(--red);
  background: var(--red-soft);
}

/* ------------------------------------------------------------------ tables */

table {
  border-collapse: collapse;
  width: 100%;
}
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--panel);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.card.flush th:first-child,
.card.flush td:first-child {
  padding-left: 22px;
}
.card.flush th:last-child,
.card.flush td:last-child {
  padding-right: 22px;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tr.click {
  cursor: pointer;
}
tr.click:hover td {
  background: var(--panel-2);
}
tr.dim td {
  color: var(--text-3);
}
.clip {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-title {
  font-weight: 500;
  color: var(--text);
}
.cell-title:hover {
  color: var(--purple);
}
.cell-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--text-2);
}
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.pill.plain::before {
  display: none;
}
.pill.open,
.pill.crash,
.pill.spike {
  background: var(--red-soft);
  color: var(--red);
}
.pill.resolved,
.pill.ok {
  background: var(--teal-soft);
  color: var(--teal);
}
.pill.new,
.pill.drop {
  background: var(--orange-soft);
  color: var(--orange);
}
.pill.vanished,
.pill.info {
  background: var(--purple-soft);
  color: var(--purple);
}

.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}
.meter .track {
  width: 90px;
  height: 6px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
}
.meter .fill {
  height: 100%;
  border-radius: 99px;
}
.pct {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: right;
}
.pct.good {
  color: var(--teal);
}
.pct.warn {
  color: var(--orange);
}
.pct.bad {
  color: var(--red);
}

/* ------------------------------------------------------------------ charts */

.chart {
  position: relative;
}
.chart svg.plot {
  width: 100%;
  height: 240px;
  display: block;
  overflow: visible;
}
.chart .grid {
  stroke: var(--line);
  stroke-dasharray: 3 4;
}
.chart .tick {
  fill: var(--text-3);
  font-size: 10.5px;
  font-family: Poppins, sans-serif;
}
.chart .guide {
  stroke: var(--line-strong);
}
.tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  min-width: 150px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16, 16, 16, 0.12);
  padding: 10px 12px;
  font-size: 12px;
  display: none;
}
.tooltip .t {
  font-weight: 600;
  margin-bottom: 6px;
}
.tooltip .r {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tooltip .r span:last-child {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-left: 12px;
}
.swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 12px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 420px;
}
.legend b {
  font-weight: 600;
  color: var(--text);
}

.funnel-row {
  display: grid;
  grid-template-columns: 220px 1fr 260px;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.funnel-row:last-child {
  border-bottom: 0;
}
.funnel-row .step {
  font-weight: 500;
}
.funnel-row .step small {
  display: block;
  color: var(--text-3);
  font-weight: 400;
}
.funnel-row .bar-track {
  height: 30px;
  background: var(--panel-2);
  border-radius: 8px;
  overflow: hidden;
}
.funnel-row .bar {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--purple), #9aa0ff);
}
.funnel-row .stats {
  text-align: right;
  font-size: 12px;
  color: var(--text-3);
}
.funnel-row .stats b {
  font-size: 14px;
  color: var(--text);
  display: block;
  font-weight: 600;
}
.big-number {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--purple);
}

.heat {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  padding: 9px 4px;
}
.retention td {
  padding: 3px;
  border: 0;
}
.retention th {
  border: 0;
  text-align: center;
}
.retention td.cohort {
  padding: 3px 12px 3px 0;
  white-space: nowrap;
  font-weight: 500;
}
.retention td.size {
  color: var(--text-3);
  padding-right: 12px;
  text-align: right;
}

/* ------------------------------------------------------------------ crash detail */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px 24px;
}
.fact small {
  display: block;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.fact div {
  font-weight: 500;
  word-break: break-word;
}
.fact .mono {
  font-size: 12px;
  font-weight: 400;
}
.fact .big {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.code {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 12px;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-x: auto;
}
.frame {
  display: grid;
  grid-template-columns: 36px minmax(180px, 320px) 1fr;
  gap: 12px;
  padding: 7px 16px 7px 0;
  border-left: 3px solid transparent;
}
.frame .n {
  color: #6c6878;
  text-align: right;
}
.frame .fn {
  color: #b9b6c6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame .fn .inlined {
  margin-left: 8px;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 10px;
  opacity: 0.6;
}
.frame .loc {
  color: #7d7989;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame.inapp {
  border-left-color: var(--purple);
  background: rgba(114, 122, 255, 0.08);
}
.frame.inapp .fn {
  color: #fff;
  font-weight: 600;
}
.frame.inapp .loc {
  color: #b8bbff;
}
details.frame-source > summary {
  list-style: none;
  cursor: pointer;
}
details.frame-source > summary::-webkit-details-marker {
  display: none;
}
details.frame-source > summary .n::before {
  content: '▸ ';
  color: #6c6878;
}
details.frame-source[open] > summary .n::before {
  content: '▾ ';
}
.source {
  margin: 2px 16px 8px 51px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 0;
  overflow-x: auto;
}
.src-line {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 0 12px 0 0;
  white-space: pre;
}
.src-line .ln {
  color: #6c6878;
  text-align: right;
  user-select: none;
}
.src-line .tx {
  color: #b9b6c6;
}
.src-line.hit {
  background: rgba(255, 92, 92, 0.16);
}
.src-line.hit .tx {
  color: #fff;
}
details.raw {
  margin-top: 14px;
}
details.raw summary {
  cursor: pointer;
  color: var(--text-3);
  font-weight: 500;
  font-size: 12.5px;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px 16px;
  border-radius: 12px;
  overflow: auto;
  max-height: 420px;
  margin: 10px 0 0;
}

.timeline {
  position: relative;
  padding-left: 4px;
}
.tl-item {
  display: grid;
  grid-template-columns: 74px 26px 1fr;
  gap: 12px;
  align-items: start;
  position: relative;
  padding-bottom: 14px;
}
.tl-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 98px;
  top: 24px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}
.tl-time {
  text-align: right;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.tl-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.tl-dot svg {
  width: 13px;
  height: 13px;
}
.tl-body {
  min-width: 0;
  padding-top: 2px;
}
.tl-body .what {
  font-weight: 500;
}
.tl-body .detail {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-item.crash .tl-body {
  background: var(--red-soft);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: -4px;
  cursor: pointer;
}
.tl-item.crash .what {
  color: var(--red);
}

/* ------------------------------------------------------------------ event catalogue */

.cat-search {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 12px;
  z-index: 3;
}
.cat-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 4px 16px;
  color: var(--text-3);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cat-search-box:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
  background: var(--panel);
  color: var(--purple);
}
.cat-search-box input {
  flex: 1;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 15px;
  padding: 10px 0;
  min-width: 0;
}
.cat-search-box input:focus {
  box-shadow: none;
  background: none;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
}
.cat-filters select {
  padding: 7px 10px;
  font-size: 12.5px;
}
.cat-filters .cat-area {
  max-width: 280px;
}
.cat-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.cat-group-head h2 {
  font-size: 15px;
}
mark {
  background: rgba(255, 206, 77, 0.45);
  color: var(--text);
  border-radius: 3px;
  padding: 0 1px;
}

.ev {
  border-bottom: 1px solid var(--line);
}
.ev:last-child {
  border-bottom: 0;
}
.ev-head {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 12px;
  align-items: start;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 14px 22px;
  cursor: pointer;
}
.ev-head:hover,
.ev.open .ev-head {
  background: var(--panel-2);
}
.ev-chevron {
  color: var(--text-3);
  padding-top: 2px;
  transition: transform 0.15s ease;
}
.ev-chevron svg {
  width: 16px;
  height: 16px;
}
.ev.open .ev-chevron {
  transform: rotate(90deg);
  color: var(--purple);
}
.ev-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ev-title {
  gap: 8px;
}
.ev-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.ev-when {
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ev.open .ev-when {
  -webkit-line-clamp: unset;
}
.ev-purpose {
  color: var(--text-3);
  font-size: 12.5px;
}
.ev-live {
  text-align: right;
  min-width: 84px;
  font-variant-numeric: tabular-nums;
}
.ev-live b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--teal);
}
.ev-live small {
  color: var(--text-3);
  font-size: 11.5px;
}
.ev-live.none {
  color: var(--text-3);
  font-size: 12px;
  padding-top: 2px;
}
.pill.tier-T1 {
  background: var(--red-soft);
  color: var(--red);
}
.pill.tier-T2 {
  background: var(--purple-soft);
  color: var(--purple);
}
.pill.tier-T3 {
  background: var(--panel-2);
  color: var(--text-3);
}
.ev-detail {
  padding: 4px 22px 20px 52px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px 28px;
}
.ev-block small {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.ev-block p {
  margin: 0 0 6px;
}
.ev-block .mono {
  word-break: break-all;
}
.ev-props {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ev-keys {
  margin-top: 8px;
  gap: 6px;
}
.ev-flow + .ev-flow {
  margin-top: 10px;
}
.ev-flow .row {
  gap: 6px;
}
.ev-detail .btn {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ states */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--text-3);
  text-align: center;
}
.empty .glyph {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--text-3);
}
.empty b {
  color: var(--text-2);
  font-weight: 500;
}
.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-2) 0%, var(--line) 50%, var(--panel-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.banner {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 500;
}

/* ------------------------------------------------------------------ sign-in */

.signin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 15% 10%, rgba(114, 122, 255, 0.22), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(3, 168, 169, 0.16), transparent 60%), var(--bg);
}
.signin-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(16, 16, 16, 0.1);
  padding: 40px 36px 32px;
  text-align: center;
}
.signin-card .logo {
  height: 34px;
  margin-bottom: 18px;
}
.signin-card h1 {
  font-size: 20px;
}
.signin-card p {
  color: var(--text-2);
  margin: 8px 0 0;
}
.google-btn {
  width: 100%;
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.google-btn:hover {
  background: var(--panel-2);
  border-color: var(--text-3);
}
.google-btn svg {
  width: 20px;
  height: 20px;
}
.signin-card .note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.signin-card .note svg {
  width: 14px;
  height: 14px;
}
.signin-card .banner {
  margin-top: 20px;
  text-align: left;
  font-size: 12.5px;
}

/* Apps + API docs */
.nav-label {
  padding: 18px 12px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.btn.small {
  padding: 5px 10px;
  font-size: 12px;
}
.btn.danger {
  color: var(--red);
}
.btn.danger:hover {
  border-color: var(--red);
  background: var(--red-soft);
}
.stack.tight {
  gap: 10px;
}
.snippet {
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
}
.snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #a9a6b6;
  font-size: 12px;
  font-weight: 500;
}
.snippet-head .btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e9e8f0;
}
.snippet-head .btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
}
.snippet pre {
  margin: 0;
  border-radius: 0;
  max-height: 520px;
  white-space: pre;
}
:not(pre) > code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.92em;
}
.docs {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.doc-toc {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px;
}
.doc-toc small {
  padding: 0 10px 8px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.doc-toc a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 12.5px;
}
.doc-toc a:hover {
  background: var(--panel-2);
  color: var(--text);
}
.doc {
  scroll-margin-top: 16px;
}
.doc h2 {
  font-size: 17px;
  margin: 0 0 10px;
}
.doc h3 {
  font-size: 13.5px;
  margin: 22px 0 8px;
}
.doc p,
.doc li {
  color: var(--text-2);
  max-width: 820px;
}
.doc li {
  margin: 4px 0;
}
.doc li b,
.doc p b {
  color: var(--text);
  font-weight: 600;
}
.doc .snippet,
.doc .stack.tight {
  margin-top: 14px;
}
ol.steps {
  padding-left: 20px;
}
table.fields th,
table.fields td {
  padding: 9px 12px;
  vertical-align: top;
}
table.fields td:first-child {
  white-space: nowrap;
  font-weight: 500;
  color: var(--text);
}
table.fields td.type {
  white-space: nowrap;
}
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--orange-soft);
  color: var(--text);
  margin-top: 12px;
}
.callout .icon {
  color: var(--orange);
  flex: none;
  margin-top: 2px;
}
.key-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.key-box > div {
  flex: 1;
  min-width: 0;
}
.key-box small {
  display: block;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.key-box code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13.5px;
  word-break: break-all;
  color: var(--text);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .docs {
    grid-template-columns: minmax(0, 1fr);
  }
  .doc-toc,
  .nav-label {
    display: none;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand {
    padding: 0 10px 0 0;
  }
  .sidebar .product,
  .me .who {
    display: none;
  }
  .theme-switch {
    margin: 0 6px 0 auto;
    flex: none;
  }
  .sidebar .me {
    margin: 0;
    border: 0;
    padding: 0;
  }
  main {
    padding: 20px 16px 48px;
  }
  .funnel-row {
    grid-template-columns: 1fr;
  }
}

/* Alerts */
[hidden] {
  display: none !important;
}
.callout.ok {
  background: var(--teal-soft);
  margin-top: 0;
}
.callout.ok .icon {
  color: var(--teal);
}
.field.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  align-self: center;
  padding-top: 18px;
}
.field input[type='number'] {
  width: 110px;
}
.row.nowrap {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* Event catalogue: add / import */
.cat-form textarea {
  font-family: inherit;
  font-size: 13px;
  min-height: 56px;
}
.cat-form input.mono {
  font-family: var(--mono);
}
.cat-import-rows {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.callout code {
  font-family: var(--mono);
  font-size: 12px;
}

/* ------------------------------------------------------------------ localisation */

.small {
  font-size: 12px;
}
.prose {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
}
.key-cell {
  min-width: 240px;
  max-width: 360px;
}
.key-cell .cell-title {
  word-break: break-all;
  font-size: 12px;
}
.cell-sub.plain-sub {
  font-family: inherit;
  font-size: 12px;
}
.copy-cell {
  max-width: 460px;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-cell .callout {
  margin-top: 8px;
  font-size: 12.5px;
}
.key-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  word-break: break-all;
}
.diff-line {
  padding: 3px 8px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-line + .diff-line {
  margin-top: 4px;
}
.diff-line.old {
  background: var(--red-soft);
}
.diff-line.new {
  background: var(--teal-soft);
}
del {
  background: rgba(221, 43, 43, 0.22);
  text-decoration: line-through;
  border-radius: 3px;
}
ins {
  background: rgba(3, 168, 169, 0.25);
  text-decoration: none;
  border-radius: 3px;
}
textarea.plain {
  font-family: inherit;
  font-size: 13px;
  min-height: 0;
}
.timeline {
  display: flex;
  flex-direction: column;
}
.event {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.event:last-child {
  border-bottom: 0;
}
.history-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.history-row .clip {
  max-width: 420px;
}
.comment {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
}
.nav-item .count {
  margin-left: auto;
  background: var(--purple);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
}
.banner.info {
  background: var(--purple-soft);
  color: var(--purple);
}
.banner.ok {
  background: var(--teal-soft);
  color: var(--teal);
}
.query > select {
  padding: 10px 12px;
}
.query .grow {
  flex: 1;
  min-width: 280px;
}
.dev-login {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dev-login input {
  flex: 1;
}
