/* Custom styles for DataRequestStudio (UI/UX Pro Max Design System) */

:root {
    --color-primary: #0F172A;
    --color-on-primary: #FFFFFF;
    --color-secondary: #334155;
    --color-on-secondary: #FFFFFF;
    --color-accent: #0369A1;
    --color-on-accent: #FFFFFF;
    --color-background: #F8FAFC;
    --color-foreground: #020617;
    --color-card: #FFFFFF;
    --color-card-foreground: #020617;
    --color-muted: #E8ECF1;
    --color-muted-foreground: #475569;
    --color-border: #E2E8F0;
    --color-destructive: #DC2626;
    --color-ring: #2563EB;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

html.dark {
    --color-primary: #0B0F19;
    --color-on-primary: #F8FAFC;
    --color-secondary: #1E293B;
    --color-accent: #38BDF8;
    --color-background: #070B14;
    --color-foreground: #F8FAFC;
    --color-card: #0F172A;
    --color-card-foreground: #F8FAFC;
    --color-muted: #152033;
    --color-muted-foreground: #94A3B8;
    --color-border: #1E293B;
    --color-destructive: #EF4444;
    --color-ring: #60A5FA;
}

/* ================= TYPOGRAPHY (PLUS JAKARTA SANS + INTER + JETBRAINS MONO) ================= */
body {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
}

code, pre, .font-mono, #sql-editor-input, #sql-code-block, #sql-edit-gutter, #sql-view-gutter, #console-agent-logs, .sql-stats-badge {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Tabular figures for data tables and financial numbers */
table, .tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ================= ACCESSIBILITY: WCAG FOCUS INDICATORS ================= */
:focus-visible {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
}

html.dark :focus-visible {
    outline: 2px solid #60a5fa !important;
    outline-offset: 2px !important;
}

button, a, input, select, textarea, [role="button"] {
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

/* Tactile pressed micro-interaction (UI/UX Pro Max) */
button:active:not(:disabled),
[role="button"]:active:not([aria-disabled="true"]),
.btn-tactile:active {
    transform: scale(0.98);
}

/* ================= PREFERS REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ================= WORKFLOW STEPPER TIMELINE (UI/UX PRO MAX) ================= */
.step-card {
    position: relative;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.step-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

.step-card.active {
    border-color: #3b82f6 !important;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(219, 234, 254, 0.6)) !important;
    box-shadow: 0 0 0 1px #3b82f6, 0 8px 16px -4px rgba(59, 130, 246, 0.2) !important;
}

html.dark .step-card.active {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.4), rgba(15, 23, 42, 0.8)) !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 0 1px #60a5fa, 0 8px 16px -4px rgba(59, 130, 246, 0.3) !important;
}

.step-card.done {
    border-color: #10b981 !important;
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.8), rgba(209, 250, 229, 0.4)) !important;
}

html.dark .step-card.done {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.3), rgba(15, 23, 42, 0.8)) !important;
    border-color: #059669 !important;
}

