:root {
    /* Premium Light Theme */
    --bg-grad: linear-gradient(135deg, #e0f2fe, #f0fdf4, #e0e7ff);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 10px 40px -10px rgba(14, 165, 233, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    
    /* Glossy Accents */
    --accent-blue: #0ea5e9;
    --accent-blue-glow: rgba(14, 165, 233, 0.4);
    --accent-blue-bg: rgba(14, 165, 233, 0.1);
    
    --accent-green: #047857;
    --accent-green-glow: rgba(4, 120, 87, 0.4);
    --accent-green-bg: rgba(4, 120, 87, 0.1);
    
    --accent-yellow: #f59e0b;
    --accent-yellow-bg: rgba(245, 158, 11, 0.1);
    
    --accent-red: #ef4444;
    --accent-red-bg: rgba(239, 68, 68, 0.1);
}

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

body { background: var(--bg-grad) fixed; color: var(--text-primary); height: 100vh; overflow: hidden; display: flex; font-weight: 400;}

.glass-bg {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.15), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.15), transparent 25%),
                radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.05), transparent 25%);
    z-index: -1;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); 
    border-radius: 20px; 
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 45px -10px rgba(14, 165, 233, 0.25);
}

.app-container { width: 100%; display: flex; padding: 20px; gap: 24px; height: 100vh;}

.login-wrapper { width: 100%; display: flex; justify-content: center; align-items: center; }
.login-card { padding: 48px; width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 24px; }
.login-title { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--accent-blue), var(--accent-green)); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.input-group { position: relative; width: 100%; }
.input-icon { position: absolute; left: 16px; top: 14px; color: var(--text-secondary); width: 20px; }
input { width: 100%; background: rgba(255,255,255,0.6); border: 1px solid rgba(0,0,0,0.1); padding: 14px 16px 14px 48px; border-radius: 12px; color: var(--text-primary); outline: none; transition: all 0.3s ease; font-size: 15px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);}
input:focus { border-color: var(--accent-blue); background: #ffffff; box-shadow: 0 0 0 4px var(--accent-blue-bg);}

.glow-button {
    width: 100%; background: linear-gradient(135deg, var(--accent-blue), #0284c7); border: none; padding: 14px; border-radius: 12px; color: #fff; font-weight: 600; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 16px; transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--accent-blue-glow);
}
.glow-button:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-blue-glow); filter: brightness(1.1);}
.error-banner { background: var(--accent-red-bg); padding: 12px; border-left: 4px solid var(--accent-red); display: flex; gap: 10px; border-radius:8px; font-size: 14px; color: var(--text-primary);}

.sidebar { width: 280px; padding: 32px 24px; display: flex; flex-direction: column; gap: 32px; flex-shrink: 0;}
.brand { display: flex; flex-direction: column;}
.logo-text { font-size: 26px; font-weight: 800; color: var(--accent-green); text-shadow: 0 2px 10px var(--accent-green-glow);}
.logo-sub { color: var(--accent-blue); font-size: 14px; letter-spacing: 3px; text-transform: uppercase; font-weight: 600;}

.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 8px; flex-grow: 1;}
.nav-menu li { padding: 14px 16px; border-radius: 12px; display: flex; gap: 14px; font-weight: 600; cursor: pointer; color: var(--text-secondary); transition: all 0.2s ease;}
.nav-menu li.active { background: var(--accent-blue-bg); color: var(--accent-blue); border-left: 4px solid var(--accent-blue);}
.nav-menu li a { color: inherit; text-decoration: none; display: flex; gap: 14px;}
.nav-menu li:hover:not(.active) { background: rgba(0,0,0,0.03); color: var(--text-primary);}

.sidebar-filters { border-top: 1px solid rgba(0,0,0,0.05); padding-top: 24px; display: flex; flex-direction: column; gap: 16px;}
.filter-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.5px;}
.select-wrapper { position: relative; }
select { width: 100%; border-radius: 12px; padding: 12px 16px; background: rgba(255,255,255,0.8); border: 1px solid rgba(0,0,0,0.1); color: var(--text-primary); appearance: none; outline: none; cursor: pointer; font-weight: 500; transition: all 0.2s;}
select:focus, select:hover { border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-bg); }
select option { background: #fff; color: var(--text-primary);}
.select-icon { position: absolute; right: 16px; top: 12px; color: var(--accent-blue); width: 18px; pointer-events: none;}
.status-indicator { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-secondary);}
.pulse { width: 10px; height: 10px; background: var(--accent-green); border-radius: 50%; box-shadow: 0 0 12px var(--accent-green); animation: pulsate 2s infinite;}
@keyframes pulsate { 0% { transform: scale(0.9); opacity: 0.7;} 50% { transform: scale(1.3); opacity: 1;} 100% { transform: scale(0.9); opacity: 0.7;}}

.main-content { flex-grow: 1; display: flex; flex-direction: column; gap: 24px; overflow-y: auto; padding-right: 12px; height:100%; width:calc(100% - 304px);}
.page-header h1 { display: flex; align-items: center; gap: 16px; font-size: 28px; font-weight: 800; color: var(--text-primary);}
.date-badge { background: var(--accent-blue-bg); color: var(--accent-blue); padding: 6px 14px; border-radius: 20px; font-size: 15px; font-weight: 600;}
.leave-badge { color: var(--accent-yellow); background: var(--accent-yellow-bg); padding: 4px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;}

