/* Tokens follow the OS theme; [data-theme] pins one. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f6f7, #0b0c0f);
  --surface: light-dark(#ffffff, #131418);
  --surface-2: light-dark(#f3f3f5, #1a1b20);
  --hover: light-dark(#eeeef1, #202128);
  --line: light-dark(#e5e5ea, #25262d);
  --line-strong: light-dark(#d2d2d9, #34353e);
  --text: light-dark(#17171c, #ececf1);
  --muted: light-dark(#666673, #9c9da8);
  --subtle: light-dark(#9b9ba6, #686974);
  --accent: light-dark(#0b9a78, #3dd9ae);
  --accent-fg: light-dark(#ffffff, #052119);
  --red: light-dark(#d92d48, #ff6b7f);
  --orange: light-dark(#c76a05, #ffb35c);
  --c1: light-dark(#0fa57f, #34d3a6);
  --c2: light-dark(#3b7bf6, #6ea7ff);
  --c3: light-dark(#8b5cf6, #a78bfa);
  --c4: light-dark(#e3900b, #fbbf24);
  --c5: light-dark(#ec4865, #fb7185);
  --c6: light-dark(#0aa5c4, #22d3ee);
  --c7: light-dark(#d4317e, #f472b6);
  --bar-plain: light-dark(#c9cdd6, #3a3d48);
  --shadow-tint: light-dark(#1a1a2a0d, transparent);
  --shadow-deep: light-dark(#1a1a2a2e, #000000b0);
  --shadow-sm: 0 1px 2px var(--shadow-tint);
  --shadow-lg: 0 14px 36px -8px var(--shadow-deep);
  --radius: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 216px;
  font:
    13px/1.45 "Inter var",
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "tnum";
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
[hidden] {
  display: none !important;
}
.i {
  flex: none;
  display: block;
}
kbd {
  font: 500 10.5px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 4px;
  background: var(--surface);
}
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 30;
  background: var(--surface);
  padding: 8px 10px;
}

/* Shell */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 15;
  transition: width 0.22s var(--ease);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 7px;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-mark {
  flex: none;
  color: var(--accent);
  transition: transform 0.4s var(--ease);
}
.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.06);
}
.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 6px 0 9px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition:
    border-color 0.12s,
    color 0.12s;
}
.search-trigger:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.search-trigger span {
  flex: 1;
}
.side-label {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 550;
  padding: 12px 8px 4px;
  white-space: nowrap;
}
.sidebar nav {
  display: grid;
  gap: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s;
}
.nav-item .label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover,
.nav-item.active {
  background: var(--hover);
  color: var(--text);
}
.nav-item.active .i {
  color: var(--accent);
}
.nav-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-radius: 99px;
  padding: 0 6px;
  line-height: 18px;
}
.app-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 6px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  text-align: left;
  min-width: 0;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.12s,
    background 0.12s;
}
.app-chip:hover {
  border-color: var(--line-strong);
  background: var(--hover);
}
.app-chip .label:not(.i) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-chip .i {
  color: var(--subtle);
}
.side-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-left: 8px;
}
.side-live {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
/* Collapsed sidebar: an icon rail. */
body.collapsed {
  --sidebar: 56px;
}
body.collapsed .sidebar .label,
body.collapsed .nav-count {
  display: none;
}
body.collapsed .search-trigger,
body.collapsed .nav-item,
body.collapsed .app-chip {
  justify-content: center;
  padding: 0;
}
body.collapsed .app-chip {
  height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
body.collapsed .side-bottom {
  flex-direction: column;
  padding: 0;
  gap: 10px;
}
body.collapsed .brand {
  padding: 0 7px;
}
.live-dot {
  position: relative;
  display: inline-block;
  background: var(--accent);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping {
  70%,
  100% {
    transform: scale(3);
    opacity: 0;
  }
}
.workspace {
  min-width: 0;
  flex: 1;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  gap: 12px;
}
#progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent) 40%,
    var(--accent) 60%,
    transparent
  );
  background-size: 40% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
body.busy #progress {
  opacity: 1;
  transition-delay: 0.12s;
  animation: progress 1s linear infinite;
}
@keyframes progress {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.breadcrumbs a,
.breadcrumbs b {
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 6px;
  border-radius: 6px;
}
.breadcrumbs a {
  transition:
    background 0.12s,
    color 0.12s;
}
.breadcrumbs a:hover {
  background: var(--hover);
  color: var(--text);
}
.breadcrumbs b {
  color: var(--text);
  font-weight: 600;
}
.crumb-sep {
  color: var(--subtle);
  flex: none;
}
.top-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: none;
}
#identity {
  position: relative;
}
.avatar-button {
  border: 0;
  padding: 2px;
  border-radius: 50%;
  background: none;
  display: block;
  transition: box-shadow 0.15s;
}
.avatar-button:hover,
.avatar-button[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--line-strong);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--c2), var(--c3));
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 30;
  animation: menu-in 0.16s var(--ease);
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.menu-head {
  display: grid;
  gap: 2px;
  justify-items: start;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.menu-head span:not(.badge) {
  color: var(--muted);
  font-size: 12px;
}
.menu-head .badge {
  margin-top: 4px;
}
.menu-item {
  display: block;
  width: 100%;
  color: inherit;
  text-decoration: none;
  text-align: left;
  border: 0;
  background: none;
  padding: 7px 10px;
  border-radius: 6px;
}
.menu-item:hover {
  background: var(--hover);
}

/* Controls */
.icon-button,
.quiet-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition:
    background 0.12s,
    border-color 0.12s,
    transform 0.08s,
    filter 0.12s;
}
.icon-button:hover,
.quiet-button:hover {
  background: var(--hover);
  border-color: var(--line-strong);
}
.icon-button:active,
.quiet-button:active,
.button:active,
.seg button:active,
.metric.sortable:active {
  transform: scale(0.97);
}
.icon-button {
  width: 30px;
  padding: 0;
  color: var(--muted);
}
.icon-button:hover {
  color: var(--text);
}
.icon-button.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.icon-button.ghost:hover {
  background: var(--hover);
}
.button {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
  font-weight: 600;
}
.button:hover {
  filter: brightness(1.08);
}
.quiet-button.danger {
  color: var(--red);
}
.quiet-button.danger:hover {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  background: color-mix(in srgb, var(--red) 8%, var(--surface));
}
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.link-button:hover {
  text-decoration: underline;
}
.show-more {
  margin: 10px 16px 0;
}
.mobile-menu {
  display: none;
}
#refresh.spinning .i {
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.theme-moon {
  display: none;
}
:root[data-theme="light"] .theme-sun {
  display: none;
}
:root[data-theme="light"] .theme-moon {
  display: block;
}
.select,
.input {
  appearance: none;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  font-size: 12.5px;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
.select {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.select:hover,
.input:hover {
  border-color: var(--line-strong);
}
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input[type="datetime-local"] {
  appearance: auto;
}
.search-field {
  position: relative;
  display: flex;
  align-items: center;
}
.search-field .i {
  position: absolute;
  left: 9px;
  color: var(--subtle);
  pointer-events: none;
}
.search-field .input {
  padding-left: 28px;
  width: 200px;
}
.search-field kbd {
  position: absolute;
  right: 7px;
  pointer-events: none;
}
.search-field .input:focus + kbd {
  display: none;
}
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}
.seg button:hover {
  color: var(--text);
}
.seg button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 1px 2px #0000001a,
    0 0 0 1px var(--line);
}
.seg-count {
  font-size: 11px;
  color: var(--subtle);
}
.seg button.active .seg-count {
  color: var(--muted);
}
.controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 9px 0 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}
.live-pill.paused {
  color: var(--muted);
  background: var(--surface-2);
}
.live-pill.paused .live-dot {
  background: var(--subtle);
}
.live-pill.paused .live-dot::after {
  display: none;
}
.range-custom {
  display: flex;
  gap: 6px;
  align-items: center;
  width: min(420px, calc(100vw - 32px));
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.range-custom .input { min-width: 0; flex: 1; }
.range-custom[hidden] { display: none; }
.range-anchor { position: relative; }
.range-custom span {
  color: var(--muted);
}
.histogram {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 230px;
  padding: 12px 4px 0;
  overflow-x: auto;
}
.histogram-caption { margin: 10px 0 0 16px; color: var(--muted); font-size: 12px; }
.histogram-bin {
  min-width: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  height: 100%;
  text-align: center;
}
.histogram-bar { display: block; background: var(--c2); min-height: 2px; border-radius: 2px 2px 0 0; }
.histogram-bin small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.write-confirm { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.write-confirm[hidden] { display: none; }

/* Page */
main {
  padding: 18px 24px 56px;
  max-width: 1640px;
  margin: 0 auto;
}
main:focus {
  outline: none;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px 16px;
  margin-bottom: 14px;
}
.page-head > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 2px -3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s;
}
.back:hover {
  color: var(--accent);
}
.back:hover .i {
  transform: translateX(-2px);
}
.back .i {
  transition: transform 0.15s var(--ease);
}
.page-head h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: break-word;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-head p {
  color: var(--muted);
  margin: 3px 0 0;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.page-head p code {
  color: var(--subtle);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  min-width: 0;
}
.panel h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}
.panel h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 14px 0 6px;
}
.panel-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin: 1px 0 0;
}
.custom-metric-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.custom-metric-controls label {
  display: grid;
  gap: 5px;
  min-width: min(320px, 100%);
  font-size: 12px;
  color: var(--muted);
}
.custom-metric-controls #custom-metric {
  max-width: min(600px, 100%);
}
.custom-metric-note {
  margin-top: 16px;
}
.custom-metric-search {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.custom-metric-search .search-field {
  width: min(420px, 100%);
}
.custom-metric-search .input {
  width: 100%;
}
.custom-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.custom-metric-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 13px 14px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.custom-metric-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.custom-metric-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.custom-metric-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.custom-metric-card-head strong {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.custom-metric-card-head .i {
  color: var(--subtle);
}
.custom-metric-scope {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
}
.custom-metric-preview {
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 12px;
  overflow: visible;
  fill: none;
  stroke: var(--c1);
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
}
.custom-metric-preview .zero {
  stroke: var(--line);
  stroke-width: 0.8;
}
.custom-metric-preview path {
  vector-effect: non-scaling-stroke;
}
.custom-metric-preview circle {
  fill: var(--c1);
  stroke: none;
}
.custom-metric-no-data {
  display: flex;
  align-items: end;
  height: 66px;
  color: var(--subtle);
  font-size: 11.5px;
}
.custom-metric-pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.custom-metric-pages > div {
  display: flex;
  gap: 6px;
}
@media (max-width: 560px) {
  .custom-metric-search {
    flex-wrap: wrap;
  }
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.metric-grid.seven {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.metric {
  padding: 11px 14px 12px;
  background: var(--surface);
  min-width: 0;
  text-align: left;
  border: 0;
  font: inherit;
  color: inherit;
}
.metric-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.metric-sub {
  font-size: 11.5px;
  color: var(--subtle);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
}
.metric.sortable {
  position: relative;
  cursor: pointer;
  transition: background 0.12s;
}
.metric.sortable:hover {
  background: var(--surface-2);
}
.metric.sortable::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s var(--ease);
}
.metric.sortable.active::after {
  transform: none;
}
.metric.sortable.active .metric-label {
  color: var(--text);
}
.metric-value.bad {
  color: var(--red);
}
.metric-value.warn,
b.warn {
  color: var(--orange);
}
b.bad {
  color: var(--red);
}
.metric-value.good {
  color: var(--accent);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.dashboard-grid.even {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}
.dashboard-grid.flip {
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
}
.dashboard-grid .panel {
  margin: 0;
}
.chart-column {
  display: grid;
  gap: 12px;
}
.subnav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 14px;
  overflow-x: auto;
}
.subnav a,
.subnav button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 7px 10px 8px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  transition:
    color 0.12s,
    border-color 0.2s;
}
.subnav a:hover,
.subnav button:hover {
  color: var(--text);
}
.subnav a.active,
.subnav button.active {
  color: var(--text);
  border-color: var(--accent);
}

/* Charts */
.chart-block {
  position: relative;
}
.chart-wrap {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}
.chart-wrap.hovering {
  overflow: visible;
}
.chart {
  display: block;
  overflow: visible;
}
.chart text {
  fill: var(--subtle);
  font-size: 11px;
}
.chart .series {
  transition: opacity 0.15s;
}
.chart-block.focus .series:not(.on) {
  opacity: 0.15;
}
.chart .guide {
  stroke: var(--line-strong);
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
}
.chart .dot {
  stroke: var(--surface);
  stroke-width: 2;
  opacity: 0;
  pointer-events: none;
}
.chart-wrap.hovering .guide,
.chart-wrap.hovering .dot {
  opacity: 1;
}
.chart-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  min-width: 150px;
  max-width: 320px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.12s,
    transform 0.12s var(--ease);
}
.chart-wrap.hovering .chart-tip {
  opacity: 1;
  transform: none;
}
.chart-tip time {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.7;
}
.tip-row span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.tip-row b {
  font-weight: 600;
}
.tip-row.total {
  border-top: 1px solid var(--line);
  margin-top: 3px;
  padding-top: 2px;
}
.legend {
  display: flex;
  gap: 4px 12px;
  flex-wrap: wrap;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}
.legend-item {
  display: flex;
  gap: 6px;
  align-items: center;
  max-width: 260px;
  padding: 1px 0;
  cursor: default;
  transition: color 0.12s;
}
.legend-item b {
  color: var(--text);
  font-weight: 600;
}
.legend-item:hover {
  color: var(--text);
}
.legend-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
}
.legend-dot.line {
  height: 2px;
  border-radius: 1px;
}
.legend-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spark {
  display: block;
  width: 100%;
  height: 30px;
}

