:root {
    color-scheme: light;
    --app-bg: #f8fafc;
    --surface: #ffffff;
    --surface-elevated: rgba(255, 255, 255, 0.84);
    --surface-muted: #f8fafc;
    --surface-subtle: #f1f5f9;
    --surface-strong: #e2e8f0;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;
    --border-subtle: rgba(229, 231, 235, 0.9);
    --border-strong: rgba(203, 213, 225, 0.95);
    --shadow-elevated: 0 24px 60px -36px rgba(15, 23, 42, 0.35);
}

html.dark {
    color-scheme: dark;
    --app-bg: #020617;
    --surface: #0f172a;
    --surface-elevated: rgba(15, 23, 42, 0.84);
    --surface-muted: #111827;
    --surface-subtle: #1e293b;
    --surface-strong: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-soft: #64748b;
    --border-subtle: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.28);
    --shadow-elevated: 0 32px 80px -44px rgba(2, 6, 23, 0.9);
}

html.dark.bg-white,
html.dark.bg-gray-50,
html.dark.bg-gray-50\/50,
html.dark.bg-gray-50\/80 {
    background-color: var(--app-bg) !important;
}

html,
body {
    background-color: var(--app-bg);
    color: var(--text-primary);
}

body,
header,
main,
footer,
section,
article,
aside,
nav,
div,
a,
button,
input,
textarea,
select {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle svg {
    flex-shrink: 0;
}

html.dark .glass-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

html.dark .bg-white {
    background-color: var(--surface) !important;
}

html.dark .bg-white\/80 {
    background-color: var(--surface-elevated) !important;
}

html.dark .bg-white\/90 {
    background-color: rgba(15, 23, 42, 0.92) !important;
}

html.dark .bg-gray-50,
html.dark .bg-gray-50\/50,
html.dark .bg-gray-50\/80 {
    background-color: var(--surface-muted) !important;
}

html.dark .bg-gray-100 {
    background-color: var(--surface-subtle) !important;
}

html.dark .bg-gray-200 {
    background-color: var(--surface-strong) !important;
}

html.dark .text-gray-900 {
    color: var(--text-primary) !important;
}

html.dark .text-gray-800 {
    color: #e5eefc !important;
}

html.dark .text-gray-700,
html.dark .text-gray-600 {
    color: var(--text-secondary) !important;
}

html.dark .text-gray-500,
html.dark .text-gray-400 {
    color: var(--text-muted) !important;
}

html.dark .text-gray-300 {
    color: var(--text-soft) !important;
}

html.dark .text-slate-900 {
    color: var(--text-primary) !important;
}

html.dark .text-slate-700,
html.dark .text-slate-600 {
    color: var(--text-secondary) !important;
}

html.dark .border-gray-50 {
    border-color: rgba(148, 163, 184, 0.1) !important;
}

html.dark .border-gray-100,
html.dark .border-gray-200 {
    border-color: var(--border-subtle) !important;
}

html.dark .border-gray-300 {
    border-color: var(--border-strong) !important;
}

html.dark .border-red-200,
html.dark .border-red-300,
html.dark .border-red-500 {
    border-color: rgba(248, 113, 113, 0.42) !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-100 {
    background-color: var(--surface-subtle) !important;
}

html.dark .bg-slate-700 {
    background-color: #334155 !important;
}

html.dark .bg-slate-800 {
    background-color: #1e293b !important;
}

html.dark .bg-slate-900 {
    background-color: #0f172a !important;
}

html.dark .bg-brand-50,
html.dark .bg-blue-50,
html.dark .bg-indigo-50,
html.dark .bg-amber-50,
html.dark .bg-orange-50,
html.dark .bg-purple-50,
html.dark .bg-pink-50,
html.dark .bg-teal-50,
html.dark .bg-cyan-50,
html.dark .bg-sky-50,
html.dark .bg-green-50,
html.dark .bg-emerald-50,
html.dark .bg-red-50,
html.dark .bg-rose-50,
html.dark .bg-yellow-50 {
    background-color: rgba(30, 41, 59, 0.72) !important;
}

html.dark .bg-brand-100,
html.dark .bg-blue-100,
html.dark .bg-indigo-100,
html.dark .bg-amber-100,
html.dark .bg-orange-100,
html.dark .bg-purple-100,
html.dark .bg-pink-100,
html.dark .bg-teal-100,
html.dark .bg-cyan-100,
html.dark .bg-sky-100,
html.dark .bg-green-100,
html.dark .bg-emerald-100,
html.dark .bg-red-100,
html.dark .bg-rose-100,
html.dark .bg-yellow-100 {
    background-color: rgba(51, 65, 85, 0.9) !important;
}

html.dark .text-brand-600,
html.dark .text-brand-700,
html.dark .text-brand-800 {
    color: #c2cbff !important;
}

html.dark .text-blue-600,
html.dark .text-blue-700,
html.dark .text-blue-800,
html.dark .text-indigo-600,
html.dark .text-indigo-700,
html.dark .text-indigo-800,
html.dark .text-cyan-600,
html.dark .text-cyan-700,
html.dark .text-cyan-800,
html.dark .text-sky-600,
html.dark .text-sky-700,
html.dark .text-sky-800 {
    color: #93c5fd !important;
}

html.dark .text-purple-600,
html.dark .text-purple-700,
html.dark .text-purple-800,
html.dark .text-violet-600,
html.dark .text-violet-700,
html.dark .text-violet-800,
html.dark .text-pink-600,
html.dark .text-pink-700,
html.dark .text-pink-800,
html.dark .text-rose-600,
html.dark .text-rose-700,
html.dark .text-rose-800 {
    color: #c4b5fd !important;
}

html.dark .text-red-600,
html.dark .text-red-700,
html.dark .text-red-800 {
    color: #fca5a5 !important;
}

html.dark .text-amber-600,
html.dark .text-amber-700,
html.dark .text-amber-800,
html.dark .text-orange-600,
html.dark .text-orange-700,
html.dark .text-orange-800,
html.dark .text-yellow-600,
html.dark .text-yellow-700,
html.dark .text-yellow-800 {
    color: #fcd34d !important;
}

html.dark .text-green-600,
html.dark .text-green-700,
html.dark .text-green-800,
html.dark .text-emerald-600,
html.dark .text-emerald-700,
html.dark .text-emerald-800,
html.dark .text-teal-600,
html.dark .text-teal-700,
html.dark .text-teal-800 {
    color: #6ee7b7 !important;
}

html.dark .from-brand-50 {
    --tw-gradient-from: #141f53 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(20 31 83 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-blue-50 {
    --tw-gradient-from: #172554 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(23 37 84 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-amber-50 {
    --tw-gradient-from: #78350f var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(120 53 15 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-purple-50 {
    --tw-gradient-from: #3b0764 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(59 7 100 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-violet-50 {
    --tw-gradient-from: #4c1d95 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(76 29 149 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-rose-50 {
    --tw-gradient-from: #4c0519 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(76 5 25 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-green-50 {
    --tw-gradient-from: #052e16 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(5 46 22 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-teal-50 {
    --tw-gradient-from: #042f2e var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(4 47 46 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .from-cyan-50 {
    --tw-gradient-from: #083344 var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgb(8 51 68 / 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

html.dark .to-emerald-50 {
    --tw-gradient-to: #022c22 var(--tw-gradient-to-position) !important;
}

html.dark .to-indigo-50 {
    --tw-gradient-to: #1e1b4b var(--tw-gradient-to-position) !important;
}

html.dark .to-orange-50 {
    --tw-gradient-to: #431407 var(--tw-gradient-to-position) !important;
}

html.dark .to-pink-50 {
    --tw-gradient-to: #500724 var(--tw-gradient-to-position) !important;
}

html.dark .to-cyan-50 {
    --tw-gradient-to: #164e63 var(--tw-gradient-to-position) !important;
}

html.dark .to-sky-50 {
    --tw-gradient-to: #0c4a6e var(--tw-gradient-to-position) !important;
}

html.dark .to-yellow-50 {
    --tw-gradient-to: #422006 var(--tw-gradient-to-position) !important;
}

html.dark .ring-gray-100,
html.dark .ring-gray-200 {
    --tw-ring-color: rgba(148, 163, 184, 0.16) !important;
}

html.dark .ring-white {
    --tw-ring-color: #0f172a !important;
}

html.dark .ring-white\/30 {
    --tw-ring-color: rgba(15, 23, 42, 0.45) !important;
}

html.dark .ring-gray-300 {
    --tw-ring-color: rgba(148, 163, 184, 0.3) !important;
}

html.dark .ring-gray-900\/5 {
    --tw-ring-color: rgba(148, 163, 184, 0.16) !important;
}

html.dark .placeholder\:text-gray-400::placeholder {
    color: var(--text-soft) !important;
}

html.dark .shadow-sm,
html.dark .shadow-lg,
html.dark .shadow-xl,
html.dark .shadow-soft {
    box-shadow: var(--shadow-elevated) !important;
}

html.dark .hover\:bg-gray-50:hover {
    background-color: rgba(30, 41, 59, 0.75) !important;
}

html.dark .hover\:bg-brand-50:hover {
    background-color: rgba(68, 95, 227, 0.16) !important;
}

html.dark .divide-gray-50 > :not([hidden]) ~ :not([hidden]) {
    border-color: rgba(148, 163, 184, 0.1) !important;
}

html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--border-subtle) !important;
}

html.dark .divide-gray-300 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--border-strong) !important;
}