.step-num-badge {
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    min-height: 2rem !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.step-card.done .step-num-badge {
    background-color: #10b981 !important;
    color: #ffffff !important;
}

.step-card.active .step-num-badge {
    background-color: #2563eb !important;
    color: #ffffff !important;
    animation: pulse 1.8s infinite;
}

.tab-btn.active {
    color: #2563eb;
    border-color: #2563eb;
    font-weight: 600;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Subtle shadows and header utilities */
.shadow-2xs {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

.shadow-xs {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

header select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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");
    background-repeat: no-repeat;
    background-position: right 0.25rem center;
    background-size: 0.9em;
    padding-right: 1.35rem;
}

/* SQL IDE Window & Editor Styles */
.sql-window {
    background: #0B1120;
    border: 1px solid #1E293B;
    border-radius: 0.875rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

.sql-window-header {
    background: #0F172A;
    border-bottom: 1px solid #1E293B;
    border-top-left-radius: 0.875rem;
    border-top-right-radius: 0.875rem;
}

.sql-editor-gutter {
    user-select: none;
    color: #475569;
    background: #090E1A;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.625rem;
    text-align: right;
    padding: 1rem 0.75rem 1rem 0.5rem;
    border-right: 1px solid #1E293B;
}

.sql-code-area {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.625rem;
    background: transparent;
    color: #E2E8F0;
}

.sql-textarea-editor {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.625rem;
    background: transparent;
    color: #34D399;
    resize: vertical;
    outline: none;
}

.sql-textarea-editor:focus {
    color: #F8FAFC;
}

.sql-status-bar {
    background: #090E1A;
    border-top: 1px solid #1E293B;
    border-bottom-left-radius: 0.875rem;
    border-bottom-right-radius: 0.875rem;
}

/* ================= DARK MODE OVERRIDES (ENTERPRISE HIGH READABILITY — ALL LAYERS & STAGES) ================= */
html.dark {
    color-scheme: dark;
}

/* 1. Base Canvas & Elevation Hierarchy */
html.dark body {
    background-color: #080c16 !important;
    color: #e2e8f0 !important;
}

/* Surface Level 1: Main Panels, Header, Footer */
html.dark header {
    background-color: rgba(13, 20, 36, 0.96) !important;
    border-color: #1e293b !important;
}

html.dark header select,
html.dark header nav,
html.dark header button {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark header select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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") !important;
}

html.dark .bg-white {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #1e293b !important;
}

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

/* Surface Level 2: Inner Cards, Wells & Sub-Panels */
html.dark .bg-slate-50,
html.dark .bg-slate-100 {
    background-color: #131c2e !important;
    color: #e2e8f0 !important;
    border-color: #243247 !important;
}

html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/50,
html.dark .bg-slate-100\/80 {
    background-color: #111a2b !important;
    border-color: #243247 !important;
}

html.dark .bg-slate-200\/80,
html.dark .bg-slate-200 {
    background-color: #0b1120 !important;
    border-color: #1e293b !important;
}

/* 2. Global Typography & Neutral Text Contrast */
html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: #f8fafc !important;
}

html.dark .text-slate-700 {
    color: #f1f5f9 !important;
}

html.dark .text-slate-600 {
    color: #cbd5e1 !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400 {
    color: #94a3b8 !important;
}

/* 3. Universal High-Contrast Color Text Wildcards (No Dark Text On Dark Backgrounds) */
html.dark [class*="text-blue-9"],
html.dark [class*="text-blue-8"],
html.dark [class*="text-blue-7"] {
    color: #93c5fd !important;
}
html.dark .text-blue-600 {
    color: #60a5fa !important;
}

html.dark [class*="text-indigo-9"],
html.dark [class*="text-indigo-8"],
html.dark [class*="text-indigo-7"] {
    color: #a5b4fc !important;
}
html.dark .text-indigo-600 {
    color: #818cf8 !important;
}

html.dark [class*="text-emerald-9"],
html.dark [class*="text-emerald-8"],
html.dark [class*="text-emerald-7"] {
    color: #6ee7b7 !important;
}
html.dark .text-emerald-600 {
    color: #34d399 !important;
}

html.dark [class*="text-teal-9"],
html.dark [class*="text-teal-8"],
html.dark [class*="text-teal-7"] {
    color: #5eead4 !important;
}
html.dark .text-teal-600 {
    color: #2dd4bf !important;
}

html.dark [class*="text-cyan-9"],
html.dark [class*="text-cyan-8"],
html.dark [class*="text-cyan-7"] {
    color: #67e8f9 !important;
}
html.dark .text-cyan-600 {
    color: #22d3ee !important;
}

html.dark [class*="text-amber-9"],
html.dark [class*="text-amber-8"],
html.dark [class*="text-amber-7"] {
    color: #fde047 !important;
}
html.dark .text-amber-600 {
    color: #fbbf24 !important;
}

html.dark [class*="text-rose-9"],
html.dark [class*="text-rose-8"],
html.dark [class*="text-rose-7"],
html.dark [class*="text-red-9"],
html.dark [class*="text-red-8"],
html.dark [class*="text-red-7"] {
    color: #fda4af !important;
}
html.dark .text-rose-600,
html.dark .text-red-600 {
    color: #f43f5e !important;
}

html.dark [class*="text-purple-9"],
html.dark [class*="text-purple-8"],
html.dark [class*="text-purple-7"] {
    color: #d8b4fe !important;
}
html.dark .text-purple-600 {
    color: #c084fc !important;
}

/* 4. Universal Pastel Container Wildcards -> Dark Translucent Cards (No Blinding Pastel Boxes) */
html.dark [class*="bg-blue-50"],
html.dark [class*="bg-blue-100"] {
    background-color: rgba(30, 58, 138, 0.35) !important;
    border-color: rgba(96, 165, 250, 0.35) !important;
}

html.dark [class*="bg-indigo-50"],
html.dark [class*="bg-indigo-100"] {
    background-color: rgba(49, 46, 129, 0.35) !important;
    border-color: rgba(129, 140, 248, 0.35) !important;
}

html.dark [class*="bg-emerald-50"],
html.dark [class*="bg-emerald-100"] {
    background-color: rgba(6, 78, 59, 0.35) !important;
    border-color: rgba(52, 211, 153, 0.35) !important;
}

html.dark [class*="bg-teal-50"],
html.dark [class*="bg-teal-100"] {
    background-color: rgba(19, 78, 74, 0.35) !important;
    border-color: rgba(45, 212, 191, 0.35) !important;
}

html.dark [class*="bg-cyan-50"],
html.dark [class*="bg-cyan-100"] {
    background-color: rgba(22, 78, 99, 0.35) !important;
    border-color: rgba(34, 211, 238, 0.35) !important;
}

html.dark [class*="bg-amber-50"],
html.dark [class*="bg-amber-100"] {
    background-color: rgba(120, 53, 15, 0.35) !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
}

html.dark [class*="bg-rose-50"],
html.dark [class*="bg-rose-100"],
html.dark [class*="bg-red-50"],
html.dark [class*="bg-red-100"] {
    background-color: rgba(136, 19, 55, 0.35) !important;
    border-color: rgba(251, 113, 133, 0.35) !important;
}

html.dark [class*="bg-purple-50"],
html.dark [class*="bg-purple-100"] {
    background-color: rgba(88, 28, 135, 0.35) !important;
    border-color: rgba(192, 132, 252, 0.35) !important;
}

/* 5. Borders & Dividers Across All Panels */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300 {
    border-color: #243247 !important;
}

html.dark [class*="border-blue-100"],
html.dark [class*="border-blue-200"] {
    border-color: rgba(59, 130, 246, 0.4) !important;
}

html.dark [class*="border-indigo-100"],
html.dark [class*="border-indigo-200"] {
    border-color: rgba(99, 102, 241, 0.4) !important;
}

html.dark [class*="border-emerald-100"],
html.dark [class*="border-emerald-200"] {
    border-color: rgba(16, 185, 129, 0.4) !important;
}

html.dark [class*="border-teal-100"],
html.dark [class*="border-teal-200"] {
    border-color: rgba(20, 184, 166, 0.4) !important;
}

html.dark [class*="border-amber-100"],
html.dark [class*="border-amber-200"] {
    border-color: rgba(245, 158, 11, 0.4) !important;
}

html.dark [class*="border-rose-100"],
html.dark [class*="border-rose-200"],
html.dark [class*="border-red-100"],
html.dark [class*="border-red-200"] {
    border-color: rgba(244, 63, 94, 0.4) !important;
}

html.dark [class*="border-purple-100"],
html.dark [class*="border-purple-200"] {
    border-color: rgba(168, 85, 247, 0.4) !important;
}

/* 6. Form Controls, Dropdowns & Inputs */
html.dark input[type="text"],
html.dark input[type="password"],
html.dark select,
html.dark textarea {
    background-color: #0b1120 !important;
    border-color: #354763 !important;
    color: #f8fafc !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748b !important;
}

html.dark input[type="checkbox"] {
    background-color: #0b1120 !important;
    border-color: #475569 !important;
    accent-color: #3b82f6;
}

/* 7. Buttons: White Secondary Buttons & Sample Cards */
html.dark button.bg-white,
html.dark a.bg-white,
html.dark #sample-list button {
    background-color: #152033 !important;
    border-color: #2b3d57 !important;
    color: #e2e8f0 !important;
}

html.dark button.bg-white:hover,
html.dark a.bg-white:hover,
html.dark #sample-list button:hover {
    background-color: #1e2c45 !important;
    color: #ffffff !important;
    border-color: #435b80 !important;
}

/* 8. Stepper Pipeline Indicator (Stage 1) */
html.dark .step-card {
    border-color: #243247 !important;
}

html.dark .step-card:not(.active):not(.done) {
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}

html.dark .step-card:not(.active):not(.done) > div:first-child {
    background-color: #172236 !important;
    color: #94a3b8 !important;
}

html.dark .step-card.active {
    background-color: #16243d !important;
    border-color: #3b82f6 !important;
}

html.dark .step-card.done {
    background-color: #0b241a !important;
    border-color: #059669 !important;
}

/* 9. Tab Navigation Bar (Stage 2) */
html.dark .tab-btn.active {
    color: #60a5fa !important;
    border-color: #3b82f6 !important;
    font-weight: 600 !important;
}

html.dark .tab-btn:not(.active) {
    color: #94a3b8 !important;
    border-color: transparent !important;
}

html.dark .tab-btn:not(.active):hover {
    background-color: rgba(30, 41, 59, 0.5) !important;
    color: #f8fafc !important;
}

/* 10. Data Tables & Grids (Tab 5 Delivery, CMS History, Schemas) */
html.dark table {
    border-color: #243247 !important;
}

html.dark table thead th {
    background-color: #152033 !important;
    color: #cbd5e1 !important;
    border-color: #243247 !important;
    font-weight: 600 !important;
}

html.dark table tbody td {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #1a2538 !important;
}

html.dark table tbody tr:nth-child(even) td {
    background-color: #121a2a !important;
}

html.dark table tbody tr:hover td {
    background-color: #1c293e !important;
    color: #ffffff !important;
}

/* 11. Tab 5 Delivery Inspector & Sheet Sub-Tabs */
html.dark [id*="btn-sheet-tab-"] {
    color: #94a3b8 !important;
    background-color: transparent !important;
}

html.dark [id*="btn-sheet-tab-"]:hover {
    color: #f8fafc !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

html.dark [id*="btn-sheet-tab-"].bg-white {
    background-color: #1e293b !important;
    color: #a5b4fc !important;
    border: 1px solid #334155 !important;
    box-shadow: none !important;
}

/* 12. Executive Banners (Tab 1 Spec Purpose, Tab 4 Independent Audit Card, HITL Spec Confirmation Header) */
#verif-compliance-card,
#spec-purpose-banner,
#spec-confirmation-modal-header {
    background: linear-gradient(135deg, #090e1a 0%, #151a36 50%, #090e1a 100%) !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
    color: #ffffff !important;
}

html.dark input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85);
    cursor: pointer;
}

