/* ==========================================================================
   FinSight AI — Premium Enterprise Design System
   Theme: Dark & Light Financial Intelligence Platform
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    /* Brand Palette */
    --brand-primary: #2563eb;
    --brand-primary-hover: #1d4ed8;
    --brand-primary-dim: rgba(37, 99, 235, 0.12);
    --brand-cyan: #0ea5e9;
    --brand-accent: #6366f1;
    --brand-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --brand-gradient-soft: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(14, 165, 233, 0.08) 100%);

    /* Risk Levels */
    --risk-critical: #ef4444;
    --risk-critical-bg: rgba(239, 68, 68, 0.1);
    --risk-critical-border: rgba(239, 68, 68, 0.3);
    --risk-high: #f97316;
    --risk-high-bg: rgba(249, 115, 22, 0.1);
    --risk-high-border: rgba(249, 115, 22, 0.3);
    --risk-medium: #f59e0b;
    --risk-medium-bg: rgba(245, 158, 11, 0.1);
    --risk-medium-border: rgba(245, 158, 11, 0.3);
    --risk-safe: #10b981;
    --risk-safe-bg: rgba(16, 185, 129, 0.1);
    --risk-safe-border: rgba(16, 185, 129, 0.3);

    /* Typography */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Animation */
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Geometry */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 999px;
}

/* ==========================================================================
   Dark Theme (Default)
   ========================================================================== */
[data-theme="dark"] {
    --bg-base: #070b14;
    --bg-surface: #0d1524;
    --bg-surface-elevated: #141f32;
    --bg-glass: rgba(13, 21, 36, 0.82);
    --bg-input: #0b1220;

    /* Boosted text contrast for readability */
    --text-primary: #eef2ff;
    --text-secondary: #a8bdd8;
    /* was #8ba0c4 — lifted +20% lightness */
    --text-muted: #7090b8;
    /* was #4f6282 — lifted +30% lightness */

    --border-subtle: rgba(99, 155, 255, 0.09);
    --border-strong: rgba(99, 155, 255, 0.17);
    --border-accent: rgba(37, 99, 235, 0.35);

    --shadow-soft: 0 4px 28px -4px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 32px -8px rgba(37, 99, 235, 0.22);
    --shadow-card: 0 8px 40px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 155, 255, 0.07);
}

/* ==========================================================================
   Light Theme
   ========================================================================== */
[data-theme="light"] {
    --bg-base: #f0f4fc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f5f7ff;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-input: #f8faff;

    /* Boosted text contrast for readability */
    --text-primary: #0c1428;
    --text-secondary: #2e4060;
    /* was #4b6080 — darkened for WCAG AA */
    --text-muted: #506080;
    /* was #9aafc8 — much darker, now readable */

    --border-subtle: #dde6f5;
    --border-strong: #c6d5ec;
    --border-accent: rgba(37, 99, 235, 0.3);

    --shadow-soft: 0 4px 24px -4px rgba(37, 99, 235, 0.07);
    --shadow-glow: 0 0 28px -8px rgba(37, 99, 235, 0.1);
    --shadow-card: 0 8px 36px -8px rgba(37, 99, 235, 0.08), 0 0 0 1px #dde6f5;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Subtle animated mesh background */
    background-image:
        radial-gradient(ellipse at 8% 12%, rgba(37, 99, 235, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 92% 85%, rgba(14, 165, 233, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 55% 50%, rgba(99, 102, 241, 0.03) 0%, transparent 60%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary);
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.25rem;
    height: 64px;
    background: var(--bg-glass);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    /* Edge-lit top accent */
    box-shadow: 0 1px 0 0 var(--border-subtle), inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: var(--brand-gradient-soft);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.brand-logo:hover {
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--brand-primary);
}

.logo-svg {
    width: 28px;
    height: 28px;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    color: var(--text-primary);
}

.ai-badge {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(2, 132, 199, 0.16));
    border: 1px solid rgba(37, 99, 235, 0.35);
    color: #38bdf8;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    letter-spacing: 0.05em;
    margin-left: 0.45rem;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-text p {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

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

.theme-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.theme-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.2);
    transform: rotate(15deg);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.75rem 2rem;
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0;
}

.tab-btn {
    position: relative;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.65rem 1.1rem 0.85rem;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    margin-bottom: -1px;
}

.tab-btn i {
    font-size: 0.85em;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    font-weight: 700;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================================================
   Glass Cards — Core Building Block
   ========================================================================== */
.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* Subtle top-edge shimmer on cards */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 40%, rgba(255, 255, 255, 0.13) 60%, transparent);
    pointer-events: none;
}

