/* =========================================================
   SubSync AI — Modern Next-Gen Subtitle Studio Theme
   Light & Dark Mode Tokens
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.hidden,
.btn-remove-key.hidden,
.btn-save.hidden,
[hidden] {
  display: none !important;
}

:root {
  --bg-dark: #07090e;
  --surface-base: #0e121b;
  --surface-glass: rgba(16, 21, 32, 0.75);
  --surface-glass-active: rgba(22, 29, 44, 0.85);
  --surface-card: #131826;
  --surface-inner: #0a0d15;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-bright: rgba(140, 130, 255, 0.35);

  --brand-primary: #6366f1;
  --brand-primary-light: #818cf8;
  --brand-cyan: #06b6d4;
  --brand-cyan-light: #22d3ee;
  --brand-violet: #a855f7;
  
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);
  --accent-glow: rgba(99, 102, 241, 0.3);
  --cyan-glow: rgba(6, 182, 212, 0.25);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-error: #ef4444;
  --status-error-bg: rgba(239, 68, 68, 0.12);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-bn: 'Hind Siliguri', 'Plus Jakarta Sans', sans-serif;

  --shadow-card: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px var(--accent-glow);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --surface-base: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --surface-glass-active: rgba(241, 245, 249, 0.98);
  --surface-card: #ffffff;
  --surface-inner: #f1f5f9;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.14);
  --border-bright: rgba(99, 102, 241, 0.4);

  --brand-primary: #4f46e5;
  --brand-primary-light: #6366f1;
  --brand-cyan: #0284c7;
  --brand-cyan-light: #0ea5e9;
  --brand-violet: #9333ea;

  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #0284c7 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4338ca 0%, #0369a1 100%);
  --accent-glow: rgba(79, 70, 229, 0.15);
  --cyan-glow: rgba(2, 132, 199, 0.15);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --status-success: #059669;
  --status-success-bg: rgba(5, 150, 105, 0.1);
  --status-warning: #d97706;
  --status-warning-bg: rgba(217, 119, 6, 0.1);
  --status-error: #dc2626;
  --status-error-bg: rgba(220, 38, 38, 0.1);

  --shadow-card: 0 12px 32px -6px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.1);
}

[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="light"] .glow-orb.orb-primary {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
}

[data-theme="light"] .glow-orb.orb-cyan {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.1), transparent 70%);
}

[data-theme="light"] .glow-orb.orb-violet {
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1), transparent 70%);
}

[data-theme="light"] .grid-overlay {
  background-image: linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
}

[data-theme="light"] .codebox-wrapper,
[data-theme="light"] .terminal-log-wrapper {
  background: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

[data-theme="light"] .codebox-wrapper pre,
[data-theme="light"] .terminal-feed {
  color: #e2e8f0;
}

[data-theme="light"] .quota-item,
[data-theme="light"] .session-tracker-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .tracker-title {
  color: var(--text-main);
}

/* Light Mode Overrides for Field Cards, Dropdowns & Modals */
[data-theme="light"] .field-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

[data-theme="light"] .field-card:hover {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .field-label-group {
  color: var(--text-main);
}

[data-theme="light"] .custom-select-trigger {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

[data-theme="light"] .custom-select-value {
  color: #0f172a;
}

[data-theme="light"] .custom-select-trigger:hover {
  background: #f1f5f9;
  border-color: #6366f1;
}

[data-theme="light"] .custom-select-container.is-open .custom-select-trigger {
  background: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .custom-select-menu {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15), 0 2px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .custom-select-search-wrap {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .custom-select-search-input {
  color: #0f172a;
}

[data-theme="light"] .custom-select-option {
  color: #334155;
}

[data-theme="light"] .custom-select-option:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

[data-theme="light"] .custom-select-option.is-selected {
  background: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
  font-weight: 700;
}

[data-theme="light"] .custom-modal-backdrop {
  background: rgba(15, 23, 42, 0.55);
}

[data-theme="light"] .custom-modal-box {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25);
  color: #0f172a;
}

[data-theme="light"] .modal-dialog-title,
[data-theme="light"] .modal-title {
  color: #0f172a;
}

[data-theme="light"] .modal-dialog-message,
[data-theme="light"] .modal-message {
  color: #475569;
}

[data-theme="light"] .btn-modal-cancel {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .btn-modal-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Screen Reader Only Utility for Semantic SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

[data-theme="light"] .btn-modal-cancel {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .btn-modal-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .quota-dashboard {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .quota-value {
  color: #0f172a;
}

[data-theme="light"] .quota-value.highlight {
  color: #0284c7;
}

[data-theme="light"] .auto-batch-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .auto-batch-title {
  color: #0f172a;
}

[data-theme="light"] .drop-zone {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .drop-zone:hover {
  background: rgba(99, 102, 241, 0.04);
  border-color: #6366f1;
}

[data-theme="light"] .drop-headline {
  color: #0f172a;
}

[data-theme="light"] .file-meta-bar {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .preview-tab {
  background: #f1f5f9;
  color: #475569;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .preview-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .preview-tab.active {
  background: #ffffff;
  color: #4f46e5;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .subtitle-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .side-by-side-row {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .side-by-side-row:hover {
  background: #f8fafc;
}

[data-theme="light"] .seo-feature-card,
[data-theme="light"] .seo-step-card,
[data-theme="light"] .seo-faq-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

[data-theme="light"] .seo-feature-card:hover,
[data-theme="light"] .seo-step-card:hover,
[data-theme="light"] .seo-faq-item:hover {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .seo-faq-item.is-open {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .faq-toggle-icon {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .seo-faq-item.is-open .faq-toggle-icon {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .seo-toggle-bar-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .seo-toggle-bar-card:hover {
  border-color: #6366f1;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .seo-collapsible-wrapper.is-open .seo-toggle-bar-card {
  background: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 6px 25px rgba(79, 70, 229, 0.12);
}

[data-theme="light"] .seo-guide-chevron-circle {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .failover-toggle-label {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .failover-toggle-switch {
  background: rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .provider-tab-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .provider-tab-btn:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: #6366f1;
}

[data-theme="light"] .provider-chip {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
  color: #64748b;
}

[data-theme="light"] .provider-chip.is-active-chip {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

/* ── Brand Header & Navigation in Light Mode ── */
[data-theme="light"] .brand-title span:first-child {
  background: linear-gradient(135deg, #0f172a 35%, #4338ca 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

[data-theme="light"] .brand-badge {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border-color: rgba(79, 70, 229, 0.25);
}

[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .app-main-tabs {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .app-tab-btn {
  color: #475569;
}

[data-theme="light"] .app-tab-btn:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .header-ai-status-badge {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
  color: #475569;
}

/* ── Cloud History Subtitle Archive in Light Mode ── */
[data-theme="light"] .cloud-history-item {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
}

[data-theme="light"] .cloud-history-item:hover {
  background: #ffffff !important;
  border-color: rgba(79, 70, 229, 0.4) !important;
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.08) !important;
}

[data-theme="light"] .cloud-item-title {
  color: #0f172a !important;
}

[data-theme="light"] .cloud-item-meta {
  color: #475569 !important;
}

[data-theme="light"] .meta-svg {
  color: #64748b !important;
}

[data-theme="light"] .btn-refresh-history {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #475569;
}

[data-theme="light"] .btn-refresh-history:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  color: #0284c7;
}

[data-theme="light"] .cloud-history-empty {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  color: #64748b;
}

[data-theme="light"] .cloud-history-empty p {
  color: #475569;
}

[data-theme="light"] .btn-see-all-history {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

[data-theme="light"] .btn-see-all-history:hover {
  background: #e2e8f0;
  border-color: #4f46e5;
  color: #4f46e5;
}

[data-theme="light"] .btn-cloud-rename {
  background: #f1f5f9 !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: #475569 !important;
}

[data-theme="light"] .btn-cloud-rename:hover {
  background: #e2e8f0 !important;
  border-color: #4f46e5 !important;
  color: #0f172a !important;
}

[data-theme="light"] .btn-cloud-delete {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

[data-theme="light"] .btn-cloud-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #dc2626;
  color: #b91c1c;
}

[data-theme="light"] .condensed-badge-mini,
[data-theme="light"] .condensed-badge {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.25);
  color: #4f46e5;
}

[data-theme="light"] .meta-expiry-pill {
  color: #b45309;
}

[data-theme="light"] .meta-expiry-pill.urgent {
  color: #dc2626;
}

/* ── Google Account & Cloud Backup Banner in Light Mode ── */
[data-theme="light"] .google-sync-banner {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .google-sync-banner-title {
  color: #0f172a;
}

[data-theme="light"] .google-sync-banner-desc {
  color: #475569;
}

[data-theme="light"] .logged-in-profile-row,
[data-theme="light"] .profile-card {
  background: transparent;
  border: none;
  box-shadow: none;
}

[data-theme="light"] .profile-meta-info strong {
  color: #0f172a;
}

[data-theme="light"] .profile-email-text {
  color: #475569;
}

[data-theme="light"] .auth-sync-status-badge,
[data-theme="light"] .sync-status-badge {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .auth-sync-status-badge.sync-active,
[data-theme="light"] .sync-status-badge.status-synced {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.22);
  color: #059669;
}

[data-theme="light"] .profile-avatar-medium {
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .btn-sync-cloud {
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.22);
  color: #4f46e5;
}

[data-theme="light"] .btn-sync-cloud:hover {
  background: rgba(79, 70, 229, 0.15);
  border-color: #4f46e5;
  color: #3730a3;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .btn-sign-out {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: #dc2626;
}

[data-theme="light"] .btn-sign-out:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: #dc2626;
  color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

/* ── Settings API Inputs & Actions in Light Mode ── */
[data-theme="light"] .input-glow-wrapper input {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

[data-theme="light"] .input-glow-wrapper input:focus {
  background: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

[data-theme="light"] .input-glow-wrapper input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .input-action-btn {
  color: #64748b;
}

[data-theme="light"] .input-action-btn:hover {
  color: #0f172a;
}

[data-theme="light"] .btn-save {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

[data-theme="light"] .btn-save:hover {
  background: #e2e8f0;
  border-color: #4f46e5;
  color: #4f46e5;
}

[data-theme="light"] .btn-remove-key {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
  color: #dc2626;
}

[data-theme="light"] .btn-remove-key:hover {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

[data-theme="light"] .setting-desc,
[data-theme="light"] .field-hint,
[data-theme="light"] .api-guide-tip {
  color: #475569;
}

[data-theme="light"] .api-key-status {
  color: #64748b;
}

[data-theme="light"] .api-key-status.saved {
  color: #059669;
}

/* ── Translator & Results Views in Light Mode ── */
[data-theme="light"] .pill-metric {
  background: #f1f5f9;
  color: #475569;
}

[data-theme="light"] .btn-icon {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
  color: #475569;
}

[data-theme="light"] .btn-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .preview-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .preview-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .preview-text-line {
  color: #0f172a;
}

[data-theme="light"] .result-success-title h3 {
  color: #0f172a;
}

[data-theme="light"] .result-sub-info {
  color: #475569;
}

[data-theme="light"] .btn-copy-hero {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

[data-theme="light"] .btn-copy-hero:hover {
  background: #e2e8f0;
  border-color: #4f46e5;
  color: #4f46e5;
}

[data-theme="light"] .btn-secondary-subtle {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.14);
  color: #475569;
}

[data-theme="light"] .btn-secondary-subtle:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .result-file-pill {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

[data-theme="light"] .result-file-pill:hover {
  background: #e2e8f0;
  border-color: #4f46e5;
}

[data-theme="light"] .preview-tabs-nav {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .subtitle-block-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .subtitle-block-card:hover {
  border-color: rgba(79, 70, 229, 0.4);
}

[data-theme="light"] .block-text-content {
  color: #0f172a;
}

[data-theme="light"] .progress-track {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .stat-cell {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .stat-name {
  color: #64748b;
}

[data-theme="light"] .stat-val {
  color: #0f172a;
}

/* ── Mobile Bottom Navigation in Light Mode ── */
[data-theme="light"] .native-bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .bottom-nav-btn {
  color: #64748b;
}

[data-theme="light"] .bottom-nav-btn.active {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .bottom-nav-btn.active .bottom-nav-icon-wrap svg {
  stroke: #0284c7;
  filter: drop-shadow(0 0 6px rgba(2, 132, 199, 0.3));
}

[data-theme="light"] .bottom-nav-dot {
  border-color: #ffffff;
}

/* ── Custom Modals in Light Mode ── */
[data-theme="light"] .modal-input-field {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

[data-theme="light"] .modal-input-field:focus {
  background: #ffffff;
  border-color: #4f46e5;
}

[data-theme="light"] .modal-title {
  color: #0f172a;
}

[data-theme="light"] .modal-message {
  color: #475569;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--brand-primary-light);
  transform: translateY(-1px);
}

.theme-toggle-btn svg {
  width: 15px;
  height: 15px;
}

/* Header Downloads Manager Button (App Only) */
.header-downloads-btn {
  position: relative;
  display: none !important;
  align-items: center;
  justify-content: center;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

body.is-native-platform .header-downloads-btn {
  display: inline-flex !important;
}

.header-downloads-btn:hover {
  border-color: var(--brand-primary-light);
  transform: translateY(-1px);
  background: var(--surface-glass-active);
  color: var(--brand-primary-light);
}

.header-downloads-svg {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}

.header-downloads-btn:active .header-downloads-svg {
  transform: translateY(2px);
}

.header-downloads-badge {
  display: none !important;
}

.header-downloads-pulse {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid #10b981;
  animation: downloadPulseRing 1.4s cubic-bezier(0.24, 0, 0.38, 1) infinite;
  pointer-events: none;
}

@keyframes downloadPulseRing {
  0% { transform: scale(0.95); opacity: 0.9; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

@keyframes downloadArrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.header-downloads-btn.is-downloading .header-downloads-svg {
  animation: downloadArrowBounce 0.8s ease-in-out infinite;
  color: #10b981;
}

.header-apk-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.2) 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-apk-btn:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #10b981;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.header-apk-btn svg {
  width: 14px;
  height: 14px;
}

.theme-toggle-btn .sun-icon {
  display: block;
  color: #f59e0b;
}

.theme-toggle-btn .moon-icon {
  display: none;
  color: var(--brand-primary-light);
}

[data-theme="light"] .theme-toggle-btn .sun-icon {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .moon-icon {
  display: block;
  color: #6366f1;
}

html, body {
  overflow-x: clip;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background Lighting */
.glow-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: floatOrb 22s ease-in-out infinite alternate;
}

.orb-primary {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, #6366f1, #3b82f6);
  top: -180px;
  left: -120px;
}

.orb-cyan {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #06b6d4, #0d9488);
  top: 35%;
  right: -150px;
  animation-delay: -8s;
}

.orb-violet {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #a855f7, #6366f1);
  bottom: -150px;
  left: 25%;
  animation-delay: -15s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.08); }
}

/* App Shell */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

/* Top Navigation (Permanently Sticky & Glitch-Proof) */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: -24px;
  margin-right: -24px;
  margin-bottom: 24px;
  padding: max(12px, env(safe-area-inset-top)) 24px 12px 24px;
  background: rgba(8, 12, 24, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  flex-wrap: nowrap;
  gap: 12px;
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate;
}

[data-theme="light"] .top-nav {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-box {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 0 20px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .logo-box {
  background: rgba(18, 24, 38, 0.85);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 20px rgba(99, 102, 241, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .logo-box {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 0 15px rgba(99, 102, 241, 0.08);
}

.logo-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 25px rgba(99, 102, 241, 0.3);
}

.logo-box svg {
  width: 34px;
  height: 34px;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title span:first-child {
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.18);
  color: var(--brand-primary-light);
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin-top: 2px;
}

/* 2-Tab Main Navigation Switcher (Hidden: Translator and Settings belong exclusively to the Floating Bottom Nav) */
.app-main-tabs,
.desktop-tabs {
  display: none !important;
}

.app-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.app-tab-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.app-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.app-tab-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 16px var(--accent-glow);
}

.app-tab-btn.active svg {
  transform: scale(1.1);
}

.settings-nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.settings-nav-dot.dot-on {
  background: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.settings-nav-dot.dot-off {
  background: var(--status-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Header AI Status Badge */
.header-ai-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-muted);
  transition: all 0.25s ease;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1.2;
}

.header-ai-status-badge .status-text {
  white-space: nowrap !important;
  display: inline-block;
}

.header-ai-status-badge .status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulseDot 2s infinite;
}

.header-ai-status-badge.badge-on {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.header-ai-status-badge.badge-on .status-indicator-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.header-ai-status-badge.badge-off {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.nav-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap !important;
}

.nav-system-group,
.nav-user-group,
.nav-system-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* View Containers (Translator vs Settings) */
.app-view {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  padding-bottom: 80px;
}

.app-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ===================================================
   SUB-TABS NAVIGATION (Translation Setting / Translate & API Keys / History)
   =================================================== */
.sub-tabs-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
  z-index: 10;
}

.sub-tabs-bar {
  display: inline-flex;
  align-items: center;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: 100%;
}

[data-theme="light"] .sub-tabs-bar {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.sub-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.sub-tab-pill svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sub-tab-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .sub-tab-pill:hover {
  background: rgba(15, 23, 42, 0.04);
}

.sub-tab-pill.active {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.sub-tab-pill.active svg {
  transform: scale(1.1);
}

[data-theme="light"] .sub-tab-pill.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

/* Sub-View Panels with Smooth Slide-Fade */
.sub-view-panel {
  display: none;
  width: 100%;
}

.sub-view-panel.active {
  display: block;
  animation: subViewEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, transform;
}

@keyframes subViewEnter {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mandatory API Key Lockout Guard */
.translator-lock-guard {
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease;
}

.lock-guard-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lock-icon-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.3);
}

.lock-icon-orb svg {
  width: 28px;
  height: 28px;
}

.lock-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.lock-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.55;
  margin: 0;
}

.lock-actions {
  margin-top: 6px;
}

.btn-lock-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
}

.btn-lock-cta svg {
  width: 18px;
  height: 18px;
}

/* App Info Section in Settings - Hidden */
.app-info-section,
body.is-native-app .app-info-section {
  display: none !important;
}

.app-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.app-info-item {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-info-item .info-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.app-info-item .info-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.app-info-item .info-val.highlight {
  color: var(--brand-primary-light);
}

.app-actions-row {
  display: flex;
  justify-content: flex-start;
}

.btn-reset-session {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-session:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-reset-session svg {
  width: 14px;
  height: 14px;
}

/* Glass Cards */
.glass-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s, box-shadow 0.25s;
  position: relative;
  z-index: 1;
}

.glass-card.has-open-dropdown,
.glass-card:has(.custom-select-container.is-open),
.api-section.has-open-dropdown,
.api-section:has(.custom-select-container.is-open),
.settings-section.has-open-dropdown,
.settings-section:has(.custom-select-container.is-open),
.provider-select-box.has-open-dropdown,
.provider-select-box:has(.custom-select-container.is-open) {
  z-index: 999999 !important;
}

.api-section {
  position: relative;
  z-index: 20;
  padding: 14px 18px !important;
  margin-bottom: 10px !important;
}

.settings-info-card {
  position: relative;
  z-index: 1;
}

.glass-card:hover {
  border-color: var(--border-medium);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-wrap svg {
  width: 20px;
  height: 20px;
}

.key-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(234, 88, 12, 0.12));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.12);
}

[data-theme="light"] .key-icon {
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.3);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

.config-icon {
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-primary-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.title-with-icon h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.title-with-icon .desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.get-key-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brand-cyan-light);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  transition: all 0.2s;
}

.get-key-link:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

/* ── Multi-Provider Dropdown & Switcher ── */
.api-section .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  width: 100%;
}

.api-section .title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-section .key-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.1);
}

.api-section .key-icon svg {
  width: 16px;
  height: 16px;
}

[data-theme="dark"] .api-section .key-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.api-section .title-with-icon h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.api-section .failover-control-badge {
  display: flex;
  align-items: center;
}

.api-section .failover-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 4px 14px;
  border-radius: 9999px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

[data-theme="dark"] .api-section .failover-toggle-label {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

.api-section .failover-toggle-label:hover {
  border-color: var(--brand-primary-light);
}

.api-section .failover-toggle-label input {
  display: none;
}

.api-section .failover-toggle-switch {
  width: 28px;
  height: 16px;
  background: rgba(15, 23, 42, 0.2);
  border-radius: 10px;
  position: relative;
  transition: background 0.25s ease;
}

[data-theme="dark"] .api-section .failover-toggle-switch {
  background: rgba(255, 255, 255, 0.2);
}

.api-section .failover-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.api-section .failover-toggle-label input:checked + .failover-toggle-switch,
[data-theme="light"] .api-section .failover-toggle-label input:checked + .failover-toggle-switch,
[data-theme="dark"] .api-section .failover-toggle-label input:checked + .failover-toggle-switch {
  background: #10b981 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.45) !important;
}

.api-section .failover-toggle-label input:checked + .failover-toggle-switch::after {
  transform: translateX(12px);
}

.provider-select-box {
  margin-bottom: 8px;
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  padding: 8px 12px;
  position: relative;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.04);
  box-sizing: border-box;
}

[data-theme="dark"] .provider-select-box {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(99, 102, 241, 0.3);
}

.provider-select-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  width: 100%;
}

.provider-select-label .field-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
}

.provider-select-label .field-icon {
  width: 16px;
  height: 16px;
  color: #0284c7;
}

#providerSelectedTag {
  background: #e0f2fe;
  color: #0284c7;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #bae6fd;
}

[data-theme="dark"] #providerSelectedTag {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border-color: rgba(6, 182, 212, 0.3);
}

.provider-select-box .select-wrapper {
  width: 100%;
  margin-bottom: 0;
}

.provider-select-box .select-wrapper select,
.provider-select-box .custom-select-trigger {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
}

[data-theme="dark"] .provider-select-box .select-wrapper select,
[data-theme="dark"] .provider-select-box .custom-select-trigger {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--border-medium);
  color: #f8fafc;
}

.provider-panel {
  display: none;
  width: 100%;
}

.provider-panel.active {
  display: block;
  width: 100%;
}

.provider-panel .api-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.provider-panel .input-glow-wrapper {
  grid-column: 1 / -1;
  width: 100%;
  position: relative;
}

.provider-panel .input-glow-wrapper input {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 9px 40px 9px 12px !important;
  font-size: 0.88rem;
  color: #0f172a;
  height: 38px;
  box-sizing: border-box !important;
}

[data-theme="dark"] .provider-panel .input-glow-wrapper input {
  background: rgba(15, 23, 42, 0.6);
  border-color: var(--border-medium);
  color: #ffffff;
}

.provider-panel .input-action-btn,
.api-section .input-action-btn,
.input-action-btn {
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
  z-index: 2 !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  outline: none !important;
}

.provider-panel .input-action-btn:hover,
.api-section .input-action-btn:hover,
.input-action-btn:hover {
  color: #cbd5e1 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateY(-50%) !important;
}

.provider-panel .input-action-btn:active,
.api-section .input-action-btn:active,
.input-action-btn:active {
  transform: translateY(-50%) scale(0.92) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.14) !important;
}

[data-theme="light"] .provider-panel .input-action-btn,
[data-theme="light"] .api-section .input-action-btn,
[data-theme="light"] .input-action-btn {
  color: #94a3b8 !important;
}

[data-theme="light"] .provider-panel .input-action-btn:hover,
[data-theme="light"] .api-section .input-action-btn:hover,
[data-theme="light"] .input-action-btn:hover {
  color: #334155 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  transform: translateY(-50%) !important;
}

[data-theme="light"] .provider-panel .input-action-btn:active,
[data-theme="light"] .api-section .input-action-btn:active,
[data-theme="light"] .input-action-btn:active {
  transform: translateY(-50%) scale(0.92) !important;
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.09) !important;
}

.provider-panel .input-action-btn svg,
.api-section .input-action-btn svg,
.input-action-btn svg {
  width: 15px !important;
  height: 15px !important;
  flex-shrink: 0 !important;
  display: block !important;
  margin: auto !important;
  pointer-events: none !important;
}


.provider-panel .btn-save {
  width: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  height: 38px;
  min-height: 38px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  white-space: nowrap !important;
}

.provider-panel .btn-save span,
.api-section .btn-save span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.provider-panel .btn-save:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

[data-theme="dark"] .provider-panel .btn-save {
  background: var(--surface-card);
  border-color: var(--border-medium);
  color: #ffffff;
}

.provider-panel .btn-remove-key {
  width: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #dc2626;
  cursor: pointer;
  height: 38px;
  min-height: 38px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  white-space: nowrap !important;
}

.provider-panel .btn-remove-key:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.provider-panel .btn-remove-key svg {
  width: 15px;
  height: 15px;
  stroke: #dc2626;
}

.provider-panel .provider-get-key-btn {
  width: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0284c7;
  text-decoration: none;
  cursor: pointer;
  height: 38px;
  min-height: 38px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  white-space: nowrap !important;
}

.provider-panel .provider-get-key-btn:hover {
  background: #bae6fd;
  color: #0369a1;
}

[data-theme="dark"] .provider-panel .provider-get-key-btn {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: #38bdf8;
}

.provider-panel .btn-save.hidden,
.provider-panel .btn-save[style*="display: none"],
.provider-panel .btn-remove-key.hidden,
.provider-panel .btn-remove-key[style*="display: none"],
.provider-panel .btn-manage-keys.hidden,
.provider-panel .btn-manage-keys[style*="display: none"],
.provider-panel .provider-get-key-btn.hidden,
.provider-panel .provider-get-key-btn[style*="display: none"] {
  display: none !important;
}

.provider-panel .api-form-row:not(.custom-actions-row) .btn-remove-key,
.provider-panel .api-form-row:not(.custom-actions-row) .btn-manage-keys {
  grid-column: auto !important;
  width: 100% !important;
}

.provider-panel .api-feedback-row {
  margin-top: 4px;
  width: 100%;
}

.provider-panel .api-feedback {
  font-size: 0.84rem;
  font-weight: 600;
  color: #059669;
  display: flex;
  align-items: center;
  gap: 6px;
}

.provider-tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.provider-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.provider-tab-btn:hover {
  background: var(--surface-card);
  color: var(--text-main);
  border-color: var(--border-bright);
}

.provider-tab-btn.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--brand-primary-light);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .provider-tab-btn.active {
  background: rgba(79, 70, 229, 0.1);
  border-color: #4f46e5;
  color: #312e81;
}

.provider-tab-icon svg {
  width: 15px;
  height: 15px;
}

.provider-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.provider-status-dot.dot-connected {
  background: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
}

.provider-status-dot.dot-off {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .provider-status-dot.dot-off {
  background: rgba(15, 23, 42, 0.2);
}

/* Provider Panels */
.provider-panel {
  display: none;
}

.provider-panel.active {
  display: block;
}

.provider-get-key-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-cyan-light);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.provider-get-key-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

.provider-get-key-btn svg {
  width: 12px;
  height: 12px;
}

/* Summary Bar */
.providers-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.connected-providers-list {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.provider-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s;
}

.provider-chip.is-active-chip {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--status-success);
}

/* API Section */
.api-form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-glow-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-glow-wrapper input,
.input-glow-wrapper input[type="text"],
.input-glow-wrapper input[type="password"] {
  width: 100%;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 13px 56px 13px 16px !important;
  outline: none;
  transition: all 0.25s;
  box-sizing: border-box !important;
}

.input-glow-wrapper input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface-card);
}

.input-glow-wrapper input.input-locked,
.input-glow-wrapper input:disabled {
  background: var(--surface-inner);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--text-main);
  opacity: 0.92;
  cursor: not-allowed;
}

.input-glow-wrapper input.input-locked:focus {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .input-glow-wrapper input.input-locked,
[data-theme="light"] .input-glow-wrapper input:disabled {
  background: #f1f5f9;
  border-color: rgba(5, 150, 105, 0.4);
  color: #0f172a;
}

.input-glow-wrapper input::placeholder {
  color: var(--text-dim);
  font-family: var(--font-main);
}

/* Note: .input-action-btn base styles, centering, and active micro-states are consolidated at lines 1936-2015 */


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
  user-select: none;
}

.btn-save {
  background: var(--surface-card);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 13px 22px;
  font-size: 0.88rem;
}

.btn-save:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand-primary-light);
  color: white;
}

.btn-remove-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 13px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn-remove-key:hover {
  background: rgba(239, 68, 68, 0.24);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.btn-remove-key svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.api-feedback-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.api-feedback {
  font-size: 0.74rem;
  font-weight: 500;
  min-height: 20px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.api-feedback.ok { color: var(--status-success); }
.api-feedback.err { color: var(--status-error); }

.btn-toggle-quota {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-toggle-quota:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--brand-primary-light);
  transform: translateY(-1px);
}

.btn-toggle-quota.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--brand-primary-light);
  color: #fff;
}

.btn-toggle-quota.active svg#toggleQuotaChevron {
  transform: rotate(180deg);
}

/* API Quota & Limits Dashboard */
.quota-dashboard {
  margin-top: 18px;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.35s ease;
}

.quota-dashboard.hidden {
  display: none !important;
}

.quota-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
  gap: 8px;
}

.quota-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.quota-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  transition: all 0.3s ease;
  font-family: var(--font-main);
  letter-spacing: 0.01em;
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.api-health-pill.health-optimal {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.api-health-pill.health-optimal .health-dot {
  box-shadow: 0 0 8px #10b981;
}

.api-health-pill.health-active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--brand-primary-light);
  border: 1px solid rgba(99, 102, 241, 0.35);
  animation: pulseHealth 1.4s infinite ease-in-out;
}
.api-health-pill.health-active .health-dot {
  background: #818cf8;
  box-shadow: 0 0 10px #6366f1;
}

.api-health-pill.health-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  animation: pulseHealth 1s infinite ease-in-out;
}
.api-health-pill.health-warning .health-dot {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
}

.api-health-pill.health-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.api-health-pill.health-error .health-dot {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.api-health-pill.health-disconnected {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.api-health-pill.health-disconnected .health-dot {
  background: #94a3b8;
  box-shadow: none;
}

@keyframes pulseHealth {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.quota-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-cyan-light);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  transition: all 0.2s;
}

.quota-ext-link:hover {
  background: rgba(6, 182, 212, 0.22);
  color: white;
  transform: translateY(-1px);
}

.quota-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .quota-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .quota-grid {
    grid-template-columns: 1fr;
  }
}

.quota-item {
  padding: 12px 14px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, transform 0.2s;
}

.quota-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.quota-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.quota-value {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.quota-value.highlight {
  color: var(--brand-cyan-light);
}

.quota-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Real-Time Session Tracker */
.session-tracker-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(10, 15, 29, 0.75);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: var(--radius-sm);
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.tracker-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--status-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--status-success);
  animation: pulseDot 1.8s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.5; }
}

.btn-reset-counter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset-counter:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.tracker-bar-wrap {
  margin-bottom: 12px;
}

.tracker-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.tracker-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--status-success), #38bdf8);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.tracker-stats-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tracker-stats-line strong {
  color: var(--text-main);
}

.remaining-badge {
  color: var(--status-success);
  font-weight: 600;
}

.tracker-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
}