/* Lists and tables */
.txn-prefix {
  color: var(--subtle);
  font-weight: 400;
}
.transaction-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 -8px;
}
.transaction-row {
  display: block;
  padding: 6px 8px 7px;
  border-radius: 7px;
  transition: background 0.12s;
}
.transaction-row:hover {
  background: var(--hover);
}
.transaction-row .row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-size: 12.5px;
}
.row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.row-value {
  color: var(--muted);
  white-space: nowrap;
}
.transaction-row:hover .row-value {
  color: var(--text);
}
.bar-track {
  height: 4px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--c2);
  transform-origin: left;
}
main.enter .bar-fill,
main.enter .span-bar {
  animation: grow 0.5s var(--ease) both;
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
.table-scroll {
  overflow-x: auto;
  margin: 0 -16px -14px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
}
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table td,
.data-table th {
  white-space: nowrap;
}
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 16px;
}
.data-table th:last-child,
.data-table td:last-child {
  padding-right: 16px;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr {
  transition: background 0.1s;
}
.data-table tbody tr:hover {
  background: var(--surface-2);
}
.data-table tr[data-href] {
  cursor: pointer;
}
.data-table td.num,
.data-table th.num {
  text-align: right;
}
.data-table td.sorted {
  font-weight: 600;
}
.data-table a {
  font-weight: 500;
}
.data-table tr:hover a {
  color: var(--accent);
}
.data-table.breakdown tr.extra {
  display: none;
}
.data-table.breakdown.expanded tr.extra {
  display: table-row;
}
.th-sort {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}
.th-sort:hover,
.th-sort.active {
  color: var(--text);
}
.two-line {
  line-height: 1.3;
}
.two-line b {
  display: block;
  font-weight: 500;
}
.two-line span {
  color: var(--subtle);
  font-size: 11.5px;
}
.cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
/* Shrinks to the space the other columns leave, with an ellipsis. */
.cell-clip {
  max-width: 0;
  width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.err-class {
  font-weight: 600;
}
.err-message {
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
code,
.code {
  font:
    11.5px/1.5 var(--mono);
  word-break: break-word;
}
a.link {
  color: var(--accent);
  font-weight: 500;
}
a.link:hover {
  text-decoration: underline;
}
.pct {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.pct-bar {
  display: block;
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.pct-bar::before {
  content: "";
  display: block;
  height: 100%;
  width: var(--w);
  border-radius: 2px;
  background: var(--bar);
}
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -6px -16px 12px;
  padding: 0 10px;
}
.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 8px 7px;
  margin-bottom: -1px;
  font-size: 12.5px;
  font-weight: 500;
  transition:
    color 0.12s,
    border-color 0.2s;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--text);
  border-color: var(--accent);
}
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 16px;
  margin: 0;
  font-size: 12.5px;
}
.kv dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12px;
}