/* ==========================================================================
   Desk Views
   ========================================================================== */
.desk-view {
    animation: fadeSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.form-container-card {
    max-width: 980px;
    margin: 0 auto;
    padding: 2.5rem 2.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.form-container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-primary) 40%, var(--brand-cyan) 60%, transparent);
    opacity: 0.4;
}

.view-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.view-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: -0.02em;
}

.view-header h2 i {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.view-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.55;
}

/* ==========================================================================
   Form
   ========================================================================== */
.aligned-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.form-section-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.6rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.form-section-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
    pointer-events: none;
}

.form-section-card:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.06), var(--shadow-soft);
}

.form-section-card:focus-within::after {
    border-color: var(--border-accent);
    opacity: 0.5;
}

.section-title-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.step-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.section-title-bar h3 {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title-bar h3 i {
    color: var(--brand-cyan);
    font-size: 0.85rem;
}

.inputs-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    width: 100%;
}

@media (max-width: 860px) {
    .inputs-grid-3 {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .form-container-card {
        padding: 1.5rem 1.25rem;
    }

    .form-actions-bar {
        flex-direction: column;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.form-group label {
    font-family: var(--font-heading);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.72rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: var(--transition-smooth);
    outline: none;
    appearance: none;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--border-accent);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
    background: var(--bg-surface);
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238ba0c4'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 18px;
    padding-right: 2.5rem;
    cursor: pointer;
}

input[type="datetime-local"] {
    color-scheme: dark;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

[data-theme="light"] input[type="datetime-local"] {
    color-scheme: light;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    padding: 0.72rem 1.3rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: -0.01em;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s ease;
    pointer-events: none;
}

.btn:hover::after {
    background: rgba(255, 255, 255, 0.06);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--brand-gradient);
    color: #ffffff;
    flex: 1;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--brand-primary-dim);
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--brand-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.btn-text:hover {
    background: var(--brand-primary-dim);
    text-decoration: none;
}

.btn-large {
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

.form-actions-bar {
    display: flex;
    gap: 0.85rem;
    margin-top: 0.5rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Results Dossier
   ========================================================================== */
.results-container-card {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.25rem 2.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.results-container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-primary) 30%, var(--brand-cyan) 70%, transparent);
    opacity: 0.5;
}

.analysis-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 1rem;
}

.back-btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    font-family: var(--font-heading);
    font-weight: 600;
}

.back-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
    transform: translateX(-2px);
}

.analysis-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.analysis-header-title h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.live-tag {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--risk-safe);
    background: var(--risk-safe-bg);
    border: 1px solid var(--risk-safe-border);
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.live-tag i {
    font-size: 0.5rem;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.4);
    }
}

/* ==========================================================================
   Dossier Banner
   ========================================================================== */
.dossier-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.4rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.dossier-banner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 2px 0 0 2px;
}

.dossier-banner.risk-critical {
    background: var(--risk-critical-bg);
    border-color: var(--risk-critical-border);
}

.dossier-banner.risk-critical::before {
    background: var(--risk-critical);
}

.dossier-banner.risk-high {
    background: var(--risk-high-bg);
    border-color: var(--risk-high-border);
}

.dossier-banner.risk-high::before {
    background: var(--risk-high);
}

.dossier-banner.risk-medium {
    background: var(--risk-medium-bg);
    border-color: var(--risk-medium-border);
}

.dossier-banner.risk-medium::before {
    background: var(--risk-medium);
}

.dossier-banner.risk-low {
    background: var(--risk-safe-bg);
    border-color: var(--risk-safe-border);
}

.dossier-banner.risk-low::before {
    background: var(--risk-safe);
}