@media (max-width: 600px) {
  .tracker-chips-grid {
    grid-template-columns: 1fr;
  }
}

.tracker-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 10px;
  border-radius: 4px;
}

.chip-label {
  color: var(--text-dim);
}

.chip-value {
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.chip-value.highlight {
  color: var(--brand-cyan-light);
}

/* Settings Grid & Modern Field Cards */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.field-card {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px 12px;
  transition: all 0.25s ease;
}

.field-card:hover {
  background: var(--surface-glass-active);
  border-color: var(--border-bright);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.field-item.full-width {
  grid-column: 1 / -1;
}

.field-item label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  min-width: 0;
  width: 100%;
}

.field-label-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-main);
}

.field-icon {
  width: 15px;
  height: 15px;
  color: var(--brand-primary-light);
  flex-shrink: 0;
}

.field-icon.icon-ai {
  color: var(--brand-cyan-light);
}

.field-icon.icon-pacing {
  color: #fbbf24;
}

.field-icon.icon-batch {
  color: var(--status-success);
}

.field-icon.icon-hint {
  color: #c084fc;
}

.field-footer-info {
  margin-top: 4px;
}

.field-micro-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.speed-tag {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  font-weight: 700;
}

.hint-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 6px;
}

.hint-tag.active-tag {
  background: rgba(6, 182, 212, 0.12);
  color: var(--brand-cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.hint-muted {
  font-size: 0.72rem;
  text-transform: none;
  color: var(--text-dim);
  font-weight: 400;
}

/* Auto Batch Card */
.auto-batch-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.auto-batch-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-success);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.auto-batch-icon svg {
  width: 16px;
  height: 16px;
}

.auto-batch-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.auto-batch-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
}

.select-wrapper {
  position: relative;
  width: 100%;
}

/* Hidden native select (completely decoupled from layout & focus) */
.custom-hidden-select {
  display: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Custom Dropdown Trigger */
.custom-select-container {
  position: relative;
  width: 100%;
  min-width: 0;
  user-select: none;
  z-index: 10;
}

.custom-select-container.is-open {
  z-index: 99999 !important;
}

.custom-select-trigger {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: auto;
  box-sizing: border-box;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  gap: 8px;
}

.custom-select-trigger:hover {
  border-color: var(--brand-primary-light);
  background: var(--surface-glass-active);
  box-shadow: 0 0 14px var(--accent-glow);
}

.custom-select-container.is-open .custom-select-trigger {
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface-card);
}

.custom-select-container.is-disabled .custom-select-trigger {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: var(--border-subtle);
  box-shadow: none;
  pointer-events: none;
}

.custom-select-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  padding-right: 4px;
  color: var(--text-main);
  min-width: 0;
  flex: 1;
}

.custom-select-value .custom-select-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.custom-select-flag-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 15px;
  min-width: 22px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

[data-theme="light"] .custom-select-flag-wrapper {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.15);
}

.custom-select-flag-wrapper .lang-flag-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.custom-select-chevron {
  width: 15px;
  height: 15px;
  color: var(--brand-primary-light);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-container.is-open .custom-select-chevron {
  transform: rotate(180deg);
}

/* Floating Glass Dropdown Menu (Always opens downwards) */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px) !important;
  bottom: auto !important;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--surface-card, #0f172a);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright, rgba(255, 255, 255, 0.15));
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 15px var(--accent-glow);
  z-index: 999999 !important;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top center !important;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
  will-change: opacity, transform;
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .custom-select-menu {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.15), 0 2px 8px rgba(15, 23, 42, 0.05);
}

.custom-select-container.is-open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-select-container.opens-up .custom-select-menu {
  top: auto !important;
  bottom: calc(100% + 4px) !important;
  transform-origin: bottom center !important;
  transform: translateY(6px) scale(0.97);
}

.custom-select-container.opens-up.is-open .custom-select-menu {
  transform: translateY(0) scale(1);
}

.field-card:has(.custom-select-container.is-open),
.field-item:has(.custom-select-container.is-open),
.settings-grid:has(.custom-select-container.is-open),
.glass-card:has(.custom-select-container.is-open),
.sub-tab-panel:has(.custom-select-container.is-open),
.has-open-dropdown {
  overflow: visible !important;
  z-index: 10000 !important;
}

.custom-select-search-wrap {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-inner, #1e293b);
  min-width: 0;
  flex-shrink: 0;
}

[data-theme="light"] .custom-select-search-wrap {
  background: #f1f5f9;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.custom-select-search-icon {
  width: 13px;
  height: 13px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
}

.custom-select-search-input {
  width: 100% !important;
  min-width: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-main, #f8fafc) !important;
  font-size: 0.78rem !important;
  font-family: inherit !important;
  outline: none !important;
  padding: 3px 0 !important;
  height: auto !important;
  border-radius: 0 !important;
}

[data-theme="light"] .custom-select-search-input {
  color: #0f172a !important;
}

[data-theme="light"] .custom-select-search-input::placeholder {
  color: #94a3b8 !important;
}

.custom-select-options-list {
  max-height: 260px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-primary-light) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Subtitle Pacing Dropdown - Compact 2-item height so it never cuts off at the bottom */
.custom-select-container[data-select-id="styleMode"] .custom-select-options-list,
.select-styleMode .custom-select-options-list {
  max-height: 125px !important;
}

.custom-select-container[data-select-id="styleMode"] .custom-select-group-header,
.select-styleMode .custom-select-group-header {
  padding: 6px 8px 3px;
  font-size: 0.63rem;
}

.custom-select-container[data-select-id="styleMode"] .custom-select-option,
.select-styleMode .custom-select-option {
  padding: 6px 8px;
}

@media (max-width: 640px) {
  .custom-select-menu {
    max-height: calc(100vh - 170px) !important;
  }
  .custom-select-options-list {
    max-height: min(240px, calc(100vh - 220px)) !important;
    overflow-y: auto !important;
  }
  .custom-select-container[data-select-id="styleMode"] .custom-select-options-list,
  .select-styleMode .custom-select-options-list {
    max-height: 122px !important;
  }
}

.custom-select-options-list::-webkit-scrollbar {
  width: 4px;
}

.custom-select-options-list::-webkit-scrollbar-thumb {
  background: var(--brand-primary-light);
  border-radius: 3px;
}

.custom-select-group-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-primary-light);
  padding: 8px 8px 4px;
  pointer-events: none;
  white-space: normal;
  line-height: 1.3;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  margin-bottom: 3px;
}

[data-theme="light"] .custom-select-group-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  transition: all 0.12s ease;
  gap: 8px;
  min-width: 0;
}

.custom-select-option-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  direction: ltr;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.option-main-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  text-align: left;
  direction: ltr;
}

[data-theme="light"] .option-main-title {
  color: #0f172a;
}

.option-sub-desc {
  font-size: 0.67rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  text-align: left !important;
  align-self: flex-start;
  direction: ltr !important;
}

.option-sub-desc bdi {
  display: inline-block;
  text-align: left;
  unicode-bidi: isolate;
}

[data-theme="light"] .option-sub-desc {
  color: #64748b;
}

