@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css');
@import url('https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/css/tom-select.bootstrap5.min.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.20/codemirror.min.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.20/addon/fold/foldgutter.min.css');

:root {
  --pba-bg: #f0f4f8;
  --pba-panel: #ffffff;
  --pba-border: #e2eaf2;
  --pba-text: #2c3e50;
  --pba-muted: #718096;
  --pba-primary: #5b9bd5;
  --pba-success: #6dbb8a;
  --pba-warning: #f5c164;
  --pba-danger: #e07f7f;
  --pba-info: #7db9d8;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  background: var(--pba-bg);
  color: var(--pba-text);
  min-width: 320px;
}

.admin-shell {
  align-items: stretch;
}

.admin-sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--pba-panel);
  border-right: 1px solid var(--pba-border);
  flex-shrink: 0;
}

.admin-sidebar-nav {
  min-width: 0;
}

.admin-sidebar .sidebar-logo {
  padding: 1rem 1.2rem 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid var(--pba-border);
}

.admin-sidebar .nav-link {
  padding: 0.45rem 1.2rem;
  color: #4a5568;
  font-size: 0.84rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-sidebar .nav-link:hover {
  background: #f0f4f8;
  color: var(--pba-text);
}

.admin-sidebar .nav-link.active {
  background: #ebf2fa;
  color: var(--pba-primary);
  font-weight: 500;
  border-right: 2px solid var(--pba-primary);
}

.nav-section-title {
  padding: 0.75rem 1.2rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #a0aec0;
  text-transform: uppercase;
}

.admin-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--pba-panel);
  border-bottom: 1px solid var(--pba-border);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 53px;
}

.admin-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.page-title { font-weight: 600; font-size: 0.95rem; }
.admin-main { padding: 1.5rem; flex: 1 0 auto; }

.section-card {
  background: var(--pba-panel);
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 1.25rem;
}

.section-card-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--pba-border);
  font-weight: 600;
  font-size: 0.875rem;
  background: #f8fafc;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-card-body { padding: 1.25rem; }

.section-card-body.p-0 {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.section-card-body.p-0 > .table {
  min-width: 640px;
}

.kpi-card {
  background: var(--pba-panel);
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #a0aec0;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0.25rem;
}

.kpi-sub { font-size: 0.75rem; color: var(--pba-muted); margin-top: 0.15rem; }
.kpi-danger { border-left: 3px solid var(--pba-danger); }
.kpi-success { border-left: 3px solid var(--pba-success); }
.kpi-info { border-left: 3px solid var(--pba-info); }
.kpi-warning { border-left: 3px solid var(--pba-warning); }

.table-compact th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #a0aec0;
  background: #f8fafc;
  border-bottom: 1px solid var(--pba-border);
  white-space: nowrap;
}

.table-compact td { font-size: 0.84rem; vertical-align: middle; }

