:root {
  --bg: #f9fafb;
  --bg-card: #ffffff;
  --bg-sidebar: #111827;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: rgba(255, 255, 255, 0.1);
  --bg-input: #ffffff;
  --bg-code: #0f172a;

  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-focus: #3b82f6;

  --text: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-placeholder: #9ca3af;
  --text-sidebar: #f9fafb;
  --text-sidebar-muted: #9ca3af;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-ring: rgba(37, 99, 235, 0.15);

  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.1);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.08);

  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);

  --sidebar-w: 260px;
  --topbar-h: 60px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 100ms, box-shadow 100ms, color 100ms;
}

button:hover {
  background: #f3f4f6;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-hover);
}

button.danger {
  background: var(--red-soft);
  color: var(--red);
}

button.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding: 8px 12px;
  font-size: 13px;
  transition: border-color 100ms, box-shadow 100ms;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

select {
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.app-shell,
.app {
  min-height: 100vh;
}

.layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  padding: 20px 0;
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 20px 20px;
}

.brand-title {
  margin: 0;
  color: var(--text-sidebar);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--text-sidebar-muted);
  font-size: 11px;
}

.side-group {
  display: grid;
  gap: 8px;
  padding: 0 16px;
  margin-top: 16px;
}

.side-group label {
  color: var(--text-sidebar-muted);
}

.side-group input,
.side-group select {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-sidebar);
}

.side-group input::placeholder {
  color: rgba(249, 250, 251, 0.38);
}

.side-group button {
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-sidebar-muted);
}

.side-group button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--text-sidebar);
}

.sidebar__game-select {
  position: relative;
  margin: 16px 16px 0;
}

.nav-list {
  display: grid;
  gap: 2px;
  flex: 1;
  align-content: start;
  grid-auto-rows: min-content;
  margin-top: 16px;
  padding: 0 8px;
}

.nav-list button {
  justify-content: flex-start;
  width: 100%;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text-sidebar-muted);
  padding: 9px 12px;
  text-align: left;
}

.nav-list button:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar);
}

.nav-list button.active {
  border-left-color: var(--accent);
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar);
}

.nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex: 0 0 auto;
}

.nav-list button.active .nav-icon {
  opacity: 1;
}

.sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
  padding: 16px 20px 0;
}

.sidebar__add-game {
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-sidebar-muted);
  padding: 9px 12px;
}

.sidebar__add-game:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--text-sidebar);
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-w);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  padding: 0 28px;
}

.page-title {
  min-width: 0;
}

.page-title h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}

.page-title p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-actions select {
  width: auto;
  min-width: 180px;
}

.top-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.top-action-link:hover {
  background: #f3f4f6;
}

.content {
  flex: 1;
  display: block;
  padding: 24px 28px 40px;
}