.custom-select-option:hover {
  background: rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .custom-select-option:hover {
  background: rgba(99, 102, 241, 0.08);
}

.custom-select-option.is-selected {
  background: rgba(99, 102, 241, 0.18);
}

[data-theme="light"] .custom-select-option.is-selected {
  background: rgba(99, 102, 241, 0.12);
}

.custom-select-option.is-selected .option-main-title {
  color: var(--brand-primary-light, #818cf8);
}

[data-theme="light"] .custom-select-option.is-selected .option-main-title {
  color: #4f46e5;
}

.custom-select-option .option-check-icon {
  width: 13px;
  height: 13px;
  color: var(--brand-primary-light, #818cf8);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="light"] .custom-select-option .option-check-icon {
  color: #4f46e5;
}

.custom-select-option.is-selected .option-check-icon {
  opacity: 1;
  transform: scale(1);
}

.custom-select-empty {
  padding: 14px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

input[type="text"] {
  width: 100%;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 14px;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background-color: var(--surface-glass-active);
}

input[type="text"]:focus {
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background-color: var(--surface-inner);
}

[data-theme="light"] input[type="text"] {
  background-color: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

[data-theme="light"] input[type="text"]:focus {
  background-color: #ffffff;
  border-color: var(--brand-primary);
  color: #0f172a;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Upload Zone */
.drop-zone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 46px 24px;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  background: var(--surface-inner);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--brand-primary-light);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-icon-anim {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: grid;
  place-items: center;
  color: var(--brand-primary-light);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.drop-zone:hover .drop-icon-anim {
  transform: translateY(-4px) scale(1.05);
  color: #fff;
  background: var(--brand-primary);
}

.drop-icon-anim svg {
  width: 32px;
  height: 32px;
}

.drop-headline {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.drop-subline {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-bottom: 22px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  padding: 12px 26px;
  font-size: 0.92rem;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 26px var(--accent-glow);
}

/* ── Dropzone & Engine Subtitle Sources (SubDL & OpenSubtitles) ── */
.drop-sources-wrapper,
.engine-sources-wrapper {
  margin: 22px auto 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  cursor: default;
  user-select: none;
  text-align: center;
}

.engine-sources-wrapper {
  margin: 14px auto 0 !important;
}

.drop-sources-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.drop-sources-divider .divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.drop-sources-label {
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  text-align: center;
}

.drop-sources-label .label-info-svg {
  width: 13px;
  height: 13px;
  stroke: var(--brand-primary-light, #818cf8);
  opacity: 0.85;
}

.drop-sources-pills {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.source-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-secondary, #cbd5e1);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.source-link-pill:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.22);
}

.source-link-pill:active {
  transform: translateY(0);
}

.source-link-pill .source-icon {
  width: 14px;
  height: 14px;
  stroke: var(--brand-primary-light, #818cf8);
  flex-shrink: 0;
  transition: stroke 0.2s ease, transform 0.2s ease;
}

.source-link-pill:hover .source-icon {
  stroke: #a5b4fc;
  transform: scale(1.08);
}

.source-link-pill .external-icon {
  width: 11px;
  height: 11px;
  stroke: var(--text-muted, #94a3b8);
  opacity: 0.75;
  flex-shrink: 0;
  transition: transform 0.2s ease, stroke 0.2s ease, opacity 0.2s ease;
}

.source-link-pill:hover .external-icon {
  opacity: 1;
  stroke: #ffffff;
  transform: translate(1.5px, -1.5px);
}

/* Light Theme overrides for Subtitle Sources */
[data-theme="light"] .drop-sources-divider .divider-line {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

[data-theme="light"] .source-link-pill {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .source-link-pill:hover {
  background: rgba(99, 102, 241, 0.09);
  border-color: rgba(99, 102, 241, 0.35);
  color: #1e1b4b;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* File Loaded View */
.file-loaded-view {
  animation: slideFadeIn 0.35s ease;
}

.file-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.file-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.14);
  color: var(--brand-cyan-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.file-icon-badge svg {
  width: 22px;
  height: 22px;
}

.file-info-text {
  flex: 1;
  min-width: 0;
}

.file-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
  cursor: pointer;
  transition: color 0.2s;
  max-width: 100%;
}

.file-title:hover {
  color: var(--brand-cyan-light);
  text-decoration: underline;
}

.file-stats-pills {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.pill-metric {
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 6px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-remove:hover {
  background: var(--status-error-bg);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--status-error);
}

.preview-box {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.timing-badge {
  color: var(--status-success);
  font-size: 0.72rem;
  background: var(--status-success-bg);
  padding: 2px 8px;
  border-radius: 6px;
}

.preview-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
}

.preview-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.preview-meta .block-num { color: var(--brand-primary-light); font-weight: 700; }
.preview-meta .block-tc { color: var(--brand-cyan-light); }
.preview-text-line { color: var(--text-main); font-family: var(--font-bn); }

/* Hero Action Button */
.action-cta-wrap {
  text-align: center;
  margin: 12px 0 24px;
}

.btn-hero {
  background: var(--accent-gradient);
  color: white;
  padding: 18px 52px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 36px var(--accent-glow);
  min-width: 280px;
  position: relative;
  overflow: hidden;
}

.btn-hero:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 48px var(--accent-glow);
}

.btn-hero:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

/* Missing API Keys Red Warning State on Translate Button */
.btn-hero.btn-missing-keys {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%) !important;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.45) !important;
  color: #ffffff !important;
  opacity: 1 !important;
  cursor: pointer !important;
  animation: pulse-missing-keys 2s infinite ease-in-out;
}

.btn-hero.btn-missing-keys:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 42px rgba(239, 68, 68, 0.6) !important;
  background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%) !important;
}

@keyframes pulse-missing-keys {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 10px 38px rgba(239, 68, 68, 0.7);
  }
}

/* Completed State on Translate Hero Button */
.btn-hero.btn-completed {
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%) !important;
  border-color: rgba(52, 211, 153, 0.5) !important;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.3) !important;
  cursor: default !important;
  opacity: 0.95 !important;
  pointer-events: auto !important;
}

.btn-hero.btn-completed:hover {
  transform: none !important;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.3) !important;
}

.btn-hero.btn-completed .btn-hero-title {
  color: #ffffff !important;
}

.btn-hero.btn-completed .btn-hero-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
}

.btn-hero.btn-completed .btn-hero-icon-glow {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Top Red Warning Alert Banner when API Keys are Missing */
/* Top Red Warning Alert Banner when API Keys are Missing */
.top-api-key-alert-banner {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 9px;
  margin: 0 auto 6px;
  max-width: 100%;
  width: 100%;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.06);
  animation: bannerSlideDown 0.2s ease-out;
  overflow: hidden;
  cursor: pointer;
}

[data-theme="light"] .top-api-key-alert-banner {
  background: #fff5f5;
  border-color: #fecaca;
  box-shadow: 0 1px 6px rgba(239, 68, 68, 0.05);
}

.top-alert-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 10px;
}

.top-alert-main-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.top-alert-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #ef4444;
}

.top-alert-text {
  flex: 1;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fee2e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .top-alert-text {
  color: #b91c1c;
}

.top-alert-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  height: 24px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.top-alert-btn:hover {
  background: #dc2626;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.35);
}

.top-alert-btn:active {
  transform: scale(0.98);
}

/* ── Compact Required API Keys Status Checklist (Settings Bottom) ── */
.api-required-checklist.compact-checklist {
  background: var(--surface-inner, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  padding: 6px 10px;
  margin-top: 6px;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
}

[data-theme="light"] .api-required-checklist.compact-checklist {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="dark"] .api-required-checklist.compact-checklist {
  background: rgba(30, 41, 59, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
}

.compact-checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.compact-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.compact-header-icon {
  width: 15px;
  height: 15px;
  color: #4f46e5;
  flex-shrink: 0;
}

[data-theme="light"] .compact-header-icon {
  color: #4f46e5;
}

.api-required-checklist .checklist-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: normal;
  white-space: nowrap;
  text-transform: none;
}

[data-theme="light"] .api-required-checklist .checklist-title {
  color: #0f172a;
}

.api-required-checklist .checklist-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.70rem;
  font-weight: 700;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.checklist-status-badge.badge-all-done {
  background: #dcfce7;
  border: 1px solid rgba(22, 163, 74, 0.35);
  color: #166534;
}

[data-theme="light"] .checklist-status-badge.badge-all-done {
  background: #dcfce7;
  border-color: rgba(22, 163, 74, 0.35);
  color: #166534;
}

.checklist-status-badge.badge-partial {
  background: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
}

[data-theme="light"] .checklist-status-badge.badge-partial {
  background: #fef3c7;
  border-color: rgba(217, 119, 6, 0.35);
  color: #92400e;
}

.checklist-status-badge.badge-none {
  background: #fee2e2;
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #991b1b;
}

[data-theme="light"] .checklist-status-badge.badge-none {
  background: #fee2e2;
  border-color: rgba(220, 38, 38, 0.35);
  color: #991b1b;
}

.compact-checklist-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}

.compact-checklist .checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 9px;
  padding: 6px 12px;
  min-height: 44px;
  height: auto;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
  cursor: pointer;
}

.compact-checklist .checklist-item:hover {
  filter: brightness(0.98);
}

[data-theme="light"] .compact-checklist .checklist-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
}

.compact-checklist .checklist-item.is-connected {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}

[data-theme="light"] .compact-checklist .checklist-item.is-connected {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
}

