:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #121212;
  --panel-2: #1b1b1b;
  --panel-3: #0b0b0b;
  --line: #ffffff1a;
  --line-strong: #ffffff33;
  --text: #fafafa;
  --muted: #c4c4c4;
  --soft: #ffffff80;
  --lime: #ebf701;
  --cyan: #0ef5ff;
  --danger: #ff5f57;
  --warn: #ffc857;
  --ok: #7cff9b;
  --shadow: 0 24px 80px #00000080;
  font-family: Inter, Montserrat, Arial, Helvetica, sans-serif;
}

:root[data-theme="light"],
body.is-light {
  color-scheme: light;
  --bg: #eef1ea;
  --panel: #f8faf5;
  --panel-2: #edf1e8;
  --panel-3: #fff;
  --line: #1c25101f;
  --line-strong: #1c25103d;
  --text: #151915;
  --muted: #4f584f;
  --soft: #717a70;
  --lime: #93af2d;
  --cyan: #2497a7;
  --danger: #d94f45;
  --warn: #b8831f;
  --ok: #348a57;
  --shadow: 0 18px 58px #18210f22;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto;
  font-family: inherit;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
body.auth-loading .app-shell, body.auth-locked .app-shell { display: none; }
body:not(.auth-loading):not(.auth-locked) .login-screen { display: none; }

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}
.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #0ef5ff10, transparent 42%), linear-gradient(315deg, #ebf70112, transparent 58%), var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-card input, input, select, textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
textarea { min-height: 92px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 20%, transparent); }
.login-error { min-height: 18px; margin: -4px 0 0; color: var(--danger); font-size: 13px; font-weight: 700; }

