/* ==========================================================================
   moli studio — Liquid Glass Design System
   ========================================================================== */

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

/* ── Design Tokens ── */
:root {
    /* Liquid Glass Background */
    --bg-base: #05080f;
    --bg-mesh-1: rgba(79, 70, 229, 0.18);
    --bg-mesh-2: rgba(147, 51, 234, 0.12);
    --bg-mesh-3: rgba(6, 182, 212, 0.08);

    /* Glass Surfaces */
    --glass-ultra:    rgba(255,255,255,0.04);
    --glass-light:    rgba(255,255,255,0.07);
    --glass-mid:      rgba(255,255,255,0.10);
    --glass-strong:   rgba(255,255,255,0.14);
    --glass-sidebar:  rgba(5, 8, 18, 0.72);

    /* Borders */
    --border-glass:   rgba(255,255,255,0.10);
    --border-glow:    rgba(139,92,246,0.50);
    --border-hover:   rgba(167,139,250,0.55);
    --border-subtle:  rgba(255,255,255,0.06);

    /* Brand Colors */
    --primary:        #818cf8;
    --primary-dark:   #6366f1;
    --primary-grad:   linear-gradient(135deg, #6366f1 0%, #a78bfa 50%, #c084fc 100%);
    --secondary:      #c084fc;
    --accent:         #22d3ee;
    --success:        #34d399;
    --warning:        #fbbf24;
    --danger:         #f87171;

    /* Text */
    --text-primary:   rgba(255,255,255,0.92);
    --text-secondary: rgba(255,255,255,0.55);
    --text-muted:     rgba(255,255,255,0.30);

    /* Shadows */
    --shadow-xs:    0 1px 4px rgba(0,0,0,0.25);
    --shadow-sm:    0 2px 12px rgba(0,0,0,0.30);
    --shadow-md:    0 8px 28px rgba(0,0,0,0.40);
    --shadow-lg:    0 20px 60px rgba(0,0,0,0.55);
    --shadow-glow:  0 0 24px rgba(99,102,241,0.35);
    --shadow-card:  0 4px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
    --shadow-card-hover: 0 8px 40px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 1px var(--border-hover);

    /* Radii */
    --r-xs: 6px;
    --r-sm: 9px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-full: 999px;

    /* Legacy aliases (for backward compatibility) */
    --bg-main:          var(--bg-base);
    --bg-surface:       rgba(12,17,35,0.95);
    --bg-card:          var(--glass-light);
    --bg-card-hover:    var(--glass-mid);
    --bg-sidebar:       var(--glass-sidebar);
    --bg-input:         rgba(255,255,255,0.05);
    --bg-input-focus:   rgba(255,255,255,0.09);
    --border-color:     var(--border-glass);
    --border-color-glow:var(--border-glow);
    --border-card-hover:var(--border-hover);
    --primary-gradient: var(--primary-grad);
    --radius-sm:        var(--r-xs);
    --radius-md:        var(--r-sm);
    --radius-lg:        var(--r-md);

    /* Layout */
    --sidebar-width: 200px;
    --sidebar-collapsed-width: 60px;
    --header-height: 48px;
}

/* ── Light theme stub ── */
[data-theme="light"] {
    --bg-base: #f0f4ff;
    --glass-ultra:  rgba(255,255,255,0.60);
    --glass-light:  rgba(255,255,255,0.75);
    --glass-mid:    rgba(255,255,255,0.85);
    --glass-strong: rgba(255,255,255,0.92);
    --glass-sidebar:rgba(245,247,255,0.88);
    --border-glass: rgba(99,102,241,0.14);
    --text-primary: #0f172a;
    --text-secondary:#475569;
    --text-muted:   #94a3b8;
    --bg-main:      var(--bg-base);
    --bg-surface:   rgba(255,255,255,0.95);
    --bg-card:      var(--glass-light);
    --bg-card-hover:var(--glass-mid);
    --bg-sidebar:   var(--glass-sidebar);
    --bg-input:     rgba(99,102,241,0.06);
    --bg-input-focus:rgba(99,102,241,0.10);
    --border-color: var(--border-glass);
}

/* ══════════════════════════════════════════
   AURORA ACCENT THEME  (data-accent="aurora")
   Teal → sky → violet northern-lights palette
   ══════════════════════════════════════════ */
[data-accent="aurora"] {
    --bg-base: #030d12;

    --glass-sidebar: rgba(3, 13, 18, 0.72);

    --border-glow:  rgba(45,212,191,0.50);
    --border-hover: rgba(94,234,212,0.55);

    --primary:      #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-grad: linear-gradient(135deg, #14b8a6 0%, #38bdf8 50%, #a78bfa 100%);
    --secondary:    #67e8f9;
    --accent:       #a78bfa;

    --shadow-glow: 0 0 24px rgba(45,212,191,0.35);
    --shadow-card-hover: 0 8px 40px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.12), 0 0 0 1px var(--border-hover);

    --bg-surface: rgba(8,20,26,0.95);
}