[data-theme="dark"] .compact-checklist .checklist-item.is-connected {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.compact-checklist .checklist-item.is-missing {
  border: 1px solid #fecaca;
  background: #fef2f2;
}

[data-theme="light"] .compact-checklist .checklist-item.is-missing {
  border: 1px solid #fecaca;
  background: #fef2f2;
}

[data-theme="dark"] .compact-checklist .checklist-item.is-missing {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
}

.compact-checklist .checklist-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.compact-checklist .checklist-status-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.compact-checklist .checklist-status-icon svg {
  width: 11px;
  height: 11px;
}

.compact-checklist .checklist-status-icon.status-connected {
  background: #dcfce7;
  color: #16a34a;
}

[data-theme="light"] .compact-checklist .checklist-status-icon.status-connected {
  background: #dcfce7;
  color: #16a34a;
}

.compact-checklist .checklist-status-icon.status-missing {
  background: #fee2e2;
  color: #dc2626;
}

[data-theme="light"] .compact-checklist .checklist-status-icon.status-missing {
  background: #fee2e2;
  color: #dc2626;
}

.compact-checklist .checklist-text-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.compact-checklist .checklist-item-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

[data-theme="light"] .compact-checklist .checklist-item-name {
  color: #0f172a;
}

.compact-checklist .checklist-item-status-text {
  font-size: 0.70rem;
  font-weight: 600;
  line-height: 1.15;
}

.compact-checklist .checklist-item-status-text.status-connected {
  color: #16a34a;
}

[data-theme="light"] .compact-checklist .checklist-item-status-text.status-connected {
  color: #16a34a;
}

.compact-checklist .checklist-item-status-text.status-missing {
  color: #dc2626;
}

[data-theme="light"] .compact-checklist .checklist-item-status-text.status-missing {
  color: #dc2626;
}

.compact-checklist .checklist-action-btn {
  background: #ffffff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  color: #4338ca;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  height: 24px;
  min-height: 24px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.compact-checklist .checklist-action-btn:hover {
  background: #4338ca;
  color: #ffffff;
  border-color: #4338ca;
}

[data-theme="light"] .compact-checklist .checklist-action-btn {
  background: #ffffff;
  border-color: #c7d2fe;
  color: #4338ca;
}

[data-theme="light"] .compact-checklist .checklist-action-btn:hover {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #818cf8;
}

[data-theme="dark"] .compact-checklist .checklist-action-btn {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

@keyframes bannerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-content, .btn-spinner-state {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.hero-icon {
  width: 22px;
  height: 22px;
}

.cta-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 10px;
}

/* Spinner */
.modern-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spinRotate 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spinRotate {
  to { transform: rotate(360deg); }
}

/* Live Progress Card */
.progress-section {
  animation: slideFadeIn 0.35s ease;
  scroll-margin-top: 80px;
}

.progress-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-activity-dot {
  width: 9px;
  height: 9px;
  background: var(--brand-cyan);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--brand-cyan);
  animation: pulseDot 1.4s infinite;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.live-activity-dot.is-paused {
  background: var(--status-warning, #f59e0b) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7) !important;
  animation: none !important;
}

.btn-hero.is-paused {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  box-shadow: 0 8px 32px rgba(217, 119, 6, 0.35) !important;
  opacity: 0.9 !important;
}

.btn-hero.is-paused .modern-spinner {
  border-top-color: #fbbf24 !important;
  animation-play-state: paused !important;
}

.progress-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.cloud-job-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill, 9999px);
  margin-left: 6px;
  animation: pulseBadge 2.5s infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}

[data-theme="light"] .cloud-job-badge {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(5, 150, 105, 0.4);
  color: #047857;
}

.progress-percentage {
  font-weight: 800;
  color: var(--brand-cyan-light);
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

.progress-track {
  height: 8px;
  background: var(--surface-inner);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.35s ease;
  box-shadow: 0 0 14px var(--accent-glow);
}

.progress-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .progress-stats-strip {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-cell {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-val {
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-mono);
}

.stat-good {
  color: var(--status-success);
}

/* Terminal Log */
.terminal-log-wrapper {
  background: #06080e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.terminal-bar {
  background: #0d111b;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-dots {
  display: flex;
  gap: 5px;
}

.terminal-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #f59e0b; }
.terminal-dots span:nth-child(3) { background: #10b981; }

.terminal-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.terminal-feed {
  padding: 12px 16px;
  max-height: 140px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.6;
}

.log-entry {
  display: flex;
  gap: 8px;
}

.log-entry.ok { color: #34d399; }
.log-entry.warn { color: #fbbf24; }
.log-entry.err { color: #f87171; }
.log-entry.info { color: #94a3b8; }

/* Results Section */
.result-section {
  animation: slideFadeIn 0.35s ease;
}

.result-top-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.result-success-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
  max-width: 100%;
}

.result-title-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  max-width: 100%;
  overflow: hidden;
}

.success-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm, 10px);
  background: var(--status-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--status-success);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.success-icon-badge svg {
  width: 18px;
  height: 18px;
}

.result-title-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.result-title-head-row h3,
.result-success-title h3 {
  flex: 1;
  min-width: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
}

.btn-close-result {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm, 8px);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}

.btn-close-result svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.btn-close-result:hover {
  background: var(--status-error-bg, rgba(239, 68, 68, 0.12));
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--status-error, #ef4444);
  transform: scale(1.05);
}

[data-theme="light"] .btn-close-result {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #64748b;
}

[data-theme="light"] .btn-close-result:hover {
  background: #fee2e2;
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}

.result-sub-info {
  font-size: 0.80rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.quick-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-download-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 8px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 10px);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-download-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
}

.download-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-download-options {
  background: var(--surface-card);
  border: 1px solid var(--border-bright);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.80rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 10px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-download-options:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--brand-primary-light);
  color: var(--brand-primary-light);
  transform: translateY(-1px);
}

/* Downward-Opening Compact Glass Box for Export Formats (Engine Settings Dropdown Style) */
.export-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px) !important;
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  width: min(280px, 100%) !important;
  min-width: 240px;
  background: var(--surface-card, #0f172a);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright, rgba(255, 255, 255, 0.15));
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 20px rgba(99, 102, 241, 0.2);
  padding: 8px 6px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: dropdownSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

[data-theme="light"] .export-dropdown-menu {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 2px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .export-dropdown-menu {
  background: var(--surface-card, #0f172a);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.2);
}

.export-dropdown-menu.hidden {
  display: none !important;
}

@keyframes dropdownSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.export-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  padding: 4px 8px 6px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  margin-bottom: 2px;
}

[data-theme="light"] .export-menu-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  color: #64748b;
}

.export-count-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--brand-primary-light, #818cf8);
  letter-spacing: 0;
  text-transform: none;
}

/* Scrollable Container showing exactly 3 items per scroll view */
.export-menu-list {
  max-height: 126px; /* 3 full items (38px * 3 + gaps) */
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-primary-light, #6366f1) transparent;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.export-menu-list::-webkit-scrollbar {
  width: 4px;
}

.export-menu-list::-webkit-scrollbar-track {
  background: transparent;
}

.export-menu-list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}

.export-menu-list::-webkit-scrollbar-thumb:hover {
  background: var(--brand-primary-light, #6366f1);
}

.export-menu-item {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 38px;
  text-align: left;
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

[data-theme="light"] .export-menu-item {
  color: #1e293b;
}

.export-menu-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand-primary-light, #818cf8);
}

.export-menu-item.active-format {
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
}

[data-theme="dark"] .export-menu-item.active-format {
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.2);
}

.export-ext-badge {
  font-size: 0.70rem;
  font-weight: 700;
  font-family: monospace;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

[data-theme="dark"] .export-ext-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

.export-menu-item.active-format .export-ext-badge {
  background: rgba(99, 102, 241, 0.25);
  color: #4338ca;
}

[data-theme="dark"] .export-menu-item.active-format .export-ext-badge {
  background: rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
}

.format-tag {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

[data-theme="dark"] .format-tag {
  background: rgba(14, 165, 233, 0.15) !important;
  color: #38bdf8 !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
}

.btn-download-primary svg, .btn-copy-hero svg, .btn-condense-hero svg, .btn-secondary-subtle svg, .btn-download-options svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-copy-hero {
  background: var(--surface-card);
  border: 1px solid var(--border-bright);
  color: var(--text-main);
  padding: 8px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-copy-hero:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--brand-primary-light);
  color: var(--brand-primary-light);
  transform: translateY(-1px);
}

.btn-condense-hero {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  color: #fff;
  padding: 8px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 14px rgba(139, 92, 246, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-condense-hero:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
  background: linear-gradient(135deg, #9333ea 0%, #0891b2 100%);
}

.btn-condense-hero:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary-subtle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-subtle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.card-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-pill {
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-pill.ultra-fast,
.speed-pill.speed-micro {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.speed-pill.fast,
.speed-pill.speed-fast {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.speed-pill.moderate,
.speed-pill.speed-normal {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.speed-pill.speed-dense {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.btn-card-shorten {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-card-shorten:hover {
  background: rgba(139, 92, 246, 0.25);
  color: #fff;
  border-color: #a855f7;
}

.btn-card-shorten:disabled {
  opacity: 0.4;
  cursor: wait;
}

/* Quality Badges */
.quality-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.quality-pill.success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.quality-pill.warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Preview Tabs */
.preview-tabs-nav {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 5px;
  background: var(--surface-inner);
  padding: 3px 4px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid var(--border-subtle);
}

.preview-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.preview-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.preview-tab.active {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.preview-tab:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

/* Tab View Container */
.tab-view-container {
  margin-bottom: 14px;
}

/* Codebox Tab */
.codebox-wrapper {
  position: relative;
  background: #07090e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.codebox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #0f131f;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
}

.codebox-file-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.codebox-file-name span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codebox-file-name svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--brand-cyan-light);
}

.codebox-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.codebox-copy-btn:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.codebox-content {
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.7;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  unicode-bidi: plaintext;
  text-align: start;
}

/* Formatted Card View */
.cards-scroll-view {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.subtitle-block-card {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: border-color 0.2s;
}

.subtitle-block-card:hover {
  border-color: var(--border-bright);
}

.block-header-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.block-index {
  color: var(--brand-primary-light);
  font-weight: 700;
}

.block-timecode {
  color: var(--brand-cyan-light);
}

.block-text-content {
  font-size: 0.92rem;
  font-family: var(--font-bn);
  color: var(--text-main);
  line-height: 1.5;
  unicode-bidi: plaintext;
  text-align: start;
}

/* Side-by-Side View */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 720px) {
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

.comparison-column {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.column-title-bar {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

.comparison-scroll {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Result Bottom Bar */
.result-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}

.bottom-auto-status {
  display: none !important;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

body.is-native-platform .bottom-auto-status {
  display: inline-flex !important;
}

.bottom-auto-status span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-auto-status svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--status-success);
}

.btn-secondary {
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.80rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-secondary svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}

/* Utility Animations & Helpers */
.hidden { display: none !important; }

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Mobile Optimization & Responsive Design ── */
@media (max-width: 768px) {
  .app-shell {
    padding: 16px 12px 60px;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 14px;
  }

  .brand-group {
    display: flex;
    align-items: center;
    width: auto;
    gap: 10px;
  }

  .brand-title {
    font-size: 1.25rem;
  }

  .brand-subtitle {
    font-size: 0.74rem;
  }

  .nav-badges {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .glass-card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .title-with-icon {
    gap: 10px;
  }

  .title-with-icon h3 {
    font-size: 0.98rem;
  }

  .title-with-icon .desc {
    font-size: 0.76rem;
  }

  .get-key-link {
    align-self: flex-start;
    font-size: 0.76rem;
    padding: 5px 10px;
  }

  /* API Form Row on Mobile */
  .api-form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }

  .input-glow-wrapper {
    width: 100%;
  }

  .input-glow-wrapper input {
    font-size: 0.86rem;
    padding: 12px 54px 12px 14px;
    box-sizing: border-box;
  }

  .btn-save {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  .btn-remove-key {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.88rem;
    justify-content: center;
  }

  /* Quota Dashboard on Mobile */
  .quota-dashboard {
    padding: 12px 14px;
    margin-top: 14px;
  }

  .quota-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .quota-title {
    font-size: 0.82rem;
  }

  .quota-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .quota-item {
    padding: 10px 10px;
  }

  .quota-label {
    font-size: 0.64rem;
  }

  .quota-value {
    font-size: 0.88rem;
  }

  .quota-sub {
    font-size: 0.64rem;
  }

  /* Settings Grid */
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .field-item label {
    font-size: 0.74rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .select-wrapper select {
    font-size: 0.84rem;
    padding: 11px 36px 11px 12px;
  }

  .batch-card-auto {
    padding: 12px;
  }

  .batch-card-title {
    font-size: 0.84rem;
  }

  .batch-card-sub {
    font-size: 0.72rem;
  }

  /* Dropzone on Mobile */
  .drop-zone {
    padding: 28px 14px;
  }

  .drop-icon-circle {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
  }

  .drop-icon-circle svg {
    width: 22px;
    height: 22px;
  }

  .drop-text h4 {
    font-size: 0.95rem;
  }

  .drop-text p {
    font-size: 0.76rem;
  }

  .choose-btn {
    width: 100%;
    max-width: 240px;
    padding: 11px 16px;
    font-size: 0.86rem;
  }

  /* Loaded File Info */
  .file-loaded-info {
    padding: 12px;
  }

  .file-loaded-top {
    flex-wrap: wrap;
    gap: 8px;
  }

  .file-stats-pills {
    flex-wrap: wrap;
    gap: 6px;
  }

  .f-pill {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  /* CTA Section */
  .cta-section {
    padding: 16px 0;
  }

  .btn-translate {
    width: 100%;
    padding: 14px 20px;
    font-size: 0.94rem;
  }

  .cta-hint {
    font-size: 0.74rem;
  }

  /* Progress & Terminal */
  .progress-card {
    padding: 16px 14px;
  }

  .progress-stats-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .progress-log {
    max-height: 180px;
    font-size: 0.74rem;
    padding: 10px;
  }

  /* Results Card */
  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .result-actions {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .btn-download,
  .btn-copy-full {
    width: 100%;
    justify-content: center;
    padding: 11px 16px;
    font-size: 0.86rem;
  }

  .fix-summary {
    flex-wrap: wrap;
    gap: 6px;
  }

  .quality-pill {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .preview-tabs-nav {
    display: inline-flex;
    width: fit-content;
    padding: 3px 4px;
    margin-bottom: 10px;
    gap: 4px;
  }

  .preview-tab {
    padding: 7px 12px;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .codebox-content {
    font-size: 0.78rem;
    padding: 12px;
    max-height: 300px;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comparison-column {
    padding: 10px;
  }

  .cards-scroll-view {
    max-height: 300px;
  }

  .result-bottom-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .quota-grid {
    grid-template-columns: 1fr;
  }

  .brand-title {
    font-size: 1.15rem;
  }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ── Collapsible SEO & Guide Master Drawer ── */
.seo-collapsible-wrapper {
  margin-top: 32px;
}

.seo-toggle-bar-card {
  background: var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.seo-toggle-bar-card:hover {
  border-color: var(--brand-primary-light);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.12);
}

.seo-collapsible-wrapper.is-open .seo-toggle-bar-card {
  border-color: var(--border-bright);
  background: var(--surface-glass-active);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.15);
}

.btn-seo-guide-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  text-align: left;
}

.seo-guide-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.seo-guide-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--brand-primary-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.25s ease;
}

.seo-guide-icon-badge svg {
  width: 20px;
  height: 20px;
}

.seo-collapsible-wrapper.is-open .seo-guide-icon-badge {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.seo-guide-main-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.seo-guide-pill-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-primary-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.seo-guide-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.seo-guide-action {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.seo-guide-action-text {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-primary-light);
}

.seo-guide-chevron-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  display: grid;
  place-items: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-guide-chevron-circle svg {
  width: 15px;
  height: 15px;
  color: var(--brand-primary-light);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-collapsible-wrapper.is-open .seo-guide-chevron-circle {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--brand-primary-light);
}

.seo-collapsible-wrapper.is-open .seo-guide-chevron-circle svg {
  transform: rotate(180deg);
}

/* Collapsible Body with Smooth Grid Transition */
.seo-guide-collapse-container {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-collapsible-wrapper.is-open .seo-guide-collapse-container {
  grid-template-rows: 1fr;
}

.seo-guide-collapse-inner {
  overflow: hidden;
}

@media (max-width: 640px) {
  .btn-seo-guide-toggle {
    padding: 14px 16px;
  }
  .seo-guide-subtext {
    display: none;
  }
  .seo-guide-action-text {
    display: none;
  }
}

/* ── SEO & Content Sections ── */
.seo-features-section,
.seo-steps-section,
.seo-faq-section {
  margin-top: 24px;
  padding: 32px 28px;
}

.seo-section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 28px auto;
}

.seo-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-primary-light);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.seo-h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
}

.seo-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Features Grid */
.seo-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.seo-feature-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.seo-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(255, 255, 255, 0.035);
}

.feature-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.feature-icon-box svg {
  width: 18px;
  height: 18px;
}

.seo-feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.seo-feature-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* How It Works Grid */
.seo-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.seo-step-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  position: relative;
  transition: transform var(--transition-fast);
}

.seo-step-card:hover {
  transform: translateY(-2px);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand-primary-light);
  opacity: 0.4;
  margin-bottom: 10px;
}

.seo-step-card h3 {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.seo-step-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* FAQ Accordion List */
.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seo-faq-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-faq-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(255, 255, 255, 0.035);
}

.seo-faq-item.is-open {
  border-color: var(--border-bright);
  background: var(--surface-glass-active);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}

.faq-q-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: color 0.2s ease;
}

.faq-q-btn:hover {
  color: var(--brand-primary-light);
}

.seo-faq-item.is-open .faq-q-btn {
  color: var(--brand-primary-light);
}

.faq-toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-inner);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-toggle-icon svg {
  width: 14px;
  height: 14px;
  color: var(--brand-primary-light);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-faq-item.is-open .faq-toggle-icon {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
}

.seo-faq-item.is-open .faq-toggle-icon svg {
  transform: rotate(180deg);
}

/* Smooth Accordion Height Collapse */
.faq-ans-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.seo-faq-item.is-open .faq-ans-collapse {
  grid-template-rows: 1fr;
}

.faq-ans-inner {
  overflow: hidden;
}

.faq-a {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 0 20px 18px 20px;
}

/* Footer */
.site-footer {
  margin-top: 36px;
  padding: 24px 0 36px 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.footer-brand {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-brand span {
  font-weight: 700;
  color: var(--text-main);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--brand-primary-light);
}

.footer-copy {
  font-size: 0.74rem;
  color: var(--text-dim);
}

@media (max-width: 768px) {
  .seo-features-grid,
  .seo-steps-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
  }

  .incomplete-warning-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn-warning-retry {
    width: 100%;
    justify-content: center;
  }
}

/* Incomplete Batch Warning Banner */
.incomplete-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--status-warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  animation: slideInDown 0.3s ease-out;
}

.warning-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--status-warning);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.warning-icon-wrap svg {
  width: 22px;
  height: 22px;
}

.warning-text-content {
  flex: 1;
}

.warning-text-content strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.warning-text-content p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-warning-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f59e0b;
  color: #000;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-warning-retry:hover {
  background: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* Progress Action Controls (Pause / Resume / Cancel) */
.progress-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-progress-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-progress-ctrl:hover {
  background: var(--surface-glass-active);
  border-color: var(--brand-primary-light);
  color: var(--brand-primary-light);
}

.btn-progress-ctrl svg {
  width: 12px;
  height: 12px;
}

.btn-progress-ctrl.is-paused {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.btn-progress-cancel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-progress-cancel:hover {
  background: var(--status-error-bg);
  border-color: var(--status-error);
  color: var(--status-error);
}

.btn-progress-cancel svg {
  width: 12px;
  height: 12px;
}

.restored-tag {
  background: rgba(99, 102, 241, 0.15) !important;
  color: var(--brand-primary-light) !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.2); }
  50% { box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.35); }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalPopOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }
}

/* =========================================================
   Custom Modern Modal Dialog System (Warnings & Alerts)
   ========================================================= */

.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000000 !important;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transform: translateZ(0);
  will-change: opacity;
  animation: modalFadeIn 0.36s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease;
}

[data-theme="light"] .custom-modal-backdrop {
  background: rgba(15, 23, 42, 0.65);
}

.custom-modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.custom-modal-box {
  position: relative;
  width: 90%;
  max-width: 360px;
  background: var(--surface-card, #0f172a);
  border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14));
  border-radius: var(--radius-md, 20px);
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 0, 0, 0.3);
  padding: 24px 20px 20px;
  text-align: center;
  overflow: hidden;
  transform: translateZ(0);
  will-change: transform, opacity;
  animation: modalPopIn 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-modal-backdrop.hidden .custom-modal-box {
  transform: scale(0.92) translateY(10px);
}

.modal-top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  transition: background 0.3s ease;
}

.modal-type-danger .modal-top-accent {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.modal-type-warning .modal-top-accent {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

.modal-type-info .modal-top-accent {
  background: var(--accent-gradient);
}

.modal-icon-badge {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.modal-icon-badge svg {
  width: 22px;
  height: 22px;
}

.modal-type-warning .modal-icon-badge,
.modal-icon-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.modal-type-danger .modal-icon-badge {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.modal-type-info .modal-icon-badge {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--brand-primary-light);
  box-shadow: 0 0 16px var(--accent-glow);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.modal-message {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 16px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.modal-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.btn-modal-cancel {
  flex: 1;
  min-width: 0;
  background: var(--surface-inner, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14));
  color: var(--text-main, #f1f5f9);
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-modal-cancel:hover {
  background: var(--surface-glass-active, rgba(255, 255, 255, 0.12));
  border-color: var(--text-muted);
  color: #fff;
  transform: translateY(-1px);
}

[data-theme="light"] .btn-modal-cancel {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .btn-modal-cancel:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-modal-confirm {
  flex: 1.15;
  min-width: 0;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-modal-confirm:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.btn-modal-confirm:active,
.btn-modal-cancel:active {
  transform: scale(0.96);
}

.btn-modal-confirm.btn-info {
  background: var(--accent-gradient);
  border: 1px solid var(--border-bright);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-modal-confirm.btn-info:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-modal-confirm.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* Mobile Navigation & 2-Tab Layout Responsive Enhancements */
@media (max-width: 640px) {
  .top-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    width: auto;
  }

  .app-main-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .app-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 9px 12px;
    font-size: 0.84rem;
  }

  .sub-tabs-container {
    width: 100%;
    margin-bottom: 16px;
  }

  .sub-tabs-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .sub-tab-pill {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.82rem;
    gap: 6px;
  }

  .nav-badges {
    justify-content: space-between;
    width: 100%;
  }

  .lock-guard-card {
    padding: 24px 16px;
  }

  .lock-title {
    font-size: 1.12rem;
  }

  .lock-desc {
    font-size: 0.84rem;
  }

  .btn-lock-cta {
    width: 100%;
    justify-content: center;
    font-size: 0.86rem;
    padding: 12px 16px;
  }

  .app-info-grid {
    grid-template-columns: 1fr;
  }

  .apk-download-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .btn-apk-download {
    width: 100%;
    justify-content: center;
  }
}

/* ── Standalone Android App (APK) Download Section ── */
.apk-download-section {
  margin-top: 24px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(6, 182, 212, 0.04) 100%), var(--surface-card);
}

.apk-icon {
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.apk-download-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.apk-info-content {
  flex: 1;
}

.apk-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.apk-app-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}

.apk-version-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--status-success);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.apk-desc-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.btn-apk-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(16, 185, 129, 0.5);
  border-radius: var(--radius-sm);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-apk-download:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  color: #ffffff;
}

.btn-apk-download svg {
  width: 17px;
  height: 17px;
}

/* ── Hide APK Download Banners when running inside native Android App ── */
body.is-native-platform .apk-download-section,
body.is-native-platform .header-apk-btn,
body.is-native-platform #apkTranslatorBanner,
body.is-native-platform #apkDownloadSection {
  display: none !important;
}

/* Native App Compact Cloud History Adjustments */
body.is-native-platform .cloud-history-item {
  padding: 6px 8px;
  gap: 3px;
}

body.is-native-platform .cloud-item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  flex-wrap: nowrap;
  width: 100%;
  margin: 1px 0 3px 0;
  font-size: 0.55rem;
  line-height: 1;
}

body.is-native-platform .meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.55rem;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  line-height: 1;
}

body.is-native-platform .meta-pill span {
  font-size: 0.55rem;
  line-height: 1;
}

body.is-native-platform .meta-svg {
  width: 8.5px;
  height: 8.5px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

body.is-native-platform .meta-expiry-pill {
  font-size: 0.55rem;
  font-weight: 700;
  flex-shrink: 0;
}

body.is-native-platform .history-modal-box {
  max-width: 96vw;
  width: 96vw;
  margin: auto 6px;
}

body.is-native-platform .history-modal-content-list {
  padding: 6px 6px;
  gap: 4px;
}

/* ── Ultra-Modern Google Sign-In & Cloud Sync Navigation Styles ── */
.user-auth-badge {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-google-sign-in {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-google-sign-in:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(66, 133, 244, 0.5);
  box-shadow: 0 4px 16px rgba(66, 133, 244, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-google-sign-in svg {
  width: 15px;
  height: 15px;
}

.user-profile-wrap {
  position: relative;
}

.user-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-profile-btn:hover {
  border-color: var(--brand-primary);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.user-avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #6366f1;
}

.user-short-name {
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: #0f172a;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 12px);
  padding: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: modalSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-user-info {
  padding: 8px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dropdown-user-info strong {
  font-size: 0.88rem;
  color: #f8fafc;
}

.dropdown-user-email {
  font-size: 0.74rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 0.72rem;
  color: #34d399;
  font-weight: 600;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.sync-dot.dot-off {
  background: #64748b;
  box-shadow: none;
}

.dropdown-btn-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.dropdown-btn-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.dropdown-btn-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}

.dropdown-btn-item.item-logout {
  color: #f87171;
}

.dropdown-btn-item.item-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ── Google Cloud Sync Settings Card (Compact Single-Line Strip) ── */
.auth-card-section {
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

.auth-sync-banner-simple {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
}

.auth-banner-text-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.google-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(66, 133, 244, 0.12);
  border: 1px solid rgba(66, 133, 244, 0.3);
  border-radius: 8px;
  padding: 5px;
  flex-shrink: 0;
}

.google-icon-wrap svg {
  width: 15px;
  height: 15px;
}

.auth-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.auth-banner-copy h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.auth-banner-copy p {
  font-size: 0.67rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-google-connect {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all var(--transition-fast);
}

[data-theme="light"] .btn-google-connect {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.btn-google-connect:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #4285f4;
  box-shadow: 0 4px 14px rgba(66, 133, 244, 0.35);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-google-connect:hover {
  background: #f8fafc !important;
  border-color: #4285f4 !important;
  box-shadow: 0 3px 10px rgba(66, 133, 244, 0.2) !important;
}

.btn-google-connect svg {
  width: 14px;
  height: 14px;
}

.logged-in-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 2px 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md, 12px);
}

.profile-avatar-medium {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #6366f1;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

.profile-meta-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
}

.auth-sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(100, 116, 139, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.auth-sync-status-badge.sync-active {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.profile-meta-info strong {
  font-size: 0.95rem;
  color: var(--text-main, #f8fafc);
}

.profile-email-text {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}

.profile-action-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sync-cloud {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 8px 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-sync-cloud:hover {
  background: rgba(99, 102, 241, 0.28);
  color: #ffffff;
  border-color: #818cf8;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.btn-sync-cloud svg {
  width: 15px;
  height: 15px;
}

.btn-sign-out {
  display: inline-flex;
  align-items: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 8px 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-sign-out:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}


/* ── 3-Day Cloud Subtitle Archive Styles (Compact Zero-Scroll Fit) ── */
.cloud-history-section {
  margin-bottom: 12px;
  padding: 14px 16px;
}

.cloud-history-section .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 0;
}

.cloud-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 8px;
  padding: 5px;
  color: #38bdf8;
  width: 28px;
  height: 28px;
}

.cloud-icon-wrap svg {
  width: 15px;
  height: 15px;
}

.btn-refresh-history {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  height: 28px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-refresh-history:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}

.btn-refresh-history svg {
  width: 12px;
  height: 12px;
}

.cloud-history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-clear-all-history {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.69rem;
  font-weight: 600;
  cursor: pointer;
  height: 25px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-clear-all-history:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

.btn-clear-all-history svg {
  width: 11px;
  height: 11px;
}

[data-theme="light"] .btn-clear-all-history {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

[data-theme="light"] .btn-clear-all-history:hover {
  background: #fecaca;
  border-color: #f87171;
  color: #b91c1c;
}

.cloud-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #94a3b8;
}

.cloud-history-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
  color: #38bdf8;
}

.cloud-history-empty p {
  font-size: 0.78rem;
  max-width: 400px;
  line-height: 1.4;
  margin: 0;
  color: #94a3b8;
}

.cloud-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cloud-history-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cloud-history-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(30, 41, 59, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* In-Progress Cloud History Card */
.cloud-history-item.is-in-progress {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 24px rgba(14, 165, 233, 0.18);
  position: relative;
  overflow: hidden;
}

.cloud-history-item.is-in-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, transparent);
  animation: inProgressHeaderGlow 2.5s infinite linear;
}

@keyframes inProgressHeaderGlow {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

.in-progress-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  letter-spacing: 0.3px;
}

.in-progress-badge .pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseDot 1.4s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.history-in-progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 2px 0;
  width: 100%;
}

.history-in-progress-bar {
  height: 5px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.history-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #6366f1);
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.history-progress-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 500;
  flex-wrap: nowrap;
}

.cloud-running-tag {
  color: #38bdf8;
  font-weight: 600;
  font-size: 0.70rem;
}

.btn-cloud-view-live {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600 !important;
  padding: 5px 12px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-size: 0.74rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35) !important;
}

.btn-cloud-view-live:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.5) !important;
}

.btn-cloud-cancel-job {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 0.74rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.btn-cloud-cancel-job:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fca5a5 !important;
}

[data-theme="light"] .cloud-history-item.is-in-progress {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.12);
}

[data-theme="light"] .cloud-history-item.is-in-progress .cloud-item-title {
  color: #0f172a;
}

[data-theme="light"] .history-in-progress-bar {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .history-progress-status-row {
  color: #475569;
}

.cloud-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.cloud-item-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  flex-wrap: nowrap;
}

.cloud-title-group {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1 1 auto;
}

.cloud-item-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 0 1 auto;
}

.condensed-badge-mini,
.condensed-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  white-space: nowrap;
  flex-shrink: 0;
  height: 17px;
  line-height: 1;
}

.condensed-badge-mini svg,
.condensed-badge svg {
  width: 9px;
  height: 9px;
  color: #818cf8;
  flex-shrink: 0;
}

[data-theme="light"] .condensed-badge-mini,
[data-theme="light"] .condensed-badge {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  color: #4f46e5;
}

[data-theme="light"] .condensed-badge-mini svg,
[data-theme="light"] .condensed-badge svg {
  color: #4f46e5;
}

.cloud-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  flex-wrap: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 2px 0 5px 0;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.meta-svg {
  width: 11px;
  height: 11px;
  color: #94a3b8;
  display: inline-block;
  vertical-align: -1px;
  flex-shrink: 0;
}

.meta-expiry-pill {
  color: #fbbf24;
  font-weight: 600;
}

.meta-expiry-pill .meta-svg {
  color: #fbbf24;
}

.meta-expiry-pill.urgent {
  color: #f87171;
  font-weight: 700;
}

.meta-expiry-pill.urgent .meta-svg {
  color: #f87171;
}

[data-theme="light"] .meta-expiry-pill {
  color: #d97706;
}

[data-theme="light"] .meta-expiry-pill .meta-svg {
  color: #d97706;
}

[data-theme="light"] .meta-expiry-pill.urgent {
  color: #dc2626;
}

[data-theme="light"] .meta-expiry-pill.urgent .meta-svg {
  color: #dc2626;
}

.cloud-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.btn-cloud-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  height: 28px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.btn-cloud-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
}

.btn-cloud-download svg {
  width: 12px;
  height: 12px;
}

.btn-cloud-condense {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  height: 28px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}

.btn-cloud-condense:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
}

.btn-cloud-condense svg {
  width: 12px;
  height: 12px;
}

.btn-cloud-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-cloud-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-cloud-delete svg {
  width: 13px;
  height: 13px;
}

/* History Meta Pills without Emojis */
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-svg {
  width: 12px;
  height: 12px;
  color: #94a3b8;
  display: inline-block;
  vertical-align: -1px;
  flex-shrink: 0;
}

/* ── Cloud History Shimmer & Loading State ── */
.cloud-history-loading {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.25s ease;
}

.cloud-history-skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-skeleton-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md, 12px);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .history-skeleton-card {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

.skeleton-shimmer {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite linear;
  border-radius: 6px;
}

[data-theme="light"] .skeleton-shimmer {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-title {
  width: 45%;
  height: 18px;
}

.skeleton-meta {
  width: 75%;
  height: 14px;
}

.cloud-loading-spinner-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 4px 0 6px 0;
}

.history-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(99, 102, 241, 0.25);
  border-top-color: var(--brand-primary-light, #6366f1);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* See All History Button */
.see-all-history-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.btn-see-all-history {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  padding: 9px 20px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-see-all-history:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--brand-primary-light, #6366f1);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-see-all-history svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.btn-see-all-history.is-expanded svg {
  transform: rotate(180deg);
}

/* ── Modern Glass Confirmation & Alert Modal Dialog ── */

.modal-top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.modal-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  margin-bottom: 16px;
}

.modal-icon-warning {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.modal-icon-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.modal-icon-badge svg {
  width: 26px;
  height: 26px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 8px 0;
}

.modal-message {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 24px 0;
}

.modal-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-modal-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 10px 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.btn-modal-confirm {
  flex: 1;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.modal-input-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
  text-align: left;
}

.modal-input-field {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm, 8px);
  padding: 11px 14px;
  font-size: 0.92rem;
  color: #f8fafc;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
  text-align: left;
  box-sizing: border-box;
}

.modal-input-field:focus {
  border-color: var(--brand-primary-light, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.modal-char-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 6px;
  padding: 0 2px;
}

.modal-char-counter.is-limit .char-count-text {
  color: #f87171;
  font-weight: 700;
}

.char-limit-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
}

[data-theme="light"] .modal-input-field {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .modal-input-field:focus {
  background: #ffffff;
  border-color: #6366f1;
}

[data-theme="light"] .modal-char-counter {
  color: #64748b;
}

/* ── Custom API Provider Panel Styling ── */
.custom-api-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
  width: 100%;
}

.custom-api-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.custom-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
}

.custom-field-hint {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-dim, #64748b);
}

[data-theme="light"] .custom-field-label {
  color: #1e293b;
}

[data-theme="light"] .custom-field-hint {
  color: #64748b;
}

.custom-detected-models-box {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md, 10px);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

[data-theme="light"] .custom-detected-models-box {
  background: #eef2ff;
  border-color: rgba(99, 102, 241, 0.3);
}

.detected-models-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detected-models-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-primary-light, #818cf8);
  text-transform: uppercase;
}

[data-theme="light"] .detected-models-title {
  color: #4f46e5;
}

.detected-models-count {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill, 9999px);
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-main, #ffffff);
}

[data-theme="light"] .detected-models-count {
  background: #c7d2fe;
  color: #312e81;
}

.detected-models-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-height: 120px;
  overflow-y: auto;
}

.detected-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-card, #1e293b);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-family: monospace;
  color: var(--text-main, #f8fafc);
  cursor: pointer;
  transition: all 0.15s ease;
}