html.dark .hover\:text-gray-600:hover,
html.dark .hover\:text-gray-700:hover {
    color: #f8fafc !important;
}

html.dark .hover\:text-brand-700:hover,
html.dark .hover\:text-brand-600:hover {
    color: #dfe5ff !important;
}

html.dark .bg-mesh {
    background-color: #020617;
    background-image: radial-gradient(at 0% 0%, rgba(68, 95, 227, 0.18) 0, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(113, 134, 248, 0.1) 0, transparent 50%);
}

html.dark .bg-pattern {
    background-color: #141f53;
    background-image: radial-gradient(at 0% 0%, rgba(113, 134, 248, 0.24) 0, transparent 50%),
                      radial-gradient(at 50% 0%, rgba(68, 95, 227, 0.2) 0, transparent 50%),
                      radial-gradient(at 100% 0%, rgba(20, 31, 83, 0.3) 0, transparent 55%);
}

html.dark .markdown-content {
    color: var(--text-secondary);
}

html.dark .markdown-content h1,
html.dark .markdown-content h2,
html.dark .markdown-content h3,
html.dark .markdown-content strong {
    color: var(--text-primary);
}

html.dark .markdown-content h1 {
    border-bottom-color: var(--border-subtle);
}

html.dark .markdown-content p,
html.dark .markdown-content li,
html.dark .markdown-content em {
    color: var(--text-secondary);
}