/* Aurora mesh — northern-lights ribbons over deep night sky */
[data-accent="aurora"] body {
    background-image:
        radial-gradient(ellipse 80vw 60vh at 15% 10%,  rgba(45,212,191,0.18)  0%, transparent 55%),
        radial-gradient(ellipse 60vw 50vh at 85% 90%,  rgba(139,92,246,0.14)  0%, transparent 55%),
        radial-gradient(ellipse 50vw 40vh at 70% 20%,  rgba(56,189,248,0.10)  0%, transparent 55%),
        radial-gradient(ellipse 40vw 30vh at 20% 80%,  rgba(52,211,153,0.08)  0%, transparent 55%);
}

[data-accent="aurora"] .bg-orb-1 {
    background: radial-gradient(circle, rgba(45,212,191,0.65) 0%, transparent 70%);
}

[data-accent="aurora"] .bg-orb-2 {
    background: radial-gradient(circle, rgba(139,92,246,0.60) 0%, transparent 70%);
}

[data-accent="aurora"] ::-webkit-scrollbar-thumb { background: rgba(45,212,191,0.30); }
[data-accent="aurora"] ::-webkit-scrollbar-thumb:hover { background: rgba(45,212,191,0.55); }

[data-accent="aurora"] .sidebar-logo {
    box-shadow: 0 4px 12px rgba(45,212,191,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}

[data-accent="aurora"] .sidebar-title {
    background: linear-gradient(135deg, #99f6e4 0%, #7dd3fc 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-accent="aurora"] .nav-item.active {
    background: linear-gradient(135deg, rgba(20,184,166,0.55) 0%, rgba(56,189,248,0.40) 55%, rgba(139,92,246,0.40) 100%);
    border-color: rgba(94,234,212,0.40);
    box-shadow: 0 2px 12px rgba(45,212,191,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

[data-accent="aurora"] .recent-tool-chip:hover {
    border-color: rgba(94,234,212,0.40);
    box-shadow: 0 2px 12px rgba(45,212,191,0.25), inset 0 1px 0 rgba(255,255,255,0.10);
}

/* Aurora × Light — pale mint morning sky */
[data-accent="aurora"][data-theme="light"] {
    --bg-base: #edfbf7;
    --glass-sidebar: rgba(240,252,249,0.88);
    --border-glass: rgba(20,184,166,0.16);
    --bg-input: rgba(20,184,166,0.06);
    --bg-input-focus: rgba(20,184,166,0.10);
    --border-color: var(--border-glass);
    --primary: #0d9488;
    --secondary: #0891b2;
}

[data-accent="aurora"][data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 80vw 60vh at 15% 10%,  rgba(45,212,191,0.14)  0%, transparent 55%),
        radial-gradient(ellipse 60vw 50vh at 85% 90%,  rgba(139,92,246,0.10)  0%, transparent 55%),
        radial-gradient(ellipse 50vw 40vh at 70% 20%,  rgba(56,189,248,0.08)  0%, transparent 55%);
}

[data-accent="aurora"][data-theme="light"] .sidebar-title {
    background: linear-gradient(135deg, #0d9488 0%, #0284c7 50%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ══════════════════════════════════════════════
   FROSTED GLASS THEME  (data-glass="frosted")
   Classic heavy-blur macOS-style frosted glass
   ══════════════════════════════════════════════ */
[data-glass="frosted"] {
    /* Heavier, more opaque glass surfaces */
    --glass-ultra:    rgba(255,255,255,0.08);
    --glass-light:    rgba(255,255,255,0.14);
    --glass-mid:      rgba(255,255,255,0.20);
    --glass-strong:   rgba(255,255,255,0.28);
    --glass-sidebar:  rgba(8, 12, 26, 0.88);
    --border-glass:   rgba(255,255,255,0.16);
    --border-glow:    rgba(255,255,255,0.30);
    --border-hover:   rgba(255,255,255,0.35);
}

/* Frosted body — more neutral, less vivid gradient */
[data-glass="frosted"] body {
    background-image:
        radial-gradient(ellipse 80vw 60vh at 15% 10%,  rgba(79,70,229,0.10)  0%, transparent 55%),
        radial-gradient(ellipse 60vw 50vh at 85% 90%,  rgba(147,51,234,0.08) 0%, transparent 55%),
        radial-gradient(ellipse 50vw 40vh at 70% 20%,  rgba(6,182,212,0.05)  0%, transparent 55%);
}

/* Frosted Orbs — much dimmer */
[data-glass="frosted"] .bg-orb { opacity: 0.20; filter: blur(160px); }

/* ── Frosted Card ── classic heavy blur, neutral tint ── */
[data-glass="frosted"] .glass-card {
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(48px) saturate(140%) brightness(1.02);
    -webkit-backdrop-filter: blur(48px) saturate(140%) brightness(1.02);
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow:
        0 4px 24px rgba(0,0,0,0.22),
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 rgba(0,0,0,0.10);
    border-radius: var(--r-lg);
}

[data-glass="frosted"] .glass-card::before {
    background: linear-gradient(
        118deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.00) 35%,
        rgba(255,255,255,0.00) 65%,
        rgba(255,255,255,0.10) 100%
    );
}

[data-glass="frosted"] .glass-card::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.60), transparent);
}

[data-glass="frosted"] .glass-card:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.28);
    box-shadow:
        0 8px 40px rgba(0,0,0,0.30),
        inset 0 1px 0 rgba(255,255,255,0.30),
        inset 0 -1px 0 rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* ── Frosted Sidebar ── */
