:root {
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --teal: #0ea5e9;
  --dark: #0f172a;
  --gray: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--dark);
  min-height: 100vh;
}

a {
  color: inherit;
}

.top-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 20px;
  color: var(--blue);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.env-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.env-badge.sandbox {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.env-badge.production {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.container {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px 48px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.page-title {
  margin-bottom: 12px;
  font-size: 32px;
  font-weight: 700;
}

.page-subtitle {
  margin: 0 0 28px;
  color: var(--gray);
  font-size: 16px;
  line-height: 1.6;
}

/* Status Strip Container */
.status-strip {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

/* Auth Health Banner */
.auth-health-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 12px;
  font-size: 0.875rem;
}

.auth-health-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-health-left strong {
  color: var(--dark);
  font-weight: 600;
}

.auth-health-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
}

.mono-inline {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  font-size: 0.8125rem;
  color: var(--gray);
}

/* Pill variants for health states */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pill-ok {
  background: rgba(46, 204, 113, 0.15);
  color: #16a34a;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.pill-warn {
  background: rgba(251, 191, 36, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.pill-err {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pill-muted {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Ready Banner */
.ready-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(46, 204, 113, 0.08);
  border: 2px solid rgba(46, 204, 113, 0.3);
  border-radius: 12px;
  animation: slideDown 0.3s ease-out;
}

.ready-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ready-banner-content strong {
  color: #16a34a;
  font-size: 1rem;
}

.ready-banner-content .muted {
  font-size: 0.875rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

.message.success {
  border-color: #bbf7d0;
  background: #ecfccb;
}

.message.error {
  border-color: #fecaca;
  background: #fee2e2;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.22);
}

.hero-card {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02));
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.hero-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

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

.section-title {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 32px 0 12px;
}

.section-separator {
  height: 1px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.2), transparent);
  margin: 32px 0;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card header h2 {
  margin: 0;
  font-size: 18px;
}

.card header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.credentials-form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

.input-action {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray);
  transition: background 0.2s ease, color 0.2s ease;
}

.input-action:hover {
  background: var(--bg);
  color: var(--dark);
}

.input-action:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
.copy-chip:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .card:hover,
  .ready-banner {
    transform: none;
  }
}

.form-field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  transition: border 0.2s ease;
}

.form-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-helper {
  color: var(--muted);
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--gray);
}

.checkbox-field input {
  margin-top: 3px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--blue-dark);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--dark);
}

