@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

/* ── Design tokens ───────────────────────────────────────────────── */
:root {
  --radius: 0.875rem;
  --background: oklch(0.985 0.005 80);
  --foreground: oklch(0.16 0.02 264);
  --card: oklch(1 0 0);
  --primary: #4169E1;
  --primary-hover: oklch(0.42 0.18 264);
  --primary-soft: oklch(0.955 0.022 264);
  --primary-foreground: oklch(1 0 0);
  --muted: oklch(0.968 0.007 264);
  --muted-foreground: oklch(0.48 0.04 264);
  --border: oklch(0.925 0.012 264);
  --input: oklch(0.925 0.012 264);
  --shadow-card: 0 1px 3px oklch(0.16 0.02 264 / 0.04), 0 8px 32px -8px oklch(0.16 0.02 264 / 0.08);
  --shadow-button: 0 4px 14px -2px oklch(0.21 0.15 264 / 0.4);
}

[data-theme="dark"] {
  --background: oklch(0.13 0.01 264);
  --foreground: oklch(0.93 0.01 264);
  --card: oklch(0.18 0.012 264);
  --primary: oklch(0.62 0.18 264);
  --primary-hover: oklch(0.68 0.2 264);
  --primary-soft: oklch(0.24 0.06 264);
  --primary-foreground: oklch(0.98 0 0);
  --muted: oklch(0.23 0.01 264);
  --muted-foreground: oklch(0.62 0.03 264);
  --border: oklch(0.3 0.015 264);
  --input: oklch(0.3 0.015 264);
  --shadow-card: 0 1px 3px oklch(0 0 0 / 0.3), 0 8px 32px -8px oklch(0 0 0 / 0.5);
  --shadow-button: 0 4px 14px -2px oklch(0.72 0.16 264 / 0.35);
  color-scheme: dark;
}

[data-theme="dark"] body {
  background: radial-gradient(ellipse at top, oklch(0.2 0.04 264) 0%, var(--background) 55%);
}

[data-theme="dark"] .hero-badge-inner {
  background: linear-gradient(135deg, oklch(0.55 0.18 264), oklch(0.6 0.22 285), oklch(0.65 0.24 315));
}


[data-theme="dark"] .section-toggle:hover,
[data-theme="dark"] .wisdom-section + .wisdom-section { border-color: var(--border); }

[data-theme="dark"] .failed-patterns-banner {
  background: oklch(0.22 0.05 27);
  border-color: oklch(0.35 0.1 27);
  color: oklch(0.8 0.1 27);
}

[data-theme="dark"] .flash-error {
  background: oklch(0.22 0.05 27);
  border-color: oklch(0.35 0.1 27);
  color: oklch(0.8 0.1 27);
}

[data-theme="dark"] .flash-success {
  background: oklch(0.2 0.06 145);
  border-color: oklch(0.35 0.1 145);
  color: oklch(0.75 0.12 145);
}

[data-theme="dark"] .history-status-done {
  background: oklch(0.22 0.06 145); color: oklch(0.72 0.14 145);
}
[data-theme="dark"] .history-status-pending {
  background: oklch(0.22 0.05 60); color: oklch(0.72 0.14 60);
}
[data-theme="dark"] .history-status-failed {
  background: oklch(0.22 0.05 27); color: oklch(0.72 0.14 27);
}

[data-theme="dark"] .plan-badge-free {
  background: var(--muted); color: var(--muted-foreground); border-color: var(--border);
}
[data-theme="dark"] .plan-badge-premium {
  background: oklch(0.25 0.06 60); color: oklch(0.75 0.16 60); border-color: oklch(0.38 0.1 60);
}

[data-theme="dark"] .user-dropdown {
  background: oklch(0.2 0.012 264);
  border-color: var(--border);
}

[data-theme="dark"] .user-dropdown-logout { color: oklch(0.72 0.14 27); }
[data-theme="dark"] .user-dropdown-logout:hover {
  background: oklch(0.22 0.05 27); color: oklch(0.8 0.14 27);
}

[data-theme="dark"] .payment-amount { color: oklch(0.72 0.14 145); }

[data-theme="dark"] .info-tip-content {
  background: oklch(0.08 0.01 264);
  color: oklch(0.92 0.01 264);
}
[data-theme="dark"] .info-tip-content::after {
  border-top-color: oklch(0.08 0.01 264);
}
[data-theme="dark"] .info-tip-content strong { color: oklch(1 0 0); }

