* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "SF Pro Display", sans-serif;
  background: linear-gradient(160deg, #f0f4fa 0%, #e8eef8 50%, #f4f7fc 100%);
  color: #0f172a;
  min-height: 100vh;
}

.admin-shell {
  width: calc(100vw - 24px);
  max-width: none;
  margin: 12px auto 24px;
  display: grid;
  gap: 12px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: none;
  border-radius: 16px;
  padding: 18px 22px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
}

.admin-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}

.admin-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #94a3b8;
}

.admin-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-user-text {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.admin-link-btn,
.admin-btn {
  border-radius: 10px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.admin-link-btn {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.admin-link-btn:hover {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

td .admin-link-btn {
  min-height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #2563eb;
}

td .admin-link-btn:hover {
  background: transparent;
  color: #1d4ed8;
  text-decoration: underline;
}

.mono-cell {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.admin-btn {
  border: none;
  background: linear-gradient(135deg, #4D6BFE 0%, #6C5CE7 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(77, 107, 254, 0.25);
  transition: all 0.2s ease;
}

.admin-btn:hover {
  box-shadow: 0 6px 20px rgba(77, 107, 254, 0.35);
  transform: translateY(-1px);
}

.admin-btn.ghost {
  border-color: #c8d8f6;
  background: #fff;
  color: #2f67ff;
  box-shadow: none;
}

.admin-btn.ghost:hover {
  border-color: #9fc0ff;
  background: #edf4ff;
}

.admin-topbar .admin-btn.ghost {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.admin-topbar .admin-btn.ghost:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.admin-btn.mini {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 4px;
  min-height: auto;
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
  box-shadow: none;
}
.admin-btn.mini:hover {
  background: #e2e8f0;
  transform: none;
  box-shadow: none;
}
.admin-btn.mini.danger {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}
.admin-btn.mini.danger:hover {
  background: #fee2e2;
}
.admin-btn.mini.success {
  background: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}
.admin-btn.mini.success:hover {
  background: #dcfce7;
}
.admin-btn.mini.warning {
  background: #fff7ed;
  border-color: #fdba74;
  color: #ea580c;
}
.admin-btn.mini.warning:hover {
  background: #ffedd5;
}
.admin-btn.mini.ghost {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}
.admin-btn.mini.ghost:hover {
  background: #f8fafc;
}

.admin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.admin-toast-viewport {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 12000;
  pointer-events: none;
}
.admin-toast {
  min-width: 260px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #dbe5f4;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  color: #334155;
  font-size: 13px;
  line-height: 1.65;
  pointer-events: auto;
  animation: adminToastIn 0.18s ease;
}
.admin-toast.success {
  border-color: #bbf7d0;
  background: rgba(240, 253, 244, 0.98);
  color: #166534;
}
.admin-toast.error {
  border-color: #fecaca;
  background: rgba(254, 242, 242, 0.98);
  color: #991b1b;
}
.admin-toast.info {
  border-color: #bfdbfe;
  background: rgba(239, 246, 255, 0.98);
  color: #1d4ed8;
}
@keyframes adminToastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #dbe5f4;
  border-radius: 16px;
  padding: 12px 10px;
  box-shadow: 0 8px 18px rgba(22, 45, 88, 0.05);
}

.admin-nav-btn {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  padding: 0 16px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
}

.admin-nav-btn:hover {
  border-color: transparent;
  background: #f1f5f9;
  color: #1e293b;
}

.admin-nav-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, #4D6BFE 0%, #6C5CE7 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(77, 107, 254, 0.3);
}

.nav-icon {
  margin-right: 8px;
  flex-shrink: 0;
  opacity: 0.55;
}

.admin-nav-btn:hover .nav-icon {
  opacity: 0.75;
}

.admin-nav-btn.active .nav-icon {
  opacity: 1;
}

.admin-content {
  display: grid;
  gap: 12px;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-card {
  background: #ffffff;
  border: 1px solid #dbe5f4;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(24, 45, 88, 0.05);
}

.admin-card.admin-view {
  display: none;
}

.admin-card.admin-view.active {
  display: grid;
  animation: viewFadeIn 0.16s ease;
}

.section-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #1e293b, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-desc {
  margin: -4px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.dashboard-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid #dbe5f4;
  background: #f8fbff;
}

.dashboard-tab-btn {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #4a6286;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.dashboard-tab-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, #4D6BFE 0%, #6C5CE7 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(77, 107, 254, 0.2);
}

.sub-tabs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #dbe5f4;
  background: #f8fbff;
}

.sub-tab-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #4a6286;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sub-tab-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.sub-tab-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, #4D6BFE 0%, #6C5CE7 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(77, 107, 254, 0.2);
}

.sub-pane {
  display: none;
  gap: 12px;
}

.sub-pane.active {
  display: grid;
}

.dashboard-pane {
  display: none;
  gap: 24px;
}

.dashboard-pane.active {
  display: grid;
}

.block-title {
  margin: 6px 0 -2px;
  font-size: 16px;
  font-weight: 700;
  color: #1e3a66;
  padding-left: 11px;
  border-left: 4px solid #7da6f8;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.block-head .block-title {
  margin: 0;
}

.block-head .admin-btn {
  min-width: 124px;
}

.block-hint {
  margin: -2px 0 2px 15px;
  color: #7388a9;
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 16px;
}

.dashboard-section-spacer {
  height: 10px;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 24px;
  border: 1px solid #dbeafe;
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.14), transparent 32%),
    linear-gradient(135deg, #f8fbff 0%, #eef5ff 54%, #ffffff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -72px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(77, 107, 254, 0.1);
}

.dashboard-hero-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-hero-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  color: #0f172a;
}

.dashboard-hero-desc {
  margin: 8px 0 0;
  color: #5b7598;
  font-size: 13px;
}

.dashboard-hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-hero-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #2554b8;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-stat-card,
.welfare-summary-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.dashboard-stat-card::before,
.welfare-summary-card::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: #2563eb;
}