.detected-model-pill:hover {
  border-color: var(--brand-primary-light, #818cf8);
  background: var(--surface-hover, #334155);
  transform: translateY(-1px);
}

.detected-model-pill.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

[data-theme="light"] .detected-model-pill {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

[data-theme="light"] .detected-model-pill.active {
  border-color: #059669;
  background: #d1fae5;
  color: #065f46;
}

.custom-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-test-ping {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm, 8px);
}

.custom-api-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--radius-md, 10px);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #fde68a;
}

[data-theme="light"] .custom-api-tip-card {
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.3);
  color: #92400e;
}

.tip-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #fbbf24;
  margin-top: 2px;
}

[data-theme="light"] .tip-icon {
  color: #d97706;
}

.code-pill {
  background: rgba(0, 0, 0, 0.35);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
}

[data-theme="light"] .code-pill {
  background: #e2e8f0;
  color: #0369a1;
}

/* Filename Group & Rename Trigger */
.file-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  flex-wrap: wrap;
}

.btn-rename-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-rename-trigger:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-rename-trigger svg {
  width: 12px;
  height: 12px;
}

.btn-cloud-rename {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-cloud-rename:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-cloud-rename svg {
  width: 12px;
  height: 12px;
}

/* Result Section File Pill */
.result-file-pill-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  max-width: 100%;
  min-width: 0;
}

.result-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  padding: 3px 9px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.76rem;
  font-weight: 600;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.result-file-icon {
  width: 12px;
  height: 12px;
  color: var(--brand-primary-light, #818cf8);
  flex-shrink: 0;
}

.result-file-pill #resultFileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  display: block;
}

.result-file-pill:hover {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.22);
  color: #ffffff;
}

[data-theme="light"] .result-file-pill {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}

[data-theme="light"] .result-file-pill:hover {
  background: #ddd6fe;
  color: #4c1d95;
}

/* ── Dedicated All-History Modal Popup ── */
.history-modal-backdrop {
  z-index: 1000000 !important;
  background: rgba(3, 7, 18, 0.82);
  transform: translateZ(0);
  will-change: opacity;
  animation: modalFadeIn 0.18s ease-out;
}

[data-theme="light"] .history-modal-backdrop {
  background: rgba(15, 23, 42, 0.65);
}

.history-modal-box {
  position: relative;
  background: #0f172a;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateZ(0);
  will-change: transform, opacity;
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  text-align: left;
}

[data-theme="light"] .history-modal-box {
  background: #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.history-modal-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 22px 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .history-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.history-modal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.history-modal-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.01em;
  margin: 0;
  min-width: 0;
}

[data-theme="light"] .history-modal-heading {
  color: #0f172a;
}

.history-count-badge {
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="light"] .history-count-badge {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #6366f1;
}

.history-modal-header-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.history-modal-subline {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

[data-theme="light"] .history-modal-subline {
  color: #64748b;
}

.btn-history-clear-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #f87171;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  height: 24px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-history-clear-all:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
  transform: translateY(-1px);
}

.btn-history-clear-all svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

[data-theme="light"] .btn-history-clear-all {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

[data-theme="light"] .btn-history-clear-all:hover {
  background: #fecaca;
  border-color: #f87171;
  color: #b91c1c;
}

.btn-history-modal-close {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.btn-history-modal-close svg {
  width: 12px;
  height: 12px;
}

.btn-history-modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

[data-theme="light"] .btn-history-modal-close {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #64748b;
}

.history-modal-search-bar {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

[data-theme="light"] .history-modal-search-bar {
  background: #f8fafc;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.history-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.history-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 2;
  transition: color 0.2s ease;
}

[data-theme="light"] .history-search-icon {
  color: #64748b;
}

.history-search-input-wrap:focus-within .history-search-icon {
  color: #6366f1;
}

input[type="text"].history-search-input,
.history-search-input {
  width: 100% !important;
  height: 40px !important;
  padding: 9px 38px 9px 42px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  font-size: 0.88rem !important;
  outline: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

input[type="text"].history-search-input::placeholder,
.history-search-input::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}

input[type="text"].history-search-input:focus,
.history-search-input:focus {
  border-color: #6366f1 !important;
  background: rgba(15, 23, 42, 0.85) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22) !important;
}

[data-theme="light"] input[type="text"].history-search-input,
[data-theme="light"] .history-search-input {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.14) !important;
  color: #0f172a !important;
}

[data-theme="light"] input[type="text"].history-search-input::placeholder,
[data-theme="light"] .history-search-input::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] input[type="text"].history-search-input:focus,
[data-theme="light"] .history-search-input:focus {
  background: #ffffff !important;
  border-color: #6366f1 !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18) !important;
}

.btn-history-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.15s ease;
  z-index: 2;
}

.btn-history-clear-search:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="light"] .btn-history-clear-search {
  color: #64748b;
}

[data-theme="light"] .btn-history-clear-search:hover {
  background: #fee2e2;
  color: #dc2626;
}

.history-modal-content-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  text-align: center;
  color: #94a3b8;
  gap: 12px;
}

.history-modal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
  color: #64748b;
  gap: 10px;
  font-size: 0.88rem;
}

/* ── Dedicated Downloads Manager Modal / Drawer ── */
.downloads-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000000 !important;
  background: rgba(3, 7, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  visibility: visible;
  transform: translateZ(0);
  will-change: opacity;
  animation: modalFadeIn 0.18s ease-out;
  transition: opacity 0.18s ease;
}

[data-theme="light"] .downloads-drawer-backdrop {
  background: rgba(15, 23, 42, 0.65);
}

.downloads-modal-box {
  position: relative;
  background: #0f172a;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateZ(0);
  will-change: transform, opacity;
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  text-align: left;
}

[data-theme="light"] .downloads-modal-box {
  background: #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.downloads-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 10px;
}

[data-theme="light"] .downloads-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.downloads-modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.downloads-modal-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  white-space: nowrap;
}

[data-theme="light"] .downloads-modal-heading {
  color: #0f172a;
}

.downloads-count-badge {
  font-size: 0.70rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
}

.downloads-path-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.64rem;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.22);
  padding: 2px 7px;
  border-radius: 6px;
  margin-top: 2px;
  width: fit-content;
}

[data-theme="light"] .downloads-path-badge {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.downloads-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-downloads-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-downloads-clear:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.btn-downloads-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-downloads-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

[data-theme="light"] .btn-downloads-close {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #64748b;
}

.downloads-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}

/* Active Downloads Section */
.downloads-active-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}

.active-download-card {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme="light"] .active-download-card {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.2);
}

.active-download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.active-download-title {
  font-size: 0.80rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="light"] .active-download-title {
  color: #0f172a;
}

.active-download-status {
  font-size: 0.68rem;
  font-weight: 700;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.active-download-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

[data-theme="light"] .active-download-progress-track {
  background: rgba(0, 0, 0, 0.08);
}

.active-download-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* Downloaded Card Item */
.download-card-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.download-card-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .download-card-item {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .download-card-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.download-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.download-card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.download-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

[data-theme="light"] .download-card-title {
  color: #0f172a;
}

.download-card-top-row .condensed-badge-mini,
.download-card-top-row .condensed-badge {
  font-size: 0.58rem;
  padding: 1px 5px;
  height: 17px;
  flex-shrink: 0;
}

.download-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.download-card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.btn-download-share {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  border: none;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  height: 28px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-download-share:hover {
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.4);
}

.btn-download-condense {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  height: 28px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-download-condense:hover {
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.4);
}

.btn-download-delete {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-download-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.downloads-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
  gap: 10px;
  color: #94a3b8;
}

.downloads-empty-state svg {
  width: 42px;
  height: 42px;
  opacity: 0.5;
  color: #6366f1;
}

.downloads-empty-state h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
}

[data-theme="light"] .downloads-empty-state h4 {
  color: #0f172a;
}

.downloads-empty-state p {
  margin: 0;
  font-size: 0.74rem;
  max-width: 320px;
  line-height: 1.4;
  color: #94a3b8;
}

/* ── Offline Faded Lockout System ── */
body > *:not(#offlineLockoutModal) {
  transition: filter 0.55s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

body.is-offline-lockout > *:not(#offlineLockoutModal) {
  filter: blur(6px) grayscale(30%) !important;
  opacity: 0.34 !important;
  pointer-events: none !important;
  user-select: none !important;
}

.offline-lockout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 9, 20, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              backdrop-filter 0.45s ease,
              -webkit-backdrop-filter 0.45s ease;
  will-change: opacity, backdrop-filter;
}

[data-theme="light"] .offline-lockout-backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.offline-lockout-backdrop.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.offline-lockout-backdrop.hidden {
  display: none !important;
}

.offline-lockout-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 22px 22px 22px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 40px rgba(239, 68, 68, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  transform: scale(0.92) translateY(24px);
  opacity: 0;
  transition: transform 0.48s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease,
              border-color 0.4s ease,
              background 0.4s ease;
  will-change: transform, opacity;
}

.offline-lockout-backdrop.is-visible .offline-lockout-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

[data-theme="light"] .offline-lockout-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 30px rgba(239, 68, 68, 0.1);
}

.offline-lockout-card.is-online {
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 40px rgba(16, 185, 129, 0.22);
}

[data-theme="light"] .offline-lockout-card.is-online {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 30px rgba(16, 185, 129, 0.15);
}

.offline-top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #ef4444);
  transition: background 0.3s ease;
}

.offline-lockout-card.is-online .offline-top-accent {
  background: linear-gradient(90deg, #10b981, #06b6d4, #10b981);
}

.offline-icon-container {
  position: relative;
  margin-bottom: 14px;
}

.offline-icon-halo {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, transparent 70%);
  animation: offlineHaloPulse 2.6s infinite ease-in-out;
  transition: background 0.4s ease;
}

.offline-lockout-card.is-online .offline-icon-halo {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.28) 0%, transparent 70%);
}

.offline-lockout-card.is-reconnecting .offline-icon-halo {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.28) 0%, transparent 70%);
}

@keyframes offlineHaloPulse {
  0%, 100% { transform: scale(0.94); opacity: 0.45; }
  50% { transform: scale(1.15); opacity: 0.95; }
}

.offline-icon-bubble {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.offline-lockout-card.is-online .offline-icon-bubble {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.offline-status-svg {
  width: 26px;
  height: 26px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.offline-badge-wrap {
  margin-bottom: 10px;
}

.offline-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.offline-status-badge.badge-online {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.offline-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: offlineDotBlink 1.4s infinite ease-in-out;
}

@keyframes offlineDotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.offline-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

[data-theme="light"] .offline-title {
  color: #0f172a;
}

.offline-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #94a3b8;
  margin: 0 0 16px 0;
}

[data-theme="light"] .offline-desc {
  color: #64748b;
}

/* In-Progress Preview Box */
.offline-progress-preview {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  text-align: left;
}

[data-theme="light"] .offline-progress-preview {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.08);
}

.offline-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.offline-preview-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #94a3b8;
}

.offline-preview-state {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 7px;
  border-radius: 6px;
}

.offline-preview-file {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

[data-theme="light"] .offline-preview-file {
  color: #0f172a;
}

.offline-preview-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

[data-theme="light"] .offline-preview-progress-track {
  background: rgba(0, 0, 0, 0.08);
}

.offline-preview-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.offline-preview-stats {
  font-size: 0.70rem;
  color: #94a3b8;
}

/* Actions Row */
.offline-actions-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offline-waiting-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 6px 12px;
  animation: offlineFadeSlideUp 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.offline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(239, 68, 68, 0.25);
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: offlineSpin 0.8s linear infinite;
}

@keyframes offlineSpin {
  to { transform: rotate(360deg); }
}

@keyframes offlineFadeSlideUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.btn-offline-resume {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: offlineFadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-offline-resume:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-offline-resume svg {
  width: 15px;
  height: 15px;
}

.btn-offline-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.25s ease;
  animation: offlineFadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-offline-continue:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
}

.btn-offline-keep-paused {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  height: 34px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: offlineFadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-offline-keep-paused:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

[data-theme="light"] .btn-offline-keep-paused {
  border-color: rgba(0, 0, 0, 0.12);
  color: #64748b;
}

[data-theme="light"] .btn-offline-keep-paused:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #0f172a;
}

/* ── Reconnecting Loading State Styles ── */
.offline-lockout-card.is-reconnecting .offline-top-accent {
  background: linear-gradient(90deg, #0ea5e9, #6366f1, #38bdf8);
}

.offline-lockout-card.is-reconnecting .offline-icon-bubble {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.35);
  color: #38bdf8;
}

.offline-status-badge.badge-reconnecting {
  background: rgba(14, 165, 233, 0.15) !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
  color: #38bdf8 !important;
}

[data-theme="light"] .offline-status-badge.badge-reconnecting {
  background: rgba(14, 165, 233, 0.1) !important;
  border-color: rgba(14, 165, 233, 0.35) !important;
  color: #0284c7 !important;
}

.offline-status-badge.badge-reconnecting .offline-pulse-dot {
  background: #0ea5e9 !important;
  box-shadow: 0 0 10px #0ea5e9 !important;
}

.offline-sync-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 10px 14px;
  border-radius: 14px;
  width: 100%;
  animation: offlineFadeSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

[data-theme="light"] .offline-sync-indicator {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.25);
}

.offline-sync-spinner-wrap {
  position: relative;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.offline-spinner-sync {
  width: 26px;
  height: 26px;
  border: 2.5px solid rgba(14, 165, 233, 0.2);
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: offlineSpin 0.75s linear infinite;
}

.offline-sync-icon {
  position: absolute;
  width: 11px;
  height: 11px;
  color: #0ea5e9;
  animation: offlinePulse 1.4s infinite ease-in-out;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.92); }
}

.offline-sync-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
}

.offline-sync-status {
  font-size: 0.80rem;
  font-weight: 700;
  color: #38bdf8;
  line-height: 1.2;
}

[data-theme="light"] .offline-sync-status {
  color: #0284c7;
}

.offline-sync-sub {
  font-size: 0.70rem;
  color: #94a3b8;
  line-height: 1.2;
}

[data-theme="light"] .offline-sync-sub {
  color: #64748b;
}

/* ═══════════════════════════════════════════════════════════════════
   ULTRA-PREMIUM NATIVE APP EXPERIENCE (MOBILE & DESKTOP SUITE)
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Native Mobile Touch & Feel Defaults (Zero Web Jank) ── */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none;
  box-sizing: border-box;
}

html, body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
}

body {
  -webkit-user-select: none;
  user-select: none;
}

/* Allow text selection ONLY in text areas, code boxes, logs, and inputs */
input, textarea, [contenteditable="true"], .terminal-feed, .raw-srt-editor, .tab-view-container, .preview-list, .field-item input {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* Tactile Spring Press Micro-Interactions (Haptic Feel) */
button:not(.input-action-btn), .btn, .app-tab-btn, .bottom-nav-btn, .custom-select-trigger, .faq-q-btn, .sub-tab-pill, .preset-pill, .btn-action-pill, .model-select-btn, .cloud-action-btn, .provider-tab-pill {
  touch-action: manipulation;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
}

button:active:not(:disabled):not(.input-action-btn),
.btn:active:not(:disabled),
.app-tab-btn:active,
.bottom-nav-btn:active,
.custom-select-trigger:active,
.sub-tab-pill:active,
.preset-pill:active,
.btn-action-pill:active,
.model-select-btn:active,
.cloud-action-btn:active,
.provider-tab-pill:active {
  transform: scale(0.965) !important;
}

/* ── 2. Native App Floating Bottom Navigation Bar (All Devices & Screens) ── */
.native-bottom-nav {
  display: block !important;
  position: fixed !important;
  bottom: 20px !important;
  left: 50% !important;
  transform: translateX(-50%) translateZ(0) !important;
  -webkit-transform: translateX(-50%) translateZ(0) !important;
  z-index: 100000 !important;
  width: auto !important;
  min-width: 320px !important;
  max-width: 440px !important;
  background: rgba(7, 11, 22, 0.90) !important;
  backdrop-filter: blur(28px) !important;
  -webkit-backdrop-filter: blur(28px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 28px !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  padding: 6px 14px !important;
  /* Anti-Jitter & Hardware Anchoring: permanently stationary */
  backface-visibility: hidden !important;
  -webkit-backface-visibility: hidden !important;
  contain: layout style !important;
  transition: none !important; /* CRITICAL: Never animate on scroll/touch to prevent jitter */
}

[data-theme="light"] .native-bottom-nav {
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.bottom-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 12px;
}

.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #94a3b8;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-nav-icon-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-icon-wrap svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  transition: all 0.25s ease;
}

.bottom-nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}

.bottom-nav-btn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.22);
}

.bottom-nav-btn.active .bottom-nav-icon-wrap svg {
  stroke: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.bottom-nav-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.bottom-nav-btn.active .bottom-nav-glow {
  opacity: 1;
}

.bottom-nav-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  border: 1.5px solid #070b16;
}

.bottom-nav-dot.dot-off {
  background: #ef4444;
  box-shadow: none;
}