.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;}
.metric { padding: 24px; display: flex; align-items: center; gap: 20px;}
.metric-icon { width: 56px; height: 56px; background: #fff; padding: 14px; border-radius: 16px; flex-shrink:0;}
.metric-icon.blue { color: var(--accent-blue); box-shadow: 0 8px 20px var(--accent-blue-bg);}
.metric-icon.yellow { color: var(--accent-yellow); box-shadow: 0 8px 20px var(--accent-yellow-bg);}
.metric-icon.green { color: var(--accent-green); box-shadow: 0 8px 20px var(--accent-green-bg);}
.metric-info h3 { font-size: 14px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;}
.metric-info h2 { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1;}

.chart-container { padding: 24px; min-height: 380px; display: flex; flex-direction: column;}
.chart-container > div { width: 100%; height: 100%; flex-grow: 1; }

.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px;}
.split-grid.tables { align-items: start;}
.system-audit { padding: 24px; display: flex; flex-direction: column; gap: 16px;}
.system-audit h3 { display: flex; gap: 12px; align-items: center; color: var(--text-primary); font-size: 18px; font-weight: 700;}
.system-audit .select-wrapper select { background: rgba(255,255,255,0.9); }
.secondary-btn { background: #fff; color: var(--text-primary); border: 1px solid rgba(0,0,0,0.1); padding: 12px 18px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.02);}
.secondary-btn:hover:not(:disabled) { background: #f8fafc; border-color: rgba(0,0,0,0.15); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05);}
.secondary-btn:disabled { opacity: 0.5; cursor: not-allowed;}
.secondary-btn i { width: 18px; height: 18px; color: var(--accent-blue);}

.audit-results { border-top: 1px solid rgba(0,0,0,0.05); padding-top: 20px; display: flex; flex-direction: column; gap: 12px;}
.audit-stats { display: flex; justify-content: space-between; background: rgba(255,255,255,0.6); border: 1px solid rgba(0,0,0,0.05); border-radius: 12px; padding: 16px;}
.astat { display: flex; flex-direction: column; text-align: center; gap: 4px;}
.astat span { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase;}
.astat strong { font-size: 18px; color: var(--text-primary);}
.focus-bar { text-align: center; background: #fff; color: var(--text-primary); padding: 12px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.05); font-size: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.02);}
.hidden { display: none !important;}
.spin { animation: rotate 1s linear infinite;}
@keyframes rotate { 100% { transform: rotate(360deg); } }

.table-wrapper { padding: 24px; overflow-x: auto;}
.table-wrapper h3 { margin-bottom: 16px; color: var(--text-primary); font-size: 18px; font-weight: 700;}
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 14px;}
th, td { padding: 14px 16px; border-bottom: 1px solid rgba(0,0,0,0.05);}
th { color: var(--text-secondary); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; background: rgba(255,255,255,0.4); }
th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
tr { transition: background 0.2s; }
tr:hover td { background: rgba(255,255,255,0.6); }
.badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-block;}
.risk-high .badge { background: var(--accent-red-bg); color: var(--accent-red);}
.risk-medium .badge { background: var(--accent-yellow-bg); color: var(--accent-yellow);}
.fade-text { color: var(--text-secondary);}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* Animations */
.glass-card {
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.metric:nth-child(1) { animation-delay: 0.1s; }
.metric:nth-child(2) { animation-delay: 0.2s; }
.metric:nth-child(3) { animation-delay: 0.3s; }
.shift-card:nth-child(1) { animation-delay: 0.4s; }
.shift-card:nth-child(2) { animation-delay: 0.5s; }
.shift-card:nth-child(3) { animation-delay: 0.6s; }

/* Responsive Media Queries (iPad & Mobile) */
@media (max-width: 1200px) {
    .metrics-grid { grid-template-columns: repeat(3, 1fr); }
    .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 992px) { /* iPad / Tablet */
    .app-container { flex-direction: column; height: auto; overflow-y: auto;}
    body { overflow: auto; height: auto;}
    .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 20px; height: auto;}
    .brand { flex-direction: row; align-items: baseline; gap: 10px;}
    .nav-menu { flex-direction: row; width: auto; flex-grow: 0; gap: 15px;}
    .sidebar-filters { border-top: none; padding-top: 0; flex-direction: row; align-items: center;}
    .filter-form label { display: none;}
    .main-content { width: 100%; padding-right: 0;}
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) { /* Mobile */
    .sidebar { flex-direction: column; align-items: stretch; gap: 20px; }
    .brand { justify-content: center; margin-bottom: 10px;}
    .nav-menu { flex-direction: column; }
    .sidebar-filters { flex-direction: column; align-items: stretch;}
    .metrics-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 15px;}
    .metric { flex-direction: column; text-align: center; gap: 15px;}
    .split-grid.tables { grid-template-columns: 1fr; }
    .shift-grid { grid-template-columns: 1fr !important; }
}