.btn-inline {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.hidden {
  display: none !important;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

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

.metric-label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value {
  font-size: 24px;
  font-weight: 600;
}

.metric-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.metric-number {
  font-size: 42px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e0f2fe;
  color: var(--blue-dark);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge.free {
  background: #eef2ff;
  color: #4f46e5;
}

.badge.pro {
  background: #dcfce7;
  color: #166534;
}

.list {
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

.list-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
}

.list-row span {
  color: var(--muted);
}

.list-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.status-chip.ok {
  background: #dcfce7;
  color: #166534;
}

.status-chip.warn {
  background: #fef3c7;
  color: #92400e;
}

.status-chip.error {
  background: #fee2e2;
  color: #991b1b;
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--gray);
  transition: border 0.2s ease, color 0.2s ease;
}

.copy-chip:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.metric-card {
  height: 100%;
}

.metric-highlight {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-caption {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.card-message {
  margin: 0;
  font-size: 14px;
  color: var(--gray);
}

.card-message.error {
  color: #991b1b;
}

.card-footer {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.upgrade-callout {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upgrade-callout h3 {
  margin: 0;
  font-size: 20px;
}

.upgrade-callout p {
  margin: 0;
  color: #cbd5f5;
}

.upgrade-callout .btn {
  align-self: flex-start;
  background: #facc15;
  color: #0f172a;
  box-shadow: none;
}

.upgrade-callout .btn:hover {
  transform: translateY(-1px);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 0.75rem 1.25rem;
  background: #111827;
  color: #f9fafb;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.35);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-out, transform 150ms ease-out;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sandbox-banner {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  position: relative;
}

.banner-body {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
}

.banner-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b45309;
  margin: 0 0 6px;
}

.banner-copy {
  margin: 0 0 8px;
  color: #92400e;
}

.banner-welcome {
  margin: 0;
  color: #b45309;
  font-weight: 600;
}

.banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.banner-dismiss {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #92400e;
}

.usage-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin: 8px 0;
}

.usage-bar-wrapper {
  background: #e2e8f0;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}

.usage-bar-inner {
  height: 100%;
  width: 0%;
  background: #22c55e;
  transition: width 0.3s ease;
}

.usage-bar-caption {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 10px;
}

.usage-details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

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

.usage-details th,
.usage-details td {
  text-align: left;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.usage-details th {
  color: var(--muted);
  font-weight: 500;
}

.mode-metric .btn {
  align-self: flex-start;
}

.setup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.setup-item {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.setup-item div {
  flex: 1;
}

.setup-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.setup-status {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.setup-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.setup-item.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.setup-item.done .setup-status {
  color: #166534;
}

.secret-row .input-action {
  font-size: 12px;
}

.quick-start-card {
  margin-top: 2rem;
}

.quick-start-header {
  margin-bottom: 1.5rem;
}

.quick-start-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.quick-start-header h2 {
  font-size: 1.25rem;
  margin: 0;
}

.quick-start-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.quick-start-step {
  border-top: 1px solid #eef0f4;
  padding-top: 1.25rem;
}

.quick-start-step:first-child {
  border-top: none;
  padding-top: 0;
}

.step-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-bottom: 0.35rem;
}

.quick-start-step h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.quick-start-step p.muted {
  margin: 0 0 0.5rem;
}

.code-block {
  position: relative;
  background: #0f172a;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
  overflow: auto;
}

.code-block pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  color: #e5e7eb;
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-copy {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.8rem;
  background: var(--bg);
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-copy:hover {
  background: var(--card);
  color: var(--blue-dark);
}

.quick-start-card .btn-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.quick-start-card .btn-copy:hover {
  border-color: #e5e7eb;
}

.quick-start-card .btn-copy.copied {
  border-color: #4ade80;
  color: #bbf7d0;
}

/* Stripe Webhook Card */
.stripe-webhook-card {
  margin-top: 20px;
}

.stripe-webhook-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stripe-webhook-card .mode-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stripe-webhook-card .mode-badge.sandbox {
  background: #fef3c7;
  color: #92400e;
}

.stripe-webhook-card .mode-badge.live {
  background: #d1fae5;
  color: #065f46;
}

.stripe-webhook-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row label {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

.input-with-action input {
  flex: 1;
}

.input-with-action .btn-copy {
  flex-shrink: 0;
  min-width: 80px;
}

.btn-toggle-secret {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0 0.5rem;
  margin-left: 0.5rem;
  text-decoration: underline;
}

.btn-toggle-secret:hover {
  color: var(--blue-dark);
}

.input-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.input-hint code {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
}

.input-error {
  font-size: 0.875rem;
  color: #dc2626;
  margin-top: -0.25rem;
  line-height: 1.4;
}

.input-error.hidden {
  display: none;
}

.readonly-input {
  background: #f9fafb;
  color: #374151;
  cursor: default;
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

.readonly-input:focus {
  outline: none;
  border-color: #d1d5db;
}

.secret-input {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.webhook-health {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
}

.webhook-health .status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.webhook-health .status-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.webhook-health .status-text {
  font-size: 0.95rem;
  color: #374151;
  font-weight: 500;
}

.webhook-health.healthy {
  background: #f0fdf4;
  border-color: #86efac;
}

.webhook-health.error {
  background: #fef2f2;
  border-color: #fca5a5;
}

.webhook-health .status-detail {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-left: 1.75rem;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-loading::after {
  content: '...';
  animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

@media (max-width: 768px) {
  .stripe-webhook-card .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .input-with-action {
    flex-direction: column;
  }
  
  .input-with-action .btn-copy {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .page-title {
    font-size: 26px;
  }

  .card {
    padding: 20px;
  }

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

  .banner-body {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* --- Onboarding hero & credentials summary styles --- */
.hero-card {
  margin-bottom: 24px;
}

.hero-grid {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-header h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.hero-header p {
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-steps {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.hero-steps li {
  margin-bottom: 6px;
}

.hero-cta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  font-weight: 600;
}

.btn-link:hover {
  color: #1d4ed8;
}

.btn-link:disabled {
  color: #9ca3af;
  cursor: not-allowed;
  text-decoration: none;
}

.connected-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* CLI Status Indicator */
.cli-status {
  margin-bottom: 12px;
  font-size: 14px;
  border-radius: 6px;
}

.cli-status--info,
.cli-status--success,
.cli-status--warning {
  padding: 10px 12px;
  border-left: 3px solid transparent;
}

.cli-status--info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.cli-status--success {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
}

.cli-status--warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

/* Secondary Actions */
.cli-secondary-actions {
  margin-top: 12px;
  text-align: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.credentials-summary {
  margin-top: 20px;
}

.credentials-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.credentials-body {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cred-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.cred-value-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cred-value-group code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.credentials-body.hidden {
  display: none;
}

.demo-card {
  margin-top: 1.5rem;
}

.demo-instructions {
  margin-bottom: 0.75rem;
}

.demo-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: #64748b;
}

.demo-steps li + li {
  margin-top: 0.2rem;
}

.demo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.demo-status {
  margin-top: 0.25rem;
}

.demo-status.success {
  color: #16a34a;
}

.demo-status.error {
  color: #b91c1c;
}

.badge-muted {
  background-color: rgba(148, 163, 184, 0.12);
  color: #64748b;
}

.qs-notice {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(106, 169, 255, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.qs-notice.hidden {
  display: none;
}


.btn:disabled,
.btn.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:disabled:hover,
.btn.btn-disabled:hover {
  transform: none;
}

.empty-state-help {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.empty-state-help p {
  margin: 0 0 0.5rem;
}

.empty-state-help .btn-inline {
  margin-top: 0.5rem;
}

.code-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.code-inline code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 0.85rem;
  flex: 1;
  min-width: 200px;
}

.quickstart-files {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quickstart-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.starter-select {
  min-width: 180px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.9rem;
}

.starter-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.starter-files-details {
  margin-top: 0.5rem;
}

.starter-files-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  color: var(--muted);
}

.starter-files-details summary:hover {
  color: var(--blue);
}

.file-list {
  margin: 0.5rem 0 0 1rem;
  padding: 0;
  list-style: none;
}

.file-list li {
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.file-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.starter-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.starter-modal-content {
  background: var(--card);
  border-radius: 16px;
  padding: 2rem;
  max-width: 550px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.starter-modal-content h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.starter-modal-content ol {
  margin: 0.5rem 0 1rem 1.25rem;
  padding: 0;
}

.starter-modal-content li {
  margin: 0.25rem 0;
}

.modal-creds {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.modal-cred-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.modal-cred-row:last-child {
  border-bottom: none;
}

.modal-cred-row > code {
  font-size: 0.8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.modal-cred-value {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-cred-value code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--card);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.starter-modal-content .btn {
  width: 100%;
  margin-top: 1rem;
}
.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* -------- Welcome Banner (Setup Flow) -------- */
#welcome-banner {
  opacity: 0;
  transition: opacity 0.3s ease;
}

#welcome-banner.show {
  opacity: 1;
}

.message-success {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 48px 16px 16px;
}

.message-icon {
  font-size: 24px;
  line-height: 1;
}

.message-content h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

.message-content p {
  margin: 0;
  font-size: 14px;
  color: var(--gray);
}

/* Auth Mode Indicator */
.auth-mode-indicator {
  margin-bottom: 0.75rem;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.mode-owner {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: #27ae60;
}

.mode-cli {
  background: rgba(106, 169, 255, 0.1);
  border: 1px solid rgba(106, 169, 255, 0.3);
  color: #6aa9ff;
}

.mode-none {
  background: rgba(142, 160, 182, 0.1);
  border: 1px solid rgba(142, 160, 182, 0.3);
  color: #8ea0b6;
}

.mode-icon {
  font-size: 1rem;
  line-height: 1;
}

.mode-label {
  font-weight: 600;
}

.mode-badge {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-weight: 500;
}

.mode-help {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
}

.message-dismiss {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.message-dismiss:hover {
  color: var(--dark);
}

/* ============================================
   STRIPE TIER MAPPING CARD
   ============================================ */

#stripe-tier-mapping-card .badge.optional {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

#stripe-tier-mapping-card .spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Locked State */
#stripe-tier-mapping-card .tier-locked-callout {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
}

#stripe-tier-mapping-card .tier-locked-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

#stripe-tier-mapping-card .tier-locked-callout h3 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--dark);
}

#stripe-tier-mapping-card .tier-locked-callout p {
  margin: 8px 0;
  color: var(--gray);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

#stripe-tier-mapping-card .tier-locked-callout button {
  margin-top: 24px;
}

/* Error State */
#stripe-tier-mapping-card .tier-error-state {
  padding: 24px;
  text-align: center;
}

#stripe-tier-mapping-card .error-text {
  color: #dc2626;
  margin-bottom: 16px;
}

/* Success Message */
#stripe-tier-mapping-card .tier-save-success {
  background: rgba(46, 204, 113, 0.1);
  color: #16a34a;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

/* Error Box */
#stripe-tier-mapping-card .tier-error-box {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  color: #dc2626;
}

#stripe-tier-mapping-card .tier-error-box ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

#stripe-tier-mapping-card .tier-error-box li {
  margin: 4px 0;
}

/* Section Layout */
#stripe-tier-mapping-card .tier-section {
  margin-bottom: 32px;
}

#stripe-tier-mapping-card .tier-section:last-of-type {
  margin-bottom: 0;
}

#stripe-tier-mapping-card .tier-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#stripe-tier-mapping-card .tier-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

/* Mapping Table */
#stripe-tier-mapping-card .tier-mapping-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

#stripe-tier-mapping-card .tier-mapping-header {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--gray);
  border-bottom: 1px solid var(--border);
}

#stripe-tier-mapping-card .tier-mapping-row {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: white;
}

#stripe-tier-mapping-card .tier-mapping-row:last-child {
  border-bottom: none;
}

#stripe-tier-mapping-card .tier-mapping-empty {
  padding: 32px 16px;
  text-align: center;
  background: white;
}

#stripe-tier-mapping-card .tier-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
}

#stripe-tier-mapping-card .tier-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#stripe-tier-mapping-card .btn-icon {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

#stripe-tier-mapping-card .btn-icon:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

#stripe-tier-mapping-card #add-mapping-btn {
  padding: 12px 16px;
  width: 100%;
  text-align: left;
  background: white;
  border-bottom: none;
}

/* Precedence Textarea */
#stripe-tier-mapping-card .tier-precedence-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
  resize: vertical;
  min-height: 120px;
}

#stripe-tier-mapping-card .tier-precedence-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select Dropdown */
#stripe-tier-mapping-card .tier-select {
  width: 100%;
  max-width: 300px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

#stripe-tier-mapping-card .tier-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Preview Section */
#stripe-tier-mapping-card .tier-preview-section {
  background: var(--bg);
  padding: 20px;
  border-radius: 8px;
}

#stripe-tier-mapping-card .tier-preview-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
  margin-bottom: 12px;
}

#stripe-tier-mapping-card .tier-preview-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#stripe-tier-mapping-card .tier-preview-output {
  min-height: 60px;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#stripe-tier-mapping-card .tier-preview-result {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

#stripe-tier-mapping-card .tier-preview-result code {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
}

/* Actions */
#stripe-tier-mapping-card .tier-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Modal */
#stripe-tier-mapping-card .tier-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

#stripe-tier-mapping-card .tier-modal.hidden {
  display: none;
}

#stripe-tier-mapping-card .tier-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

#stripe-tier-mapping-card .tier-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

#stripe-tier-mapping-card .tier-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

#stripe-tier-mapping-card .tier-modal-close {
  background: transparent;
  border: none;
  font-size: 32px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

#stripe-tier-mapping-card .tier-modal-close:hover {
  background: var(--bg);
  color: var(--dark);
}

#stripe-tier-mapping-card .tier-modal-body {
  padding: 24px;
}

#stripe-tier-mapping-card .tier-bulk-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
  resize: vertical;
  min-height: 200px;
}

#stripe-tier-mapping-card .tier-bulk-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#stripe-tier-mapping-card .tier-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