[data-theme="dark"] .site-nav {
  background: oklch(0.15 0.012 264 / 0.92);
}

[data-theme="dark"] footer {
  background: oklch(0.1 0.01 264);
  color: oklch(0.85 0.01 264);
}
[data-theme="dark"] .footer-links {
  color: oklch(0.85 0.01 264 / 0.6);
}
[data-theme="dark"] .footer-links a:hover { color: oklch(0.85 0.01 264); }

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

/* Smooth theme transitions — exclude animated/transitioning elements */
html, body, .card, .site-nav, footer,
.btn-primary, .btn-secondary, .btn-outline, .btn-file, .btn-nav-ghost, .btn-nav-primary,
.tab-btn, .form-input, .url-input-wrap, .dropzone, .plan-card, .theme-option,
.user-dropdown, .profile-nav-item, .user-dropdown-item {
  transition: background-color 0.2s ease, border-color 0.15s ease, color 0.15s ease;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background: radial-gradient(ellipse at top, oklch(0.93 0.04 264) 0%, var(--background) 55%);
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 4rem 1rem 6rem; }
.inner { max-width: 48rem; margin: 0 auto; }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 2.5rem; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 500;
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
  color: var(--primary);
}

.hero-sub {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--foreground);
  max-width: 38rem;
  margin: 0 auto;
  line-height: 1.4;
}

.hero-desc {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs-wrap {
  position: relative;
}
@media (max-width: 520px) {
  .tabs-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 1px;
    width: 2.5rem;
    background: linear-gradient(to right, transparent, var(--primary-soft));
    pointer-events: none;
    z-index: 1;
  }
}

.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

/* Hide tab text labels on small screens — icons remain visible */
@media (max-width: 480px) {
  .tab-label { display: none; }
}

.tab-btn {
  flex: 1;
  min-width: 7.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted-foreground);
  background: var(--primary-soft);
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--foreground); background: var(--primary-soft); }
.tab-btn.active { color: var(--primary); background: var(--card); }
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background: var(--primary);
  border-radius: 999px;
}

/* ── Tab panels ──────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.card-body { padding: 1.5rem 2rem 2rem; }

/* ── URL input ───────────────────────────────────────────────────── */
.url-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  padding: 0.75rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.url-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.url-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.875rem;
  color: var(--foreground);
}
.url-input-wrap input::placeholder { color: var(--muted-foreground); }
.url-icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }

/* ── Dropzone ────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--primary-soft);
  margin: 0 auto 1rem;
  color: var(--primary);
}
.dropzone-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}
.dropzone-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}
.dropzone-file-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  margin-top: 0.75rem;
}
.dropzone-error {
  font-size: 0.8125rem;
  font-weight: 500;
  color: oklch(0.42 0.18 27);
  margin-top: 0.625rem;
}

/* ── Textarea ────────────────────────────────────────────────────── */
.text-wrap { position: relative; }
.text-wrap textarea {
  width: 100%;
  height: 12rem;
  resize: none;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  padding: 1rem;
  padding-bottom: 2rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-wrap textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.text-wrap textarea::placeholder { color: var(--muted-foreground); }
.char-count {
  position: absolute;
  bottom: 0.75rem;
  right: 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.99); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-file {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-file:hover { border-color: var(--primary); color: var(--primary); }

/* ── Advanced / accordion ────────────────────────────────────────── */
.advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.advanced-toggle:hover { color: var(--foreground); }
.advanced-toggle svg { transition: transform 0.2s; }
.advanced-toggle.open svg { transform: rotate(180deg); }

.advanced-panel {
  display: none;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
}
.advanced-panel.open { display: block; }

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}
.pattern-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--foreground);
  cursor: pointer;
  line-height: 1.4;
}
.pattern-row input[type="checkbox"] { margin-top: 0.175rem; accent-color: var(--primary); flex-shrink: 0; }
.pattern-hint { font-size: 0.7rem; color: var(--muted-foreground); display: block; }
.pattern-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* ── Error banner ────────────────────────────────────────────────── */
.error-banner {
  margin-bottom: 1.25rem;
  padding: 0.875rem 1.125rem;
  border-radius: calc(var(--radius) - 2px);
  background: oklch(0.97 0.03 27);
  border: 1px solid oklch(0.88 0.07 27);
  color: oklch(0.42 0.18 27);
  font-size: 0.875rem;
}