[data-glass="frosted"] .sidebar {
    background: rgba(8,12,26,0.82);
    backdrop-filter: blur(56px) saturate(160%);
    -webkit-backdrop-filter: blur(56px) saturate(160%);
    border-right-color: rgba(255,255,255,0.12);
}

/* ── Frosted Header ── */
[data-glass="frosted"] .top-header {
    background: rgba(8,12,26,0.72);
    backdrop-filter: blur(48px) saturate(150%);
    -webkit-backdrop-filter: blur(48px) saturate(150%);
    border-bottom-color: rgba(255,255,255,0.10);
}

/* ── Frosted Search Trigger ── */
[data-glass="frosted"] .search-trigger {
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.16);
    border-radius: var(--r-full);
}

[data-glass="frosted"] .search-trigger:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.28);
    box-shadow: 0 0 16px rgba(255,255,255,0.08);
}

/* ── Frosted Icon Button ── */
[data-glass="frosted"] .icon-btn {
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.14);
}

[data-glass="frosted"] .icon-btn:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.28);
    box-shadow: 0 0 10px rgba(255,255,255,0.10);
}

/* ── Frosted Input ── */
[data-glass="frosted"] input[type="text"],
[data-glass="frosted"] input[type="password"],
[data-glass="frosted"] input[type="number"],
[data-glass="frosted"] input[type="date"],
[data-glass="frosted"] select,
[data-glass="frosted"] textarea {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.14);
    backdrop-filter: blur(12px);
}

[data-glass="frosted"] input:focus,
[data-glass="frosted"] select:focus,
[data-glass="frosted"] textarea:focus {
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.10);
}

/* ── Frosted Button Secondary ── */
[data-glass="frosted"] .btn-secondary {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
}

[data-glass="frosted"] .btn-secondary:hover {
    background: rgba(255,255,255,0.20);
    border-color: rgba(255,255,255,0.30);
    box-shadow: 0 4px 16px rgba(255,255,255,0.08);
}

/* ── Frosted Modal ── */
[data-glass="frosted"] .search-modal {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(60px) saturate(180%);
    -webkit-backdrop-filter: blur(60px) saturate(180%);
    border-color: rgba(255,255,255,0.22);
    box-shadow:
        0 24px 72px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,255,255,0.28),
        inset 0 -1px 0 rgba(0,0,0,0.10);
}

/* ── Frosted Nav Active ── */
[data-glass="frosted"] .nav-item.active {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 2px 12px rgba(0,0,0,0.20);
}

/* ── Frosted Toast ── */
[data-glass="frosted"] .toast {
    background: rgba(255,255,255,0.14);
    backdrop-filter: blur(32px);
    border-color: rgba(255,255,255,0.22);
    border-left-color: var(--primary);
}

/* ── Frosted Result Box ── */
[data-glass="frosted"] .result-box {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
    backdrop-filter: blur(16px);
}

/* ── Frosted Card Title accent bar ── */
[data-glass="frosted"] .card-title::before {
    box-shadow: 0 0 6px rgba(139,92,246,0.40);
}

/* ── Frosted drop zone ── */
[data-glass="frosted"] .drop-zone {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.14);
}

[data-glass="frosted"] .drop-zone.drag-over {
    border-color: rgba(255,255,255,0.40);
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 20px rgba(255,255,255,0.10);
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

code, pre, textarea, input.mono {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px;
}

/* ── Body ── */
body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    font-size: 12px;
    line-height: 1.45;
    transition: background-color 0.4s, color 0.4s;
    /* Animated mesh gradient */
    background-image:
        radial-gradient(ellipse 80vw 60vh at 15% 10%,  rgba(79,70,229,0.22)  0%, transparent 55%),
        radial-gradient(ellipse 60vw 50vh at 85% 90%,  rgba(147,51,234,0.16) 0%, transparent 55%),
        radial-gradient(ellipse 50vw 40vh at 70% 20%,  rgba(6,182,212,0.10)  0%, transparent 55%),
        radial-gradient(ellipse 40vw 30vh at 20% 80%,  rgba(236,72,153,0.08) 0%, transparent 55%);
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.30); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.55); }

