@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Satisfy&display=swap');

:root {
    /* Premium HSL Palette (Brand Constants) */
    --primary-h: 217;
    --primary-s: 91%;
    --primary-l: 60%;
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.5);
    --primary-hover: hsl(var(--primary-h), var(--primary-s), 50%);
    
    --accent-h: 188;
    --accent-s: 91%;
    --accent-l: 43%;
    --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
    
    /* Theme Variables - Dark Mode (Default) */
    --bg-body: #0a0f1e;
    --bg-card: rgba(15, 23, 42, 0.4);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-gradient-top: #0f172a;
    --bg-gradient-bottom: #020617;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --bg-input-focus: rgba(15, 23, 42, 0.6);
    
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 88px;
    --header-height: 80px;
    
    --success: #10b981;
    --error: #f43f5e;
    --warning: #f59e0b;
    
    /* Animation Easing */
    --ease-out: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Variables - Light Mode Override */
.light-mode {
    --bg-body: #f1f5f9; /* Soft Slate */
    --bg-card: rgba(255, 255, 255, 0.85); /* Frosty White */
    --bg-glass: rgba(255, 255, 255, 0.5);
    --bg-gradient-top: #ffffff;
    --bg-gradient-bottom: #f1f5f9;
    
    --text-main: #1e293b; /* Slate 800 */
    --text-muted: #64748b; /* Slate 500 */
    --border-color: rgba(15, 23, 42, 0.08);
    
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --primary-glow: hsla(var(--primary-h), var(--primary-s), var(--primary-l), 0.15);
    --bg-input-focus: #ffffff;

    /* Slightly adjust primary for better contrast on light */
    --primary-l: 55%;
}

/* Light mode readability fixes for hardcoded dark-theme colors */
.light-mode .logo-text,
.light-mode .sidebar-toggle,
.light-mode .footer-brand a,
.light-mode .nav-item:hover,
.light-mode .btn-glass:hover,
.light-mode .strategic-card:hover span {
    color: var(--text-main) !important;
}

.light-mode .page-title {
    background: linear-gradient(135deg, #1e293b, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.light-mode .search-input,
.light-mode .form-control,
.light-mode .floating-control {
    color: var(--text-main);
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
}

.light-mode .glass {
    background: var(--bg-card);
    border-color: rgba(15, 23, 42, 0.06);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.light-mode th {
    background: #ffffff !important;
    color: #475569;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.light-mode .stat-card {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.04) !important;
}

.light-mode .stat-card:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.08) !important;
}

.light-mode .strategic-card {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04) !important;
}

.light-mode .strategic-card:hover {
    background: #f8fafc !important;
    border-color: var(--primary) !important;
}

.light-mode .strategic-card span {
    color: var(--text-main) !important;
}

.light-mode .mobile-nav-toggle {
    color: var(--text-main);
}

/* Light mode: improve sidebar hover/active visibility */
.light-mode .sidebar {
    background: #ffffff;
    border-right-color: rgba(15, 23, 42, 0.08);
}

.light-mode .nav-item {
    color: #64748b;
}

.light-mode .nav-item:hover {
    background: rgba(59, 130, 246, 0.06);
    color: var(--primary) !important;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.light-mode .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.light-mode .nav-item.active::after {
    background: var(--primary);
    box-shadow: 4px 0 12px rgba(59, 130, 246, 0.3);
}

/* Form Visibility for Light Mode */
.light-mode input[type="date"] {
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid rgba(15, 23, 42, 0.15);
    padding: 10px;
    border-radius: 12px;
}

.light-mode .filter-controls span {
    color: var(--text-main) !important;
    opacity: 0.85;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Advanced Background --- */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at top right, var(--bg-gradient-top), var(--bg-gradient-bottom));
    overflow: hidden;
}

.bg-gradient::before,
.bg-gradient::after {
    content: '';
    position: absolute;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    z-index: -1;
    animation: blob-float 25s infinite alternate var(--ease-in-out);
}

.bg-gradient::before {
    background: var(--primary);
    top: -300px;
    left: -200px;
}