.section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.section + .section,
.notice + .section,
.empty + .section {
  margin-top: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-body {
  padding: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.subsection-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.subsection-form h3 {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

.info-grid div {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f9fafb;
  padding: 10px 12px;
}

.info-grid span,
.info-grid strong {
  display: block;
}

.info-grid span {
  color: var(--text-muted);
  font-size: 11px;
}

.info-grid strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

th:first-child {
  border-radius: var(--radius-md) 0 0 0;
}

th:last-child {
  border-radius: 0 var(--radius-md) 0 0;
}

td {
  border-bottom: 1px solid var(--border-light);
  padding: 10px 12px;
  vertical-align: middle;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions button,
button[data-edit-exp],
button[data-config-name],
button[data-delete-config],
button[data-revoke-key],
button[data-revoke-admin-key] {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

.pill.ok {
  background: var(--green-soft);
  color: #166534;
}

.pill.danger {
  background: var(--red-soft);
  color: #991b1b;
}

.empty,
.notice {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.notice {
  border-style: solid;
  box-shadow: var(--shadow-sm);
}

.error {
  border-color: var(--red);
  background: var(--red-soft);
  color: #991b1b;
}

.success {
  border-color: var(--green);
  background: var(--green-soft);
  color: #166534;
}

.toast-container {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  transform: translateX(20px);
  transition: opacity 180ms, transform 180ms;
}

.toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.toast--success {
  border-color: var(--green);
}

.toast--error {
  border-color: var(--red);
}

.toast__icon {
  display: flex;
  flex: 0 0 auto;
}

.toast--success .toast__icon {
  color: var(--green);
}

.toast--error .toast__icon {
  color: var(--red);
}

.toast--info .toast__icon {
  color: var(--accent);
}

.toast__msg {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.section-body > label,
form > label.section-body {
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
}

.btn--secondary:hover {
  background: #f3f4f6;
}

.btn--danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn--sm {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card + .card {
  margin-top: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.field__input,
.field__select,
.field__textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding: 8px 12px;
  font-size: 13px;
}

.field__input--mono {
  font-family: var(--font-mono);
}

.field__textarea {
  min-height: 160px;
  font-family: var(--font-mono);
  line-height: 1.5;
}

.card__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.form-row {
  display: grid;
  gap: 12px;
}

.form-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.clickable {
  cursor: pointer;
}

.table tr.clickable:hover td,
.clickable:hover {
  background: #f9fafb;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
}

.badge--green {
  background: var(--green-soft);
  color: #166534;
}

.badge--blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--red {
  background: var(--red-soft);
  color: #991b1b;
}

.badge--amber {
  background: var(--amber-soft);
  color: #92400e;
}

.pill--on {
  background: var(--green-soft);
  color: #166534;
}

.pill--off {
  background: #f3f4f6;
  color: var(--text-muted);
}

.experiment-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.experiment-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.experiment-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 12px;
}

.experiment-tab:hover {
  background: transparent;
  color: var(--text);
}

.experiment-tab--active {
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.experiment-tab .pill {
  font-weight: 600;
}

.experiment-card {
  margin-bottom: 8px;
}

.experiment-disabled-group {
  margin-top: 14px;
}

.experiment-disabled-group__header {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  padding: 12px 14px;
  text-align: left;
}

.experiment-disabled-group__header:hover {
  border-color: var(--primary);
}

.experiment-disabled-group__title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.experiment-disabled-group__body {
  margin-top: 8px;
}

.strat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
}

.strat-row__arrow {
  width: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.strat-row__key {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.strat-row__exp {
  color: var(--text-muted);
}

.strat-row__managed-link {
  margin-left: auto;
}

.strat-panel {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}

.managed-inline-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.strat-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.experiment-evaluation {
  border-top: 1px solid var(--border-light);
  margin-top: 14px;
  padding-top: 2px;
}

.evaluation-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.evaluation-formula {
  margin-top: 8px;
}

.strat-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.strat-actions .btn--danger {
  margin-left: auto;
}

.override-list {
  display: grid;
  gap: 6px;
}

.managed-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.managed-list {
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  min-width: 0;
  overflow: hidden;
}

.managed-detail {
  min-width: 0;
  overflow: hidden;
}

.managed-task-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.managed-task-item {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.managed-task-item:hover,
.managed-task-item--active {
  border-color: var(--primary);
  background: #f8fbff;
}

.managed-task-item__top {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.managed-task-item__top strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-task-item__meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managed-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.managed-detail__header h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.managed-detail__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.managed-detail__title h2 {
  min-width: 0;
}

.managed-detail__header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.managed-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.managed-info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.managed-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.managed-task-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.managed-task-meta b {
  color: var(--text-muted);
  font-weight: 600;
}

.managed-subsection {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 2px;
}

.managed-rounds {
  display: grid;
  gap: 10px;
}

.managed-round {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
}

.managed-round--running {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f8fbff;
}

.managed-round__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.managed-round__head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.managed-round__time,
.managed-round__empty {
  color: var(--text-muted);
  font-size: 12px;
}

.managed-round__variants {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.managed-round__empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin-top: 10px;
  padding: 10px;
}

.managed-report-table {
  margin-top: 10px;
}

.managed-json {
  margin-top: 10px;
}

.managed-json summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}

.managed-json pre {
  overflow: auto;
  border-radius: var(--radius-md);
  background: #111827;
  color: #f9fafb;
  padding: 12px;
  font-size: 12px;
}

.managed-config-preview summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
}

.managed-config-preview pre {
  max-width: min(520px, 70vw);
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text);
  margin: 8px 0 0;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.experiment-v2-page {
  display: grid;
  gap: 12px;
}

.experiment-v2-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}

.experiment-v2-controls__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  color: var(--text-muted);
  font-size: 12px;
}

.experiment-v2-controls__meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  padding: 5px 8px;
}

.experiment-v2-controls__meta .btn {
  min-height: 28px;
}

.experiment-v2-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.experiment-v2-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.experiment-v2-heading {
  min-width: 0;
}

.experiment-v2-panel__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.experiment-v2-heading__main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.experiment-v2-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.experiment-v2-strategy-key {
  margin-left: 4px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.experiment-v2-heading p {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.experiment-v2-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.experiment-v2-summary {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.experiment-v2-summary__item {
  flex: 1 1 140px;
  min-width: 0;
  border-right: 1px solid var(--border);
  padding: 8px 12px;
}

.experiment-v2-summary__item:last-child {
  border-right: 0;
}

.experiment-v2-default-row td {
  background: #f8fafc;
}

.experiment-v2-summary__item span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.experiment-v2-summary__item b {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.experiment-v2-table-block {
  margin-top: 12px;
}

.experiment-v2-override-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.experiment-v2-override-form .field__input,
.experiment-v2-override-form .field__select {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.experiment-v2-override-actions {
  text-align: right;
  white-space: nowrap;
}

.experiment-v2-managed {
  margin-top: 12px;
}

.experiment-v2-managed__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.experiment-v2-managed__rounds {
  display: grid;
  gap: 8px;
}

.experiment-v2-managed__round {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfdff;
  padding: 10px 12px;
}

.experiment-v2-managed__round > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.experiment-v2-managed__round p {
  margin: 5px 0 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.experiment-assessment {
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: #f7faff;
  margin-top: 12px;
  padding: 10px 12px;
}

.experiment-assessment--compact {
  margin-top: 10px;
  padding: 9px 10px;
}

.experiment-assessment__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.experiment-assessment__head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.experiment-assessment__time {
  color: var(--text-muted);
  font-size: 11px;
}

.experiment-assessment p,
.experiment-formal-report__summary {
  margin: 8px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.experiment-assessment__signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.experiment-assessment__error {
  margin-top: 7px;
  color: var(--red);
  font-size: 12px;
}

.experiment-formal-reports {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.experiment-formal-report {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fbfdff;
  padding: 12px;
}

.experiment-assessment-table {
  margin-top: 10px;
  min-width: 860px;
}

.experiment-assessment-table__baseline td {
  background: #f8fafc;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  margin: 0 5px 5px 0;
  padding: 3px 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.experiment-v2-subtitle {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.experiment-v2-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
  color: var(--text-muted);
  padding: 12px;
  font-size: 12px;
}

.experiment-v2-config-preview pre {
  max-width: min(680px, 75vw);
  max-height: 220px;
}

.override-row {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.override-row .field__input,
.override-row .field__select {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.override-row__delete {
  color: var(--red);
  padding-inline: 8px;
}

.muted-small {
  color: var(--text-muted);
  font-size: 12px;
}

.muted-italic {
  color: var(--text-muted);
  font-style: italic;
}

.key-reveal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--green);
  border-radius: var(--radius-lg);
  background: var(--green-soft);
  margin-top: 16px;
  padding: 14px;
}

.key-help {
  margin-bottom: 12px;
}

.key-reveal__label {
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.key-reveal__title {
  color: #14532d;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.key-reveal__hint {
  color: #166534;
  font-size: 12px;
  margin-top: 6px;
}

.marketing-sync-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.marketing-sync-status span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 7px 10px;
}

.marketing-sync-status b {
  color: var(--text-muted);
  font-size: 12px;
}

.marketing-sync-status__error {
  border-color: var(--red) !important;
  background: var(--red-soft) !important;
  color: #991b1b;
}

.marketing-sync-action {
  justify-content: end;
}

.adjust-callback-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

@media (max-width: 720px) {
  .adjust-callback-box {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.key-reveal__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 20px;
  text-align: center;
}

.empty-state__title {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
}

.topbar__badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #92400e;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}

.editor-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  min-height: 560px;
}

.editor-list {
  border-right: 1px solid var(--border);
  min-width: 0;
  padding-right: 16px;
}

.editor-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.editor-list__item {
  display: block;
  width: 100%;
  min-width: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 10px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: background 100ms;
  margin-bottom: 2px;
}

.editor-list__item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: inherit;
}

.editor-list__item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
}

.editor-list__item:hover {
  background: #f3f4f6;
}

.editor-list__item--active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.editor-list__empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.editor-create {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.editor-create .btn {
  width: 100%;
  margin-top: 8px;
}

.editor-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-title {
  font-size: 14px;
  font-weight: 600;
}

.editor-spacer {
  flex: 1;
}

.editor-save-as {
  width: 160px;
  padding: 5px 10px;
  font-size: 12px;
}

.editor-toolbar__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.editor-code {
  flex: 1;
  min-height: 440px;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  caret-color: #93c5fd;
  tab-size: 2;
}

.editor-code:focus {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.editor-code::selection {
  background: rgba(96, 165, 250, 0.35);
  color: #fff;
}

.report-pack-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 12px;
  flex: 1;
  min-height: 440px;
}

.report-pack-grid .editor-code {
  min-height: 440px;
}

.report-preview {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f9fafb;
  padding: 14px;
}

.report-preview__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.report-preview__messages {
  margin: 0 0 10px 18px;
  padding: 0;
  font-size: 12px;
}

.report-preview__error {
  color: #b91c1c;
}

.report-preview__warning {
  color: #92400e;
}

.report-preview__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.report-preview__meta span {
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
}

.report-sql {
  margin-top: 12px;
}

.report-sql__title {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.report-sql pre {
  overflow: auto;
  max-height: 360px;
  margin: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.report-dashboard {
  display: grid;
  gap: 16px;
}

.report-dashboard__bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.report-dashboard__bar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.report-dashboard__bar p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.report-dashboard__actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.report-dashboard__version {
  width: 180px;
}

.report-dashboard__date {
  width: 148px;
}

.report-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.report-tab {
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 10px 12px;
}

.report-tab:hover {
  background: transparent;
  color: var(--text);
}

.report-tab--active {
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.report-group-list {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.report-group {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: 14px;
}

.report-group__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.report-group__title {
  min-width: 0;
}

.report-group__title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.report-group__title p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.report-group__tools {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.report-group__selector {
  width: 148px;
}

.report-group__selector--search {
  width: 184px;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.report-chart-card {
  grid-column: span 6;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.report-chart-card--sm {
  grid-column: span 4;
}

.report-chart-card--lg {
  grid-column: span 8;
}

.report-chart-card--full {
  grid-column: 1 / -1;
}

.report-chart-switcher {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.report-chart-switcher__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.report-chart-switcher__title {
  min-width: 0;
}

.report-chart-switcher__title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.report-chart-switcher__title p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.report-chart-switcher__tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  border-radius: 9px;
  background: #f3f5f8;
  padding: 4px;
}

.report-chart-switcher__tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.report-chart-switcher__tabs button:hover {
  color: var(--text);
}

.report-chart-switcher__tabs button.is-active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.report-chart-switcher__tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.report-chart-switcher__body > [hidden] {
  display: none;
}

.report-chart-switcher__panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-chart-switcher__panel-grid > .report-chart-card--embedded {
  grid-column: auto;
  min-width: 0;
  padding: 0 14px 14px;
}

.report-chart-switcher__panel-grid > .report-chart-card--embedded + .report-chart-card--embedded {
  border-left: 1px solid var(--border);
}

.report-chart-switcher__panel-grid .report-chart-card--embedded > .report-chart-card__header {
  display: flex;
  min-height: 68px;
  margin: 0 -14px 4px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.report-chart-card--embedded {
  display: block;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.report-chart-card--embedded > .report-chart-card__header {
  display: none;
}

.report-chart-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-chart-card__header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.report-chart-card__header p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.report-pie-date-control {
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  min-width: 146px;
  color: var(--text-muted);
  font-size: 11px;
}

.report-pie-date-control select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.report-pie-date-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(51, 109, 244, 0.12);
}

.report-chart {
  min-width: 0;
  overflow: hidden;
}

.report-chart .analytics-chart {
  width: 100%;
  height: auto;
}

.report-echart {
  width: 100%;
  height: 286px;
  min-height: 240px;
}

.report-echart--pie {
  height: 300px;
}

.report-funnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px;
}

.report-funnel-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.report-funnel-panel {
  min-width: 0;
}

.report-funnel-panel h4 {
  margin: 0 0 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.report-echart--funnel {
  height: 340px;
}

.report-line-active {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.report-line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
}

.report-line-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  min-height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  padding: 2px 4px;
  font-size: 12px;
  cursor: pointer;
}

.report-line-legend__item:hover,
.report-line-legend__item.is-active {
  background: var(--border-light);
  color: var(--text);
}

.report-line-legend__item.is-muted {
  opacity: 0.42;
}

.report-line-legend__item i {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.report-line-legend__item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-chart-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(320px, calc(100vw - 16px));
  border-radius: 6px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow-md);
  opacity: 0;
  padding: 6px 8px;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 80ms ease, transform 80ms ease;
  font-size: 12px;
  line-height: 1.35;
}

.report-chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.report-bar__rect {
  transition: opacity 80ms ease;
}

.report-bar__rect:hover {
  opacity: 0.78;
}

.report-pie {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 220px;
}

.report-pie__circle {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.report-pie__legend {
  display: grid;
  gap: 8px;
}

.report-pie__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.report-pie__item span {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.report-pie__item i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.report-pie__item strong {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
}

.report-pie__item strong b {
  font-weight: 700;
}

.report-pie__item strong em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 600;
}

.report-runner {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 14px;
}

.report-runner__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-runner__title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.report-runner__controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 150px;
  gap: 10px;
  margin-bottom: 12px;
}

.report-result {
  margin-top: 12px;
}

.report-result__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.report-table-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.report-table-tools__filter,
.report-table-filter-chips {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.report-table-filter-field {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.report-table-filter-field__select {
  width: 150px;
  min-height: 30px;
  padding: 5px 28px 5px 8px;
  font-size: 12px;
}

.report-table-filter-field--range {
  width: 110px;
}

.report-table-filter-input {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.report-table-filter-hint {
  align-self: center;
  color: var(--text-muted);
  font-size: 12px;
}

.report-table-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f9fafb;
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.report-table-filter-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  line-height: 18px;
}

.report-table-filter-chip button:hover {
  background: var(--border-light);
  color: var(--text);
}

.report-table-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.report-table-sort span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-table-sort i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  color: var(--text);
  font-style: normal;
  font-size: 11px;
}

.report-table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.report-table-pager__controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.report-table-pager__size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.report-table-pager__select {
  width: 74px;
  min-height: 30px;
  padding: 5px 26px 5px 8px;
  font-size: 12px;
}

.report-table-pager__page {
  min-width: 54px;
  text-align: center;
  color: var(--text-secondary);
  font-weight: 600;
}

.data-table--compact th,
.data-table--compact td {
  padding: 8px 10px;
  white-space: nowrap;
}

.empty--compact {
  min-height: 72px;
  padding: 18px;
}

.link-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
  padding: 8px 12px;
}

.link-bar span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.link-bar input {
  padding: 5px 8px;
  font-size: 12px;
}

.slide-over-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.slide-over-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

.slide-over {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 31;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  padding: 24px;
  transform: translateX(100%);
  transition: transform 200ms ease;
}

.slide-over--wide {
  width: min(960px, 92vw);
}

.slide-over--open {
  transform: translateX(0);
}

.slide-over__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.slide-over__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.slide-over__close {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: var(--text-muted);
}

.slide-over__close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.slide-over__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slide-over__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.slide-over__actions .btn--danger {
  margin-left: auto;
}

.diff-empty {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.diff-pane {
  min-width: 0;
}

.diff-pane__title {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.diff-pane__body {
  max-height: calc(100vh - 190px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f9fafb;
  margin: 0;
  padding: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 150ms;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 150ms;
}

.switch input:checked + .switch__track {
  background: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.token-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.token-panel {
  width: 100%;
  max-width: 380px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.token-panel h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.token-panel p {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.analytics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.analytics-tab {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.analytics-tab:hover {
  background: var(--bg);
  color: var(--text-secondary);
}

.analytics-tab--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.analytics-field {
  width: 180px;
}

.analytics-field--date {
  width: 150px;
}

.analytics-refresh {
  margin-left: auto;
}

.analytics-checkbox {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: var(--text-muted);
}

.analytics-checkbox input {
  width: auto;
}

.analytics-block + .analytics-block,
.analytics-block--spaced {
  margin-top: 24px;
}

.analytics-block__header,
.analytics-subheader {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.analytics-block__header h3,
.analytics-subheader h4,
.analytics-cohort-group h4 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.analytics-subheader h4,
.analytics-cohort-group h4 {
  font-size: 13px;
}

.analytics-metric-select {
  width: 220px;
}

.analytics-range {
  display: flex;
  gap: 8px;
  align-items: end;
}

.analytics-range .field {
  width: 142px;
}

.analytics-range .field__input {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.analytics-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.analytics-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.analytics-chart {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin-bottom: 12px;
}

.analytics-cohort-group {
  margin-top: 22px;
}

.analytics-cohort-group--aggregate {
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  padding-bottom: 18px;
}

.analytics-aggregate-row td {
  background: var(--accent-soft);
}

.analytics-cell {
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.analytics-cell--good {
  background: var(--green-soft);
}

.analytics-cell--warn {
  background: var(--amber-soft);
}

.analytics-cell--low {
  background: var(--red-soft);
}

.analytics-event-detail {
  background: #f9fafb;
}

.analytics-event-detail pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.analytics-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .main {
    margin-left: 0;
  }

  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-list {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 16px;
  }

  .report-pack-grid {
    grid-template-columns: 1fr;
  }

  .report-dashboard__bar {
    align-items: stretch;
    flex-direction: column;
  }

  .report-dashboard__actions {
    justify-content: flex-start;
  }

  .report-group__header {
    align-items: stretch;
    flex-direction: column;
  }

  .report-group__tools {
    justify-content: flex-start;
  }

  .report-chart-card,
  .report-chart-card--sm,
  .report-chart-card--lg,
  .report-chart-card--full {
    grid-column: 1 / -1;
  }

  .report-pie {
    grid-template-columns: 1fr;
  }

  .report-runner__controls {
    grid-template-columns: 1fr;
  }

  .managed-layout {
    grid-template-columns: 1fr;
  }

  .managed-list {
    position: static;
  }

  .managed-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .experiment-v2-controls {
    grid-template-columns: 1fr 1fr;
  }

  .experiment-v2-controls__meta {
    justify-content: flex-start;
  }

  .analytics-refresh {
    margin-left: 0;
  }

}

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions select {
    width: 100%;
  }

  .grid,
  .grid.three,
  .form-row--2,
  .form-row--4,
  .managed-info-grid,
  .experiment-v2-controls {
    grid-template-columns: 1fr;
  }

  .managed-detail__header,
  .managed-round__head,
  .managed-inline-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .key-reveal {
    grid-template-columns: 1fr;
  }

  .override-row {
    grid-template-columns: 1fr;
  }

  .analytics-field,
  .analytics-field--date,
  .analytics-metric-select,
  .report-dashboard__version,
  .report-dashboard__date {
    width: 100%;
  }

  .report-dashboard__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-group__tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .report-group__selector {
    width: 100%;
  }

  .report-chart-card__header {
    align-items: stretch;
    flex-direction: column;
  }

  .report-pie-date-control {
    width: 100%;
  }

  .report-pie__circle {
    width: min(180px, 100%);
  }

  .analytics-range {
    width: 100%;
  }

  .analytics-range .field {
    flex: 1;
    min-width: 0;
  }

  .toast-container {
    top: 16px;
    right: 16px;
  }

  .diff-grid {
    grid-template-columns: 1fr;
  }

  .slide-over {
    width: 100vw;
    max-width: 100vw;
  }
}