/* ── Animated Background Orbs ── */
.bg-orbs {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 0; overflow: hidden;
}

.bg-orb {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.55;
    animation: orbFloat 24s infinite alternate ease-in-out;
}

.bg-orb-1 {
    width: 38vw; height: 38vw;
    top: -12vw; left: -8vw;
    background: radial-gradient(circle, rgba(99,102,241,0.7) 0%, transparent 70%);
}

.bg-orb-2 {
    width: 30vw; height: 30vw;
    bottom: -10vw; right: -8vw;
    background: radial-gradient(circle, rgba(168,85,247,0.65) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%   { transform: translate(0,0) scale(1); }
    33%  { transform: translate(3vw, 2vh) scale(1.06); }
    66%  { transform: translate(-2vw, 3vh) scale(0.96); }
    100% { transform: translate(1vw, -2vh) scale(1.04); }
}

/* ── Layout ── */
#app-layout {
    display: flex; width: 100%; min-height: 100vh;
    position: relative; z-index: 1;
}

/* ────────────────────────────────────────────
   SIDEBAR — Liquid Glass Panel
────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-sidebar);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border-right: 1px solid var(--border-glass);
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
    transition: width 0.28s cubic-bezier(0.16,1,0.3,1);
    /* Inner top-edge highlight */
    box-shadow: inset 1px 0 0 rgba(255,255,255,0.05), 2px 0 20px rgba(0,0,0,0.30);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-header {
    height: var(--header-height);
    display: flex; align-items: center;
    padding: 0 14px; gap: 10px;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap; overflow: hidden;
}

.sidebar-logo {
    width: 28px; height: 28px;
    background: var(--primary-grad);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99,102,241,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}

.sidebar-title {
    font-size: 14px; font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c4b5fd 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-category-title,
.sidebar.collapsed .nav-item span:not(.nav-item-icon),
.sidebar.collapsed .sidebar-footer span { display: none !important; }

.sidebar-nav {
    flex: 1; padding: 10px 8px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
}

.nav-category { display: flex; flex-direction: column; gap: 2px; }

.nav-category-title {
    font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 8px 3px;
    white-space: nowrap;
}

.nav-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-size: 12px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all 0.22s ease;
    position: relative; white-space: nowrap;
    border: 1px solid transparent;
}

.sidebar.collapsed .nav-item { justify-content: center; padding: 8px 0; }

.nav-item:hover {
    color: var(--text-primary);
    background: var(--glass-mid);
    border-color: var(--border-glass);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99,102,241,0.55) 0%, rgba(168,85,247,0.45) 100%);
    border-color: rgba(167,139,250,0.40);
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(99,102,241,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}

.nav-item-icon { font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 9px 14px;
    border-top: 1px solid var(--border-glass);
    display: flex; align-items: center;
    justify-content: space-between; white-space: nowrap;
}

/* ────────────────────────────────────────────
   MAIN AREA
────────────────────────────────────────────── */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex; flex-direction: column; min-height: 100vh;
    transition: margin-left 0.28s cubic-bezier(0.16,1,0.3,1);
}

.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }

/* ── Top Header — Frosted Bar ── */
.top-header {
    height: var(--header-height);
    background: rgba(5,8,18,0.60);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border-bottom: 1px solid var(--border-glass);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px;
    position: sticky; top: 0; z-index: 40;
    box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 20px rgba(0,0,0,0.25);
}

.header-left { display: flex; align-items: center; gap: 10px; }

.search-trigger {
    display: flex; align-items: center; gap: 7px;
    background: var(--glass-light);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-full);
    padding: 5px 14px;
    color: var(--text-muted);
    font-size: 11px; cursor: pointer;
    width: 220px;
    transition: all 0.22s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.search-trigger:hover {
    background: var(--glass-mid);
    border-color: var(--border-glow);
    color: var(--text-secondary);
    box-shadow: 0 0 16px rgba(99,102,241,0.2), inset 0 1px 0 rgba(255,255,255,0.10);
}