html.dark .verif-filter-btn:not(.bg-indigo-600) {
    background-color: #152033 !important;
    color: #cbd5e1 !important;
    border: 1px solid #28374d !important;
}

html.dark .verif-filter-btn:not(.bg-indigo-600):hover {
    background-color: #1e2c45 !important;
    color: #ffffff !important;
}

html.dark #verif-checks-list > div {
    background-color: #0f172a !important;
    border-color: #243247 !important;
}

html.dark #verif-checks-list > div:hover {
    border-color: #3b82f6 !important;
}

/* 13. File Dropzone (Stage 1) */
html.dark #dropzone {
    border-color: #334460 !important;
    background-color: rgba(19, 28, 46, 0.5) !important;
}

html.dark #dropzone:hover {
    border-color: #3b82f6 !important;
    background-color: rgba(37, 99, 235, 0.15) !important;
}

html.dark #file-display-name {
    color: #f8fafc !important;
}

/* 14. Inline Code, Tags & Chips */
html.dark code:not([class*="language-"]) {
    background-color: #152033 !important;
    color: #93c5fd !important;
    border: 1px solid #28374d !important;
}

/* 15. All Modal Dialogs (CMS, Analytics, Settings, Spec Confirmation, Catalog, Shortcuts) */
html.dark #cms-modal > div,
html.dark #cms-detail-modal > div,
html.dark #analytics-modal > div,
html.dark #om-settings-modal > div,
html.dark #spec-confirmation-modal > div,
html.dark #catalog-modal > div,
html.dark #shortcuts-modal > div {
    background-color: #0f172a !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9) !important;
    color: #f8fafc !important;
}