/* States */
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.empty strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.table-scroll .empty {
  margin: 0 16px;
}
.onboarding {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 22px;
}
.onboarding > .i {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 10px;
  padding: 8px;
  width: 38px;
  height: 38px;
}
.onboarding h2 {
  font-size: 14px;
}
.onboarding p {
  color: var(--muted);
  margin: 3px 0 12px;
  max-width: 520px;
}
.skeleton {
  display: block;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--hover) 50%,
    var(--surface-2) 75%
  );
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
.skeleton-page {
  display: grid;
  gap: 12px;
}
.error-box {
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 6%, var(--surface));
  display: grid;
  gap: 4px;
  justify-items: start;
}
.error-box div {
  color: var(--text);
}
.error-box .quiet-button {
  margin-top: 8px;
}

/* Home */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.app-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition:
    border-color 0.15s,
    transform 0.2s var(--ease),
    box-shadow 0.2s;
}
a.app-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.app-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.app-card-text {
  min-width: 0;
  flex: 1;
  display: grid;
}
.app-card strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-card small {
  color: var(--muted);
  font-size: 12px;
}
.app-health {
  display: grid;
  gap: 6px;
  min-height: 58px;
  align-content: end;
  font-size: 12px;
}
.app-health.loading {
  align-content: space-between;
}
.app-stats {
  display: flex;
  gap: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.app-stats b {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.app-health .spark {
  margin: 0 -2px;
  width: calc(100% + 4px);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--line-strong);
}
.status-dot.ok {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.status-dot.warn {
  background: var(--orange);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 20%, transparent);
}
.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--red) 8%, transparent);
  }
}
.app-avatar {
  height: 30px;
  width: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}