.search-trigger kbd {
    margin-left: auto;
    background: rgba(255,255,255,0.08);
    padding: 1px 5px; border-radius: var(--r-xs);
    font-size: 9px; font-family: inherit;
    border: 1px solid rgba(255,255,255,0.10);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    width: 32px; height: 32px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-glass);
    background: var(--glass-light);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 14px;
    transition: all 0.22s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--glass-mid);
    border-color: var(--border-glow);
    box-shadow: 0 0 12px rgba(99,102,241,0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ── Content Area ── */
.content-container {
    flex: 1; padding: 18px 20px;
    max-width: 1600px; width: 100%; margin: 0 auto;
}

.tool-view { display: none; animation: lgFadeIn 0.28s cubic-bezier(0.16,1,0.3,1); }
.tool-view.active { display: block; }

.tool-view.fullscreen-mode {
    position: fixed !important; inset: 0 !important; z-index: 999 !important;
    background: var(--bg-base) !important; padding: 16px !important;
    overflow-y: auto !important; max-width: 100% !important;
    width: 100vw !important; height: 100vh !important;
}

@keyframes lgFadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Page Title Box ── */
.page-title-box {
    margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center;
}

.page-title {
    font-size: 20px; font-weight: 700;
    letter-spacing: -0.5px; margin-bottom: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 40%, #f0abfc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-desc { color: var(--text-secondary); font-size: 12px; }

/* ──────────────────────────────────────────────
   LIQUID GLASS CARDS
   True liquid glass: layered blur + inner light edge
   + spectral highlight + subtle refraction
──────────────────────────────────────────────── */
.glass-card {
    /* Multi-layer liquid glass */
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.10) 0%,
        rgba(255,255,255,0.04) 50%,
        rgba(255,255,255,0.07) 100%
    );
    backdrop-filter: blur(28px) saturate(180%) brightness(1.05);
    -webkit-backdrop-filter: blur(28px) saturate(180%) brightness(1.05);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.30s cubic-bezier(0.16,1,0.3,1);
    /* Layered border effect */
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow:
        /* outer ambient */
        0 4px 24px rgba(0,0,0,0.28),
        /* inner top highlight */
        inset 0 1px 0 rgba(255,255,255,0.18),
        /* inner bottom shadow */
        inset 0 -1px 0 rgba(0,0,0,0.15);
}

/* Liquid shimmer pseudo-layer */
.glass-card::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        118deg,
        rgba(255,255,255,0.18) 0%,
        rgba(255,255,255,0.00) 30%,
        rgba(255,255,255,0.00) 70%,
        rgba(255,255,255,0.08) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Top spectral highlight strip */
.glass-card::after {
    content: '';
    position: absolute; top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.50), transparent);
    border-radius: var(--r-full);
    pointer-events: none;
    z-index: 1;
}

.glass-card > * { position: relative; z-index: 2; }

.glass-card:hover {
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.15) 0%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.10) 100%
    );
    border-color: rgba(167,139,250,0.45);
    box-shadow:
        0 8px 40px rgba(0,0,0,0.38),
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 rgba(0,0,0,0.12),
        0 0 0 1px rgba(167,139,250,0.20);
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════════
   ① TOOL CARDS GRID — entrance animation
   ══════════════════════════════════════════════ */
.tool-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Card entrance: staggered fade-up driven by --card-delay */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.tool-card {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
    padding: 16px;
    /* entrance animation */
    animation: cardEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: var(--card-delay, 0ms);
    /* smooth GPU layer */
    will-change: transform, opacity;
    /* colorful glow variable, set per data-color */
    --glow-color: rgba(99,102,241,0.45);
    --glow-border: rgba(99,102,241,0.40);
}

/* ② COLORFUL HOVER GLOW per data-color */
.tool-card:hover {
    box-shadow:
        0 8px 40px rgba(0,0,0,0.38),
        inset 0 1px 0 rgba(255,255,255,0.22),
        0 0 0 1px var(--glow-border),
        0 0 28px var(--glow-color);
    border-color: var(--glow-border);
    transform: translateY(-3px) scale(1.01);
}

/* Color palette per tool category */
.tool-card[data-color="indigo"] {
    --glow-color:  rgba(99, 102, 241, 0.40);
    --glow-border: rgba(129, 140, 248, 0.50);
}
.tool-card[data-color="purple"] {
    --glow-color:  rgba(168, 85, 247, 0.40);
    --glow-border: rgba(192, 132, 252, 0.50);
}
.tool-card[data-color="amber"] {
    --glow-color:  rgba(245, 158, 11, 0.35);
    --glow-border: rgba(251, 191, 36, 0.50);
}
.tool-card[data-color="emerald"] {
    --glow-color:  rgba(16, 185, 129, 0.35);
    --glow-border: rgba(52, 211, 153, 0.50);
}
.tool-card[data-color="cyan"] {
    --glow-color:  rgba(6, 182, 212, 0.35);
    --glow-border: rgba(34, 211, 238, 0.50);
}

/* Tool card content */
.tool-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.tool-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    flex: 1;
}

/* Tool badge chips */
.tool-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-indigo {
    color: #818cf8;
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.35);
}
.badge-purple {
    color: #c084fc;
    background: rgba(168,85,247,0.15);
    border: 1px solid rgba(168,85,247,0.35);
}
.badge-amber {
    color: #fbbf24;
    background: rgba(245,158,11,0.15);
    border: 1px solid rgba(245,158,11,0.35);
}
.badge-emerald {
    color: #34d399;
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.35);
}
.badge-cyan {
    color: #22d3ee;
    background: rgba(6,182,212,0.15);
    border: 1px solid rgba(6,182,212,0.35);
}

/* Dashboard tool cards (legacy selector compat) */
#view-home .glass-card {
    display: flex; flex-direction: column;
    justify-content: space-between;
    min-height: 130px; padding: 16px;
}