.badge-status {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.text-mono {
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f4f8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.login-logo { font-size: 1.25rem; font-weight: 600; }
.login-sub { font-size: 0.8rem; color: var(--pba-muted); }

.url-copy-box {
  background: #f8fafc;
  border: 1px solid var(--pba-border);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  color: #4a5568;
  word-break: break-all;
  width: 100%;
  min-width: 0;
}

.pagination {
  --bs-pagination-font-size: 0.8rem;
  flex-wrap: wrap;
  row-gap: 0.35rem;
}

.pagination-wrap {
  margin-top: 1rem;
}

.pagination-wrap .pagination-nav {
  display: flex;
  justify-content: center;
}

.pagination-wrap .pagination {
  justify-content: center;
  gap: 0.35rem;
}

.pagination-wrap .page-item {
  margin: 0;
}

.pagination-wrap .page-link {
  min-width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #ffffff;
  color: #53657a;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.pagination-wrap .page-link:hover {
  background: #f6faff;
  border-color: rgba(91, 155, 213, 0.42);
  color: var(--pba-primary);
  box-shadow: 0 4px 14px rgba(91, 155, 213, 0.08);
}

.pagination-wrap .page-item.active .page-link {
  background: var(--pba-primary);
  border-color: var(--pba-primary);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(91, 155, 213, 0.16);
}

.pagination-wrap .page-item.disabled .page-link {
  background: #f8fafc;
  border-color: var(--pba-border);
  color: #a0aec0;
  box-shadow: none;
}

.pagination-wrap .page-item:first-child .page-link,
.pagination-wrap .page-item:last-child .page-link {
  min-width: auto;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

.pagination-wrap .page-item:not(.active):not(.disabled) .page-link:focus {
  border-color: rgba(91, 155, 213, 0.55);
  box-shadow: 0 0 0 0.18rem rgba(91, 155, 213, 0.14);
}

.json-editor-shell {
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.json-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--pba-border);
  background: #f3f7fb;
}

.json-editor-textarea {
  min-height: 300px;
  border: 0;
  border-radius: 0;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.json-editor-shell .CodeMirror {
  height: 300px;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  background: #fff;
}

.json-editor-shell .CodeMirror-gutters {
  background: #f8fafc;
  border-right: 1px solid var(--pba-border);
}

.json-preview {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.pba-search-select {
  position: relative;
  width: 100%;
  background-image: none !important;
  appearance: none;
}

.pba-search-select.form-select,
.pba-search-select.form-select-sm,
.pba-search-select.form-select-lg,
.pba-search-select.single {
  background-image: none !important;
}

.pba-search-select .ts-control,
.pba-search-select.single .ts-control {
  min-height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 2.1rem 0.375rem 0.75rem;
  border: 1px solid var(--pba-border);
  border-radius: 0.375rem;
  background: #ffffff;
  background-image: none !important;
  appearance: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.pba-search-select.focus .ts-control,
.pba-search-select .ts-control:focus-within {
  border-color: rgba(91, 155, 213, 0.6);
  box-shadow: 0 0 0 0.18rem rgba(91, 155, 213, 0.14);
}

.pba-search-select--invalid .ts-control,
.pba-search-select--invalid.focus .ts-control {
  border-color: rgba(224, 127, 127, 0.75);
  box-shadow: 0 0 0 0.18rem rgba(224, 127, 127, 0.12);
}

.pba-search-select.disabled .ts-control,
.pba-search-select .ts-control.disabled {
  background: #f8fafc;
  color: #94a3b8;
  opacity: 1;
}

.pba-search-select .ts-control > input {
  font-size: 0.84rem;
  color: var(--pba-text);
}

.pba-search-select .ts-control > input::placeholder {
  color: #94a3b8;
}

.pba-search-select .item {
  color: var(--pba-text);
}

.pba-search-select.multi::after {
  display: none;
}

.pba-search-select.multi .ts-control {
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
}

.pba-search-select.multi .item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: rgba(91, 155, 213, 0.12);
  color: #244b6b;
  font-size: 0.8rem;
  line-height: 1.3;
}

.pba-search-select.multi .item .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.05rem;
  border-radius: 999px;
  color: #5b9bd5;
  text-decoration: none;
}

.pba-search-select.multi .item .remove:hover {
  background: rgba(91, 155, 213, 0.16);
  color: #1f3f5a;
}

.pba-search-select.multi .ts-control > input {
  min-width: 7rem;
  margin: 0 !important;
  padding: 0.1rem 0;
}

.pba-search-select.single .ts-control::before,
.pba-search-select.single .ts-control::after {
  display: none !important;
  content: none !important;
}

.pba-search-select::after {
  content: '';
  position: absolute;
  right: 0.78rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid #8aa3ba;
  border-bottom: 1.5px solid #8aa3ba;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  z-index: 2;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.pba-search-select.dropdown-active::after {
  transform: translateY(-20%) rotate(-135deg);
  border-color: var(--pba-primary);
}

.pba-search-select--sm .ts-control,
.pba-search-select--sm.single .ts-control {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 1.95rem 0.25rem 0.65rem;
  font-size: 0.82rem;
}

.pba-search-select--sm .ts-control > input,
.pba-search-select--sm .item {
  font-size: 0.82rem;
}

.pba-search-select--auto {
  width: auto;
  min-width: 12rem;
}

.pba-search-select-dropdown {
  margin-top: 0.3rem;
  border: 1px solid var(--pba-border);
  border-radius: 0.55rem;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  z-index: 60;
}

.pba-search-select-dropdown .ts-dropdown-content {
  padding: 0.3rem;
  max-height: 280px;
}

.pba-search-select-dropdown .option,
.pba-search-select-dropdown .create,
.pba-search-select-dropdown .no-results {
  padding: 0.5rem 0.65rem;
  border-radius: 0.45rem;
  font-size: 0.83rem;
  line-height: 1.4;
}

.pba-search-select-dropdown .option {
  color: var(--pba-text);
}

.pba-search-select-dropdown .option.active,
.pba-search-select-dropdown .option:hover {
  background: #f4f9ff;
  color: var(--pba-primary);
}

.pba-search-select-dropdown .option.selected {
  background: rgba(91, 155, 213, 0.12);
  color: var(--pba-primary);
}

.pba-search-select-dropdown .no-results {
  color: var(--pba-muted);
}

.subscription-plan-shell {
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #fbfdff;
  padding: 1rem;
}

.product-app-toggle-grid {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 0.6rem;
  padding: 0.2rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.product-app-toggle-item {
  min-width: 0;
}

.product-app-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.product-app-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 46px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--pba-border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--pba-text);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.product-app-toggle-label:hover {
  border-color: rgba(91, 155, 213, 0.45);
  background: #f4f9ff;
}

.product-app-toggle-input:focus + .product-app-toggle-label {
  border-color: rgba(91, 155, 213, 0.55);
  box-shadow: 0 0 0 0.18rem rgba(91, 155, 213, 0.14);
}

.product-app-toggle-input:checked + .product-app-toggle-label {
  border-color: rgba(91, 155, 213, 0.52);
  background: rgba(91, 155, 213, 0.09);
  box-shadow: 0 10px 24px rgba(91, 155, 213, 0.08);
}

.product-app-toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 2.15rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #dbe7f2;
  transition: background-color 0.18s ease;
}

.product-app-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease;
}

.product-app-toggle-input:checked + .product-app-toggle-label .product-app-toggle-switch {
  background: rgba(91, 155, 213, 0.9);
}

.product-app-toggle-input:checked + .product-app-toggle-label .product-app-toggle-switch::after {
  transform: translateX(0.9rem);
}

.product-app-toggle-name {
  min-width: 0;
  font-size: 0.83rem;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.subscription-plan-preview {
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(125, 185, 216, 0.22);
  border-radius: 8px;
  background: rgba(125, 185, 216, 0.08);
  color: #476579;
  font-size: 0.78rem;
  line-height: 1.55;
}

.subscription-plan-preview--muted {
  margin-top: 0.9rem;
  border-color: var(--pba-border);
  background: #f8fafc;
  color: var(--pba-muted);
}

.mini-meta {
  font-size: 0.82rem;
  line-height: 1.65;
  word-break: break-word;
}

.tester-user-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tester-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: rgba(125, 185, 216, 0.16);
  color: #5b8faf;
  font-size: 0.72rem;
  line-height: 1;
}

.experiment-segment-row {
  padding: 0.95rem 1rem;
  border: 1px solid var(--pba-border);
  border-radius: 10px;
  background: #f8fafc;
}

.experiment-segment-row + .experiment-segment-row {
  margin-top: 0.9rem;
}

.experiment-segment-row__grid .form-label {
  min-height: 1.15rem;
  margin-bottom: 0.45rem;
}

.experiment-segment-row__grid .form-control,
.experiment-segment-row__grid .btn {
  min-height: calc(2.25rem + 2px);
}

.experiment-segment-row__action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.experiment-segment-row__action .btn {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.experiment-cohort-card {
  border: 1px solid var(--pba-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.experiment-cohort-card + .experiment-cohort-card {
  margin-top: 1rem;
}

.experiment-cohort-card__header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--pba-border);
  background: #f8fafc;
}

.experiment-analytics-table {
  min-width: 1060px;
}

.experiment-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.experiment-header-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--pba-border);
  color: var(--pba-muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.payment-links-report-note {
  margin-top: 0.35rem;
  color: var(--pba-muted);
  font-size: 0.76rem;
}

.payment-links-report-table {
  min-width: 760px;
}

.retention-report-card .section-card-header {
  align-items: flex-start;
}

.retention-report-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.retention-report-toolbar__search {
  width: 260px;
  max-width: 100%;
}

.retention-report-shell {
  overflow-x: auto;
}

.retention-report-table {
  min-width: 2200px;
}

.retention-report-table__metric--conversion {
  background: #eef8ff;
  box-shadow: inset 1px 0 0 rgba(125, 185, 216, 0.18), inset -1px 0 0 rgba(125, 185, 216, 0.18);
}

.retention-report-table__metric--prediction {
  background: #fff3e7;
  box-shadow: inset 1px 0 0 rgba(245, 193, 100, 0.18), inset -1px 0 0 rgba(245, 193, 100, 0.18);
}

.retention-report-table thead .retention-report-table__metric--conversion {
  background: #dff1ff;
  color: #4d7ea3;
}

.retention-report-table thead .retention-report-table__metric--prediction {
  background: #ffe9d0;
  color: #9a6a23;
}

.table-hover > tbody > tr:hover > .retention-report-table__metric--conversion {
  background: #e5f4ff !important;
}

.table-hover > tbody > tr:hover > .retention-report-table__metric--prediction {
  background: #ffeedb !important;
}

.retention-report-table__sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 280px;
  background: #ffffff;
  box-shadow: 1px 0 0 var(--pba-border);
}

.retention-report-table thead .retention-report-table__sticky-col {
  z-index: 3;
  background: #f8fafc;
}

.retention-report-table__sticky-col--child {
  padding-left: 2.75rem !important;
  background: #fbfdff;
}

.retention-row-toggle {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pba-border);
  border-radius: 6px;
  background: #fff;
  color: var(--pba-text);
}