/* ── Trust line ──────────────────────────────────────────────────── */
.trust-line {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 2rem;
}

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  background: var(--foreground);
  color: var(--background);
  padding: 2rem 1rem;
}
.footer-inner {
  max-width: 60rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; justify-content: space-between; }
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: oklch(1 0 0 / 0.7);
}
.footer-links a { color: inherit; text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: oklch(1 0 0); }

/* ── Results page ────────────────────────────────────────────────── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.results-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  background: var(--card);
  transition: border-color 0.15s, color 0.15s;
}
.results-back:hover { border-color: var(--primary); color: var(--primary); }

.source-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.source-thumb-link { display: block; }
.source-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.source-meta {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-wrap: wrap;
}
.source-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  line-height: 1.4;
}
.source-title a { color: var(--foreground); text-decoration: none; }
.source-title a:hover { color: var(--primary); }
.lang-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wisdom-section { border-bottom: 1px solid var(--border); }
.wisdom-section:last-child { border-bottom: none; }

.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.5rem;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.section-toggle:hover { background: var(--primary-soft); }
.section-toggle.open { border-left-color: var(--primary); padding-left: calc(1.5rem - 3px); }
.section-toggle h2 { font-size: 1rem; font-weight: 600; color: var(--foreground); }
.section-toggle svg { flex-shrink: 0; color: var(--muted-foreground); transition: transform 0.2s; }
.section-toggle.open svg { transform: rotate(180deg); }

.section-body {
  display: none;
  padding: 0 1.5rem 1.75rem;
  font-size: 1rem;
  color: var(--foreground);
  line-height: 1.85;
}
.section-body.open { display: block; }
.section-body p { margin-top: 0.75rem; }
.section-body p:first-child { margin-top: 0; }

/* Rendered Markdown inside section bodies */
.section-body h1, .section-body h2, .section-body h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 1.25rem 0 0.4rem;
}
.section-body h1:first-child, .section-body h2:first-child, .section-body h3:first-child {
  margin-top: 0;
}
.section-body ul, .section-body ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}
.section-body li { margin-bottom: 0.5rem; line-height: 1.75; }
.section-body li:last-child { margin-bottom: 0; }
.section-body strong { font-weight: 650; color: var(--foreground); }
.section-body em { font-style: italic; }
.section-body code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.875em;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.1em 0.35em;
}
.section-body pre {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}
.section-body pre code { background: none; border: none; padding: 0; }
.section-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.wisdom-list { list-style: disc; padding-left: 1.5rem; }
.wisdom-list li { margin-bottom: 0.6rem; line-height: 1.75; }
.item-sublabel { font-size: 0.8125rem; font-weight: 600; color: var(--muted-foreground); }

.business-ideas-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.business-idea-item {
  padding: 0.875rem 1.125rem;
  border-radius: 0.5rem;
  background: var(--muted);
  border: 1px solid var(--border);
}
.business-idea-title { font-weight: 600; color: var(--foreground); font-size: 0.9375rem; }
.business-idea-detail { font-size: 0.875rem; color: var(--muted-foreground); margin-top: 0.35rem; line-height: 1.75; }

blockquote {
  border-left: 2px solid var(--primary);
  padding-left: 1rem;
  font-style: italic;
  color: var(--muted-foreground);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--primary-soft);
}
.results-actions-left { margin-right: auto; }
.results-actions-right { display: flex; align-items: center; gap: 0.5rem; }

/* ── Controls row (language + accuracy) ─────────────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem 1.25rem;
  flex-wrap: wrap;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.control-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.control-select {
  flex: 1;
  min-width: 0;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--input);
  border-radius: 0.5rem;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.accuracy-pills {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}
.acc-btn {
  flex: 1;
  padding: 0.3125rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--background);
  color: var(--muted-foreground);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.acc-btn:last-child { border-right: none; }
.acc-btn:hover { background: var(--muted); color: var(--foreground); }
.acc-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ── Utility ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── Info tooltip ────────────────────────────────────────────────── */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
  color: var(--muted-foreground);
  cursor: default;
  vertical-align: middle;
}
.info-tip svg { display: block; }

.info-tip-content {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 17rem;
  padding: 0.625rem 0.75rem;
  background: var(--foreground);
  color: var(--background);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
  border-radius: 0.5rem;
  white-space: normal;
  z-index: 10;
  pointer-events: none;
}
.info-tip-content strong { color: oklch(1 0 0); }
.info-tip-content em { opacity: 0.7; font-style: normal; }

/* Arrow */
.info-tip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--foreground);
}

.info-tip:hover .info-tip-content { display: block; }