html.dark .markdown-content code {
    background-color: rgba(148, 163, 184, 0.14);
    color: #e2e8f0;
}

html.dark .markdown-content pre {
    background-color: #020617;
    color: #e2e8f0;
}

html.dark .markdown-content blockquote {
    border-left-color: #7186f8;
    color: var(--text-muted);
}

html.dark .markdown-content a {
    color: #c2cbff;
}

html.dark .markdown-content hr {
    border-top-color: var(--border-subtle);
}

.autofill-preview-modal {
    isolation: isolate;
}

.autofill-preview-modal__backdrop {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    z-index: 0;
}

.autofill-preview-modal__panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    z-index: 1;
}

.autofill-preview-modal__header,
.autofill-preview-modal__footer,
.autofill-preview-doc__header,
.autofill-preview-doc__warnings {
    border-color: rgba(148, 163, 184, 0.2);
}

.autofill-preview-modal__title,
.autofill-preview-doc__title,
.autofill-preview-fill-card__label {
    color: #0f172a;
}

.autofill-preview-modal__subtitle,
.autofill-preview-modal__footnote,
.autofill-preview-doc__subtitle,
.autofill-preview-note,
.autofill-preview-fill-card__subtle,
.autofill-preview-section-label {
    color: #64748b;
}

.autofill-preview-modal__body {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.82) 0%, rgba(241, 245, 249, 0.96) 100%);
}

.autofill-preview-modal__footer {
    background: rgba(241, 245, 249, 0.9);
}

.autofill-preview-modal__close {
    color: #64748b;
}

.autofill-preview-modal__close:hover {
    background: rgba(226, 232, 240, 0.9);
    color: #0f172a;
}

.autofill-preview-empty,
.autofill-preview-doc {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(203, 213, 225, 0.7);
}

.autofill-preview-error {
    line-height: 1.55;
}

.autofill-preview-error--provider {
    background: rgba(224, 231, 255, 0.88);
    border-color: rgba(129, 140, 248, 0.35);
    color: #312e81;
}

.autofill-preview-error--warning {
    background: rgba(254, 243, 199, 0.92);
    border-color: rgba(245, 158, 11, 0.35);
    color: #92400e;
}

.autofill-preview-pill--filled {
    background: rgba(209, 250, 229, 0.95);
    color: #047857;
}

.autofill-preview-pill--unfilled {
    background: rgba(254, 243, 199, 0.95);
    color: #b45309;
}

.autofill-preview-pill--review {
    background: rgba(226, 232, 240, 0.95);
    color: #475569;
}