/* ── Card Title ── */
.card-title {
    font-size: 13px; font-weight: 650;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
    color: var(--text-primary);
}

.card-title::before {
    content: '';
    width: 3px; height: 14px;
    background: var(--primary-grad);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(99,102,241,0.6);
}

/* ──────────────────────────────────────────────
   FORMS
──────────────────────────────────────────────── */
.form-group { margin-bottom: 10px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

label {
    display: block; font-size: 10px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%; padding: 7px 11px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--r-sm);
    color: var(--text-primary); font-size: 12px;
    outline: none; transition: all 0.22s ease;
    backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}

textarea { min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: rgba(139,92,246,0.65);
    background: rgba(255,255,255,0.09);
    box-shadow:
        0 0 0 3px rgba(99,102,241,0.18),
        inset 0 1px 2px rgba(0,0,0,0.10);
}

/* ──────────────────────────────────────────────
   BUTTONS — Liquid Glass
──────────────────────────────────────────────── */
.btn-group { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.btn {
    padding: 7px 16px;
    border: none; border-radius: var(--r-sm);
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    transition: all 0.22s ease;
    color: #ffffff; position: relative; overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.20), transparent);
    border-radius: inherit;
    pointer-events: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #c084fc 100%);
    box-shadow: 0 3px 14px rgba(99,102,241,0.40), inset 0 1px 0 rgba(255,255,255,0.20);
}

.btn-primary:hover {
    box-shadow: 0 6px 22px rgba(99,102,241,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
    border-color: rgba(167,139,250,0.40);
    box-shadow: 0 0 12px rgba(99,102,241,0.20), inset 0 1px 0 rgba(255,255,255,0.14);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%);
    box-shadow: 0 3px 14px rgba(16,185,129,0.35), inset 0 1px 0 rgba(255,255,255,0.20);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 3px 14px rgba(239,68,68,0.35), inset 0 1px 0 rgba(255,255,255,0.20);
}

.btn-sm { padding: 4px 10px; font-size: 10px; border-radius: var(--r-xs); }

/* ──────────────────────────────────────────────
   RESULT BOX
──────────────────────────────────────────────── */
.result-box {
    margin-top: 10px; padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--r-sm);
    border: 1px solid rgba(255,255,255,0.08);
    word-break: break-all;
    font-family: 'JetBrains Mono', monospace; font-size: 11px;
    display: none;
    backdrop-filter: blur(8px);
}

.result-box.show { display: block; animation: lgFadeIn 0.22s ease; }

.result-box.success {
    background: rgba(16,185,129,0.08);
    border-color: rgba(52,211,153,0.35); color: #6ee7b7;
}

.result-box.error {
    background: rgba(239,68,68,0.08);
    border-color: rgba(248,113,113,0.35); color: #fca5a5;
}

/* ──────────────────────────────────────────────
   DATA TABLE
──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px; }

.data-table th {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary); font-weight: 600;
    text-align: left; padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

.data-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
}

.data-table tr:hover td { background: rgba(99,102,241,0.08); }

.data-table td input, .data-table td select {
    padding: 4px 8px; font-size: 11px;
    border-radius: var(--r-xs); width: 100%;
}

.data-table td:has(.opb) { display: flex; align-items: center; gap: 4px; }
.data-table td:has(.opb) input { flex: 1; width: 0; min-width: 0; }

.drag-handle { cursor: grab; color: var(--text-muted); text-align: center; font-size: 14px; }

.opb {
    border: 1px solid rgba(99,102,241,0.40);
    background: rgba(99,102,241,0.16);
    border-radius: 5px; cursor: pointer;
    padding: 2px 7px; font-size: 11px; color: #a5b4fc;
    flex-shrink: 0; transition: all 0.18s ease;
    display: inline-flex; align-items: center; justify-content: center;
}

.opb:hover {
    background: rgba(99,102,241,0.38); color: #ffffff;
    border-color: var(--primary-dark);
    box-shadow: 0 0 10px rgba(99,102,241,0.45);
}

input.err  { border-color: var(--danger)  !important; background: rgba(239,68,68,0.10)  !important; }
input.warn { border-color: var(--warning) !important; background: rgba(245,158,11,0.10) !important; }
tr.dragging { opacity: 0.3; background: rgba(99,102,241,0.15) !important; }

/* ── Tabs ── */
.tab-nav {
    display: flex; gap: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 14px;
}

.tab-nav-btn {
    background: none; border: none;
    padding: 7px 14px;
    color: var(--text-secondary); font-weight: 600; font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.22s ease; border-radius: var(--r-xs) var(--r-xs) 0 0;
}

.tab-nav-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.tab-nav-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(99,102,241,0.08);
}

.sub-tab-panel { display: none; }
.sub-tab-panel.active { display: block; animation: lgFadeIn 0.2s ease; }