/* Right-anchored variant — tooltip aligns to the right edge of the icon */
.info-tip--end .info-tip-content {
  left: auto;
  right: 0;
  transform: none;
}
.info-tip--end .info-tip-content::after {
  left: auto;
  right: 0.625rem;
  transform: none;
}

/* ── SVG icon utility ────────────────────────────────────────────── */
svg { display: inline-block; vertical-align: middle; }

/* ── Failed patterns banner ──────────────────────────────────────── */
.failed-patterns-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: oklch(0.97 0.03 27);
  border-bottom: 1px solid oklch(0.88 0.07 27);
  color: oklch(0.38 0.15 27);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.failed-patterns-banner svg { flex-shrink: 0; margin-top: 0.15rem; }
.failed-pat-item { font-weight: 500; }
.failed-pat-err { font-weight: 400; opacity: 0.8; }

/* ── Pattern presets ─────────────────────────────────────────────── */
.preset-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.preset-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-right: 0.25rem;
}
.preset-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ── Loading page ────────────────────────────────────────────────── */
.loading-card { padding: 3rem 2rem; }

.loading-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.loading-spinner svg {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 18rem;
}
.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.progress-pct {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-foreground);
  min-width: 2.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.loading-step {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
}

.loading-hint {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.loading-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.loading-elapsed { font-weight: 500; color: var(--foreground); }
.loading-sep { opacity: 0.4; }
.loading-remaining { color: var(--muted-foreground); }

.loading-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
.loading-background-hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.loading-background-hint a { color: var(--primary); }

/* ── Site nav ─────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(1 0 0 / 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-brand svg { flex-shrink: 0; }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.btn-nav-ghost {
  padding: 0.4375rem 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  line-height: 1;
}
.btn-nav-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-nav-primary {
  padding: 0.4375rem 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  line-height: 1;
}
.btn-nav-primary:hover { background: var(--primary-hover); }

/* User avatar + dropdown */
.user-menu { position: relative; }
.user-avatar-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.025em;
  transition: opacity 0.15s;
}
.user-avatar-btn:hover { opacity: 0.85; }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 15rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px -4px oklch(0.16 0.02 264 / 0.18);
  overflow: hidden;
  z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 0.875rem 1rem;
  background: var(--muted);
}
.user-dropdown-name { font-size: 0.875rem; font-weight: 600; color: var(--foreground); }
.user-dropdown-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-plan { margin-top: 0.375rem; }
.user-dropdown-divider { height: 1px; background: var(--border); }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.user-dropdown-item:hover { background: var(--muted); }
.user-dropdown-logout { color: oklch(0.42 0.18 27); }
.user-dropdown-logout:hover { background: oklch(0.97 0.03 27); color: oklch(0.42 0.18 27); }

/* ── Auth pages ───────────────────────────────────────────────────── */
.auth-page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 4rem;
}
.auth-card {
  width: 100%;
  max-width: 30rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}
.auth-card.auth-card-wide { max-width: 38rem; }
.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}
.auth-subtitle { font-size: 0.875rem; color: var(--muted-foreground); }
.auth-subtitle a { color: var(--primary); text-decoration: none; }
.auth-subtitle a:hover { text-decoration: underline; }

/* Form helpers */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 0.875rem; }
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--foreground); }
.form-label .required { color: oklch(0.55 0.2 27); margin-left: 0.125rem; }

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--input);
  border-radius: 0.5rem;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-input::placeholder { color: var(--muted-foreground); }
.form-input.error { border-color: oklch(0.65 0.2 27); }
.form-input:disabled { opacity: 0.55; cursor: not-allowed; background: var(--muted); }

.form-hint { font-size: 0.75rem; color: var(--muted-foreground); }
.form-section { margin-top: 1.25rem; margin-bottom: 0; }
.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
.form-actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Password toggle */
.pass-input-wrap { position: relative; }
.pass-input-wrap .form-input { padding-right: 2.75rem; }
.pass-toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 0.25rem;
  line-height: 0;
}
.pass-toggle-btn:hover { color: var(--foreground); }