.autofill-preview-fill-card {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.autofill-preview-fill-card__body {
    color: #1e293b;
}

.autofill-preview-fill-card--filled {
    background: linear-gradient(135deg, rgba(220, 252, 231, 0.96) 0%, rgba(236, 253, 245, 0.92) 100%);
    border-color: rgba(52, 211, 153, 0.4);
}

.autofill-preview-fill-card--filled .autofill-preview-fill-card__label,
.autofill-preview-fill-card--filled .autofill-preview-fill-card__meta {
    color: #047857;
}

.autofill-preview-fill-card--unfilled {
    background: linear-gradient(135deg, rgba(255, 247, 237, 0.98) 0%, rgba(255, 251, 235, 0.94) 100%);
    border-color: rgba(251, 146, 60, 0.38);
}

.autofill-preview-fill-card--unfilled .autofill-preview-fill-card__label,
.autofill-preview-fill-card--unfilled .autofill-preview-fill-card__body {
    color: #9a3412;
}

.autofill-preview-warning {
    background: rgba(241, 245, 249, 0.86);
    border-color: rgba(148, 163, 184, 0.35);
    color: #334155;
}

.autofill-preview-button {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.autofill-preview-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.autofill-preview-button--secondary {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.45);
    color: #0f172a;
}

.autofill-preview-button--secondary:hover:not(:disabled) {
    background: rgba(248, 250, 252, 1);
}

.autofill-preview-button--primary {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.22);
}

.autofill-preview-button--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

html.dark .autofill-preview-modal__panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%) !important;
    border-color: rgba(99, 102, 241, 0.18) !important;
    color: #e5eefc !important;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.65) !important;
}

html.dark .autofill-preview-modal__header,
html.dark .autofill-preview-modal__footer,
html.dark .autofill-preview-doc__header,
html.dark .autofill-preview-doc__warnings {
    border-color: rgba(71, 85, 105, 0.75) !important;
}

html.dark .autofill-preview-modal__body {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(2, 6, 23, 0.92) 100%) !important;
}

html.dark .autofill-preview-modal__footer {
    background: rgba(15, 23, 42, 0.94) !important;
}

html.dark .autofill-preview-modal__title,
html.dark .autofill-preview-doc__title,
html.dark .autofill-preview-fill-card__label {
    color: #f8fafc !important;
}

html.dark .autofill-preview-modal__subtitle,
html.dark .autofill-preview-modal__footnote,
html.dark .autofill-preview-doc__subtitle,
html.dark .autofill-preview-note,
html.dark .autofill-preview-fill-card__subtle,
html.dark .autofill-preview-section-label {
    color: #94a3b8 !important;
}

html.dark .autofill-preview-modal__close {
    color: #cbd5e1 !important;
}

html.dark .autofill-preview-modal__close:hover {
    background: rgba(51, 65, 85, 0.92) !important;
    color: #f8fafc !important;
}

html.dark .autofill-preview-empty,
html.dark .autofill-preview-doc {
    background: rgba(15, 23, 42, 0.78) !important;
    border-color: rgba(71, 85, 105, 0.72) !important;
}

html.dark .autofill-preview-error--provider {
    background: rgba(49, 46, 129, 0.28) !important;
    border-color: rgba(129, 140, 248, 0.42) !important;
    color: #c7d2fe !important;
}

html.dark .autofill-preview-error--warning {
    background: rgba(120, 53, 15, 0.26) !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
    color: #fde68a !important;
}

html.dark .autofill-preview-pill--filled {
    background: rgba(6, 95, 70, 0.4) !important;
    color: #86efac !important;
}

html.dark .autofill-preview-pill--unfilled {
    background: rgba(146, 64, 14, 0.4) !important;
    color: #fde68a !important;
}

html.dark .autofill-preview-pill--review {
    background: rgba(51, 65, 85, 0.82) !important;
    color: #cbd5e1 !important;
}

html.dark .autofill-preview-fill-card__body {
    color: #dbeafe !important;
}

html.dark .autofill-preview-fill-card--filled {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.56) 0%, rgba(4, 120, 87, 0.28) 100%) !important;
    border-color: rgba(52, 211, 153, 0.34) !important;
}

html.dark .autofill-preview-fill-card--filled .autofill-preview-fill-card__label,
html.dark .autofill-preview-fill-card--filled .autofill-preview-fill-card__meta {
    color: #86efac !important;
}

html.dark .autofill-preview-fill-card--unfilled {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.5) 0%, rgba(154, 52, 18, 0.26) 100%) !important;
    border-color: rgba(251, 146, 60, 0.34) !important;
}

html.dark .autofill-preview-fill-card--unfilled .autofill-preview-fill-card__label,
html.dark .autofill-preview-fill-card--unfilled .autofill-preview-fill-card__body {
    color: #fdba74 !important;
}

html.dark .autofill-preview-warning {
    background: rgba(30, 41, 59, 0.86) !important;
    border-color: rgba(100, 116, 139, 0.45) !important;
    color: #cbd5e1 !important;
}

html.dark .autofill-preview-button--secondary {
    background: rgba(30, 41, 59, 0.92) !important;
    border-color: rgba(100, 116, 139, 0.55) !important;
    color: #f8fafc !important;
}

html.dark .autofill-preview-button--secondary:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.95) !important;
}

html.dark .autofill-preview-button--primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.28) !important;
}