/* ── CSV Grid ── */
.csv-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.drop-zones-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }

.drop-zone {
    background: rgba(255,255,255,0.04);
    border: 2px dashed rgba(255,255,255,0.14);
    border-radius: var(--r-md); padding: 10px; min-height: 70px;
    transition: all 0.22s ease;
}

.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(99,102,241,0.10);
    box-shadow: 0 0 20px rgba(99,102,241,0.20);
}

.chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary-grad); color: #ffffff;
    padding: 3px 8px; border-radius: 12px;
    font-size: 10px; font-weight: 700; cursor: grab; margin: 2px;
    box-shadow: 0 2px 8px rgba(99,102,241,0.30), inset 0 1px 0 rgba(255,255,255,0.20);
}

/* ──────────────────────────────────────────────
   MODALS — Liquid Glass Sheets
──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(3,5,14,0.72);
    backdrop-filter: blur(18px) saturate(160%);
    z-index: 1000; display: none;
    align-items: center; justify-content: center;
}

.modal-overlay.active, .modal-overlay.show {
    display: flex; animation: lgFadeIn 0.22s ease;
}

.search-modal {
    background: linear-gradient(160deg,
        rgba(255,255,255,0.12) 0%,
        rgba(255,255,255,0.06) 60%,
        rgba(255,255,255,0.09) 100%
    );
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--r-xl);
    width: 90%; max-width: 580px;
    box-shadow:
        0 24px 72px rgba(0,0,0,0.55),
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 rgba(0,0,0,0.15);
    overflow: hidden;
}

.search-modal.modal-fullscreen {
    max-width: 98vw !important; width: 98vw !important;
    height: 95vh !important; max-height: 95vh !important;
    display: flex; flex-direction: column;
}

.search-modal.modal-fullscreen .editor-wrap,
.search-modal.modal-fullscreen #fm-expr-text { min-height: 60vh !important; }

.search-modal-header {
    display: flex; align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    gap: 10px;
    background: rgba(255,255,255,0.04);
}

.search-modal-header input {
    border: none; background: none;
    font-size: 14px; padding: 0;
    box-shadow: none !important; color: var(--text-primary);
}

.search-modal-results { max-height: 320px; overflow-y: auto; padding: 6px; }

.search-result-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px; border-radius: var(--r-sm);
    cursor: pointer; transition: all 0.2s ease;
    text-decoration: none; color: inherit;
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}

#fm-fn-picks { display: flex; flex-wrap: wrap; gap: 4px; max-height: 90px; overflow-y: auto; }

#fm-fn-picks button {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    color: var(--text-secondary); padding: 2px 6px;
    border-radius: 5px; font-size: 10px; cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.18s;
}

#fm-fn-picks button:hover {
    color: var(--primary); border-color: var(--primary);
    background: rgba(99,102,241,0.12);
}

/* ── Toast ── */
.toast {
    position: fixed; bottom: 26px; right: 26px;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.14) 0%,
        rgba(255,255,255,0.08) 100%
    );
    backdrop-filter: blur(24px);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.18);
    border-left: 3px solid var(--primary);
    padding: 10px 20px; border-radius: var(--r-md);
    box-shadow: 0 12px 40px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.15);
    font-size: 12px; font-weight: 600; z-index: 2000;
    transform: translateY(80px); opacity: 0;
    transition: all 0.32s cubic-bezier(0.16,1,0.3,1);
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ── Fullscreen Button ── */
.fullscreen-toggle-btn {
    flex-shrink: 0;
}

/* ── Editor Wrap ── */
.editor-wrap {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--r-sm);
    min-height: 140px; position: relative;
}

.editor { border-radius: var(--r-sm); }

/* ── Suggest Box ── */
.suggest-box {
    background: linear-gradient(160deg,
        rgba(12,17,35,0.96) 0%,
        rgba(8,12,28,0.98) 100%
    );
    backdrop-filter: blur(28px);
    border: 1px solid rgba(139,92,246,0.40) !important;
    border-radius: var(--r-md) !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.05) !important;
}

/* ── Modal / Editor tokens ── */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(3,5,14,0.72);
    backdrop-filter: blur(16px);
    z-index: 1000; display: flex;
    align-items: center; justify-content: center;
}

.modal-box {
    background: linear-gradient(150deg,
        rgba(255,255,255,0.11) 0%,
        rgba(255,255,255,0.05) 60%,
        rgba(255,255,255,0.08) 100%
    );
    backdrop-filter: blur(36px) saturate(190%);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--r-xl);
    padding: 24px;
    box-shadow: 0 24px 72px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.20);
    min-width: 320px; max-width: 90vw;
}

/* ── Recent Tools ── */
.recent-tools-section { margin-bottom: 18px; }