/* ── 3. Responsive App Layout Adjustments (Mobile Breakpoint <= 768px) ── */
@media (max-width: 768px) {
  /* Mobile docks to the very bottom - Rock Solid, Stationary & Fixed */
  .native-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-transform: translate3d(0, 0, 0) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    padding: 6px 16px max(8px, env(safe-area-inset-bottom, 8px)) !important;
    transition: none !important; /* Zero transition on scroll: 100% stationary without jitter */
    will-change: auto !important;
  }

  /* Hide bottom nav ONLY when virtual keyboard is physically open (driven by viewport shrink detection) */
  body.keyboard-open .native-bottom-nav {
    display: none !important;
  }

  .desktop-tabs,
  .app-main-tabs {
    display: none !important;
  }

  /* Compact Native Top App Bar */
  .top-nav {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9998 !important;
    margin-left: -12px !important;
    margin-right: -12px !important;
    margin-bottom: 6px !important;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px 12px !important;
    height: auto !important;
    min-height: 48px !important;
    background: rgba(7, 9, 14, 0.94) !important;
    backdrop-filter: blur(28px) !important;
    -webkit-backdrop-filter: blur(28px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    row-gap: 8px !important;
    column-gap: 8px !important;
    align-items: center !important;
    overflow: visible !important;
  }

  [data-theme="light"] .top-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
  }

  .brand-title span {
    font-size: 1.15rem;
  }

  .brand-group {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    justify-content: flex-start !important;
    width: auto !important;
  }

  .logo-box {
    width: 40px !important;
    height: 40px !important;
    border-radius: 11px !important;
  }

  .logo-box svg {
    width: 30px !important;
    height: 30px !important;
  }

  .nav-badges {
    gap: 8px;
  }

  .header-ai-status-badge {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .btn-google-sign-in {
    padding: 6px 11px;
    font-size: 0.75rem;
  }

  .theme-toggle-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }

  .theme-toggle-btn .theme-label {
    display: none;
  }

  /* Safe Area Bottom Padding for main content */
  .main-content {
    padding: 4px 10px max(64px, calc(54px + env(safe-area-inset-bottom))) 10px;
  }

  .sub-tabs-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 2px auto 8px auto !important;
    padding: 0 4px !important;
    box-sizing: border-box !important;
  }

  .sub-tabs-bar {
    width: 100% !important;
    max-width: 440px !important;
    display: flex !important;
    padding: 3px !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }

  .sub-tab-pill {
    flex: 1 1 50% !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 7px 8px !important;
    font-size: 0.78rem !important;
    gap: 5px !important;
    box-sizing: border-box !important;
  }

  .sub-tab-pill span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .sub-tab-pill svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
  }

  .glass-card {
    padding: 14px 12px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .upload-section {
    padding: 10px 8px;
    margin-bottom: 10px;
    border-radius: 16px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .drop-zone {
    padding: 16px 12px;
    border-radius: 14px;
    min-height: unset;
  }

  .drop-icon-anim {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
  }

  .drop-icon-anim svg {
    width: 22px;
    height: 22px;
  }

  .drop-headline {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 3px;
    line-height: 1.3;
  }

  .drop-subline {
    font-size: 0.76rem;
    margin-bottom: 12px;
    line-height: 1.35;
  }

  #browseBtn {
    padding: 9px 18px;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 12px;
  }

  .drop-sources-wrapper,
  .engine-sources-wrapper {
    margin: 16px auto 0 !important;
    gap: 8px;
  }

  .drop-sources-divider {
    gap: 8px;
  }

  .drop-sources-label {
    font-size: 0.72rem;
  }

  .drop-sources-pills {
    gap: 8px;
  }

  .source-link-pill {
    padding: 5px 12px;
    font-size: 0.74rem;
    gap: 5px;
  }

  .action-cta-wrap {
    margin-top: 8px;
    margin-bottom: 6px;
  }

  .btn-hero {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 0.88rem;
    border-radius: 12px;
  }

  .btn-hero .hero-icon {
    width: 18px;
    height: 18px;
  }

  .cta-hint {
    margin-top: 6px;
    font-size: 0.74rem;
    line-height: 1.35;
  }

  /* Compact Post-File-Select State */
  .file-loaded-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .file-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .file-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .file-icon-badge svg {
    width: 16px;
    height: 16px;
  }

  .file-info-text {
    flex: 1;
    min-width: 0;
  }

  .file-title-group {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .file-title {
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }

  .btn-rename-trigger {
    width: 20px;
    height: 20px;
  }

  .btn-rename-trigger svg {
    width: 12px;
    height: 12px;
  }

  .file-stats-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
  }

  .pill-metric {
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 4px;
  }

  .btn-icon.btn-remove {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .btn-icon.btn-remove svg {
    width: 14px;
    height: 14px;
  }

  /* Compact Preview Box */
  .preview-box {
    padding: 8px 10px;
    border-radius: 12px;
  }

  .preview-header {
    font-size: 0.68rem;
    font-weight: 700;
    margin-bottom: 6px;
  }

  .timing-badge {
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 4px;
  }

  .preview-list {
    max-height: 85px;
    gap: 4px;
  }

  .preview-item {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.74rem;
  }

  .preview-meta {
    font-size: 0.66rem;
    gap: 6px;
    margin-bottom: 1px;
  }

  .preview-text-line {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  /* Compact Live Progress Section */
  .progress-section {
    padding: 12px 10px;
    border-radius: 16px;
    margin-bottom: 8px;
  }

  .progress-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .progress-status-info {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .progress-title {
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .progress-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }

  .btn-progress-ctrl,
  .btn-progress-cancel {
    padding: 5px 12px;
    font-size: 0.74rem;
    border-radius: 8px;
    height: 30px;
  }

  .btn-progress-ctrl svg,
  .btn-progress-cancel svg {
    width: 13px;
    height: 13px;
  }

  .progress-percentage {
    font-size: 0.95rem;
    font-weight: 800;
    margin-left: auto;
  }

  .progress-track {
    height: 6px;
    margin-bottom: 10px;
  }

  .progress-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
  }

  .stat-cell {
    padding: 6px 6px;
    border-radius: 8px;
    gap: 2px;
    text-align: center;
  }

  .stat-name {
    font-size: 0.58rem;
    line-height: 1.15;
  }

  .stat-val {
    font-size: 0.80rem;
  }

  /* Compact Terminal Log */
  .terminal-log-wrapper {
    border-radius: 12px;
  }

  .terminal-bar {
    padding: 5px 10px;
    gap: 8px;
  }

  .terminal-label {
    font-size: 0.65rem;
  }

  .terminal-dots span {
    width: 6px;
    height: 6px;
  }

  .terminal-feed {
    padding: 8px 10px;
    max-height: 80px;
    font-size: 0.70rem;
    line-height: 1.35;
    gap: 3px;
  }

  /* ── Result Section Mobile Polish & Split-Button Alignment ── */
  .result-section {
    padding: 12px 12px !important;
    margin-bottom: 16px !important;
    border-radius: 16px !important;
  }

  .result-top-banner {
    margin-bottom: 10px !important;
    gap: 8px !important;
  }

  .result-success-title {
    gap: 10px !important;
  }

  .success-icon-badge {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }

  .success-icon-badge svg {
    width: 16px !important;
    height: 16px !important;
  }

  .result-title-head-row h3,
  .result-success-title h3 {
    font-size: 1.05rem !important;
    line-height: 1.25 !important;
  }

  .btn-close-result {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }

  .btn-close-result svg {
    width: 14px !important;
    height: 14px !important;
  }

  .result-sub-info {
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
  }

  .result-file-pill-row {
    margin-top: 3px !important;
    gap: 6px !important;
  }

  .result-file-pill {
    font-size: 0.74rem !important;
    padding: 2px 8px !important;
    max-width: 100% !important;
  }

  .result-file-pill #resultFileName {
    max-width: calc(100vw - 150px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: inline-block !important;
  }

  .btn-rename-trigger {
    width: 24px !important;
    height: 24px !important;
  }

  .quick-action-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    gap: 6px !important;
    margin-top: 6px !important;
  }

  /* Row 1: AI Shorten and Restore Original (50/50 when both present, 100% if only one) */
  .quick-action-buttons .btn-condense-hero,
  .quick-action-buttons .btn-secondary-subtle {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 120px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .quick-action-buttons .btn-secondary-subtle.hidden + .btn-condense-hero,
  .quick-action-buttons .btn-condense-hero:only-of-type {
    flex: 1 1 100% !important;
  }

  /* Row 2: Unified Split-Button for Download & Export As (Spans 100% full width) */
  .quick-action-buttons .download-dropdown-wrapper {
    display: flex !important;
    width: 100% !important;
    flex: 1 1 100% !important;
    align-items: stretch !important;
    gap: 0 !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25) !important;
    position: relative !important;
    box-sizing: border-box !important;
    margin: 2px 0 !important;
  }

  .quick-action-buttons .download-dropdown-wrapper .btn-download-primary {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 10px !important;
    border-bottom-left-radius: 10px !important;
    padding: 8px 12px !important;
    font-size: 0.80rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
  }

  .quick-action-buttons .download-dropdown-wrapper .btn-download-options {
    flex: 0 0 auto !important;
    height: 40px !important;
    min-height: 40px !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    padding: 8px 10px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    background: #047857 !important;
    color: #ffffff !important;
    border: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.22) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
  }

  .quick-action-buttons .download-dropdown-wrapper .btn-download-options:hover {
    background: #065f46 !important;
  }

  /* Row 3: Full-width Copy Subtitles button */
  .quick-action-buttons #copySrtBtn {
    flex: 1 1 100% !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 8px 12px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
  }

  [data-theme="dark"] .quick-action-buttons #copySrtBtn {
    background: var(--surface-card) !important;
    border-color: var(--border-medium) !important;
    color: #f8fafc !important;
  }

  /* Compact 1-Row Quality Metrics Grid */
  .quality-badges-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 8px !important;
    margin-bottom: 10px !important;
  }

  .quality-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 5px 3px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    text-align: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .quality-pill svg {
    width: 10px !important;
    height: 10px !important;
    flex-shrink: 0 !important;
  }

  /* Code Section on Mobile: Compact & Clean */
  .preview-tabs-nav {
    margin-bottom: 6px !important;
  }

  .preview-tab {
    padding: 4px 10px !important;
    font-size: 0.74rem !important;
    border-radius: 6px !important;
  }

  .codebox-wrapper {
    border-radius: 10px !important;
    overflow: hidden !important;
    margin-bottom: 10px !important;
  }

  .codebox-header {
    padding: 6px 10px !important;
    font-size: 0.72rem !important;
  }

  .codebox-header #inlineCodeCopyBtn {
    display: none !important; /* Hide duplicate copy button on mobile */
  }

  .codebox-content {
    max-height: 150px !important;
    padding: 8px 10px !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
  }

  .result-bottom-bar {
    padding-top: 8px !important;
    gap: 8px !important;
    margin-bottom: 4px !important;
  }

  .result-bottom-bar .bottom-auto-status {
    font-size: 0.70rem !important;
  }

  .result-bottom-bar .btn-secondary {
    height: 36px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
  }

  /* Ultra-Compact Translation Engine Settings for Zero-Scroll Mobile */
  .settings-section {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 14px;
  }

  .settings-section .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .settings-section .title-with-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .settings-section .config-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    padding: 3px;
    flex-shrink: 0;
  }

  .settings-section .config-icon svg {
    width: 13px;
    height: 13px;
  }

  .settings-section .title-with-icon h3 {
    font-size: 0.84rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
  }

  .settings-section .engine-batch-badge {
    flex-shrink: 0;
  }

  .settings-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
  }

  .settings-grid .field-item {
    margin-bottom: 0;
    min-width: 0;
    width: 100%;
  }

  .settings-grid .field-card {
    padding: 6px 9px;
    border-radius: 9px;
  }

  .settings-grid .field-item label {
    margin-bottom: 2.5px;
    font-size: 0.68rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
  }

  .settings-grid .field-label-group {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .settings-grid .field-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }

  .settings-grid .hint-tag,
  .settings-grid .speed-tag,
  .settings-grid #modelLiveBadge {
    font-size: 0.58rem;
    padding: 1px 5px;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 999px;
  }

  .settings-grid .select-wrapper select,
  .settings-grid .custom-select-trigger {
    padding: 5px 10px;
    font-size: 0.78rem;
    height: 35px;
    min-height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
  }

  .settings-grid .custom-select-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
    line-height: 1.25;
    min-width: 0;
    flex: 1;
  }

  .settings-grid .field-footer-info {
    display: none;
  }

  .settings-grid .field-item.full-width {
    width: 100%;
  }

  .settings-grid .input-glow-wrapper input {
    padding: 5px 10px !important;
    font-size: 0.78rem;
    height: 35px;
    min-height: 35px;
    border-radius: 8px;
  }

  /* Ultra-Compact Settings & API Key Screen for Zero-Scroll Mobile */
  .auth-card-section {
    padding: 5px 8px;
    margin-bottom: 6px;
    border-radius: 10px;
  }

  .auth-sync-banner-simple {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .auth-banner-copy h3 {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .auth-banner-copy p {
    font-size: 0.62rem;
    line-height: 1.15;
  }

  .btn-google-connect {
    padding: 5px 10px !important;
    font-size: 0.72rem !important;
    height: 28px !important;
    border-radius: 7px !important;
    gap: 5px !important;
  }

  .logged-in-profile-row {
    gap: 8px !important;
    padding: 2px 0 !important;
  }

  .profile-avatar-medium {
    width: 38px !important;
    height: 38px !important;
  }

  .profile-meta-info strong {
    font-size: 0.88rem !important;
  }

  .profile-email-text {
    font-size: 0.72rem !important;
  }

  .btn-sync-cloud,
  .btn-sign-out {
    padding: 5px 10px !important;
    font-size: 0.74rem !important;
    height: 28px !important;
    border-radius: 7px !important;
    gap: 5px !important;
  }

  /* API Keys & Configuration on Mobile - Ultra-Compact Zero-Scroll Layout */
  .api-section {
    padding: 10px 12px !important;
    margin-bottom: 6px !important;
    border-radius: 14px !important;
  }

  .api-section .card-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 6px !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .api-section .title-with-icon {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    min-width: 0 !important;
  }

  .api-section .key-icon {
    width: 24px !important;
    height: 24px !important;
    border-radius: 6px !important;
    padding: 3px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px solid #fde68a !important;
    flex-shrink: 0 !important;
  }

  [data-theme="dark"] .api-section .key-icon {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
  }

  .api-section .key-icon svg {
    width: 13px !important;
    height: 13px !important;
  }

  .api-section .title-with-icon h3 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    color: var(--text-main) !important;
  }

  .api-section .failover-control-badge {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }

  .api-section .failover-toggle-label {
    padding: 3px 8px !important;
    font-size: 0.70rem !important;
    font-weight: 600 !important;
    gap: 5px !important;
    white-space: nowrap !important;
    border-radius: 9999px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  }

  [data-theme="dark"] .api-section .failover-toggle-label {
    background: rgba(30, 41, 59, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #f8fafc !important;
  }

  .api-section .failover-toggle-switch {
    width: 24px !important;
    height: 14px !important;
    background: rgba(15, 23, 42, 0.2);
    border-radius: 9px !important;
    position: relative !important;
    transition: background 0.2s ease, box-shadow 0.2s ease !important;
  }

  [data-theme="dark"] .api-section .failover-toggle-switch {
    background: rgba(255, 255, 255, 0.2);
  }

  .api-section .failover-toggle-label input:checked + .failover-toggle-switch {
    background: #10b981 !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.45) !important;
  }

  .api-section .failover-toggle-switch::after {
    content: '' !important;
    position: absolute !important;
    width: 10px !important;
    height: 10px !important;
    top: 2px !important;
    left: 2px !important;
    background: #ffffff !important;
    border-radius: 50% !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
  }

  .api-section .failover-toggle-label input:checked + .failover-toggle-switch::after {
    transform: translateX(10px) !important;
  }

  .api-section .provider-select-box {
    margin-bottom: 6px !important;
    padding: 5px 10px !important;
    border-radius: 10px !important;
    border: 1px solid #bfdbfe !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.04) !important;
  }

  [data-theme="dark"] .api-section .provider-select-box {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
  }

  .api-section .provider-select-label {
    margin-bottom: 0 !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    color: var(--text-main) !important;
  }

  .api-section .provider-select-label .field-label-group {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 0.78rem !important;
    font-weight: 700 !important;
  }

  .api-section .provider-select-label .field-icon {
    width: 14px !important;
    height: 14px !important;
    color: #0284c7 !important;
  }

  .api-section #providerSelectedTag {
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    padding: 1.5px 6px !important;
    border-radius: 5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    background: #e0f2fe !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd !important;
  }

  [data-theme="dark"] .api-section #providerSelectedTag {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #38bdf8 !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
  }

  .api-section .select-wrapper {
    width: 100% !important;
    margin-bottom: 0 !important;
  }

  .api-section .select-wrapper select,
  .api-section .custom-select-trigger {
    padding: 5px 10px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    min-height: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    width: 100% !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    box-sizing: border-box !important;
  }

  [data-theme="dark"] .api-section .select-wrapper select,
  [data-theme="dark"] .api-section .custom-select-trigger {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--border-medium) !important;
    color: #f8fafc !important;
  }

  .api-section .provider-panel {
    width: 100% !important;
  }

  .api-section .api-form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 4px !important;
  }

  .api-section .input-glow-wrapper {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    position: relative !important;
  }

  .api-section .input-glow-wrapper input {
    width: 100% !important;
    padding: 6px 36px 6px 10px !important;
    font-size: 0.82rem !important;
    height: 36px !important;
    min-height: 36px !important;
    border-radius: 8px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-sizing: border-box !important;
    outline: none !important;
  }

  [data-theme="dark"] .api-section .input-glow-wrapper input {
    background: rgba(15, 23, 42, 0.6) !important;
    border-color: var(--border-medium) !important;
    color: #ffffff !important;
  }

  .api-section .input-action-btn {
    width: 26px !important;
    height: 26px !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    position: absolute !important;
    background: transparent !important;
    border: none !important;
    color: #64748b !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
  }

  .api-section .input-action-btn:hover {
    transform: translateY(-50%) !important;
  }

  .api-section .input-action-btn:active {
    transform: translateY(-50%) scale(0.92) !important;
  }

  .api-section .input-action-btn svg {
    width: 14px !important;
    height: 14px !important;
  }

  .api-section .btn-save {
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 6px 8px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .api-section .btn-save.hidden,
  .api-section .btn-save[style*="display: none"] {
    display: none !important;
  }

  .api-section .btn-save span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  [data-theme="dark"] .api-section .btn-save {
    background: var(--surface-card) !important;
    border-color: var(--border-medium) !important;
    color: #ffffff !important;
  }

  .api-section .btn-remove-key {
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 6px 8px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #dc2626 !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .api-section .btn-remove-key.hidden,
  .api-section .btn-remove-key[style*="display: none"] {
    display: none !important;
  }

  [data-theme="dark"] .api-section .btn-remove-key {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #f87171 !important;
  }

  .api-section .btn-remove-key svg {
    width: 13px !important;
    height: 13px !important;
    stroke: #dc2626 !important;
  }

  [data-theme="dark"] .api-section .btn-remove-key svg {
    stroke: #f87171 !important;
  }

  .api-section .provider-get-key-btn {
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 6px 6px !important;
    font-size: 0.71rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    background: #e0f2fe !important;
    border: 1px solid #bae6fd !important;
    color: #0284c7 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .api-section .provider-get-key-btn span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
  }

  [data-theme="dark"] .api-section .provider-get-key-btn {
    background: rgba(6, 182, 212, 0.12) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
    color: #38bdf8 !important;
  }

  .api-section .provider-get-key-btn svg {
    width: 12px !important;
    height: 12px !important;
  }

  .api-section .btn-manage-keys.hidden,
  .api-section .btn-manage-keys[style*="display: none"] {
    display: none !important;
  }

  .api-section .api-form-row:not(.custom-actions-row) .btn-remove-key,
  .api-section .api-form-row:not(.custom-actions-row) .btn-manage-keys {
    grid-column: auto !important;
    width: 100% !important;
  }

  .api-section .custom-actions-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .api-section .custom-actions-row #saveApiKey_custom {
    grid-column: 1 / -1 !important;
  }

  .api-section .custom-actions-row .btn {
    width: 100% !important;
    min-height: 38px !important;
    height: 38px !important;
    padding: 6px 8px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  .api-section .api-feedback-row {
    margin-top: 4px !important;
    margin-bottom: 2px !important;
    width: 100% !important;
    min-height: unset !important;
  }

  .api-section .api-feedback {
    margin-top: 2px !important;
    padding: 2px 4px !important;
    font-size: 0.74rem !important;
    line-height: 1.35 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    width: 100% !important;
    word-break: break-word !important;
    white-space: normal !important;
  }

  /* Recommended AI Checklist for Mobile - Comfortable, Elegant & Non-Colliding */
  .api-required-checklist.compact-checklist {
    padding: 6px 8px !important;
    margin-top: 6px !important;
    margin-bottom: 0px !important;
    border-radius: 11px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  .compact-checklist-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
    min-height: 22px !important;
  }

  .compact-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .compact-header-icon {
    width: 14px !important;
    height: 14px !important;
    color: var(--brand-primary-light) !important;
    flex-shrink: 0 !important;
  }

  .api-required-checklist .checklist-title {
    font-size: 0.80rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: visible !important;
    letter-spacing: -0.01em !important;
  }

  .api-required-checklist .checklist-status-badge {
    padding: 2px 7px !important;
    font-size: 0.70rem !important;
    font-weight: 700 !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .compact-checklist-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
  }

  .compact-checklist .checklist-item {
    padding: 4px 8px !important;
    min-height: 38px !important;
    height: auto !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }

  .compact-checklist .checklist-item-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .compact-checklist .checklist-status-icon {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .compact-checklist .checklist-status-icon svg {
    width: 10px !important;
    height: 10px !important;
  }

  .compact-checklist .checklist-text-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    min-width: 0 !important;
  }

  .compact-checklist .checklist-item-name {
    font-size: 0.80rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
  }

  .compact-checklist .checklist-item-status-text {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
  }

  .compact-checklist .checklist-action-btn {
    padding: 3px 9px !important;
    font-size: 0.70rem !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    height: 26px !important;
    min-height: 26px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Ultra-Compact Cloud Subtitle Archive for Zero-Scroll Mobile */
  .cloud-history-section {
    padding: 10px 10px;
    margin-bottom: 8px;
    border-radius: 14px;
  }

  .cloud-history-section .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .cloud-history-section .title-with-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .cloud-icon-wrap {
    width: 22px;
    height: 22px;
    padding: 3px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .cloud-icon-wrap svg {
    width: 13px;
    height: 13px;
  }

  .cloud-history-section .title-with-icon h3 {
    font-size: 0.82rem;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
  }

  .cloud-history-section .title-with-icon p.desc {
    font-size: 0.64rem;
    line-height: 1.15;
    margin: 1px 0 0 0;
    white-space: nowrap;
    color: var(--text-muted);
  }

  .cloud-history-actions {
    flex-shrink: 0;
  }

  .btn-refresh-history {
    padding: 3px 8px;
    font-size: 0.68rem;
    height: 24px;
    border-radius: 6px;
    gap: 4px;
    white-space: nowrap;
  }

  .btn-refresh-history svg {
    width: 11px;
    height: 11px;
  }

  .cloud-history-list {
    gap: 6px;
  }

  .cloud-history-item {
    padding: 7px 9px;
    border-radius: 9px;
    margin-bottom: 4px;
    gap: 3px;
  }

  .cloud-item-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    margin-bottom: 2px;
  }

  .cloud-title-group {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 1;
  }

  .cloud-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
    max-width: none !important;
  }

  .btn-cloud-rename {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .btn-cloud-rename svg {
    width: 10px;
    height: 10px;
  }

  .condensed-badge-mini,
  .condensed-badge,
  .download-card-top-row .condensed-badge-mini,
  .download-card-top-row .condensed-badge {
    font-size: 0.54rem;
    padding: 1px 3.5px;
    height: 15px;
    border-radius: 3.5px;
  }

  .condensed-badge-mini svg,
  .condensed-badge svg,
  .download-card-top-row .condensed-badge-mini svg,
  .download-card-top-row .condensed-badge svg {
    width: 8px;
    height: 8px;
  }

  .cloud-item-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    flex-wrap: nowrap;
    width: 100%;
    margin: 1px 0 3px 0;
    font-size: 0.55rem;
    line-height: 1;
  }

  .meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.55rem;
    white-space: nowrap;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    line-height: 1;
  }

  .meta-pill span {
    font-size: 0.55rem;
    line-height: 1;
  }

  .meta-svg {
    width: 8.5px;
    height: 8.5px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
  }

  .meta-expiry-pill {
    font-size: 0.55rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .cloud-item-actions {
    display: flex;
    gap: 4px;
    width: 100%;
  }

  .btn-cloud-download,
  .btn-cloud-condense {
    flex: 1;
    padding: 4px 6px;
    font-size: 0.68rem;
    height: 26px;
    border-radius: 6px;
    gap: 3px;
    white-space: nowrap;
    justify-content: center;
  }

  .btn-cloud-download svg,
  .btn-cloud-condense svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
  }

  .btn-cloud-delete {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    flex-shrink: 0;
    padding: 0;
    display: grid;
    place-items: center;
  }

  .btn-cloud-delete svg {
    width: 11px;
    height: 11px;
  }

  /* History Modal Ultra-Compact Mobile Styles */
  .history-modal-box {
    max-width: 94vw;
    max-height: 88vh;
    border-radius: 16px;
    margin: auto 8px;
  }

  .history-modal-header {
    padding: 12px 14px 10px 14px;
    gap: 6px;
    display: flex;
    flex-direction: column;
  }

  .history-modal-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .history-modal-heading {
    font-size: 0.96rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    min-width: 0;
  }

  .history-modal-heading span:first-child {
    white-space: nowrap;
  }

  .history-count-badge {
    font-size: 0.68rem;
    padding: 1.5px 7px;
    white-space: nowrap;
    border-radius: 999px;
    flex-shrink: 0;
  }

  .history-modal-header-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  .history-modal-subline {
    font-size: 0.70rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    flex: 1;
  }

  .btn-history-clear-all {
    height: 22px;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 600;
    gap: 3px;
    flex-shrink: 0;
  }

  .btn-history-clear-all svg {
    width: 10px;
    height: 10px;
  }

  .btn-clear-all-history {
    height: 21px;
    padding: 1.5px 5.5px;
    border-radius: 4px;
    font-size: 0.60rem;
    gap: 2.5px;
  }

  .btn-clear-all-history svg {
    width: 9px;
    height: 9px;
  }

  .btn-history-modal-close {
    width: 21px;
    height: 21px;
    border-radius: 4px;
    flex-shrink: 0;
  }

  .btn-history-modal-close svg {
    width: 11px;
    height: 11px;
  }

  .history-modal-search-bar {
    padding: 6px 10px;
  }

  .history-search-icon {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
  }

  input[type="text"].history-search-input,
  .history-search-input {
    height: 32px !important;
    font-size: 0.76rem !important;
    padding: 4px 28px 4px 34px !important;
    border-radius: 8px !important;
  }

  .btn-history-clear-search {
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
  }

  .history-modal-content-list {
    padding: 6px 8px;
    gap: 4px;
  }

  /* Downloads Modal Ultra-Compact Mobile Styles */
  .downloads-modal-box {
    max-width: 94vw;
    max-height: 88vh;
    border-radius: 16px;
    margin: auto 8px;
  }

  .downloads-modal-header {
    padding: 10px 12px 6px 12px;
    gap: 6px;
  }

  .downloads-modal-heading {
    font-size: 0.84rem;
    font-weight: 800;
    gap: 6px;
  }

  .downloads-count-badge {
    font-size: 0.62rem;
    padding: 1.5px 6px;
  }

  .downloads-modal-subline {
    font-size: 0.62rem;
    line-height: 1.15;
  }

  .btn-downloads-close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }

  .btn-downloads-close svg {
    width: 14px;
    height: 14px;
  }

  .btn-downloads-clear {
    padding: 2px 6px;
    font-size: 0.64rem;
    border-radius: 6px;
  }

  .downloads-modal-content {
    padding: 6px 8px;
    gap: 4px;
  }

  .download-card-item {
    padding: 7px 9px;
    border-radius: 9px;
    gap: 3px;
  }

  .download-card-title {
    font-size: 0.78rem;
  }

  .btn-download-again,
  .btn-download-condense {
    padding: 4px 6px;
    font-size: 0.68rem;
    height: 26px;
    border-radius: 6px;
  }

  .btn-download-delete {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }
}