.retention-product-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.retention-product-cell__meta {
  min-width: 0;
}

.retention-product-code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retention-product-subtitle {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--pba-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retention-row-toggle__icon {
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1;
  transition: transform 0.18s ease;
}

[data-retention-parent-row][data-expanded='1'] .retention-row-toggle__icon {
  transform: rotate(90deg);
}

[data-retention-child-row] {
  background: #fbfdff;
}

.retention-cohort-label {
  font-family: SFMono-Regular, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--pba-muted);
}

.retention-sort-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.retention-sort-button::after {
  content: '↕';
  font-size: 0.7rem;
  color: #b0bdcc;
}

.retention-sort-button[data-sort-direction='asc']::after {
  content: '↑';
  color: var(--pba-primary);
}

.retention-sort-button[data-sort-direction='desc']::after {
  content: '↓';
  color: var(--pba-primary);
}

.retention-metric-link {
  color: var(--pba-primary);
  font-weight: 500;
  text-decoration: none;
}

.retention-metric-link:hover {
  color: #447fb3;
  text-decoration: underline;
}

.retention-drilldown-dialog {
  width: min(1180px, calc(100vw - 2rem));
  max-width: 1180px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
}

.retention-drilldown-dialog::backdrop {
  background: rgba(15, 23, 42, 0.24);
}