.bg-gradient::after {
    background: var(--accent);
    bottom: -300px;
    right: -200px;
    animation-delay: -12s;
}

@keyframes blob-float {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { transform: translate(150px, 150px) rotate(180deg) scale(1.3); }
}

/* --- Premium Glassmorphism --- */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    position: relative;
    overflow: hidden;
}

.glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    z-index: 1;
}

/* --- Sidebar System --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 32px 24px 10px;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    transition: width 0.4s var(--ease-out), padding 0.4s var(--ease-out);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 32px 14px;
}

.logo-section {
    padding: 0 8px;
    margin-bottom: 48px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: white;
    letter-spacing: -1.5px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    line-height: 1;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    transform: scale(0.5);
}

.logo-subtitle {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 5px;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .logo-subtitle {
    opacity: 0;
}

.sidebar-toggle {
    position: absolute;
    right: -32px;
    top: 5px;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.sidebar.collapsed .sidebar-toggle {
    right: 50%;
    transform: translateX(50%) rotate(180deg);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar for clean look */
    -ms-overflow-style: none;
    padding-bottom: 20px;
}

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

.sidebar-footer {
    margin-top: auto;
    padding: 0 10px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.footer-brand i {
    color: var(--accent);
    font-size: 0.8rem;
}

.footer-brand a {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-brand a:hover {
    color: var(--accent);
}

.footer-copyright {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 16px;
    font-weight: 500;
    transition: all 0.3s var(--ease-in-out);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item i {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.nav-item span {
    transition: opacity 0.3s ease, margin-left 0.3s ease;
}

.sidebar.collapsed .nav-item {
    padding: 14px 16px;
    justify-content: center;
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: white;
}

.nav-item.active {
    background: var(--bg-glass);
    color: var(--text-main);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    position: relative;
}

.nav-item.active i {
    color: var(--accent);
    transform: scale(1.1);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
    box-shadow: 4px 0 15px var(--accent);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.logout-link {
    color: var(--error);
    margin-top: auto;
}

.logout-link:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--error);
}

/* --- Main Layout --- */
.dashboard-wrapper {
    display: flex;
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    padding: 48px 60px;
    transition: margin-left 0.4s var(--ease-out), width 0.4s var(--ease-out);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 56px;
}

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

.mobile-brand {
    display: none;
}

.page-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-radius: 20px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
}

.user-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    color: var(--success);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
    border: 1px solid var(--border-color);
}

/* --- Component Upgrades --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin-bottom: 60px;
}

.stat-card {
    padding: 32px;
    border-radius: 32px;
    transition: transform 0.3s var(--ease-out), border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(255,255,255,0.2);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    justify-content: space-between;
}

.stat-value {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1.5px;
    transition: font-size 0.3s var(--ease-out);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    width: 100%;
    display: block;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- Tables --- */
.table-card {
    border-radius: 32px;
    padding: 10px;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.filter-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    transition: max-width 0.3s ease;
}

.search-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: var(--bg-input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 650px;
    scrollbar-gutter: stable;
}

table {
    width: 100%;
    min-width: 1200px; /* Standardize width for professional data presentation */
    border-collapse: separate;
    border-spacing: 0;
}

th {
    padding: 18px 32px;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 23, 42, 0.95) !important; /* Reinforced brand backdrop */
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

td {
    padding: 18px 32px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* --- UI Controls: Filters & Groups --- */
.filter-group {
    display: flex;
    gap: 12px;
    margin-left: 20px;
}

.filter-btn {
    padding: 10px 24px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.filter-btn.form-control[readonly] {
    background: rgba(255, 255, 255, 0.02) !important;
    cursor: not-allowed;
    border-color: transparent !important;
}

.chart-wrapper {
    padding: 48px;
    border-radius: 36px;
    margin-top: 40px;
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.chart-legend {
    display: flex;
    gap: 32px;
    background: var(--bg-glass);
    padding: 12px 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.settings-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 40px;
    align-items: start;
}

.filter-btn.active {
    background: rgba(6, 182, 212, 0.1) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.filter-btn .badge-dot {
    width: 6px;
    height: 6px;
}

/* --- Forms --- */
.form-card {
    margin: 0 auto;
    padding: 48px;
    border-radius: 40px;
}

.form-group {
    margin-bottom: 32px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 18px 24px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-main);
    font-size: 1.1rem;
    transition: all 0.3s var(--ease-in-out);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.form-actions {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 20px;
}

.financial-grid {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 32px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 28px;
    border: 1px solid var(--border-color);
}

.form-control:focus {
    background: var(--bg-input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
    transform: translateY(-2px);
}

/* --- Buttons --- */
/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 28px;
    border-radius: 50px; /* Pill Shape */
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.4s var(--ease-out);
    border: 1px solid transparent;
    text-decoration: none;
    letter-spacing: -0.2px;
}

@media (min-width: 1025px) {
    .btn {
        /* Desktop specific padding for better consistency */
        padding: 16px 40px;
    }
}

.btn-primary {
    background: #1d70f2 !important;
    color: white !important;
    box-shadow: 0 8px 24px rgba(29, 112, 242, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.btn-primary:hover {
    transform: translateY(-4px) scale(1.02) !important;
    box-shadow: 0 12px 32px rgba(29, 112, 242, 0.6) !important;
    background: #1e60d2 !important;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-main) !important;
    backdrop-filter: blur(12px) !important;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-4px) !important;
    color: white !important;
}

/* Unified top back-link design */
.back-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted) !important;
    border: none !important;
    background: transparent !important;
    transition: all 0.25s var(--ease-out);
}

.back-nav-link i {
    font-size: 1rem;
}

.back-nav-link span {
    font-weight: 600;
    letter-spacing: -0.2px;
}

.back-nav-link:hover {
    color: var(--text-main) !important;
    transform: translateX(-3px);
}

/* --- Badges --- */
.badge {
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-error { background: rgba(244, 63, 94, 0.1); color: var(--error); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }

/* --- Animations --- */
.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Premium Scrollbar */
::-webkit-scrollbar { 
    width: 6px; 
    height: 6px; 
}
::-webkit-scrollbar-track { 
    background: transparent; 
}
::-webkit-scrollbar-thumb { 
    background: rgba(var(--primary-h), var(--primary-s), var(--primary-l), 0.1);
    border-radius: 20px;
    transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover { 
    background: rgba(var(--primary-h), var(--primary-s), var(--primary-l), 0.3);
}

/* --- Login Page Enhancements --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    z-index: 10;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 460px;
    padding: 60px 48px;
    border-radius: 40px;
    animation: slideUpFade 0.8s var(--ease-out) forwards;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.floating-group {
    position: relative;
    margin-bottom: 24px;
}

.floating-group i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    opacity: 0.6;
    transition: all 0.3s ease;
    z-index: 2;
}

.floating-control {
    width: 100%;
    padding: 20px 24px 20px 54px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s var(--ease-in-out);
}

.floating-group label {
    position: absolute;
    left: 54px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: all 0.3s var(--ease-out);
    font-weight: 400;
}

.floating-control:focus,
.floating-control:not(:placeholder-shown) {
    background: var(--bg-input-focus);
    border-color: var(--primary);
    padding-top: 28px;
    padding-bottom: 12px;
}

.floating-control:focus + label,
.floating-control:not(:placeholder-shown) + label {
    top: 15px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.floating-control:focus ~ i {
    opacity: 1;
    color: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }

.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

.password-toggle {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px;
    z-index: 5;
    transition: all 0.3s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.password-toggle:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.password-toggle i {
    font-size: 1.1rem;
    position: static !important;
    transform: none !important;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.password-toggle:hover i {
    opacity: 1;
    transform: scale(1.1) !important;
}


/* --- Global Responsive Layer --- */

/* Tablet Optimization (768px - 1100px) */
@media (max-width: 1100px) {
    .main-content {
        padding: 40px 32px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Base Utility for Drawer Close (Hidden on Desktop) */
.mobile-close-btn {
    display: none;
}

/* Mobile Header Toggle (Hidden on Desktop) */
.mobile-nav-toggle {
    display: none;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Unified Mobile Responsiveness ( < 1024px ) */
@media (max-width: 1024px) {
    .dashboard-wrapper {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 2000;
        width: 280px !important;
        transform: translateX(-105%); /* Hide by default */
        transition: transform 0.4s var(--ease-out);
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
        padding: 32px 18px 10px; /* Reduced bottom padding as requested */
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Contains the internal nav scroll */
    }

    .sidebar.mobile-active {
        transform: translateX(0);
    }

    .mobile-close-btn {
        display: flex;
        position: absolute;
        right: 20px;
        top: 24px;
        color: var(--text-main);
        background: var(--bg-glass);
        width: 40px;
        height: 40px;
        border-radius: 12px;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        z-index: 10;
        opacity: 0.8;
        border: 1px solid var(--border-color);
        transition: all 0.3s ease;
    }
    .mobile-close-btn:active {
        transform: scale(0.9);
    }

    .mobile-nav-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 50px 16px 40px;
    }

    .header {
        margin-bottom: 32px;
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.8rem;
    }

    .header-right {
        width: 100% !important;
    }

    .user-profile {
        width: 100% !important;
        justify-content: center !important;
        padding: 12px 24px !important;
        border: none !important;
        background: var(--bg-glass) !important;
        border-radius: 20px !important;
    }

    .user-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .table-container {
        max-height: calc(100vh - 250px);
        border-radius: 20px;
    }

    .table-header-row {
        flex-direction: column;
        gap: 16px;
        padding: 20px 16px;
    }

    .search-wrapper {
        width: 100%;
        max-width: none !important;
    }

    .filter-group {
        width: 100%;
        margin-left: 0;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .header-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 16px !important;
    }

    .filter-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 12px !important;
    }

    .header-actions, .header-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Form Stacking - Fail Safe Flex Approach */
    .form-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .form-group {
        grid-column: span 1 !important;
        width: 100% !important;
    }

    .financial-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        padding: 20px !important;
    }

    .form-actions {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .form-actions .btn {
        width: 100% !important;
    }

    .form-wrapper {
        padding: 0 8px !important;
    }

    .form-card {
        padding: 24px 16px !important;
        border-radius: 20px !important;
    }

    .chart-wrapper {
        padding: 24px 16px !important;
        border-radius: 24px !important;
    }

    .chart-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
    }

    .chart-legend {
        width: 100% !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 16px !important;
    }

    canvas#revenueChart {
        height: 300px !important;
    }

    .form-control[readonly] {
        padding-right: 60px !important;
    }

    /* Dashboard Strategic Grid */
    .strategic-grid {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .strategic-card {
        height: auto !important;
        padding: 24px !important;
    }

    .settings-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 32px !important;
    }

    .glass[style*="sticky"] {
        position: static !important;
        padding: 32px 20px !important;
    }
}




/* Optimized Mobile Header Card */
@media (max-width: 1024px) {
    .header-left {
        display: flex !important;
        align-items: center !important;
        gap: 16px !important;
        margin-bottom: 24px;
        width: 100%; /* Expand to full width for better alignment */
    }

    .mobile-nav-toggle {
        display: flex;
        flex-shrink: 0;
        background: rgba(15, 23, 42, 0.4);
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .sidebar-toggle {
        display: none !important;
    }

    .header-titles {
        flex-grow: 1;
        text-align: center;
        margin-right: 48px; /* Offset the hamburger menu width to perfectly center the text */
    }

    .page-title {
        font-size: 1.4rem !important;
        line-height: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
        border: none !important;
        font-weight: 800;
        letter-spacing: -0.5px;
        -webkit-text-fill-color: var(--text-main) !important;
    }

    .page-subtitle {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        opacity: 0.8;
    }
}

@media (max-width: 768px) {
    .page-subtitle {
        display: none !important;
    }
    .light-mode .page-title {
        background: none;
        -webkit-text-fill-color: var(--text-main);
    }
}