/* ── 4. Polished Dropdown & Scroll Improvements ── */
.custom-select-menu {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: 14px;
}

.custom-select-options-list {
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-select-options-list::-webkit-scrollbar {
  width: 4px;
}

.custom-select-options-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}


/* ── 6. Complete Light Mode Support for Native Bottom Nav & App Bar ── */
[data-theme="light"] .native-bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .bottom-nav-btn {
  color: #64748b;
}

[data-theme="light"] .bottom-nav-btn.active {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.2);
}

[data-theme="light"] .bottom-nav-btn.active .bottom-nav-icon-wrap svg {
  stroke: #0284c7;
  filter: drop-shadow(0 0 6px rgba(2, 132, 199, 0.35));
}

[data-theme="light"] .bottom-nav-glow {
  background: radial-gradient(circle, rgba(2, 132, 199, 0.25) 0%, transparent 70%);
}

[data-theme="light"] .bottom-nav-dot {
  border-color: #ffffff;
}

[data-theme="light"] .btn-google-sign-in {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .btn-google-sign-in:hover {
  background: #f8fafc;
  border-color: #4285f4;
  box-shadow: 0 4px 14px rgba(66, 133, 244, 0.2);
}

[data-theme="light"] .user-profile-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .user-profile-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dropdown-user-info strong {
  color: #0f172a;
}

[data-theme="light"] .dropdown-user-email {
  color: #64748b;
}

[data-theme="light"] .dropdown-user-info {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dropdown-btn-item {
  color: #334155;
}

[data-theme="light"] .dropdown-btn-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ── 7. View Tab Management & Clean In-View API Lockout Guard ── */
.app-view {
  display: none !important;
  width: 100%;
}

.app-view.active {
  display: block !important;
  animation: appViewEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: opacity, transform;
}

@keyframes appViewEnter {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

#viewTranslator:not(.active) {
  display: none !important;
}

#viewSettings.active {
  display: block !important;
  animation: appViewEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#viewSettings:not(.active) {
  display: none !important;
}

/* ── Disabled Select & Control States ── */
.select-wrapper.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.select-wrapper.is-disabled select {
  cursor: not-allowed !important;
  pointer-events: none !important;
  background: var(--bg-surface-2) !important;
  opacity: 0.7 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="light"] .select-wrapper.is-disabled select {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.btn-remove-key.is-disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* ── Universal Toast Notification Engine (Compact, Full Message, No Clipping) ── */
.subsync-toast-container {
  position: fixed;
  top: max(12px, calc(env(safe-area-inset-top, 0px) + 8px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  width: auto;
  max-width: min(92vw, 440px);
}

.subsync-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill, 9999px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-14px) scale(0.94);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.subsync-toast.toast-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.subsync-toast.toast-success {
  border-color: rgba(16, 185, 129, 0.35);
}

.subsync-toast.toast-success .toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  flex-shrink: 0;
}

.subsync-toast.toast-error {
  border-color: rgba(239, 68, 68, 0.35);
}

.subsync-toast.toast-error .toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  flex-shrink: 0;
}

.subsync-toast.toast-warning {
  border-color: rgba(245, 158, 11, 0.35);
}

.subsync-toast.toast-warning .toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  flex-shrink: 0;
}

.subsync-toast.toast-info {
  border-color: rgba(56, 189, 248, 0.35);
}

.subsync-toast.toast-info .toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  flex-shrink: 0;
}

.subsync-toast .toast-msg {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
  max-width: 100%;
}

[data-theme="light"] .subsync-toast {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* ── Initial Branded App Loader ── */
.app-initial-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateZ(0) scale(1);
  will-change: opacity, transform;
}

[data-theme="dark"] .app-initial-loader {
  background: #07090e;
}

.app-initial-loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateZ(0) scale(1.025);
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loader-logo-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  z-index: 2;
  transition: background 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .loader-logo-icon {
  background: rgba(18, 24, 38, 0.9);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 25px rgba(99, 102, 241, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.loader-logo-icon svg {
  width: 38px;
  height: 38px;
}

.loader-spinner-ring {
  position: absolute;
  inset: 0px;
  border-radius: 18px;
  border: 2.5px solid transparent;
  border-top-color: #6366f1;
  border-right-color: #06b6d4;
  animation: loaderRingSpin 0.9s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  z-index: 1;
}

@keyframes loaderRingSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #0f172a 30%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .loader-brand-title {
  background: linear-gradient(135deg, #f8fafc 30%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loader-progress-bar {
  width: 150px;
  height: 4px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  position: relative;
  margin-top: 2px;
}

[data-theme="dark"] .loader-progress-bar {
  background: rgba(255, 255, 255, 0.12);
}

.loader-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #4f46e5 0%, #06b6d4 50%, #10b981 100%);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.45);
}

.loader-status-text {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.2px;
  text-align: center;
  min-height: 1.1rem;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

[data-theme="dark"] .loader-status-text {
  color: #94a3b8;
}

/* Minimal Initial Loader Sponsor Box (Auto-sizable) */
.loader-ad-box {
  margin-top: 14px;
  width: min(280px, calc(100vw - 48px));
  height: auto;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.40);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.4s ease;
  user-select: none;
  pointer-events: none;
}

[data-theme="light"] .loader-ad-box {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

/* ══════════════════════════════════════════════════════════════════════════
   MODERN UNIVERSAL MODAL DIALOG DETAILS
   ══════════════════════════════════════════════════════════════════════════ */
.modal-top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.modal-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
}

.modal-icon-badge svg {
  width: 18px;
  height: 18px;
}

.modal-icon-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
}

.modal-icon-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.modal-icon-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #6366f1;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.modal-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
  text-align: center;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.modal-message {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  line-height: 1.4;
  margin: 0 0 14px 0;
}

.modal-actions-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
  width: 100%;
}

.btn-modal-cancel {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main, #ffffff);
}

.btn-modal-cancel:active {
  transform: scale(0.97);
}

.btn-modal-confirm {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 6px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.74rem;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-confirm:hover {
  filter: brightness(1.08);
}

.btn-modal-confirm:active {
  transform: scale(0.97);
}

/* Prompt Modal Input Styles */
.modal-input-wrap {
  margin-bottom: 18px;
}

.modal-input-field {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.95rem;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.modal-input-field:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.modal-char-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
}

.char-limit-tag {
  color: #ef4444;
  font-weight: 600;
}

/* Translation Settings Compact Fit & No Unwanted Page Scroll */
#subViewEngineSettings {
  overflow: visible !important;
  padding-bottom: 16px !important;
}

@media (max-width: 768px) {
  #subViewEngineSettings {
    padding-bottom: 8px !important;
  }
}

#subViewEngineSettings .settings-section {
  margin-bottom: 0 !important;
  padding-bottom: 6px !important;
}

#subViewEngineSettings .settings-grid {
  gap: 7px !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   GOOGLE SIGN-IN & CLOUD SYNC PROGRESS OVERLAY
   ══════════════════════════════════════════════════════════════════════════ */
.auth-sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000002;
  background: rgba(3, 7, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  transform: translateZ(0);
}

[data-theme="light"] .auth-sync-overlay {
  background: rgba(15, 23, 42, 0.65);
}

.auth-sync-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.auth-sync-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--surface-card, #0c1222);
  border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14));
  border-radius: 18px;
  padding: 22px 20px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.2) inset;
  text-align: center;
  overflow: hidden;
  transform: translateZ(0);
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .auth-sync-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

.auth-sync-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 2;
  padding: 0;
}

.auth-sync-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: scale(1.05);
}

[data-theme="light"] .auth-sync-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: #64748b;
}

[data-theme="light"] .auth-sync-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

.auth-sync-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

[data-theme="light"] .auth-sync-icon-wrap {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.auth-sync-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary, #f8fafc);
}

[data-theme="light"] .auth-sync-title {
  color: #0f172a;
}

.auth-sync-status {
  font-size: 0.82rem;
  color: var(--text-secondary, #94a3b8);
  margin: 0 0 16px;
  line-height: 1.4;
  min-height: 20px;
}

[data-theme="light"] .auth-sync-status {
  color: #64748b;
}

.auth-sync-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

[data-theme="light"] .auth-sync-progress-bar {
  background: rgba(0, 0, 0, 0.08);
}

.auth-sync-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #4285F4, #34A853, #FBBC05, #EA4335);
  animation: authProgressBarAnim 1.1s ease-in-out infinite alternate;
}

@keyframes authProgressBarAnim {
  0% { left: 0%; width: 30%; }
  100% { left: 70%; width: 30%; }
}

/* Auth Sync Card Success Complete State */
.auth-sync-overlay.success .modal-top-accent {
  background: linear-gradient(90deg, #10b981, #06b6d4) !important;
}

.auth-sync-overlay.success .auth-sync-icon-wrap {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-sync-overlay.success .auth-sync-title {
  color: #10b981 !important;
}

[data-theme="light"] .auth-sync-overlay.success .auth-sync-title {
  color: #059669 !important;
}

.auth-sync-overlay.success .auth-sync-progress-fill {
  width: 100% !important;
  left: 0 !important;
  animation: none !important;
  background: linear-gradient(90deg, #10b981, #06b6d4) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  transition: width 0.3s ease, background 0.3s ease;
}

/* ── Multi-Key Vault Action Button & Modal System ── */
.btn-manage-keys,
.provider-panel .btn-manage-keys,
.api-section .btn-manage-keys {
  width: 100% !important;
  min-height: 38px !important;
  height: 38px !important;
  padding: 6px 8px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  background: rgba(99, 102, 241, 0.12) !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  color: #a5b4fc !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.08) !important;
  box-sizing: border-box !important;
  user-select: none !important;
  margin: 0 !important;
  white-space: nowrap !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  position: relative !important;
  z-index: 2 !important;
}

.btn-manage-keys *,
.provider-panel .btn-manage-keys *,
.api-section .btn-manage-keys * {
  pointer-events: none !important;
}

.btn-manage-keys:hover,
.provider-panel .btn-manage-keys:hover,
.api-section .btn-manage-keys:hover {
  background: rgba(99, 102, 241, 0.22) !important;
  border-color: rgba(99, 102, 241, 0.55) !important;
  color: #ffffff !important;
  transform: none !important;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.22) !important;
}

.btn-manage-keys svg,
.provider-panel .btn-manage-keys svg,
.api-section .btn-manage-keys svg {
  width: 13px !important;
  height: 13px !important;
  stroke: currentColor !important;
  flex-shrink: 0 !important;
}

.btn-manage-keys span,
.provider-panel .btn-manage-keys span,
.api-section .btn-manage-keys span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}

[data-theme="light"] .btn-manage-keys,
[data-theme="light"] .provider-panel .btn-manage-keys,
[data-theme="light"] .api-section .btn-manage-keys {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.28) !important;
  color: #4f46e5 !important;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.06) !important;
}

[data-theme="light"] .btn-manage-keys:hover,
[data-theme="light"] .provider-panel .btn-manage-keys:hover,
[data-theme="light"] .api-section .btn-manage-keys:hover {
  background: rgba(99, 102, 241, 0.16) !important;
  border-color: rgba(99, 102, 241, 0.45) !important;
  color: #3730a3 !important;
}