.retention-drilldown-dialog__shell {
  display: flex;
  flex-direction: column;
  max-height: min(82vh, 900px);
  overflow: hidden;
  border: 1px solid var(--pba-border);
  border-radius: 12px;
  background: var(--pba-panel);
}

.retention-drilldown-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--pba-border);
  background: #f8fafc;
}

.retention-drilldown-dialog__title {
  font-size: 0.88rem;
  font-weight: 600;
}

.retention-drilldown-dialog__body {
  padding: 1rem;
  overflow: auto;
  background: #ffffff;
}

.retention-drilldown-loading {
  padding: 1rem;
  border: 1px dashed var(--pba-border);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--pba-muted);
  text-align: center;
}

.retention-drilldown-panel {
  min-width: 0;
}

.retention-drilldown-panel__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}

.retention-drilldown-table {
  min-width: 980px;
}

.retention-drilldown-pagination {
  margin-top: 0.9rem;
}

.reconciliation-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--pba-border);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1;
}

.reconciliation-status--queued {
  background: #f8fafc;
  color: var(--pba-muted);
}

.reconciliation-status--running {
  background: #edf7fd;
  color: #4d7ea3;
  border-color: rgba(125, 185, 216, 0.5);
}

.reconciliation-status--completed {
  background: #eefaf3;
  color: #4a8d66;
  border-color: rgba(109, 187, 138, 0.45);
}

.reconciliation-status--failed {
  background: #fff2f2;
  color: #b75e5e;
  border-color: rgba(224, 127, 127, 0.45);
}

.reconciliation-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reconciliation-breakdown__chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--pba-border);
  background: #ffffff;
  color: var(--pba-muted);
  font-size: 0.76rem;
  text-decoration: none;
}

.reconciliation-breakdown__chip:hover {
  color: var(--pba-primary);
  border-color: rgba(91, 155, 213, 0.35);
  background: #f6faff;
}

.reconciliation-breakdown__chip.active {
  background: #ebf2fa;
  color: var(--pba-primary);
  border-color: rgba(91, 155, 213, 0.45);
}