/* Plan cards */
.plan-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}
@media (max-width: 400px) { .plan-cards { grid-template-columns: 1fr; } }
.plan-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1rem 1rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--background);
  user-select: none;
}
.plan-card:hover { border-color: var(--primary); }
.plan-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.plan-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.plan-card-check {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.plan-card.selected .plan-card-check { border-color: var(--primary); background: var(--primary); }
.plan-card.selected .plan-card-check::after {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: white;
}
.plan-card-name { font-size: 0.9375rem; font-weight: 600; color: var(--foreground); margin-bottom: 0.2rem; }
.plan-card-price { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.plan-card-price span { font-size: 0.75rem; font-weight: 400; color: var(--muted-foreground); }
.plan-card-desc { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.375rem; line-height: 1.4; }

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.step-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--border);
  transition: all 0.2s;
}
.step-dot.active { background: var(--primary); width: 1.5rem; }
.step-dot.done { background: var(--primary); }

/* Auth submit button */
.btn-auth-submit {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-auth-submit:hover { background: var(--primary-hover); }

/* Outline / small primary buttons */
.btn-outline {
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary-sm {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn-primary-sm:hover { background: var(--primary-hover); }

/* Flash messages */
.flash-success,
.flash-error {
  padding: 0.875rem 1.125rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.flash-success {
  background: oklch(0.96 0.05 145);
  border: 1px solid oklch(0.85 0.1 145);
  color: oklch(0.35 0.12 145);
}
.flash-error {
  background: oklch(0.97 0.03 27);
  border: 1px solid oklch(0.88 0.07 27);
  color: oklch(0.42 0.18 27);
}
.flash-success svg, .flash-error svg { flex-shrink: 0; margin-top: 0.1rem; }

/* ── Plan badges ──────────────────────────────────────────────────── */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.plan-badge-free { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); }
.plan-badge-premium { background: oklch(0.97 0.04 60); color: oklch(0.45 0.15 60); border: 1px solid oklch(0.88 0.08 60); }

/* ── Profile page ─────────────────────────────────────────────────── */
.profile-page { flex: 1; padding: 2rem 1rem 4rem; }
.profile-inner {
  max-width: 60rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 700px) {
  .profile-inner { grid-template-columns: 1fr; }
}

.profile-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.profile-user-card {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.profile-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  letter-spacing: 0.025em;
}
.profile-name { font-size: 0.9375rem; font-weight: 600; color: var(--foreground); }
.profile-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-nav { padding: 0.5rem 0; }
.profile-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color 0.15s, background 0.15s;
}
.profile-nav-item:hover { color: var(--foreground); background: var(--muted); }
.profile-nav-item.active { color: var(--primary); background: var(--primary-soft); }

.profile-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.profile-flash { margin: 1.25rem 1.5rem -0.25rem; }
.profile-panel { display: block; }
.profile-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.profile-panel-title { font-size: 1rem; font-weight: 600; color: var(--foreground); }
.profile-panel-desc { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 0.2rem; }
.profile-panel-body { padding: 1.5rem; }

/* Usage */
.usage-bar-wrap { margin-bottom: 1.5rem; }
.usage-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}
.usage-bar-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.usage-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.5s ease; }
.usage-bar-fill.near-limit { background: oklch(0.65 0.18 50); }
.usage-bar-fill.at-limit { background: oklch(0.45 0.2 27); }

.usage-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card { padding: 1rem; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--muted); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.25rem; }

/* History table */
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.history-table th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.history-table td {
  padding: 0.75rem 0.875rem;
  color: var(--foreground);
  border-bottom: 1px solid oklch(0.968 0.007 264 / 0.5);
  vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--muted); }
.history-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.history-status-done { background: oklch(0.95 0.06 145); color: oklch(0.35 0.12 145); }
.history-status-pending { background: oklch(0.97 0.04 60); color: oklch(0.5 0.12 60); }
.history-status-failed { background: oklch(0.97 0.03 27); color: oklch(0.42 0.18 27); }
.history-link { font-size: 0.8125rem; color: var(--primary); text-decoration: none; font-weight: 500; }
.history-link:hover { text-decoration: underline; }
.history-thumb-cell { width: 3rem; padding: 0.5rem 0.75rem; }
.history-thumb {
  width: 2.75rem; height: 1.875rem;
  object-fit: cover; border-radius: 0.25rem;
  display: block;
}
.history-thumb-icon {
  display: flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 1.875rem;
  border-radius: 0.25rem;
  background: var(--muted);
  color: var(--muted-foreground);
}
.history-source { max-width: 18rem; }
.history-source-text {
  display: block; font-size: 0.8125rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 18rem;
}
.history-source-placeholder { color: var(--muted-foreground); font-style: italic; }

.history-source-link {
  display: block; font-size: 0.8125rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 18rem;
  color: var(--foreground); text-decoration: none;
}
.history-source-link:hover { color: var(--primary); text-decoration: underline; }
.history-row-link { cursor: pointer; }
.history-row-link:hover td { background: var(--muted); }