.dashboard-stat-card.tone-blue::before,
.welfare-summary-card.tone-blue::before { background: #2563eb; }
.dashboard-stat-card.tone-green::before,
.welfare-summary-card.tone-green::before { background: #10b981; }
.dashboard-stat-card.tone-amber::before,
.welfare-summary-card.tone-amber::before { background: #f59e0b; }
.dashboard-stat-card.tone-violet::before,
.welfare-summary-card.tone-violet::before { background: #7c3aed; }
.dashboard-stat-card.tone-rose::before,
.welfare-summary-card.tone-rose::before { background: #e11d48; }

.dashboard-stat-card .summary-item-value,
.welfare-summary-card .summary-item-value {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}

.summary-item-note {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 12px;
}

.order-summary-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid #dbe5f4;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
.order-summary-card::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  width: 42px;
  height: 3px;
  border-radius: 999px;
  opacity: 1;
  background: currentColor;
}
.order-summary-card.slate,
.order-summary-card.blue,
.order-summary-card.green,
.order-summary-card.amber,
.order-summary-card.violet {
  color: #64748b;
}
.order-summary-card.slate::after { background: #475569; }
.order-summary-card.blue::after { background: #2563eb; }
.order-summary-card.green::after { background: #16a34a; }
.order-summary-card.amber::after { background: #d97706; }
.order-summary-card.violet::after { background: #7c3aed; }
.order-summary-label {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}
.order-summary-value {
  position: relative;
  z-index: 1;
  color: #0f172a;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}
.order-summary-note {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #94a3b8;
}

.distribution-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.distribution-grid > .distribution-panel,
.summary-grid > .conversion-panel,
.summary-grid > .paid-structure-panel {
  grid-column: 1 / -1;
}

.summary-item {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.summary-item:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.distribution-item {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.distribution-item:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.distribution-item-label {
  display: block;
  color: #5b7598;
  font-size: 12px;
}

.distribution-item-value {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 22px;
  font-weight: 700;
}

.distribution-item-hint {
  display: block;
  margin-top: 2px;
  color: #6a7f9e;
  font-size: 12px;
}

.distribution-panel {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 18px;
  align-items: stretch;
}

.distribution-donut-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid #dbe5f4;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.distribution-donut {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.distribution-donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.distribution-donut span {
  position: relative;
  z-index: 1;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
}

.distribution-legend {
  display: grid;
  gap: 10px;
  color: #5b7598;
  font-size: 13px;
}

.distribution-legend strong {
  color: #0f172a;
  font-size: 15px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 999px;
}

.legend-dot.pro { background: #2563eb; }
.legend-dot.free { background: #10b981; }
.legend-dot.blue { background: #2563eb; }
.legend-dot.violet { background: #7c3aed; }
.legend-dot.amber { background: #f59e0b; }
.legend-dot.cyan { background: #0891b2; }
.legend-dot.green { background: #10b981; }
.legend-dot.rose { background: #e11d48; }

.distribution-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.distribution-metrics .full-span {
  grid-column: 1 / -1;
}

.conversion-panel {
  display: grid;
  grid-template-columns: minmax(320px, 1.18fr) minmax(260px, 0.82fr);
  gap: 18px;
  width: 100%;
}

.paid-structure-panel {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 18px;
  width: 100%;
}

.paid-structure-donut-card {
  min-height: 208px;
}

.paid-structure-donut span {
  font-size: 30px;
}

.paid-structure-legend {
  align-content: center;
}

.paid-structure-metrics {
  align-content: start;
}

.paid-breakdown-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.paid-breakdown-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.paid-breakdown-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #0f172a;
}

.paid-breakdown-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.paid-breakdown-main strong {
  font-size: 15px;
}

.paid-breakdown-ratio {
  color: #64748b;
  font-size: 12px;
}

.conversion-funnel-card,
.conversion-paid-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid #dbe5f4;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.conversion-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
}

.conversion-funnel {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 8px 0 2px;
}

.funnel-step {
  width: var(--funnel-width);
  min-width: 190px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  color: #fff;
  border-radius: 14px;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
}

.funnel-step.blue { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.funnel-step.green { background: linear-gradient(135deg, #10b981, #34d399); }
.funnel-step.amber { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.funnel-step span {
  font-size: 13px;
  font-weight: 700;
}

.funnel-step strong {
  font-size: 16px;
}

.conversion-rate {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
  color: #64748b;
}

.conversion-rate strong {
  color: #0f172a;
  font-size: 26px;
}

.conversion-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #5b7598;
}

.conversion-breakdown-item strong {
  color: #0f172a;
}

.empty-cell.compact {
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  color: #94a3b8;
}

.welfare-action-cell {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.welfare-target {
  display: grid;
  gap: 4px;
  min-width: 160px;
}

.welfare-target span {
  color: #64748b;
  font-size: 12px;
}

.welfare-payload {
  max-width: 420px;
}

.summary-item-label {
  display: block;
  color: #5b7598;
  font-size: 12px;
}

.summary-item-value {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 24px;
  font-weight: 700;
}

.toolbar-row,
.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  padding: 12px;
  border: 1px solid #e3ecfa;
  border-radius: 14px;
  background: #f9fbff;
}

.ops-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e3ecfa;
  border-radius: 14px;
  background: #f9fbff;
}

.content-guard-panel {
  gap: 16px;
}

.content-guard-master {
  padding: 4px 2px 2px;
}

.content-guard-stack {
  display: grid;
  gap: 14px;
}

.content-guard-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dbe5f4;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.content-guard-section-muted {
  background: #ffffff;
}

.content-guard-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.content-guard-section-head h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: #16325c;
}

.content-guard-section-head p {
  margin: 6px 0 0;
  color: #6d82a3;
  font-size: 12px;
  line-height: 1.6;
}

.content-guard-section-head .ops-check {
  flex-shrink: 0;
}

.content-guard-children {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-left: 10px;
  border-left: 3px solid #cfe0ff;
  border-radius: 0 14px 14px 0;
  background: #f7fbff;
}

.content-guard-children-always {
  margin-left: 0;
  border-left: none;
  border-radius: 14px;
}

.content-guard-children-always textarea {
  min-height: 132px;
}

.content-guard-unit-field {
  position: relative;
  display: block;
}

.content-guard-unit-field input {
  width: 100%;
  padding-right: 40px !important;
}

.content-guard-unit {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: #6d82a3;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.content-guard-summary {
  margin: 0;
}

.ops-grid {
  display: grid;
  gap: 10px;
  align-items: end;
}

.ops-grid-manual {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ops-grid-bonus {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ops-grid-smtp {
  grid-template-columns: repeat(2, 1fr);
}

.ops-grid-model {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.confirm-backdrop .ops-grid-model {
  grid-template-columns: 1fr;
}

.ops-grid-route {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.ops-grid-mail {
  grid-template-columns: 1fr;
}

.ops-grid-modal {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-bottom: 8px;
}

.ops-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.ops-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.ops-actions .admin-btn {
  min-width: 160px;
  min-height: 44px;
}

.ops-actions.row {
  padding-top: 4px;
}

.free-trial-panel {
  gap: 14px;
}

.free-trial-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dfe9fb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f6faff 0%, #eff5ff 100%);
}

.free-trial-head-text {
  display: grid;
  gap: 4px;
}

.free-trial-head-text strong {
  font-size: 14px;
  color: #1f3f70;
}

.switch-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 30px;
  cursor: pointer;
}

.switch-toggle input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-slider {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #c8d6ee;
  border: 1px solid #b8cae7;
  transition: all 0.16s ease;
}

.switch-slider::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(38, 57, 90, 0.16);
  transition: transform 0.16s ease;
}

.switch-toggle input:checked + .switch-slider {
  background: linear-gradient(180deg, #4d84ff 0%, #2f67ff 100%);
  border-color: #2f67ff;
}

.switch-toggle input:checked + .switch-slider::after {
  transform: translateX(22px);
}

.switch-toggle input:focus-visible + .switch-slider {
  box-shadow: 0 0 0 3px rgba(47, 103, 255, 0.22);
}

.ops-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #cddcf2;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.ops-grid .full-span {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.batch-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid #dbe8ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
}

.batch-actions-left {
  display: grid;
  gap: 4px;
}

.batch-actions-left strong {
  color: #1f3f6f;
  font-size: 14px;
}

.batch-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-actions-right .admin-btn {
  min-width: 148px;
}

.table-check-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #36547d;
  font-weight: 700;
}

.table-check-all input,
.user-row-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2f67ff;
}

.toolbar-row label,
.form-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.toolbar-row input,
.toolbar-row select,
.form-grid input:not([type="checkbox"]),
.form-grid select,
.ops-grid input:not([type="checkbox"]),
.ops-grid select,
textarea {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #cddcf2;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
  width: 100%;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.toolbar-row input:focus,
.toolbar-row select:focus,
.form-grid input:not([type="checkbox"]):focus,
.form-grid select:focus,
.ops-grid input:not([type="checkbox"]):focus,
.ops-grid select:focus,
textarea:focus {
  outline: none;
  border-color: #4D6BFE;
  box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.12);
}

.form-grid input[type="checkbox"],
.ops-grid input[type="checkbox"],
.ops-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2f67ff;
}

.form-grid > button,
.toolbar-row > button {
  align-self: end;
  min-height: 44px;
  min-width: 160px;
  width: auto;
  justify-self: start;
}

textarea {
  min-height: 120px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.toolbar-row.compact {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.full-width {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.table-wrap {
  border: 1px solid #dfe9f8;
  border-radius: 14px;
  overflow: auto;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid #e7eef9;
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f4f8ff;
  color: #35527c;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.1s ease;
}

tbody tr:hover td {
  background: #f8fafd;
}

.visitor-wrap-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.visitor-wrap-cell .visitor-wrap-text,
.visitor-wrap-cell .mono-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.visitor-path-cell {
  width: 240px;
  min-width: 240px;
}

.visitor-page-cell {
  width: 288px;
  min-width: 288px;
}

.visitor-referrer-cell {
  width: 160px;
  min-width: 160px;
}

.inline-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.chip.active {
  border-color: #86efac;
  background: #f0fdf4;
  color: #16a34a;
}

.chip.disabled {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.chip.suspended {
  border-color: #fde68a;
  background: #fffbeb;
  color: #d97706;
}

.chip.used {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #7c3aed;
}

.muted {
  color: #6f84a3;
}

.payload-preview {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  color: #2a4267;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.45;
}

.audit-target {
  display: grid;
  gap: 2px;
}

.audit-target strong {
  font-weight: 700;
  color: #1f3f6f;
}

.audit-target .muted {
  font-size: 12px;
}

.field-help {
  display: block;
  margin-top: 2px;
  color: #6d82a3;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.icon-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 8px;
  border-radius: 999px;
  border: 1px solid #b8cdf1;
  background: #eef4ff;
  color: #2f67ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
}

.icon-help-btn.inline,
.label-inline .icon-help-btn {
  margin-left: 0;
}

.icon-help-btn:hover {
  background: #e2ecff;
  border-color: #95b6ef;
}

.field-help-popup {
  position: absolute;
  z-index: 99999;
  max-width: 280px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
}
.field-help-popup.show {
  opacity: 1;
  transform: translateY(0);
}

.label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hidden {
  display: none !important;
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(1px);
  padding-top: min(14vh, 110px);
}

.confirm-box {
  position: relative;
  width: min(560px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid #d5e2f8;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(17, 39, 78, 0.22);
  overflow: hidden;
  animation: confirmPopIn 0.16s ease;
}

.user-usage-backdrop {
  padding-top: min(3vh, 24px);
  padding-bottom: 18px;
}

.usage-detail-box {
  width: min(1380px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}

.usage-detail-body {
  flex: 1;
  padding: 22px 26px 18px;
  overflow: auto;
}

.usage-detail-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid #d9e6fb;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7ff 100%);
}

.usage-detail-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #47617f;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.usage-detail-tab:hover {
  background: rgba(255, 255, 255, 0.78);
  color: #1d4ed8;
}

.usage-detail-tab.is-active {
  background: #fff;
  color: #1d4ed8;
  border-color: #c9dafc;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.usage-detail-panel {
  display: grid;
  gap: 18px;
}

.usage-detail-foot {
  padding: 14px 26px;
  border-top: 1px solid #e2e8f0;
  background: #fbfcff;
  display: flex;
  justify-content: flex-end;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.confirm-modal.open {
  display: block;
}

.confirm-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(1px);
}

.confirm-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  margin: min(18vh, 140px) auto 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  animation: confirmPopIn 0.18s ease;
}

.plan-modal-panel {
  width: min(760px, calc(100vw - 24px));
}

.grant-modal-panel {
  width: min(880px, calc(100vw - 24px));
}

.grant-preview-panel {
  width: min(1040px, calc(100vw - 24px));
}

.help-modal-panel {
  width: min(920px, calc(100vw - 24px));
}

.inline-help-modal-panel {
  width: min(720px, calc(100vw - 28px));
}

@keyframes confirmPopIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.confirm-head {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.confirm-head h3,
.confirm-head span {
  margin: 0;
  font-size: 17px;
  color: #1e293b;
  font-weight: 700;
}

.confirm-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.confirm-close:hover {
  color: #475569;
  background: #f1f5f9;
}

.confirm-content {
  padding: 20px 24px;
  max-height: 62vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.grant-modal-panel .confirm-content {
  max-height: 68vh;
}

.grant-preview-panel .confirm-content {
  max-height: 74vh;
}

.help-modal-panel .confirm-content {
  max-height: 74vh;
}

.inline-help-modal-content {
  display: grid;
  gap: 12px;
}

.inline-help-modal-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #475569;
}

#confirmModalText {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #334155;
}

#confirmModalText .confirm-icon-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

#confirmModalText .confirm-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

#confirmModalText .confirm-icon.danger {
  background: #fef2f2;
  color: #dc2626;
}

#confirmModalText .confirm-icon.info {
  background: #eff6ff;
  color: #2563eb;
}

#confirmModalText .confirm-msg-body {
  flex: 1;
  padding-top: 2px;
}

#confirmModalText .confirm-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}

#confirmModalText .confirm-msg-main {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px;
}

#confirmModalText .confirm-msg-detail {
  font-size: 13px;
  color: #64748b;
  line-height: 1.7;
  margin: 0;
}

#confirmModalText .confirm-msg-detail strong {
  color: #334155;
  font-weight: 600;
}

#confirmModalText .confirm-msg-warn {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #991b1b;
  font-weight: 500;
}

#confirmModalText .confirm-msg-warn.info-warn {
  background: #f0f9ff;
  border-left-color: #2563eb;
  color: #1e40af;
}

.confirm-table {
  width: 100%;
  border-collapse: collapse;
}

.confirm-table th,
.confirm-table td {
  border-bottom: 1px solid #ecf1fb;
  padding: 9px 8px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.confirm-table th {
  width: 148px;
  color: #4b668e;
  font-weight: 700;
}

.confirm-table td {
  color: #1f3555;
}

.confirm-table tr:last-child th,
.confirm-table tr:last-child td {
  border-bottom: none;
}

.help-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 14px;
  color: #334155;
}

.help-list li {
  padding: 0;
}

.help-list strong {
  display: inline-block;
  font-size: 14px;
  color: #1e293b;
  margin-bottom: 4px;
}

.help-list p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: #64748b;
}
.order-help-notes {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
  color: #334155;
}
.order-help-notes h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #1e3a66;
}
.order-help-notes h4:not(:first-child) {
  margin-top: 16px;
}
.help-sublist {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  line-height: 1.7;
}
.order-help-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: #475569;
}

.preview-grid-table th {
  width: auto;
  white-space: nowrap;
}

.preview-grid-table tbody td {
  word-break: break-word;
  white-space: normal;
}

.preview-user-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 240px;
}

.preview-user-tag {
  display: inline-flex;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #bbd4ff;
  background: #edf4ff;
  color: #1f4c9e;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
}

.confirm-actions {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 980px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px;
  }

  .admin-nav-btn {
    text-align: center;
    padding: 0 8px;
    font-size: 13.5px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .distribution-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .distribution-panel,
  .conversion-panel,
  .paid-structure-panel {
    grid-template-columns: 1fr;
  }

  .distribution-metrics {
    grid-template-columns: 1fr;
  }

  .order-detail-grid,
  .order-detail-section {
    min-width: 920px;
  }

  .toolbar-row,
  .form-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    padding: 10px;
  }
  
  .ops-panel {
    padding: 10px;
  }

  .ops-grid-manual,
  .ops-grid-bonus,
  .ops-grid-smtp,
  .ops-grid-model,
  .ops-grid-route,
  .ops-grid-mail,
  .ops-grid-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .block-head {
    align-items: flex-start;
  }

  .content-guard-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ops-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .admin-shell {
    width: calc(100vw - 10px);
    margin-top: 8px;
    gap: 8px;
  }

  .admin-topbar {
    padding: 12px;
  }

  .admin-title {
    font-size: 20px;
  }

  .admin-topbar-actions {
    justify-content: flex-start;
  }

  .admin-sidebar {
    grid-template-columns: 1fr;
  }

  .ops-grid-manual,
  .ops-grid-bonus,
  .ops-grid-smtp,
  .ops-grid-model,
  .ops-grid-route,
  .ops-grid-mail,
  .ops-grid-modal {
    grid-template-columns: 1fr;
  }

  .block-head {
    flex-direction: column;
    align-items: stretch;
  }

  .content-guard-section {
    padding: 14px;
  }

  .content-guard-children {
    margin-left: 0;
    padding: 12px;
    border-left: none;
    border-top: 3px solid #cfe0ff;
    border-radius: 14px;
  }

  .dashboard-hero-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-hero-badges {
    justify-content: flex-start;
  }

  .free-trial-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-row.compact {
    grid-template-columns: 1fr;
  }

  .ops-actions .admin-btn {
    width: 100%;
  }

  .confirm-panel {
    width: calc(100vw - 16px);
    margin-top: 24px;
  }

  .confirm-box {
    width: calc(100vw - 16px);
  }

  .confirm-table th {
    width: 112px;
  }
}

/* block title row: title + action button side by side */
.block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.block-title-row .block-title {
  margin: 0;
}

/* label inline: keep label text and icon on the same line */
.label-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 6px;
}

/* toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, #4D6BFE, #6C5CE7);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.mail-toggle-label {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.mail-toggle-label span {
  font-size: 13px;
  color: #334155;
}

.purchase-provider-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.purchase-provider-field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.purchase-provider-item {
  min-width: 144px;
}

/* quick filter buttons */
.quick-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.quick-filters-label {
  font-size: 12px;
  color: #64748b;
}
.quick-filter-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}
.quick-filter-btn:hover {
  border-color: #4D6BFE;
  color: #4D6BFE;
}
.quick-filter-btn.active {
  background: linear-gradient(135deg, #4D6BFE, #6C5CE7);
  color: #fff;
  border-color: transparent;
}

/* table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 8px 4px;
  font-size: 13px;
  color: #475569;
}
.pagination-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pagination-info label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.pagination-info select {
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.pagination-btns {
  display: flex;
  gap: 8px;
}

.order-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.order-status-badge.pending {
  background: #eff6ff;
  color: #2563eb;
}
.order-status-badge.warning {
  background: #fff7ed;
  color: #ea580c;
}
.order-status-badge.success {
  background: #f0fdf4;
  color: #15803d;
}
.order-status-badge.danger {
  background: #fef2f2;
  color: #dc2626;
}
.order-action-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.order-no-cell {
  font-weight: 700;
  color: #0f172a;
}
.order-sub-line {
  margin-top: 4px;
  font-size: 12px;
  color: #94a3b8;
  word-break: break-all;
}
.order-detail-panel {
  width: min(1560px, calc(100vw - 8px));
  max-width: calc(100vw - 8px);
  height: calc(100vh - 8px);
  max-height: calc(100vh - 8px);
  margin: 4px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.manual-review-panel {
  width: min(640px, calc(100vw - 32px));
}
.growth-chart-legend {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
}
.growth-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.growth-chart-legend i {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
  font-style: normal;
}
.manual-review-intro {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
  border-radius: 12px;
  color: #334155;
  font-size: 13px;
  line-height: 1.75;
}
.manual-review-intro p {
  margin: 0;
}
.manual-review-intro p + p {
  margin-top: 8px;
}
.order-detail-content {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 22px 24px 36px;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.order-detail-content > * + * {
  margin-top: 22px;
}
.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  min-width: 1180px;
}
.order-detail-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}
.order-detail-label {
  font-size: 12px;
  color: #64748b;
}
.order-detail-value {
  font-size: 14px;
  color: #0f172a;
  word-break: break-all;
}
.order-detail-section {
  display: grid;
  gap: 14px;
  padding: 18px 18px 20px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  min-width: 1180px;
}
.order-detail-section-head {
  display: flex;
  align-items: center;
}
.order-detail-section-head h4 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.order-detail-section .user-source-section {
  margin-bottom: 0;
  padding: 16px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e2e8f0;
}
.order-detail-section .table-wrap {
  overflow: auto;
}
.order-detail-section table {
  min-width: 980px;
}
.order-source-group + .order-source-group {
  margin-top: 14px;
}

.refund-preview-box {
  display: grid;
  gap: 12px;
}

.refund-preview-summary {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f7ff 100%);
}

.refund-preview-summary.success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f7fff9 0%, #ecfdf3 100%);
}

.refund-preview-summary.warning {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffdf6 0%, #fffbeb 100%);
}

.refund-preview-summary.info {
  border-color: #dbeafe;
}

.refund-preview-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.refund-preview-summary.success .refund-preview-badge {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.refund-preview-summary.warning .refund-preview-badge {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
}

.refund-preview-summary p {
  margin: 0;
  color: #0f172a;
  line-height: 1.6;
}

.refund-preview-meta {
  font-size: 13px;
  color: #475569;
}

.refund-preview-checks {
  display: grid;
  gap: 10px;
}

.refund-preview-check {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.refund-preview-check strong {
  color: #0f172a;
  font-size: 13px;
}

.refund-preview-check span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.refund-preview-check.success {
  border-color: #bbf7d0;
}

.refund-preview-check.warning {
  border-color: #fde68a;
}

.refund-preview-check.info {
  border-color: #dbeafe;
}

.refund-preview-issues {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #fecaca;
  background: #fff7f7;
}

.refund-preview-issues strong {
  color: #991b1b;
}

.refund-preview-issues ol {
  margin: 0;
  padding-left: 18px;
  color: #7f1d1d;
  line-height: 1.7;
}

.bar-chart-wrap {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 0;
  min-height: 140px;
}
.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bar-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 100%;
  justify-content: center;
}
.bar-chart-bar {
  width: 18px;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}
.bar-chart-bar.calls { background: #4D6BFE; }
.bar-chart-bar.users { background: #22c55e; }
.bar-chart-val {
  font-size: 10px;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}
.bar-chart-label {
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}
.bar-chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 11px;
  color: #64748b;
}
.bar-chart-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.bar-chart-legend .legend-calls::before { background: #4D6BFE; }
.bar-chart-legend .legend-users::before { background: #22c55e; }

.rc-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}

.rc-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 8px;
  border: 1px solid #e3ebf8;
  border-radius: 16px;
  background: #f8fbff;
}

.rc-tab {
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.rc-tab:hover {
  color: #1d4ed8;
  background: #eef5ff;
}

.rc-tab.active {
  background: #ffffff;
  border-color: #cfe0ff;
  color: #1d4ed8;
  box-shadow: 0 8px 22px rgba(77, 107, 254, 0.10);
}

.rc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.rc-card:hover {
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.rc-card-head {
  padding: 16px 18px 12px;
}

.rc-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.rc-card-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

.rc-card-body {
  padding: 0 18px 16px;
}

.rc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.rc-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.rc-toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.rc-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rc-field-label {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  white-space: nowrap;
}

.rc-field-unit {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

.rc-input {
  width: 72px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  color: #1e293b;
  background: #f8fafc;
  text-align: center;
  transition: border-color 0.15s;
}

.rc-input:focus {
  outline: none;
  border-color: #4D6BFE;
  background: #fff;
}

.rc-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1e293b;
  background: #f8fafc;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.rc-textarea:focus {
  outline: none;
  border-color: #4D6BFE;
  background: #fff;
}

.rc-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.rc-inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(220px, 1fr) 120px auto;
  gap: 12px;
  align-items: end;
}

.rc-inline-form-item {
  display: grid;
  gap: 8px;
}

.rc-inline-form-action {
  display: flex;
  align-items: end;
}

.rc-text-input {
  width: 100%;
  height: 38px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.15s, background 0.15s;
}

.rc-text-input:focus {
  outline: none;
  border-color: #4D6BFE;
  background: #fff;
}

.rc-table-wrap code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #1e3a8a;
}

@media (max-width: 1100px) {
  .rc-inline-form {
    grid-template-columns: 1fr;
  }

  .rc-inline-form-action {
    align-items: stretch;
  }
}

.usage-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.usage-pager-left,
.usage-pager-right {
  display: flex;
  align-items: center;
}

.usage-page-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.usage-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.usage-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.user-source-section {
  margin-bottom: 24px;
  padding: 20px 20px 22px;
  border: 1px solid #e6edf8;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.user-source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.user-source-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.user-source-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.mini-section-title {
  margin: 16px 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.rc-card-wide {
  grid-column: 1 / -1;
}

.usage-summary-strip {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
  font-size: 13px;
  color: #475569;
  line-height: 1.8;
}

@media (max-width: 860px) {
  .usage-detail-tabs {
    flex-wrap: wrap;
  }

  .usage-detail-tab {
    flex: 1 1 180px;
    text-align: center;
  }
}

.source-empty-state {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
}

.chip.pending {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.rc-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}

.rc-help-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.admin-security-panel {
  width: min(760px, calc(100vw - 32px));
}

.admin-security-content {
  display: grid;
  gap: 18px;
  max-height: min(72vh, 760px);
  overflow-y: auto;
}

.admin-security-section {
  padding: 18px 20px;
  border: 1px solid #e6edf8;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.admin-security-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-security-section-head h4 {
  margin: 0;
  font-size: 16px;
  color: #1e293b;
}

.admin-security-summary {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
  color: #475569;
  font-size: 13px;
  line-height: 1.8;
}

.admin-security-bind-box {
  display: grid;
  gap: 12px;
}

.admin-security-qr-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
}

.admin-security-qr-wrap canvas {
  width: 184px;
  height: 184px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 8px;
}

.admin-security-secret-row {
  display: grid;
  gap: 6px;
}

.admin-security-secret-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.admin-security-bind-box code {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #1d4ed8;
  font-size: 13px;
  word-break: break-all;
}

.admin-security-bind-box textarea,
.admin-security-bind-box input {
  width: 100%;
  border: 1px solid #d7e0ef;
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  color: #1e293b;
  box-sizing: border-box;
}

.admin-security-secret-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