.reconciliation-filters-card {
  padding: 0.95rem 1rem;
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #fbfdff;
}

.reconciliation-results-meta {
  color: var(--pba-muted);
  font-size: 0.76rem;
}

.reconciliation-feedback-wrap .alert:last-child {
  margin-bottom: 0;
}

.reconciliation-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--pba-border);
  border-radius: 8px;
  background: #f8fbff;
}

.reconciliation-bulk-toolbar__meta {
  color: var(--pba-muted);
  font-size: 0.78rem;
}

.reconciliation-action-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.reconciliation-row-status {
  max-width: 260px;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: right;
}

.reconciliation-row-status--success {
  background: #eefaf3;
  color: #3f7d58;
  border: 1px solid rgba(109, 187, 138, 0.35);
}

.reconciliation-row-status--error {
  background: #fff2f2;
  color: #ad5b5b;
  border: 1px solid rgba(224, 127, 127, 0.35);
}

tr.reconciliation-issue-row--processing {
  opacity: 0.7;
}

tr.reconciliation-issue-row--success {
  background: #f2fbf5;
}

tr.reconciliation-issue-row--error {
  background: #fff5f5;
}

.reconciliation-json-preview {
  max-width: 360px;
  max-height: 180px;
  margin: 0;
  overflow: auto;
}

.admin-footer-note {
  margin-top: auto;
  padding: 0.9rem 1.5rem 1.1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.55);
  color: #a0aec0;
  font-size: 0.72rem;
  line-height: 1.5;
}

.nav-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.nav-tabs .nav-link {
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--pba-border);
  }

  .admin-content {
    min-height: 0;
  }

  .admin-topbar {
    padding: 0.75rem 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .admin-main {
    padding: 1rem;
  }

  .admin-footer-note {
    padding: 0.85rem 1rem 1rem;
  }
}

@media (max-width: 767.98px) {
  .admin-sidebar .sidebar-logo {
    padding: 0.9rem 1rem 0.7rem;
  }

  .admin-sidebar .nav-link,
  .nav-section-title {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .page-title {
    width: 100%;
    font-size: 0.9rem;
  }

  .admin-topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .admin-topbar-actions > * {
    flex: 1 1 100%;
  }

  .admin-topbar-actions .btn,
  .admin-topbar-actions .form-control,
  .admin-topbar-actions .form-select {
    width: 100%;
  }

  .section-card-header {
    padding: 0.75rem 1rem;
  }

  .section-card-body {
    padding: 1rem;
  }

  .kpi-card {
    padding: 0.95rem 1rem;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .section-card-body .d-flex.gap-2,
  .section-card-body .d-flex.align-items-center.gap-2 {
    flex-wrap: wrap;
  }

  .section-card-body .d-flex.gap-2 > .btn,
  .section-card-body .d-flex.align-items-center.gap-2 > .btn {
    width: 100%;
  }

  .tester-price-row {
    padding: 0.75rem;
    border: 1px solid var(--pba-border);
    border-radius: 8px;
    background: #f8fafc;
  }

  .tester-price-row [data-remove-tester-price] {
    width: 100%;
  }

  .experiment-segment-row {
    padding: 0.85rem;
  }


  .json-editor-shell .CodeMirror,
  .json-editor-textarea {
    min-height: 240px;
  }

  .pba-search-select--auto {
    width: 100%;
    min-width: 0;
  }

  .subscription-plan-shell {
    padding: 0.85rem;
  }

  .product-app-toggle-grid {
    grid-template-rows: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: visible;
  }

  .product-app-toggle-label {
    min-height: 44px;
    padding: 0.65rem 0.75rem;
  }

  .pagination-wrap .pagination {
    gap: 0.28rem;
  }

  .retention-report-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .retention-report-toolbar__search {
    width: 100%;
  }

  .retention-drilldown-dialog {
    width: calc(100vw - 1rem);
  }

  .retention-drilldown-dialog__body {
    padding: 0.85rem;
  }

  .retention-drilldown-panel__meta {
    flex-direction: column;
  }

  .pagination-wrap .page-link {
    min-width: 2rem;
    height: 2rem;
    padding: 0.4rem 0.65rem;
    border-radius: 7px;
    font-size: 0.76rem;
  }

  .pagination-wrap .page-item:first-child .page-link,
  .pagination-wrap .page-item:last-child .page-link {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .admin-footer-note {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
}