/* ── History row actions menu ────────────────────────────────────── */
.history-actions-cell { width: 2.5rem; padding: 0.25rem 0.5rem; text-align: right; }
.row-menu { position: relative; display: inline-block; }
.row-menu-btn {
  display: flex; align-items: center; justify-content: center;
  width: 1.875rem; height: 1.875rem;
  border: none; border-radius: 0.375rem;
  background: transparent; color: var(--muted-foreground);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.row-menu-btn:hover { background: var(--muted); color: var(--foreground); }
.row-menu-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  min-width: 9rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 0.5rem; box-shadow: 0 4px 16px oklch(0 0 0 / 0.12);
  padding: 0.25rem;
  overflow: hidden;
}
.row-menu-dropdown.open { display: block; }
.row-menu-item {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.5rem 0.75rem;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--foreground); background: none;
  border: none; border-radius: 0.375rem;
  text-decoration: none; cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.row-menu-item:hover { background: var(--muted); }
.row-menu-item--danger { color: oklch(0.42 0.18 27); }
.row-menu-item--danger:hover { background: oklch(0.97 0.03 27); color: oklch(0.35 0.18 27); }
[data-theme="dark"] .row-menu-item--danger { color: oklch(0.72 0.18 27); }
[data-theme="dark"] .row-menu-item--danger:hover { background: oklch(0.22 0.06 27); color: oklch(0.8 0.18 27); }

/* ── Try again card ──────────────────────────────────────────────── */
.retry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--muted);
  border: 1px solid var(--border);
}
.retry-card-text {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}
.retry-card-text svg { flex-shrink: 0; margin-top: 0.1rem; }
.retry-card-text strong { color: var(--foreground); font-weight: 600; }
.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.btn-retry:hover { border-color: var(--primary); color: var(--primary); }

/* Appearance / theme picker */
.theme-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.theme-option {
  flex: 1;
  min-width: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.15s, background 0.15s;
}
.theme-option:hover { border-color: var(--primary); }
.theme-option.active { border-color: var(--primary); background: var(--primary-soft); }
.theme-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.theme-option-preview {
  width: 2.5rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  border: 1.5px solid var(--border);
  overflow: hidden;
  display: flex;
}
.theme-option-preview-light { width: 100%; background: oklch(0.985 0.005 80); }
.theme-option-preview-dark  { width: 100%; background: oklch(0.13 0.01 264); }
.theme-option-preview-half-l { width: 50%; background: oklch(0.985 0.005 80); }
.theme-option-preview-half-d { width: 50%; background: oklch(0.13 0.01 264); }
.theme-option-label { font-size: 0.8125rem; font-weight: 500; color: var(--foreground); }

/* Billing */
.current-plan-card { margin-bottom: 1.25rem; }
.upgrade-banner {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  background: var(--primary-soft);
  border: 1px solid oklch(0.85 0.04 264);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.upgrade-banner-text { flex: 1; }
.upgrade-banner-title { font-size: 0.9375rem; font-weight: 600; color: var(--foreground); }
.upgrade-banner-desc { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 0.2rem; }

.card-display {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--muted);
  margin-bottom: 1rem;
}
.card-icon {
  width: 2.75rem;
  height: 1.875rem;
  border-radius: 0.3rem;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.card-number { font-size: 0.9375rem; font-weight: 600; color: var(--foreground); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.card-meta { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.125rem; }

.billing-address-display {
  font-size: 0.875rem;
  color: var(--foreground);
  line-height: 1.7;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--muted);
  margin-bottom: 0;
}

.payment-history-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.payment-history-table th {
  text-align: left;
  padding: 0.5rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.payment-history-table td { padding: 0.75rem 0.875rem; color: var(--foreground); border-bottom: 1px solid oklch(0.968 0.007 264 / 0.5); }
.payment-history-table tr:last-child td { border-bottom: none; }
.payment-amount { font-weight: 600; color: oklch(0.35 0.12 145); }

/* ── Translate panel & badge ────────────────────────────────────────── */
.translate-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}
.translate-panel-label {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.translate-lang-select {
  padding: 0.3rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.8125rem;
  cursor: pointer;
}
.translate-status {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.translate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
[data-theme="dark"] .translate-lang-select { background: var(--muted); }
.tprogress {
  display: inline-block;
  width: 7rem;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
}
.tprogress-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0%;
}