/* Key Vault Modal Container (Ultra Mobile-Friendly & Compact) */
.key-vault-modal-box {
  max-width: 440px !important;
  width: calc(100% - 24px) !important;
  max-height: min(88vh, 680px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 16px 14px 14px 14px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1px solid rgba(99, 102, 241, 0.35) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(99, 102, 241, 0.15) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  text-align: left !important;
  box-sizing: border-box !important;
  position: relative !important;
}

[data-theme="light"] .key-vault-modal-box {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(99, 102, 241, 0.25) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 0 20px rgba(99, 102, 241, 0.08) !important;
}

/* Modal Header */
.key-vault-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-bottom: 10px !important;
  padding-bottom: 10px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .key-vault-header {
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

.key-vault-title-wrap {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.key-vault-icon-badge {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.2)) !important;
  border: 1px solid rgba(99, 102, 241, 0.4) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #818cf8 !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
}

.key-vault-icon-badge svg {
  width: 16px !important;
  height: 16px !important;
}

.key-vault-headings {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.key-vault-title {
  font-size: 0.96rem !important;
  font-weight: 700 !important;
  color: #f1f5f9 !important;
  margin: 0 !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

[data-theme="light"] .key-vault-title {
  color: #0f172a !important;
}

.key-vault-subtitle-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  margin-top: 3px !important;
}

.key-vault-subtitle {
  font-size: 0.7rem !important;
  color: #94a3b8 !important;
  margin: 0 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

[data-theme="light"] .key-vault-subtitle {
  color: #64748b !important;
}

.key-vault-cloud-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 0.68rem !important;
  padding: 1px 7px !important;
  border-radius: 12px !important;
  background: rgba(34, 197, 94, 0.12) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* Header Action Buttons (Top Right) */
.key-vault-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
}

.btn-vault-top-get-key {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  height: 26px !important;
  padding: 0 8px !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  background: rgba(6, 182, 212, 0.14) !important;
  border: 1px solid rgba(6, 182, 212, 0.4) !important;
  color: #38bdf8 !important;
  cursor: pointer !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.btn-vault-top-get-key.hidden {
  display: none !important;
}

.btn-vault-top-get-key:hover {
  background: rgba(6, 182, 212, 0.25) !important;
  border-color: rgba(6, 182, 212, 0.7) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.btn-vault-top-get-key svg {
  width: 10px !important;
  height: 10px !important;
  stroke: currentColor !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .btn-vault-top-get-key {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}

/* Modal Close Button */
.btn-vault-modal-close {
  width: 26px !important;
  height: 26px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.btn-vault-modal-close:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #ef4444 !important;
}

.btn-vault-modal-close svg {
  width: 13px !important;
  height: 13px !important;
  stroke: currentColor !important;
}

[data-theme="light"] .btn-vault-modal-close {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #64748b !important;
}

/* Key Rotation Notice Banner */
.key-vault-notice {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 9px !important;
  border-radius: 8px !important;
  background: rgba(16, 185, 129, 0.08) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  font-size: 0.72rem !important;
  line-height: 1.3 !important;
  color: #6ee7b7 !important;
  margin-bottom: 8px !important;
  text-align: left !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .key-vault-notice {
  background: rgba(16, 185, 129, 0.08) !important;
  border-color: rgba(16, 185, 129, 0.28) !important;
  color: #047857 !important;
}

.key-vault-notice .notice-icon {
  width: 13px !important;
  height: 13px !important;
  flex-shrink: 0 !important;
}

/* Section Container & Section Title */
.key-vault-section {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  margin-bottom: 8px !important;
}

.key-vault-section-title {
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  color: #94a3b8 !important;
  margin-bottom: 5px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  text-align: left !important;
  flex-shrink: 0 !important;
}

.key-vault-add-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.key-vault-inline-get-key {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #38bdf8 !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  transition: all 0.15s ease !important;
}

.key-vault-inline-get-key:hover {
  color: #7dd3fc !important;
  text-decoration: underline !important;
}

[data-theme="light"] .key-vault-section-title {
  color: #64748b !important;
}

/* Key Items List (Scrollable Area) */
.key-vault-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  max-height: 240px !important;
  min-height: 60px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 4px !important;
  flex: 1 1 auto !important;
}

.key-vault-list::-webkit-scrollbar {
  width: 4px;
}

.key-vault-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.key-vault-item {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
  background: rgba(30, 41, 59, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: all 0.2s ease !important;
  text-align: left !important;
}

[data-theme="light"] .key-vault-item {
  background: rgba(248, 250, 252, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.key-vault-item.is-primary {
  border-color: rgba(99, 102, 241, 0.5) !important;
  background: rgba(99, 102, 241, 0.1) !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.1) !important;
}

[data-theme="light"] .key-vault-item.is-primary {
  border-color: rgba(99, 102, 241, 0.4) !important;
  background: rgba(99, 102, 241, 0.06) !important;
}

.key-item-top-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
}

.key-item-name-wrap {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.key-item-name {
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #f8fafc !important;
  letter-spacing: 0.4px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
}

[data-theme="light"] .key-item-name {
  color: #0f172a !important;
}

.key-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 2px 6px !important;
  font-size: 0.62rem !important;
  font-weight: 600 !important;
  border-radius: 5px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  flex-shrink: 0 !important;
}

.key-badge-primary {
  background: rgba(99, 102, 241, 0.22) !important;
  color: #c7d2fe !important;
  border: 1px solid rgba(99, 102, 241, 0.4) !important;
}

[data-theme="light"] .key-badge-primary {
  background: rgba(99, 102, 241, 0.12) !important;
  color: #4338ca !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

.key-badge-standby {
  background: rgba(148, 163, 184, 0.15) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
}

.key-badge-cooldown {
  background: rgba(234, 179, 8, 0.18) !important;
  color: #facc15 !important;
  border: 1px solid rgba(234, 179, 8, 0.35) !important;
}

.key-badge-invalid {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

.key-item-bottom-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  padding-top: 2px !important;
}

.key-item-meta {
  font-size: 0.7rem !important;
  color: #94a3b8 !important;
  line-height: 1.2 !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.key-item-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}

.btn-vault-action {
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.btn-make-primary {
  padding: 3px 8px !important;
  height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.btn-make-primary:hover {
  background: rgba(99, 102, 241, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(99, 102, 241, 0.45) !important;
}

[data-theme="light"] .btn-make-primary {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #334155 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .btn-make-primary:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #4338ca !important;
}

.btn-delete-key {
  width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  border-radius: 6px !important;
}

.btn-delete-key svg {
  width: 13px !important;
  height: 13px !important;
}

.btn-delete-key:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #ffffff !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
}

/* Add Key Form in Vault (Bulletproof Mobile Fit) */
.key-vault-add-section {
  padding: 8px 10px !important;
  background: rgba(30, 41, 59, 0.4) !important;
  border: 1px dashed rgba(99, 102, 241, 0.3) !important;
  border-radius: 9px !important;
  margin-bottom: 10px !important;
  text-align: left !important;
}

[data-theme="light"] .key-vault-add-section {
  background: rgba(248, 250, 252, 0.7) !important;
  border-color: rgba(99, 102, 241, 0.25) !important;
}

.key-vault-custom-fields {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin-bottom: 6px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.key-vault-custom-fields.hidden {
  display: none !important;
}

.key-vault-add-form {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.key-vault-input-wrap {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  position: relative !important;
}

.key-vault-input-wrap input {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 6px 9px !important;
  font-size: 0.78rem !important;
  height: 34px !important;
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 7px !important;
  color: #f8fafc !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.key-vault-input-wrap input:focus {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
}

.key-vault-input-wrap input.key-input-highlight {
  border-color: #818cf8 !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6) !important;
}

[data-theme="light"] .key-vault-input-wrap input {
  background: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.16) !important;
  color: #0f172a !important;
}

[data-theme="light"] .key-vault-input-wrap input:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15) !important;
}

.btn-vault-add-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  height: 34px !important;
  padding: 0 11px !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  border-radius: 7px !important;
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  color: #ffffff !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
  transition: all 0.2s ease !important;
}

.btn-vault-add-btn:hover {
  filter: brightness(1.1) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.4) !important;
}

.btn-vault-add-btn svg {
  width: 12px !important;
  height: 12px !important;
}

.key-vault-add-feedback {
  font-size: 0.72rem !important;
  margin-top: 5px !important;
  display: none;
  text-align: left !important;
}

.key-vault-add-feedback.show {
  display: block !important;
}

.key-vault-add-feedback.err {
  color: #f87171 !important;
}

.key-vault-add-feedback.ok {
  color: #34d399 !important;
}

/* Modal Footer */
.key-vault-footer {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  padding-top: 10px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .key-vault-footer {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}

.btn-vault-done {
  padding: 6px 20px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  height: 32px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* ── Header Interface Language Switcher (Compact Flag Only Button) ── */
.header-ui-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: auto;
  min-width: auto;
}

.header-ui-lang-wrap .custom-select-container {
  width: auto;
  display: inline-flex;
  align-items: center;
}

.header-ui-lang-wrap .custom-select-trigger {
  min-height: 36px;
  height: 36px;
  width: 36px;
  min-width: 36px;
  padding: 0 !important;
  border-radius: var(--radius-pill);
  background: var(--surface-inner);
  border: 1px solid var(--border-medium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
  gap: 0 !important;
}

.header-ui-lang-wrap .custom-select-trigger:hover {
  border-color: var(--brand-primary-light);
  transform: translateY(-1px);
  background: var(--surface-glass-active);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.header-ui-lang-wrap .custom-select-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  gap: 0;
}

.header-ui-lang-wrap .custom-select-value .custom-select-flag-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-ui-lang-wrap .custom-select-value .lang-flag-svg {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: block;
}

.header-ui-lang-wrap .custom-select-chevron {
  display: none !important;
}

.header-ui-lang-wrap .custom-select-menu {
  right: 0 !important;
  left: auto !important;
  min-width: 200px !important;
  width: 220px !important;
  max-width: min(260px, calc(100vw - 20px)) !important;
  max-height: min(200px, calc(100vh - 100px)) !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
  z-index: 9999999 !important;
  overflow: hidden !important;
  overscroll-behavior: contain !important;
}

.header-ui-lang-wrap .custom-select-search-wrap {
  padding: 6px 8px !important;
}

.header-ui-lang-wrap .custom-select-search-input {
  height: 32px !important;
  font-size: 0.78rem !important;
  padding: 4px 8px 4px 28px !important;
}

.header-ui-lang-wrap .custom-select-search-icon {
  width: 13px !important;
  height: 13px !important;
  left: 10px !important;
}

.header-ui-lang-wrap .custom-select-options-list {
  max-height: 94px !important; /* Compact view: 2 languages per scroll view */
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

.header-ui-lang-wrap .custom-select-option {
  padding: 7px 10px !important;
  min-height: 44px !important;
  gap: 8px !important;
  box-sizing: border-box !important;
}

.header-ui-lang-wrap .custom-select-option .option-main-title {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
}

.header-ui-lang-wrap .custom-select-option .option-sub-desc {
  font-size: 0.68rem !important;
}

.header-ui-lang-wrap .custom-select-option .lang-flag-svg {
  width: 20px !important;
  height: 14px !important;
  border-radius: 2px !important;
}

.header-ui-lang-wrap .custom-select-option .option-check-icon {
  flex-shrink: 0 !important;
  margin-left: auto !important;
  margin-right: 2px !important;
  width: 14px !important;
  height: 14px !important;
}

/* ── RTL Language Layout Support ── */
html[dir="rtl"],
body.is-rtl {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .header-ui-lang-wrap .custom-select-menu {
  right: auto;
  left: 0;
}

html[dir="rtl"] .custom-select-trigger {
  text-align: right;
}

html[dir="rtl"] .custom-select-option {
  flex-direction: row;
}

html[dir="rtl"] .custom-select-chevron {
  margin-right: auto;
  margin-left: 0;
}

html[dir="rtl"] .modal-actions-row {
  flex-direction: row-reverse;
}

/* ── Mobile 2-Row Balanced Header & Layout Architecture (<= 768px) ── */
@media (max-width: 768px) {
  .top-nav {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto !important;
    row-gap: 8px !important;
    column-gap: 8px !important;
    align-items: center !important;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px 12px !important;
    margin-bottom: 8px !important;
    overflow: visible !important;
  }

  .brand-group {
    grid-column: 1 / 2 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    justify-content: flex-start !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .nav-badges {
    display: contents !important;
    overflow: visible !important;
  }

  /* Row 1 Right: User Preferences & Account */
  .nav-user-group {
    grid-column: 2 / 3 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  /* Row 2: System Status (Left) & Actions (Right) */
  .nav-system-group {
    grid-column: 1 / -1 !important;
    grid-row: 2 / 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding-top: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    overflow: visible !important;
  }

  [data-theme="light"] .nav-system-group {
    border-top-color: rgba(0, 0, 0, 0.06) !important;
  }

  .nav-system-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
  }

  .nav-system-group .header-ai-status-badge {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
  }

  .nav-system-group .header-sub-ad-pill {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    height: 32px !important;
    max-height: 32px !important;
    margin: 0 6px !important;
    padding: 0 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
  }

  /* Theme Toggle in Mobile Header */
  .theme-toggle-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .theme-toggle-btn .theme-label {
    display: none !important;
  }

  /* UI Language Switcher in Mobile Header */
  .header-ui-lang-wrap {
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
    flex-shrink: 0 !important;
  }

  .header-ui-lang-wrap .custom-select-trigger {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .header-ui-lang-wrap .custom-select-value .lang-flag-svg {
    width: 20px !important;
    height: 14px !important;
  }

  /* User Account in Mobile Header */
  .user-auth-badge {
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  .btn-google-sign-in {
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 10px !important;
    font-size: 0.72rem !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex;
    align-items: center !important;
    gap: 5px !important;
  }

  .btn-google-sign-in.hidden,
  .user-profile-dropdown-wrap.hidden,
  #googleSignInBtn.hidden,
  #userProfileWrap.hidden {
    display: none !important;
  }

  .user-profile-btn {
    height: 34px !important;
    min-height: 34px !important;
    padding: 3px 8px 3px 4px !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .user-avatar-img {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
  }

  .user-short-name {
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    max-width: 75px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* AI Status Badge in Mobile Header */
  .header-ai-status-badge {
    padding: 5px 10px !important;
    font-size: 0.72rem !important;
    height: 32px !important;
    border-radius: var(--radius-pill) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .header-ai-status-badge .status-text {
    white-space: nowrap !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
  }

  .header-ai-status-badge .status-indicator-dot {
    width: 7px !important;
    height: 7px !important;
    flex-shrink: 0 !important;
  }

  /* Downloads History Button in Mobile Header (Native App Only) */
  .header-downloads-btn {
    display: none !important;
  }

  body.is-native-platform .header-downloads-btn {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  /* Get APK Button in Mobile Header */
  .header-apk-btn {
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    border-radius: var(--radius-pill) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
  }

  .header-apk-btn span {
    display: inline-block !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
  }

  .header-apk-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
}

/* ── Ultra-Compact Screen Adaptations (<= 380px) ── */
@media (max-width: 380px) {
  .top-nav {
    padding: max(6px, env(safe-area-inset-top)) 8px 6px 8px !important;
    row-gap: 6px !important;
  }

  .user-short-name {
    display: none !important;
  }

  .user-profile-btn {
    padding: 3px !important;
  }

  .header-ai-status-badge {
    padding: 4px 7px !important;
    font-size: 0.67rem !important;
    gap: 4px !important;
  }

  .header-ai-status-badge .status-text {
    font-size: 0.67rem !important;
  }

  .header-apk-btn {
    padding: 0 7px !important;
  }

  .header-apk-btn span {
    font-size: 0.67rem !important;
  }
}

/* ── Engine Settings Guided Bottom CTA ── */
.engine-settings-cta-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

[data-theme="light"] .engine-settings-cta-wrap {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.btn-proceed-translate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 28px;
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md, 14px);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  max-width: 320px;
}

.btn-proceed-translate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
}

.btn-proceed-translate:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}

.btn-proceed-translate svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn-proceed-translate:hover svg {
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .engine-settings-cta-wrap {
    margin-top: 12px !important;
    padding-top: 12px !important;
    width: 100% !important;
  }
  .btn-proceed-translate {
    width: 100% !important;
    max-width: 100% !important;
    padding: 11px 18px !important;
    min-height: 44px !important;
    font-size: 0.88rem !important;
    border-radius: 12px !important;
  }
}

@media (min-width: 640px) {
  .btn-proceed-translate {
    width: auto;
    min-width: 280px;
  }
}

/* ── Minimal Sponsored / In-Progress Strip ── */
.progress-ad-strip {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-sm, 10px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  transition: all 0.2s ease;
}

[data-theme="light"] .progress-ad-strip {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}

.progress-ad-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--text-muted, #94a3b8);
}

.progress-ad-badge {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
}

[data-theme="light"] .progress-ad-badge {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
  border-color: rgba(79, 70, 229, 0.25);
}

/* ── Responsive Sub-Tab Labels (Prevent mobile truncation) ── */
.sub-tab-pill .sub-tab-text-mobile {
  display: none;
}

@media (max-width: 640px) {
  .sub-tab-pill .sub-tab-text-full {
    display: none !important;
  }
  .sub-tab-pill .sub-tab-text-mobile {
    display: inline !important;
  }
}

/* ── Cloud Archive Feature Showcase & Perks (Eliminates dead space) ── */
.cloud-perks-section {
  margin-top: 14px;
  padding: 18px 16px;
  border-radius: var(--radius-lg, 18px);
  background: var(--surface-card);
  border: 1px solid var(--border-medium);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .cloud-perks-section {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(99, 102, 241, 0.16);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.cloud-perks-header {
  margin-bottom: 14px;
}

.cloud-perks-header h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.cloud-perks-header .desc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.cloud-perks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.cloud-perk-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface-inner, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  transition: transform 0.2s ease, border-color 0.2s ease;
}

[data-theme="light"] .cloud-perk-item {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(15, 23, 42, 0.06);
}

.cloud-perk-item:hover {
  transform: translateY(-1px);
  border-color: var(--brand-primary-light, rgba(99, 102, 241, 0.4));
}

.cloud-perk-item .perk-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-gradient, linear-gradient(135deg, #6366f1, #8b5cf6));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.cloud-perk-item .perk-icon-wrap svg {
  width: 16px;
  height: 16px;
}

.cloud-perk-item .perk-text strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 2px;
}

.cloud-perk-item .perk-text p {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0;
}

/* Ensure Header UI Language Switcher Container has highest stacking priority when open */
.top-nav:has(.custom-select-container.is-open),
.nav-badges:has(.custom-select-container.is-open),
.nav-user-group:has(.custom-select-container.is-open),
.header-ui-lang-wrap:has(.custom-select-container.is-open),
.top-nav.has-open-dropdown,
.nav-badges.has-open-dropdown,
.nav-user-group.has-open-dropdown,
.header-ui-lang-wrap.has-open-dropdown,
.has-open-dropdown {
  overflow: visible !important;
  z-index: 99999999 !important;
}

.header-ui-lang-wrap {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.header-ui-lang-wrap .custom-select-trigger {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

/* Expanded tap area for touch screens */
.header-ui-lang-wrap .custom-select-trigger::after {
  content: '';
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -6px;
  right: -6px;
}

@media (max-width: 768px) {
  .header-ui-lang-wrap .custom-select-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 200px !important;
    width: 220px !important;
    max-width: min(260px, calc(100vw - 20px)) !important;
    position: absolute !important;
    top: calc(100% + 6px) !important;
  }
  html[dir="rtl"] .header-ui-lang-wrap .custom-select-menu {
    right: auto !important;
    left: 0 !important;
  }
}

/* Global Ironclad Auth & Platform Visibility Overrides */
.btn-google-sign-in.hidden,
#googleSignInBtn.hidden,
.user-profile-dropdown-wrap.hidden,
#userProfileWrap.hidden {
  display: none !important;
}

body:not(.is-native-platform) .header-downloads-btn,
body:not(.is-native-platform) #headerDownloadsBtn {
  display: none !important;
}

/* Native AdMob Banner Safe Layout Spacing & Floating Nav Clearance */
:root {
  --admob-banner-height: 56px;
}

body.has-admob-banner {
  padding-bottom: calc(var(--admob-banner-height, 56px) + 84px) !important;
}

body.has-admob-banner .native-bottom-nav {
  bottom: calc(14px + var(--admob-banner-height, 56px)) !important;
}

/* ── Prevent Duplicate Auth Profile in Settings (Accessible via Top-Right Header Profile) ── */
#authSettingsSection {
  display: none !important;
}

/* ── Native App Only: Hide Modal Bottom Slots for Zero-Scroll Experience (Preserved 100% on Website for PC & Mobile Web) ── */
body.is-native-platform #engineSettingsAdSlot,
body.is-native-platform #apiSettingsAdSlot,
body.is-native-platform #historyAdSlot {
  display: none !important;
}

/* ── API Settings, Cloud History, Engine Settings, Results & Workspace CTA Embedded Ad Placements (Auto-Sizable) ── */
.api-settings-ad-container,
.history-ad-container,
.engine-settings-ad-container,
.result-ad-container,
.workspace-cta-ad-container {
  width: 100%;
  height: auto;
  min-height: 38px;
  margin: 8px auto 4px;
  padding: 4px 8px;
  border-radius: var(--radius-md, 12px);
  background: rgba(15, 23, 42, 0.40);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
  pointer-events: none;
  overflow: visible;
}

.workspace-cta-ad-container {
  margin: 10px auto 8px;
}

[data-theme="light"] .api-settings-ad-container,
[data-theme="light"] .history-ad-container,
[data-theme="light"] .engine-settings-ad-container,
[data-theme="light"] .result-ad-container,
[data-theme="light"] .workspace-cta-ad-container {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.api-settings-ad-container .ad-ins-wrapper,
.history-ad-container .ad-ins-wrapper,
.engine-settings-ad-container .ad-ins-wrapper,
.result-ad-container .ad-ins-wrapper,
.workspace-cta-ad-container .ad-ins-wrapper {
  min-height: 38px;
  height: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* ── Minimalist Ad Placeholder Preview (Clean, Zero Clutter, Non-Clickable) ── */
.ad-minimal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  min-height: 36px;
  box-sizing: border-box;
}

.ad-minimal-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.20);
  color: #818cf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
}

[data-theme="light"] .ad-minimal-badge {
  background: rgba(79, 70, 229, 0.10);
  color: #4f46e5;
}

.ad-minimal-text {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  letter-spacing: 0.2px;
}

[data-theme="light"] .ad-minimal-text {
  color: #64748b;
}

/* ── Subheader Gap Sponsored Ad Pill (Strictly Fixed Size, Zero Layout Shift) ── */
.header-sub-ad-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  max-height: 32px;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  padding: 0 10px;
  border-radius: var(--radius-pill, 9999px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  cursor: default;
  pointer-events: none;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

[data-theme="light"] .header-sub-ad-pill {
  background: rgba(0, 0, 0, 0.035);
  border-color: rgba(0, 0, 0, 0.09);
  color: #475569;
}

.header-sub-ad-pill .header-ad-tag {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.22);
  color: #818cf8;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
  line-height: 1.2;
}

[data-theme="light"] .header-sub-ad-pill .header-ad-tag {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
}

.header-sub-ad-pill .header-ad-text {
  font-size: 0.70rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .header-sub-ad-pill {
    padding: 0 6px !important;
    gap: 4px !important;
  }
  .header-sub-ad-pill .header-ad-tag {
    font-size: 0.52rem !important;
    padding: 1px 3.5px !important;
  }
  .header-sub-ad-pill .header-ad-text {
    font-size: 0.64rem !important;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   APP FREEZE-LOCKOUT & PLAY STORE FORCE UPDATE MODAL
   Admin/User Controlled — Completely unclosable when active
   ══════════════════════════════════════════════════════════════════════════ */

body.app-freeze-locked {
  overflow: hidden !important;
  touch-action: none !important;
  user-select: none !important;
}

body.app-freeze-locked > *:not(.update-lockout-backdrop) {
  pointer-events: none !important;
  user-select: none !important;
}

.update-lockout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 10, 22, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

[data-theme="light"] .update-lockout-backdrop {
  background: rgba(15, 23, 42, 0.88);
}

.update-lockout-backdrop.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.update-lockout-backdrop.hidden {
  display: none !important;
}

.update-lockout-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 30px 22px 24px 22px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.85),
              0 0 30px rgba(99, 102, 241, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.28s ease;
  box-sizing: border-box;
  will-change: transform, opacity;
}

[data-theme="light"] .update-lockout-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.25),
              0 0 25px rgba(99, 102, 241, 0.12);
}

.update-lockout-backdrop.is-visible .update-lockout-card {
  transform: translateY(0);
  opacity: 1;
}

.update-lockout-top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981, #f59e0b, #6366f1);
  background-size: 200% 100%;
  animation: shimmerGradient 4s linear infinite;
}

@keyframes shimmerGradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Pulsing Play Store Badge */
.update-lockout-icon-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.update-lockout-icon-halo {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(16, 185, 129, 0.2) 50%, transparent 70%);
  animation: pulseAura 2.4s ease-in-out infinite;
}

@keyframes pulseAura {
  0%, 100% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.18); opacity: 1; }
}

.update-lockout-icon-bubble {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .update-lockout-icon-bubble {
  background: linear-gradient(135deg, #f1f5f9, #ffffff);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.update-lockout-play-svg {
  width: 32px;
  height: 32px;
  color: #38bdf8;
  filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.4));
}

/* Version Comparison Chip */
.update-lockout-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  margin-bottom: 14px;
  font-size: 0.74rem;
  font-weight: 600;
}

[data-theme="light"] .update-lockout-version-badge {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.update-ver-curr {
  color: #f59e0b;
  text-decoration: line-through;
  opacity: 0.85;
}

.update-ver-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-secondary, #94a3b8);
}

.update-ver-req {
  color: #10b981;
  font-weight: 700;
}

.update-lockout-title {
  margin: 0 0 10px 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  letter-spacing: -0.02em;
}

[data-theme="light"] .update-lockout-title {
  color: #0f172a;
}

.update-lockout-message {
  margin: 0 0 24px 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary, #94a3b8);
  max-width: 360px;
}

[data-theme="light"] .update-lockout-message {
  color: #475569;
}

/* Action Buttons */
.update-lockout-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-update-playstore {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 700;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.45);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-update-playstore:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -5px rgba(16, 185, 129, 0.55);
}

.btn-update-playstore:active {
  transform: translateY(1px) scale(0.99);
}

.btn-update-playstore .btn-play-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.update-lockout-apk-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.update-lockout-apk-link svg {
  width: 15px;
  height: 15px;
}

.update-lockout-apk-link:hover {
  color: var(--text-primary, #e2e8f0);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: underline;
}

[data-theme="light"] .update-lockout-apk-link:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}