.recent-tools-title {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.recent-tools-list { display: flex; flex-wrap: wrap; gap: 8px; }

.recent-tool-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--glass-mid);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.22s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.recent-tool-chip:hover {
    color: var(--text-primary);
    border-color: rgba(167,139,250,0.40);
    box-shadow: 0 2px 12px rgba(99,102,241,0.25), inset 0 1px 0 rgba(255,255,255,0.10);
    transform: translateY(-1px);
}

/* ── Visitor Geo Widget ── */
.geo-widget { margin-top: 20px; }

.geo-widget-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.geo-item {
    padding: 10px 12px;
    background: var(--glass-mid);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-sm);
}

.geo-item-label {
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.geo-item-value {
    font-size: 12px; font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}

/* ── Mobile Sidebar Backdrop ── */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
}

.sidebar-backdrop.active { display: block; }

/* ── Weather FX Layers ── */
#weather-canvas {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 2000;
}

/* Storm dimmer — subtle darkening while it rains */
#storm-dim {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 1990;
    background: linear-gradient(180deg, rgba(2,4,12,0.35) 0%, rgba(2,4,12,0.10) 40%, transparent 70%);
    opacity: 0;
    transition: opacity 1.2s ease;
}

body[data-weather="rain"] #storm-dim { opacity: 0.45; }
body[data-weather="storm"] #storm-dim { opacity: 1; }
body[data-weather="typhoon"] #storm-dim { opacity: 1; }
body[data-weather="tornado"] #storm-dim { opacity: 0.85; }

/* Drifting storm clouds along the top edge */
#weather-clouds {
    position: fixed; top: 0; left: 0; right: 0; height: 30vh;
    pointer-events: none;
    z-index: 1995;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.5s ease;
}

body[data-weather="rain"] #weather-clouds { opacity: 0.5; }
body[data-weather="storm"] #weather-clouds { opacity: 1; }
body[data-weather="typhoon"] #weather-clouds { opacity: 1; }
body[data-weather="tornado"] #weather-clouds { opacity: 0.8; }

/* Typhoon: clouds race across the sky */
body[data-weather="typhoon"] .storm-cloud {
    animation-duration: 12s;
}

.storm-cloud {
    position: absolute;
    border-radius: 50%;
    filter: blur(46px);
    background: radial-gradient(ellipse, rgba(15,20,32,0.92) 0%, rgba(22,28,44,0.55) 55%, transparent 75%);
    animation: cloudDrift 46s infinite alternate ease-in-out;
}

.cloud-1 { width: 46vw; height: 22vh; top: -10vh; left: -8vw; }
.cloud-2 { width: 38vw; height: 20vh; top: -8vh;  left: 28vw; animation-delay: -12s; animation-duration: 58s; }
.cloud-3 { width: 42vw; height: 24vh; top: -12vh; left: 58vw; animation-delay: -24s; animation-duration: 52s; }
.cloud-4 { width: 30vw; height: 16vh; top: -4vh;  left: 82vw; animation-delay: -36s; animation-duration: 64s; }

@keyframes cloudDrift {
    0%   { transform: translateX(0) scale(1); }
    50%  { transform: translateX(5vw) scale(1.08); }
    100% { transform: translateX(-4vw) scale(0.95); }
}

/* Lightning full-screen flash */
#lightning-flash {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 2010;
    background: radial-gradient(ellipse 90vw 70vh at 50% 0%, rgba(210,230,255,0.85) 0%, rgba(190,215,255,0.35) 45%, transparent 75%);
    opacity: 0;
}

#lightning-flash.flashing {
    animation: lightningFlash 0.9s ease-out;
}

/* Double-strike flicker, like real lightning */
@keyframes lightningFlash {
    0%   { opacity: 0; }
    5%   { opacity: 0.9; }
    12%  { opacity: 0.15; }
    20%  { opacity: 0.65; }
    32%  { opacity: 0.08; }
    45%  { opacity: 0.25; }
    100% { opacity: 0; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .storm-cloud { animation: none; }
    #lightning-flash.flashing { animation: none; opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: calc(-1 * var(--sidebar-width) - 20px);
        width: var(--sidebar-width) !important;
        z-index: 1000;
        transition: left 0.28s cubic-bezier(0.16,1,0.3,1);
    }
    .sidebar.mobile-open { left: 0; }
    /* Drawer always shows full labels even if desktop-collapsed state persisted */
    .sidebar.collapsed .sidebar-title,
    .sidebar.collapsed .nav-category-title,
    .sidebar.collapsed .nav-item span:not(.nav-item-icon),
    .sidebar.collapsed .sidebar-footer span { display: initial !important; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 7px 10px; }
    .main-wrapper { margin-left: 0 !important; }
    .top-header { padding: 0 12px; }
    .search-trigger { width: 160px; }
    .search-trigger kbd { display: none; }
    .content-container { padding: 12px; }
    .csv-grid { grid-template-columns: 1fr; }
    .tool-cards-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .page-title { font-size: 18px; }
    .geo-widget-body { grid-template-columns: repeat(2, 1fr); }
}