.app-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: #000000d1;
  padding: 22px 16px;
  backdrop-filter: blur(14px);
}
body.is-light .sidebar { background: #f8faf5e0; }
.brand { display: flex; min-height: 48px; align-items: center; gap: 12px; }
.brand-mark, .nav-icon, .metric-icon, .icon-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff0d;
  color: var(--cyan);
}
.brand-title { font-size: 18px; font-weight: 800; line-height: 1; }
.brand-subtitle { margin-top: 5px; color: var(--soft); font-size: 12px; }
.level-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 8px; }
.nav-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  text-align: left;
}
.nav-button:hover, .nav-button.is-active { border-color: var(--line-strong); background: #ffffff0d; color: var(--text); }
.nav-button.is-active .nav-icon { background: var(--lime); color: #000; }
.nav-button[data-tab="faq"] { margin-top: auto; }
.nav-count { color: var(--soft); font-size: 11px; }
.sidebar-account { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip, .logout-button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff08;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 12px;
  text-align: left;
}
.logout-button { width: 100%; background: transparent; }
svg { width: 17px; height: 17px; stroke-width: 2; }

.workspace { display: flex; min-width: 0; min-height: 100vh; flex-direction: column; padding: 24px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.title-line { display: flex; align-items: center; gap: 10px; }
h1, h2, h3, p { margin: 0; }
.topbar h1 { font-size: 34px; line-height: 1.08; font-weight: 800; }
#pageSubtitle { margin-top: 8px; color: var(--soft); font-size: 13px; }
.plan-badge {
  border: 1px solid color-mix(in srgb, var(--lime) 45%, transparent);
  border-radius: 8px;
  color: var(--lime);
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 800;
}
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.primary-button, .ghost-button, .danger-button, .theme-toggle {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}
.primary-button { background: var(--lime); color: #000; }
.ghost-button, .theme-toggle { border-color: var(--line); background: #ffffff08; color: var(--text); }
.ghost-button.is-active { border-color: color-mix(in srgb, var(--cyan) 48%, transparent); background: color-mix(in srgb, var(--cyan) 10%, transparent); color: var(--cyan); }
.danger-button { background: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--danger) 44%, transparent); }
.theme-toggle { width: 40px; padding: 0; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .42; }

.summary-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-strip[hidden] { display: none; }
[hidden] { display: none !important; }
.metric {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  padding: 12px;
}
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { display: block; margin-top: 8px; font-size: 27px; line-height: 1; }
.content-layout.single { display: block; min-width: 0; container-type: inline-size; }
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: inset 0 1px 0 #ffffff0c;
  margin-bottom: 14px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}
.panel-head h2 { font-size: 17px; line-height: 1.2; }
.panel-body { padding: 14px; }
.empty-overview {
  display: grid;
  grid-template-columns: minmax(240px, .72fr) minmax(360px, 1.28fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  margin-bottom: 14px;
}
.empty-intro { display: flex; min-height: 250px; flex-direction: column; justify-content: space-between; gap: 24px; padding: 22px; }
.empty-kicker { color: var(--lime); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.empty-intro h2 { max-width: 420px; margin-top: 8px; font-size: 24px; line-height: 1.12; }
.empty-intro p { max-width: 520px; margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.endpoint-row { display: grid; gap: 8px; }
.endpoint-row > span { color: var(--soft); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.endpoint-copy { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; }
.endpoint-copy code { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-3); padding: 11px 12px; color: var(--ok); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.feature-menu { display: grid; align-content: start; border-left: 1px solid var(--line); }
.feature-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 14px 16px; }
.feature-menu-head strong { font-size: 13px; }
.feature-menu-head span { color: var(--soft); font-size: 11px; }
.feature-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 16px;
  text-align: left;
}
.feature-link:last-child { border-bottom: 0; }
.feature-link:hover { background: #ffffff0a; }
.feature-link-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: #ffffff0d; color: var(--cyan); }
.feature-link strong { display: block; font-size: 13px; }
.feature-link small { display: block; overflow: hidden; margin-top: 3px; color: var(--soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.feature-link > svg { color: var(--soft); }
.inline-notice { border-left: 3px solid var(--cyan); background: color-mix(in srgb, var(--cyan) 7%, transparent); padding: 10px 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.instruction-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 14px; }
.instruction-page, .faq-page { display: grid; gap: 14px; }
.instruction-layout .panel { margin-bottom: 0; }
.instruction-copy { display: grid; gap: 14px; }
.instruction-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.instruction-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.instruction-steps li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}
.instruction-steps li:last-child { border-bottom: 0; }
.instruction-steps li::before {
  content: counter(steps);
  grid-row: 1 / span 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: #000;
  font-size: 12px;
  font-weight: 900;
}
.instruction-steps li strong { font-size: 13px; }
.instruction-steps li > span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.faq-list { display: grid; }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list details:last-child { border-bottom: 0; }
.faq-list summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary svg { color: var(--soft); transition: transform .18s; }
.faq-list details[open] summary svg { transform: rotate(180deg); }
.faq-list details > div { max-width: 980px; padding: 0 48px 16px 16px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.faq-step-list, .faq-recovery-list { margin: 0; padding: 0; list-style: none; }
.faq-step-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  min-height: 70px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.faq-step-list li:last-child, .faq-recovery-item:last-child { border-bottom: 0; }
.faq-step-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}
.faq-step-list li > span:nth-child(2), .faq-recovery-item { min-width: 0; }
.faq-step-list strong, .faq-step-list small, .faq-recovery-item strong, .faq-recovery-item span { display: block; }
.faq-step-list strong, .faq-recovery-item strong { font-size: 13px; }
.faq-step-list small, .faq-recovery-item span { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.faq-step-action { min-width: 126px; justify-content: space-between; }
.faq-step-action svg { width: 16px; height: 16px; }
.faq-recovery-item {
  position: relative;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 14px 58px;
}
.faq-recovery-item .faq-recovery-number {
  position: absolute;
  top: 15px;
  left: 18px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: #000;
  font-size: 11px;
  font-weight: 900;
  margin: 0;
}
.faq-limit {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line-strong);
  padding: 14px 16px;
  color: var(--muted);
}
.faq-limit svg { width: 18px; height: 18px; color: var(--cyan); }
.faq-limit p { margin: 0; font-size: 12px; line-height: 1.6; }
.faq-limit strong { color: var(--text); }
.migration-page { display: grid; gap: 14px; }
.migration-page .panel, .migration-page .demo-banner { margin-bottom: 0; }
.recovery-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
}
.recovery-step {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 13px 18px 13px 12px;
}
.recovery-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -5px;
  z-index: 1;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
}
.recovery-step > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; background: #ffffff0a; color: var(--soft); }
.recovery-step strong, .recovery-step small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recovery-step strong { font-size: 12px; }
.recovery-step small { margin-top: 3px; color: var(--soft); font-size: 10px; }
.recovery-step.is-saved > span { color: var(--ok); }
.recovery-step.is-lost > span { color: var(--danger); }
.recovery-step.is-pixel > span { color: var(--cyan); }
.recovery-step.is-target > span { color: var(--lime); }
.migration-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--panel) 92%, transparent); }
.migration-stats > div { min-width: 0; padding: 12px 14px; }
.migration-stats > div + div { border-left: 1px solid var(--line); }
.migration-stats span, .migration-stats small { color: var(--soft); font-size: 10px; font-weight: 700; }
.migration-stats strong { display: inline-block; margin-top: 5px; font-size: 22px; line-height: 1; }
.migration-stats small { margin-left: 6px; }
.migration-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.migration-create-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.migration-list { display: grid; }
.migration-row { padding: 15px; border-bottom: 1px solid var(--line); }
.migration-row:last-child { border-bottom: 0; }
.migration-row.is-ready { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--ok) 70%, transparent); }
.migration-row.is-pending { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--warn) 70%, transparent); }
.migration-row-head, .migration-row-foot { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; }
.migration-row-head > div:first-child { min-width: 0; }
.migration-title { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 7px; }
.migration-title > strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.migration-row-head small { display: block; margin-top: 5px; color: var(--soft); font-size: 10px; }
.migration-status { display: inline-flex; align-items: center; border-radius: 6px; padding: 3px 7px; font-size: 9px; font-weight: 900; }
.migration-status.is-ready { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.migration-status.is-warning { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.migration-status.is-neutral { background: #ffffff0a; color: var(--soft); }
.migration-row-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.migration-row-actions .ghost-button { min-height: 34px; padding-inline: 10px; font-size: 11px; font-weight: 700; }
.migration-row-actions .danger-button { min-height: 34px; width: 36px; padding: 0; }
.migration-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  border-block: 1px solid var(--line);
  padding-block: 12px;
}
.migration-route > svg { width: 14px; color: var(--soft); }
.migration-endpoint { min-width: 0; border-left: 2px solid var(--line-strong); padding-left: 10px; }
.migration-endpoint.is-lost { border-color: var(--danger); }
.migration-endpoint.is-pixel { border-color: var(--cyan); }
.migration-endpoint.is-target { border-color: var(--lime); }
.migration-endpoint span, .migration-endpoint strong, .migration-endpoint small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.migration-endpoint span { color: var(--soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.migration-endpoint strong { margin-top: 5px; font-size: 12px; }
.migration-endpoint small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.migration-row-foot { align-items: flex-start; margin-top: 12px; }
.campaign-chips { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; }
.campaign-chips span { max-width: 260px; overflow: hidden; border-radius: 5px; background: #ffffff0a; padding: 4px 7px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.route-mode { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; color: var(--soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.route-mode.is-on { color: var(--ok); }
.route-mode svg { width: 13px; height: 13px; }
.migration-limit { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); padding: 11px 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.migration-limit svg { margin-top: 1px; color: var(--warn); }
.demo-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--cyan) 7%, var(--panel));
  margin-bottom: 14px;
  padding: 8px 10px;
}
.demo-banner strong, .demo-banner span { display: block; }
.demo-banner > div { width: 100%; min-width: 0; }
.demo-banner strong { max-width: 100%; overflow-wrap: anywhere; font-size: 13px; font-weight: 750; line-height: 1.2; text-wrap: balance; }
.demo-banner div > span { max-width: 100%; margin-top: 4px; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; line-height: 1.4; text-wrap: pretty; white-space: normal; }
.demo-banner .ghost-button { min-height: 34px; padding-inline: 11px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.filters-panel .panel-body { padding: 12px; }
.filters-grid { display: grid; grid-template-columns: minmax(180px, 1.3fr) repeat(5, minmax(0, .7fr)); gap: 10px; align-items: end; }
.filters-grid > label:not(.check-row) { gap: 5px; color: var(--soft); font-size: 11px; font-weight: 700; }
.filters-grid input, .filters-grid select { min-height: 38px; font-size: 13px; font-weight: 700; }
.filters-grid input::placeholder { color: var(--soft); font-weight: 600; }
.select-control { position: relative; display: block; min-width: 0; }
.select-control select { appearance: none; padding-right: 34px; }
.select-control > i, .select-control > svg {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.filters-grid .check-row { min-height: 38px; color: var(--soft); font-size: 11px; font-weight: 700; }
.filters-grid .ghost-button { min-height: 38px; font-size: 13px; font-weight: 700; }
label { display: grid; min-width: 0; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.check-row input { width: auto; min-height: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.table-wrap { overflow: auto; max-height: calc(100vh - 360px); border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-3);
  color: var(--soft);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
tr:hover td { background: #ffffff08; }
tr.sent td { background: color-mix(in srgb, var(--ok) 8%, transparent); }
tr.failed td { background: color-mix(in srgb, var(--danger) 10%, transparent); }
tr.mid:not(.sent):not(.failed) td { background: color-mix(in srgb, var(--warn) 9%, transparent); }
tr.old:not(.sent):not(.failed) td { background: color-mix(in srgb, var(--danger) 8%, transparent); }
tr.demo-row td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--cyan) 68%, transparent); }
.events-table { min-width: 960px; table-layout: fixed; }
.events-table th:nth-child(1) { width: 42px; }
.events-table th:nth-child(2) { width: 82px; }
.events-table th:nth-child(3) { width: 180px; }
.events-table th:nth-child(4) { width: 74px; }
.events-table th:nth-child(6) { width: 92px; }
.events-table th:nth-child(7) { width: 78px; }
.events-table th:nth-child(8) { width: 126px; }
.events-table th:nth-child(9) { width: 46px; }
.events-table .event-row td { height: 58px; vertical-align: middle; }
.date-cell, .campaign-cell { display: grid; min-width: 0; gap: 4px; }
.date-cell strong { font-size: 12px; font-weight: 800; }
.date-cell span, .campaign-cell span { color: var(--soft); font-size: 10px; }
.geo-cell { display: flex; align-items: center; gap: 7px; }
.geo-cell strong { font-size: 13px; }
.campaign-cell strong { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.revenue-cell { font-size: 13px; white-space: nowrap; }
.revenue-cell small { color: var(--soft); font-size: 9px; font-weight: 700; }
.match-state { display: inline-flex; min-width: 42px; justify-content: center; border-radius: 6px; padding: 4px 7px; font-size: 10px; font-weight: 800; }
.match-state.is-present { background: color-mix(in srgb, var(--cyan) 14%, transparent); color: var(--cyan); }
.match-state.is-missing { background: #ffffff0a; color: var(--soft); }
.event-details-toggle { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); }
.event-details-toggle:hover, .event-details-toggle[aria-expanded="true"] { border-color: var(--line-strong); background: #ffffff0a; color: var(--text); }
.event-details-toggle svg { transition: transform .18s; }
.event-details-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.event-detail-row td { background: color-mix(in srgb, var(--panel-2) 82%, transparent); padding: 12px 14px 14px; }
.event-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tech-item { display: grid; min-width: 0; gap: 5px; }
.tech-item span { color: var(--soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.tech-item code { overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.empty-table-cell { padding: 28px 14px; color: var(--soft); text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.tag, .tier, .state {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.tag { background: #ffffff10; color: var(--text); }
.tag.purchase { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tier.tier1 { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tier.tier2 { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tier.tier3 { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.state.sent { color: var(--ok); }
.state.failed { color: var(--danger); }
.state.unsent { color: var(--soft); }
.event-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.demo-badge { display: inline-flex; align-items: center; border: 1px solid color-mix(in srgb, var(--cyan) 42%, transparent); border-radius: 5px; background: color-mix(in srgb, var(--cyan) 10%, transparent); padding: 2px 5px; color: var(--cyan); font-size: 9px; font-weight: 900; line-height: 1.2; vertical-align: middle; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--soft); }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pixel-list, .view-list { display: grid; gap: 8px; }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff06;
  padding: 10px;
}
.token-status { display: inline-flex; margin-top: 7px; border-radius: 6px; padding: 3px 7px; font-size: 10px; font-weight: 900; }
.token-status.is-ready { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.token-status.is-missing { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.progress { display: none; border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--cyan) 8%, transparent); padding: 12px; margin-top: 12px; }
.progress.is-visible { display: block; }
.progressbar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--panel-3); margin: 8px 0; }
.progressbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--lime)); transition: width .2s; }
.codebox {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  padding: 12px;
}
.codebox textarea { width: 100%; color: var(--ok); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.toast {
  z-index: 50;
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--text);
  transition: opacity .18s, transform .18s;
}
.toast.is-visible { transform: translateY(0); opacity: 1; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: grid;
    height: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }
  .brand { min-height: 40px; }
  .brand-title { font-size: 15px; }
  .brand-subtitle { display: none; }
  .level-nav { min-width: 0; flex: 1; flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .level-nav::-webkit-scrollbar { display: none; }
  .nav-button { flex: 0 0 auto; grid-template-columns: 24px auto; min-height: 40px; padding: 7px 9px; }
  .nav-button .nav-icon { width: 24px; height: 24px; }
  .nav-button[data-tab="faq"] { margin-top: 0; }
  .nav-count { display: none; }
  .sidebar-account { display: block; margin-top: 0; border-top: 0; padding-top: 0; }
  .user-chip { display: none; }
  .logout-button { width: 40px; grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .logout-button span { display: none; }
  .workspace { padding: 16px 14px 24px; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-strip.is-empty { display: none; }
  .metric { min-height: 68px; padding: 10px; }
  .metric span { font-size: 11px; }
  .metric strong { margin-top: 6px; font-size: 23px; }
  .empty-overview { grid-template-columns: 1fr; }
  .empty-intro { min-height: 0; }
  .feature-menu { border-top: 1px solid var(--line); border-left: 0; }
  .instruction-layout { grid-template-columns: 1fr; }
  .filters-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar { align-items: center; }
}

@media (max-width: 760px) {
  .sidebar { grid-template-columns: minmax(0, 1fr) auto; }
  .brand { display: none; }
  .nav-button { grid-template-columns: 22px auto; gap: 6px; padding: 6px 8px; font-size: 12px; }
  .recovery-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recovery-step:nth-child(2)::after { display: none; }
  .migration-form { grid-template-columns: 1fr; }
  .migration-row-head, .migration-row-foot { align-items: flex-start; flex-direction: column; }
  .migration-row-actions { justify-content: flex-start; }
  .migration-route { grid-template-columns: 1fr; }
  .migration-route > svg { transform: rotate(90deg); justify-self: center; }
  .faq-step-list li { grid-template-columns: 32px minmax(0, 1fr); }
  .faq-step-action { width: 100%; grid-column: 2; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 25px; }
  .plan-badge { display: none; }
  #pageSubtitle { max-width: 360px; }
  .summary-strip { gap: 7px; }
  .metric span { font-size: 9px; }
  .empty-intro { padding: 16px; }
  .empty-intro h2 { font-size: 20px; }
  .feature-link { padding: 9px 12px; }
  .instruction-actions > * { flex: 1 1 auto; }
  .demo-toggle { width: 40px; padding: 0; }
  .demo-toggle span { display: none; }
  .event-detail-grid { grid-template-columns: 1fr; }
  .migration-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .migration-stats > div + div { border-left: 0; }
  .migration-stats > div:nth-child(even) { border-left: 1px solid var(--line); }
  .migration-stats > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .migration-create-actions { align-items: stretch; flex-direction: column; }
  .migration-create-actions .primary-button { width: 100%; }
}

@media (max-width: 520px) {
  .sidebar { gap: 8px; padding-inline: 8px; }
  .level-nav { justify-content: space-between; gap: 4px; overflow-x: visible; }
  .nav-button { width: 40px; grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .nav-button > span:nth-child(2) { display: none; }
  .recovery-flow { grid-template-columns: 1fr; }
  .recovery-step:not(:last-child)::after { top: auto; right: 50%; bottom: -5px; transform: translateX(50%) rotate(135deg); }
  .recovery-step:nth-child(2)::after { display: block; }
  .migration-row-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
  .migration-row-actions .ghost-button { width: 100%; }
}

@media (max-width: 360px) {
  .nav-button { width: 36px; }
}

@container (max-width: 900px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@container (max-width: 640px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid > label:first-child { grid-column: 1 / -1; }
}

@container (max-width: 430px) {
  .filters-grid { grid-template-columns: 1fr; }
  .filters-grid > label:first-child { grid-column: auto; }
}