.app-avatar.small {
  height: 22px;
  width: 22px;
  border-radius: 6px;
  font-size: 11px;
}
.app-avatar.tiny {
  height: 16px;
  width: 16px;
  border-radius: 4px;
  font-size: 9px;
}
.group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
  margin: 0 0 8px;
}
.group-heading .count {
  color: var(--subtle);
  font-weight: 400;
}
.app-group + .app-group {
  margin-top: 20px;
}
.app-group.drop-only {
  display: none;
}
.dragging-app .app-group.drop-only {
  display: block;
}
.app-group.drop-target {
  outline: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 6px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.group-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--subtle);
  font-size: 12px;
}
.favourite-icon {
  color: var(--c4);
  fill: currentColor;
}
.rename-group {
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--subtle);
  padding: 3px;
  border-radius: 5px;
  opacity: 0;
  transition:
    opacity 0.12s,
    background 0.12s;
}
.group-heading:hover .rename-group,
.rename-group:focus-visible {
  opacity: 1;
}
.rename-group:hover {
  color: var(--text);
  background: var(--hover);
}
.group-name-input {
  height: 26px;
  width: 240px;
  max-width: 100%;
  font-size: 12.5px;
}
.app-tile {
  position: relative;
  display: grid;
  min-width: 0;
}
.app-tile .app-card-text {
  padding-right: 22px;
}
.star-button {
  position: absolute;
  top: 15px;
  right: 26px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--subtle);
  opacity: 0;
  transition:
    opacity 0.12s,
    color 0.12s,
    background 0.12s;
}
.app-tile:hover .star-button,
.star-button:focus-visible,
.star-button.starred {
  opacity: 1;
}
.star-button:hover {
  color: var(--text);
  background: var(--hover);
}
.star-button.starred,
.star-button.starred:hover {
  color: var(--c4);
}
.star-button.starred .i {
  fill: currentColor;
}
@media (hover: none) {
  .star-button,
  .rename-group {
    opacity: 1;
  }
}
/* Trace */
.timebar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}
.timebar span {
  min-width: 3px;
  transition: filter 0.12s;
}
.timebar span:hover {
  filter: brightness(1.15);
}
.waterfall {
  overflow-x: auto;
  margin: 0 -16px -14px;
}
.waterfall-head,
.span-row {
  display: grid;
  grid-template-columns: minmax(240px, 36%) minmax(340px, 1fr) 72px;
  gap: 12px;
  align-items: center;
  min-width: 720px;
  padding: 0 16px;
}
.waterfall-head {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-top: 6px;
  padding-bottom: 6px;
}
.span-row {
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  padding-top: 4px;
  padding-bottom: 4px;
  transition: background 0.1s;
}
.span-row:last-child {
  border-bottom: 0;
}
.span-row:hover {
  background: var(--surface-2);
}
.span-row.expandable {
  cursor: pointer;
}
.span-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.span-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.span-label .legend-dot {
  border-radius: 50%;
}
.span-track {
  height: 18px;
  position: relative;
  background: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent calc(25% - 1px),
    var(--line) calc(25% - 1px),
    var(--line) 25%
  );
}
.span-bar {
  position: absolute;
  top: 4px;
  height: 10px;
  border-radius: 3px;
  min-width: 2px;
  transform-origin: left;
  transition: filter 0.12s;
}
.span-row:hover .span-bar {
  filter: brightness(1.15) saturate(1.2);
}
.span-duration {
  text-align: right;
  color: var(--muted);
  white-space: nowrap;
}
.span-meta {
  grid-column: 1 / -1;
  min-width: 0;
  padding-bottom: 2px;
}
.span-meta {
  display: none;
}
.span-row.open .span-meta {
  display: block;
}
.span-tag {
  flex: none;
  font: 600 9.5px/1 var(--mono);
  letter-spacing: 0.02em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 2px 4px;
}
.span-row.open .span-tag {
  color: var(--accent);
  border-color: var(--accent);
}
.span-meta pre {
  font:
    11.5px/1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  margin: 4px 0;
}
.stack {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 7px;
  margin: 4px 0;
  color: var(--text);
  font:
    11.5px/1.55 var(--mono);
  max-height: 420px;
  overflow: auto;
}