.banner-badge {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.risk-critical .banner-badge {
    color: var(--risk-critical);
}

.risk-high .banner-badge {
    color: var(--risk-high);
}

.risk-medium .banner-badge {
    color: var(--risk-medium);
}

.risk-low .banner-badge {
    color: var(--risk-safe);
}

.banner-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.divider {
    margin: 0 0.5rem;
    color: var(--border-strong);
}

/* ==========================================================================
   Dossier Sections
   ========================================================================== */
.dossier-section {
    margin-bottom: 1.75rem;
}

.dossier-section h3 {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dossier-section h3 i {
    color: var(--brand-primary);
    font-size: 0.95em;
}

.summary-box {
    background: var(--bg-surface-elevated);
    padding: 1.25rem 1.35rem;
    border-radius: var(--radius-md);
    line-height: 1.7;
    font-size: 0.92rem;
    border-left: 3px solid var(--brand-primary);
    color: var(--text-primary);
}

.indicators-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.indicators-list li {
    background: var(--bg-surface-elevated);
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.55;
    transition: var(--transition-fast);
}

.indicators-list li:hover {
    border-color: var(--border-accent);
    background: var(--bg-surface);
}

/* ==========================================================================
   Citations & Precedents
   ========================================================================== */
.citations-grid,
.precedents-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 900px) {

    .citations-grid,
    .precedents-grid {
        grid-template-columns: 1fr;
    }
}

.citation-card,
.precedent-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    transition: var(--transition-smooth);
}

.citation-card:hover,
.precedent-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.citation-header,
.precedent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.55rem;
}

.citation-code,
.precedent-id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--brand-primary-dim);
    color: var(--brand-primary);
    padding: 0.18rem 0.55rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
}

.citation-title,
.precedent-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.citation-body,
.precedent-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ==========================================================================
   Checklist
   ========================================================================== */
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    background: var(--bg-surface-elevated);
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    border: 1px solid var(--border-subtle);
    transition: var(--transition-fast);
}

.check-item:hover {
    border-color: var(--border-accent);
}

.check-item input[type="checkbox"] {
    margin-top: 0.15rem;
    accent-color: var(--brand-primary);
    cursor: pointer;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ==========================================================================
   Quick ML Modal
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1.5rem;
}

.quick-modal-card {
    max-width: 440px;
    width: 90%;
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
    animation: modalPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.quick-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-primary) 40%, var(--brand-cyan) 60%, transparent);
    opacity: 0.6;
}

.quick-score-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.35rem 0;
}