html.dark #cms-modal .border-b,
html.dark #cms-detail-modal .border-b,
html.dark #analytics-modal .border-b,
html.dark #om-settings-modal .border-b,
html.dark #spec-confirmation-modal .border-b,
html.dark #catalog-modal .border-b,
html.dark #shortcuts-modal .border-b {
    border-color: #1e293b !important;
}

html.dark #cms-modal .border-t,
html.dark #cms-detail-modal .border-t,
html.dark #analytics-modal .border-t,
html.dark #om-settings-modal .border-t,
html.dark #spec-confirmation-modal .border-t,
html.dark #catalog-modal .border-t,
html.dark #shortcuts-modal .border-t {
    border-color: #1e293b !important;
}

/* Modal Filter Buttons */
html.dark .catalog-filter-btn:not(.bg-blue-600),
html.dark .btn-period-filter:not(.bg-blue-600) {
    background-color: #152033 !important;
    color: #cbd5e1 !important;
    border: 1px solid #28374d !important;
}

html.dark .catalog-filter-btn:not(.bg-blue-600):hover,
html.dark .btn-period-filter:not(.bg-blue-600):hover {
    background-color: #1e2c45 !important;
    color: #ffffff !important;
}

/* 16. Footer */
html.dark footer {
    background-color: #090e1a !important;
    border-color: #1e293b !important;
    color: #94a3b8 !important;
}

/* 17. Custom Scrollbars in Dark Mode */
html.dark ::-webkit-scrollbar-track {
    background: #0b1120 !important;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #243247 !important;
    border-radius: 4px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
    background: #334460 !important;
}

/* ================= FLOATING TOAST NOTIFICATIONS (UI/UX PRO MAX) ================= */
.toast-item {
    pointer-events: auto;
    transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
    animation: toast-in 250ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-out {
    animation: toast-out 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
}

/* ================= MOBILE TOUCH TARGETS & ACCESSIBILITY POLISH (UI/UX PRO MAX) ================= */
@media (max-width: 640px) {
    button, [role="button"], select, .tab-btn {
        min-height: 38px;
    }
}