/* Errors */
.occurrence {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.12s;
}
.occurrence:hover {
  border-color: var(--line-strong);
}
.occurrence summary {
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  list-style: none;
  font-size: 12.5px;
}
.occurrence summary::-webkit-details-marker,
.lib-frames summary::-webkit-details-marker {
  display: none;
}
.occurrence summary::before,
.lib-frames summary::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}
.occurrence[open] > summary::before,
.lib-frames[open] > summary::before {
  transform: rotate(45deg);
}
.occurrence summary > span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.occurrence[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.occurrence-body {
  padding: 10px 12px 12px;
}
.stack-trace {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 0;
  font:
    12px/1.6 var(--mono);
  background: var(--surface-2);
}
.stack-copy {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
}
.frame {
  display: flex;
  gap: 10px;
  padding: 1px 40px 1px 12px;
  min-width: 0;
}
.frame-file {
  overflow-wrap: anywhere;
}
.frame-line {
  color: var(--subtle);
}
.frame-fn {
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.frame.app .frame-file {
  font-weight: 600;
}
.frame.lib {
  color: var(--subtle);
}
.frame.lib .frame-fn {
  color: var(--subtle);
}
.frame.culprit {
  background: color-mix(in srgb, var(--red) 9%, transparent);
  box-shadow: inset 2px 0 var(--red);
}
.lib-frames summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 1px 12px;
  color: var(--subtle);
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
}
.lib-frames summary:hover {
  color: var(--text);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 550;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0;
}
.badge.red {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 12%, transparent);
}
.badge.green {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.badge.warn {
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 14%, transparent);
  padding: 0 6px;
  font-family: var(--mono);
}
.badge.red::before,
.badge.green::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Setup */
.setup-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge .live-dot {
  background: var(--orange);
}
.setup-steps {
  list-style: none;
  counter-reset: step;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.setup-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 32px;
  min-width: 0;
}
.setup-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}
.setup-steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 9.5px;
  top: 26px;
  bottom: -10px;
  width: 1px;
  background: var(--line);
}
.setup-steps h3 {
  margin: 1px 0 2px;
  font-size: 13px;
}
.setup-steps p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 760px;
}
.setup-steps p strong {
  color: var(--text);
}
.setup-steps .button {
  margin-bottom: 8px;
}
.setup-method-tabs {
  margin: 12px 0;
  padding: 0 4px;
  flex-wrap: wrap;
}
.setup-method-panel {
  min-width: 0;
}
.setup-method-panel ul {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted);
}
.setup-method-panel li + li {
  margin-top: 6px;
}
.setup-snippet {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 8px;
}
.setup-snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 4px 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}
.setup-snippet-head .icon-button {
  width: 24px;
  height: 24px;
}
.setup-snippet pre {
  margin: 0;
  padding: 9px 10px;
  overflow-x: auto;
  font:
    11.5px/1.6 var(--mono);
}
.setup-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
}
.setup-details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.setup-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 720px;
}
.form-grid label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-grid .input,
.form-grid .select {
  width: 100%;
}
.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field-hint {
  font-size: 11.5px;
  line-height: 1.45;
  opacity: 0.85;
}
.inline-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.inline-actions > .input {
  min-width: 200px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
fieldset:disabled input,
fieldset:disabled select {
  opacity: 0.6;
}
.form-actions {
  margin-top: 12px;
}
.secret-panel {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  animation: pop 0.35s var(--ease);
}
@keyframes pop {
  from {
    transform: scale(0.98);
    opacity: 0;
  }
}
.secret-row {
  display: flex;
  gap: 6px;
}
.secret-value {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12px;
}
.welcome {
  max-width: 400px;
  margin: 14vh auto;
  text-align: center;
  padding: 32px 28px;
}
.welcome .brand-mark {
  display: inline-block;
  margin-bottom: 6px;
}
.welcome h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
}
.welcome p {
  color: var(--muted);
  margin: 0 auto 18px;
}