.quick-score-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.quick-label {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.quick-verdict-badge {
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quick-verdict-badge.badge-suspicious {
    background: var(--risk-critical-bg);
    color: var(--risk-critical);
    border: 1px solid var(--risk-critical-border);
}

.quick-verdict-badge.badge-normal {
    background: var(--risk-safe-bg);
    color: var(--risk-safe);
    border: 1px solid var(--risk-safe-border);
}

.quick-score-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.quick-explanation {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.55;
    background: var(--bg-input);
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--brand-primary);
}

/* ==========================================================================
   Modal (Batch Dossier)
   ========================================================================== */
.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    animation: modalPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modalPop {
    from {
        transform: scale(0.92) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.9rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

/* ==========================================================================
   Results Panel Empty State
   ========================================================================== */
.results-panel {
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    margin: auto;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.7;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.empty-state p {
    font-size: 0.88rem;
    max-width: 400px;
    line-height: 1.6;
}

/* ==========================================================================
   Batch Upload
   ========================================================================== */
.batch-upload-card {
    padding: 2.25rem;
}

.batch-upload-card h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.batch-upload-card > p {
    font-family: var(--font-main);
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 1.25rem;
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--brand-gradient-soft);
    opacity: 0;
    transition: var(--transition-smooth);
    pointer-events: none;
}

.drop-zone:hover {
    border-color: var(--brand-primary);
    border-style: solid;
}

.drop-zone:hover::before {
    opacity: 1;
}

.drop-zone i {
    font-size: 2.8rem;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.85rem;
    display: block;
    position: relative;
    z-index: 1;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.browse-link {
    color: var(--brand-primary);
    font-weight: 600;
    cursor: pointer;
}

.browse-link:hover {
    text-decoration: underline;
}

.sample-btn-container {
    margin-top: 1.1rem;
    text-align: center;
}

/* ==========================================================================
   Metric Cards (Batch)
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 800px) {
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
}

.metric-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.metric-title {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1;
}

.metric-card.risk-critical .metric-value {
    color: var(--risk-critical);
}

.metric-card.risk-safe .metric-value {
    color: var(--risk-safe);
}

/* ==========================================================================
   Tables
   ========================================================================== */
.batch-table-card {
    margin-top: 1.5rem;
}

.batch-table-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.styled-table th {
    text-align: left;
    padding: 0.85rem 1.1rem;
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}

.styled-table td {
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    vertical-align: middle;
}

.styled-table tbody tr {
    transition: var(--transition-fast);
}

.styled-table tbody tr:hover {
    background: var(--bg-surface-elevated);
}

.styled-table tbody tr:last-child td {
    border-bottom: none;
}

.table-badge {
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.badge-critical {
    background: var(--risk-critical-bg);
    color: var(--risk-critical);
    border-color: var(--risk-critical-border);
}

.badge-high {
    background: var(--risk-high-bg);
    color: var(--risk-high);
    border-color: var(--risk-high-border);
}

.badge-medium {
    background: var(--risk-medium-bg);
    color: var(--risk-medium);
    border-color: var(--risk-medium-border);
}

.badge-low {
    background: var(--risk-safe-bg);
    color: var(--risk-safe);
    border-color: var(--risk-safe-border);
}

/* ==========================================================================
   Knowledge Base
   ========================================================================== */
.kb-search-card {
    padding: 2rem;
}

.kb-header h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    color: var(--text-primary);
}

.kb-header h2 i {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.kb-header p {
    font-family: var(--font-main);
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    line-height: 1.6;
    max-width: 680px;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.35rem;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.5rem 0.4rem 1.1rem;
    align-items: center;
    transition: var(--transition-smooth);
}

.search-bar:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: var(--font-main);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.kb-results-grid {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.1rem;
}

.kb-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: var(--transition-smooth);
}

.kb-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.kb-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.kb-authority {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--brand-primary);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.kb-card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.kb-card-body {
    font-family: var(--font-main);
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 300;
    font-size: 0.88rem;
    font-family: var(--font-heading);
    font-weight: 500;
    animation: toastSlide 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    align-items: center;
    gap: 0.5rem;
    border-left: 3px solid var(--brand-primary);
}

@keyframes toastSlide {
    from {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-mono {
    font-family: var(--font-mono);
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.8rem;
}

/* ==========================================================================
   RESPONSIVE — Full Device Coverage
   Breakpoints: xs<480, sm<640, md<768, lg<1024, xl<1280
   ========================================================================== */

/* ---- Tablet & below (≤1024px) ---- */
@media (max-width: 1024px) {
    .main-container {
        padding: 1.25rem 1.25rem;
    }

    .form-container-card {
        padding: 2rem 2rem;
    }

    .results-container-card {
        padding: 1.75rem 1.75rem;
    }

    .citations-grid,
    .precedents-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Small Tablet / Large Phone (≤768px) ---- */
@media (max-width: 768px) {

    /* Navbar */
    .navbar {
        padding: 0 1rem;
        height: 58px;
    }

    .brand-text p {
        display: none;
        /* Hide subtitle on small screens */
    }

    .brand-text h1 {
        font-size: 1.1rem;
    }

    .brand-logo {
        width: 38px;
        height: 38px;
    }

    .logo-svg {
        width: 24px;
        height: 24px;
    }

    /* Main layout */
    .main-container {
        padding: 1rem;
    }

    /* Nav Tabs — horizontal scroll */
    .nav-tabs {
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0;
        margin-bottom: 1.25rem;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 0.6rem 0.9rem 0.8rem;
        flex-shrink: 0;
    }

    /* Form card */
    .form-container-card {
        padding: 1.5rem 1.25rem;
        border-radius: var(--radius-lg);
    }

    .view-header h2 {
        font-size: 1.15rem;
    }

    /* 3-col inputs become 1-col */
    .inputs-grid-3 {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    /* Action buttons stack */
    .form-actions-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-primary {
        flex: none;
        width: 100%;
    }

    .btn-large {
        width: 100%;
    }

    /* Analysis dossier */
    .results-container-card {
        padding: 1.25rem 1rem;
        border-radius: var(--radius-lg);
    }

    .analysis-nav-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
        padding-bottom: 1rem;
    }

    .analysis-header-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .analysis-header-title h2 {
        font-size: 1.1rem;
    }

    .dossier-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
        padding: 1rem 1.1rem;
    }

    /* Batch */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .metric-value {
        font-size: 1.65rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    /* Tables — horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .styled-table th,
    .styled-table td {
        padding: 0.7rem 0.85rem;
        font-size: 0.78rem;
    }

    /* Batch upload card */
    .batch-upload-card {
        padding: 1.5rem 1.25rem;
    }

    .batch-upload-card h2 {
        font-size: 1.1rem;
    }

    /* KB */
    .kb-search-card {
        padding: 1.5rem 1.25rem;
    }

    .kb-results-grid {
        grid-template-columns: 1fr;
    }

    /* Modal */
    .modal-card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        max-height: 95vh;
    }

    .quick-modal-card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }

    .quick-score-container {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    /* Toast */
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
    }
}

/* ---- Phone (≤480px) ---- */
@media (max-width: 480px) {

    /* Navbar collapses further */
    .navbar {
        padding: 0 0.85rem;
        height: 54px;
    }

    .brand-text h1 {
        font-size: 1rem;
    }

    .brand-logo {
        width: 34px;
        height: 34px;
    }

    .logo-svg {
        width: 22px;
        height: 22px;
    }

    /* Main */
    .main-container {
        padding: 0.75rem;
    }

    .tab-btn {
        font-size: 0.78rem;
        padding: 0.55rem 0.75rem 0.75rem;
    }

    /* Form */
    .form-container-card {
        padding: 1.25rem 1rem;
        border-radius: var(--radius-md);
    }

    .section-title-bar {
        gap: 0.55rem;
    }

    .section-title-bar h3 {
        font-size: 0.73rem;
    }

    /* Metric cards — 2 per row on small phones */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.4rem;
    }

    .metric-title {
        font-size: 0.65rem;
    }

    /* Dossier */
    .dossier-section h3 {
        font-size: 0.72rem;
    }

    .summary-box {
        font-size: 0.86rem;
        padding: 1rem;
    }

    .indicators-list li {
        font-size: 0.82rem;
        padding: 0.6rem 0.85rem;
    }

    /* Citations/Precedents */
    .citations-grid,
    .precedents-grid {
        grid-template-columns: 1fr;
    }

    /* Quick modal — full-width */
    .quick-modal-card {
        width: 95%;
        max-width: none;
        padding: 1rem;
    }

    .quick-score-container {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    /* Table font smaller */
    .styled-table th,
    .styled-table td {
        padding: 0.6rem 0.65rem;
        font-size: 0.74rem;
    }

    /* Glass cards smaller radius */
    .glass-card {
        border-radius: var(--radius-lg);
    }

    /* KB card search */
    .kb-results-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* ---- Very small phones (≤360px) ---- */
@media (max-width: 360px) {
    .navbar {
        height: 50px;
    }

    .brand-text h1 {
        font-size: 0.92rem;
    }

    .tab-btn {
        font-size: 0.73rem;
        padding: 0.5rem 0.6rem 0.7rem;
    }

    .metric-value {
        font-size: 1.2rem;
    }

    .btn {
        font-size: 0.82rem;
        padding: 0.65rem 1rem;
    }
}

/* ---- Wide Desktop (≥1440px) ---- */
@media (min-width: 1440px) {
    .form-container-card {
        max-width: 1020px;
    }

    .results-container-card {
        max-width: 1200px;
    }

    .kb-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

/* ---- Touch device optimizations ---- */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    /* iOS tap target */
    .tab-btn {
        min-height: 44px;
    }

    .theme-btn {
        width: 44px;
        height: 44px;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .back-btn {
        min-height: 44px;
    }

    /* Disable hover-only transforms on touch */
    .brand-logo:hover {
        transform: none;
    }

    .theme-btn:hover {
        transform: none;
    }

    .back-btn:hover {
        transform: none;
    }

    .btn-primary:hover {
        transform: none;
    }

    .metric-card:hover {
        transform: none;
    }

    .kb-card:hover {
        transform: none;
    }
}