/* Command palette */
.palette {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 12vh 16px 16px;
}
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: light-dark(#14141c40, #000000a0);
  backdrop-filter: blur(2px);
  animation: fade 0.15s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.palette-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--shadow-tint);
  overflow: hidden;
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  height: 48px;
  font-size: 15px;
  outline: none;
  color: var(--text);
}
.palette-list {
  overflow-y: auto;
  padding: 4px 6px 6px;
}
.palette-group {
  font-size: 11px;
  font-weight: 550;
  color: var(--subtle);
  padding: 10px 8px 4px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
}
.palette-item.active {
  background: var(--hover);
  color: var(--text);
}
.palette-label {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-hint {
  font-size: 12px;
  color: var(--subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}
.palette-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}
.palette-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--subtle);
  background: var(--surface-2);
}
.palette-foot kbd {
  margin-right: 2px;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 12px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.3s var(--ease);
  z-index: 60;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.scrim {
  display: none;
}

@media (max-width: 1100px) {
  .metric-grid.seven {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .metric-grid.seven .metric:last-child {
    grid-column: span 2;
  }
}
@media (max-width: 960px) {
  .dashboard-grid,
  .dashboard-grid.even,
  .dashboard-grid.flip {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 800px) {
  body.collapsed {
    --sidebar: 216px;
  }
  body.collapsed .sidebar .label {
    display: revert;
  }
  .sidebar {
    position: fixed;
    left: 0;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  #collapse-button {
    display: none;
  }
  body.menu-open .sidebar {
    transform: none;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: #0006;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  body.menu-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .mobile-menu {
    display: inline-flex;
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head > div:first-child {
    flex: none;
  }
  .controls,
  .range-custom {
    justify-content: flex-start;
  }
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .breadcrumbs > :not(:last-child),
  .live-pill {
    display: none;
  }
  .metric-grid,
  .metric-grid.seven {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-grid.seven .metric:last-child {
    grid-column: span 2;
  }
  .seg {
    max-width: 100%;
    overflow-x: auto;
  }
  .range-custom {
    flex-wrap: wrap;
  }
  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }
  .search-field,
  .search-field .input {
    width: 100%;
  }
  .palette {
    padding-top: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
/* Docs: a contents page of guide cards, and one reading page per guide. */
.doc-head {
  margin-bottom: 32px;
}
.doc-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.doc-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.doc-summary {
  margin: 10px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

/* Contents page */
.doc-index {
  max-width: 1080px;
  padding-top: 8px;
}
.doc-group + .doc-group {
  margin-top: 40px;
}
.doc-group-title {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}
.doc-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}
.doc-card:hover {
  border-color: var(--line-strong);
}
.doc-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 16px;
  transition: background 0.15s;
}
.doc-card-head:hover {
  background: var(--hover);
}
.doc-card-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
}
.doc-card-text {
  flex: 1;
  min-width: 0;
}
.doc-card-text b {
  display: block;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.doc-card-text span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.doc-card-arrow {
  flex: none;
  margin-top: 2px;
  color: var(--subtle);
  transition:
    transform 0.15s var(--ease),
    color 0.15s;
}
.doc-card-head:hover b,
.doc-card-head:hover .doc-card-arrow {
  color: var(--accent);
}
.doc-card-head:hover .doc-card-arrow {
  transform: translateX(3px);
}
.doc-card-label {
  padding: 12px 18px 4px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.doc-card-sections {
  margin: 0;
  padding: 0 8px 10px;
  list-style: none;
}
.doc-card-sections a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.4;
  transition:
    background 0.12s,
    color 0.12s;
}
.doc-card-sections a .i {
  flex: none;
  color: var(--subtle);
  opacity: 0.6;
}
.doc-card-sections a:hover {
  background: var(--hover);
  color: var(--accent);
}
.doc-card-sections a:hover .i {
  color: var(--accent);
  opacity: 1;
}

/* Guide page */
.doc-page {
  display: grid;
  grid-template-columns: minmax(0, 720px) 210px;
  gap: 64px;
  align-items: start;
  padding-top: 8px;
}
.doc-page .doc-head {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.doc {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: break-word;
}
.doc > :first-child {
  margin-top: 0;
}
.doc h2 {
  margin: 52px 0 14px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.doc h3 {
  margin: 32px 0 10px;
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.35;
}
.doc h2,
.doc h3 {
  scroll-margin-top: 76px;
}
.doc h2 code,
.doc h3 code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.88em;
  font-weight: 600;
}
.doc-anchor {
  margin-left: 8px;
  color: var(--subtle);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.12s;
}
.doc h2:hover .doc-anchor,
.doc h3:hover .doc-anchor,
.doc-anchor:focus-visible {
  opacity: 1;
}
.doc .doc-anchor:hover {
  color: var(--accent);
  text-decoration: none;
}
.doc p,
.doc ul,
.doc ol {
  margin: 0 0 16px;
}
.doc ul,
.doc ol {
  padding-left: 24px;
}
.doc li {
  margin: 6px 0;
}
.doc li > ul,
.doc li > ol {
  margin: 6px 0 0;
}
.doc li::marker {
  color: var(--subtle);
}
.doc strong {
  font-weight: 620;
}
.doc a:not(.doc-anchor) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
}
.doc a:not(.doc-anchor):hover {
  text-decoration-color: currentColor;
}
.doc code {
  font-size: 0.86em;
  line-height: 1.5;
}
.doc :not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}
.doc a > code {
  color: inherit;
}
.doc-code {
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.doc-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: 500 11.5px/1 var(--mono);
}
.doc-code-head .icon-button {
  width: 26px;
  height: 26px;
}
.doc pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.doc pre code {
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre;
  word-break: normal;
}
.doc-table {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
}
.doc th,
.doc td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.doc tr:last-child td {
  border-bottom: 0;
}
.doc th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.doc td:first-child {
  min-width: 140px;
}
.doc td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
}
.doc blockquote {
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}
.doc blockquote p {
  margin: 0;
}

/* Previous and next guides */
.doc-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 56px;
}
.doc-pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition:
    border-color 0.15s,
    background 0.15s;
}
.doc-pager-link:hover {
  border-color: var(--accent);
  background: var(--hover);
}
.doc-pager-link span {
  color: var(--muted);
  font-size: 12px;
}
.doc-pager-link b {
  font-size: 15px;
  font-weight: 600;
}
.doc-pager-link.previous span::before {
  content: "← ";
}
.doc-pager-link.next {
  grid-column: 2;
  text-align: right;
}
.doc-pager-link.next span::after {
  content: " →";
}

/* On this page */
.doc-toc {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-top: 6px;
  font-size: 13px;
}
.doc-toc-title {
  margin-bottom: 10px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.doc-toc a {
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  line-height: 1.4;
  transition:
    color 0.12s,
    border-color 0.12s;
}
.doc-toc a:hover {
  color: var(--text);
}
.doc-toc a.active {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 500;
}
@media (max-width: 1180px) {
  .doc-page {
    grid-template-columns: minmax(0, 720px);
  }
  .doc-toc {
    display: none;
  }
}
@media (max-width: 640px) {
  .doc-head h1 {
    font-size: 25px;
  }
  .doc-pager {
    grid-template-columns: 1fr;
  }
  .doc-pager-link.next {
    grid-column: 1;
  }
}
