:root {
    --bg-base: #030303;
    --bg-surface: rgba(20, 20, 20, 0.6);
    --border-color: rgba(42, 42, 42, 0.8);
    --accent: #C29A32;
    --accent-glow: rgba(194, 154, 50, 0.6);
    --light: #1B6E86;
    --light-glow: rgba(27, 110, 134, 0.6);
    --text-main: #F2F2F2;
    --text-muted: #7A7A7A;
    --text-dark: #0A0A0A;
    --critical: #C25A5A;
    --critical-bg: rgba(36, 20, 20, 0.7);
    --critical-border: #4A2020;
    --critical-glow: rgba(194, 90, 90, 0.6);
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.75), -0.025em -0.05em 0 rgba(0,255,0,0.75), 0.025em 0.05em 0 rgba(0,0,255,0.75); }
    14% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.75), -0.025em -0.05em 0 rgba(0,255,0,0.75), 0.025em 0.05em 0 rgba(0,0,255,0.75); }
    15% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.75), 0.025em 0.025em 0 rgba(0,255,0,0.75), -0.05em -0.05em 0 rgba(0,0,255,0.75); }
    49% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.75), 0.025em 0.025em 0 rgba(0,255,0,0.75), -0.05em -0.05em 0 rgba(0,0,255,0.75); }
    50% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.75), 0.05em 0 0 rgba(0,255,0,0.75), 0 -0.05em 0 rgba(0,0,255,0.75); }
    99% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.75), 0.05em 0 0 rgba(0,255,0,0.75), 0 -0.05em 0 rgba(0,0,255,0.75); }
    100% { text-shadow: -0.025em 0 0 rgba(255,0,0,0.75), -0.025em -0.025em 0 rgba(0,255,0,0.75), -0.025em -0.05em 0 rgba(0,0,255,0.75); }
}

@keyframes backgroundGrid {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { box-shadow: 0 0 0 10px rgba(194, 154, 50, 0); }
    100% { box-shadow: 0 0 0 0 rgba(194, 154, 50, 0); }
}

body {
    background-color: var(--bg-base);
    background-image: 
        linear-gradient(rgba(20, 20, 20, 0.8) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 20, 20, 0.8) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: backgroundGrid 20s linear infinite;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.scanline {
    width: 100%;
    height: 100px;
    z-index: 9999;
    position: fixed;
    pointer-events: none;
    background: linear-gradient(0deg, rgba(0,0,0,0) 0%, rgba(27,110,134,0.1) 50%, rgba(0,0,0,0) 100%);
    animation: scanline 8s linear infinite;
}

/* Typography */
.main-title {
    margin: 0 0 6px;
    color: var(--text-main);
    font-size: 38px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.main-title.glitch-text:hover {
    animation: glitch 1s linear infinite;
}

.section-title {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.body-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

/* Error Box */
.error-box {
    background-color: var(--critical-bg);
    border: 1px solid var(--critical);
    color: var(--critical);
    padding: 15px 20px;
    margin-bottom: 25px;
    font-size: 14px;
    font-weight: 500;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    box-shadow: 0 0 10px var(--critical-glow);
    animation: pulseBorder 2s infinite;
}

/* Containers */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    z-index: 10;
}

.login-box {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 50px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255,255,255,0.05);
}

.dashboard-container {
    padding: 50px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    z-index: 10;
}

/* Tactical Accents */
.tactical-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}
.tactical-accent.blue {
    background-color: var(--light);
    box-shadow: 0 0 15px var(--light-glow);
}

/* Buttons - AAA Gaming Style */
.btn {
    display: inline-block;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 16px 32px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
    z-index: -1;
}

.btn:hover::before {
    left: 200%;
}

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

.btn-primary {
    background-color: var(--accent);
    color: var(--text-dark);
}

.btn-primary:hover {
    box-shadow: 0 0 25px var(--accent-glow);
    background-color: #e5bf45;
}

.btn-secondary {
    background-color: rgba(20, 20, 20, 0.8);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(42, 42, 42, 0.8);
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

.btn-critical {
    background-color: var(--critical-bg);
    color: var(--critical);
    box-shadow: inset 0 0 0 1px var(--critical-border);
}

.btn-critical:hover {
    background-color: rgba(58, 26, 26, 0.9);
    color: #ff8a8a;
    box-shadow: 0 0 25px var(--critical-glow), inset 0 0 0 1px #ff8a8a;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 14px;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.badge-active {
    background-color: var(--accent);
    color: var(--text-dark);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 20;
    position: sticky;
    top: 0;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

/* Operator HUD Card */
.operator-card {
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 35px;
    position: relative;
    margin-top: 30px;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(194, 154, 50, 0.1);
}

.operator-card::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 30px;
    height: 30px;
    border-bottom: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
}

.operator-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 30px;
    height: 30px;
    border-top: 2px solid var(--accent);
    border-left: 2px solid var(--accent);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
}

.avatar-wrapper {
    position: relative;
    padding: 4px;
    background: linear-gradient(45deg, var(--accent), var(--light));
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.avatar {
    width: 80px;
    height: 80px;
    display: block;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.profile-info h2 {
    margin: 0 0 6px 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-main);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, var(--border-color) 0%, rgba(42,42,42,0) 100%);
    margin: 25px 0;
}

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

.stat-item {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 16px;
    border-left: 2px solid var(--light);
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stat-value {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 600;
    margin-top: 6px;
    letter-spacing: 1px;
}

/* --- LIGHT MODE --- */
:root.light-mode {
    --bg-base: #E8E8E8;
    --bg-surface: rgba(240, 240, 240, 0.8);
    --border-color: rgba(200, 200, 200, 0.8);
    --text-main: #1A1A1A;
    --text-muted: #5A5A5A;
    --text-dark: #FFFFFF;
    --critical-bg: rgba(255, 230, 230, 0.7);
    --critical-border: #FFB3B3;
    
    /* Slightly darken accents for visibility on light background if needed, but keeping them same is usually fine for AAA gaming feel, maybe less glow */
    --accent-glow: rgba(194, 154, 50, 0.2);
    --light-glow: rgba(27, 110, 134, 0.2);
}

:root.light-mode body {
    background-image: 
        linear-gradient(rgba(200, 200, 200, 0.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(200, 200, 200, 0.4) 1px, transparent 1px);
}
:root.light-mode body::before {
    background: linear-gradient(rgba(255, 255, 255, 0) 50%, rgba(200, 200, 200, 0.1) 50%);
}

:root.light-mode .sidebar {
    background: rgba(230, 230, 230, 0.8);
    border-right: 1px solid var(--border-color);
}

:root.light-mode .operator-card,
:root.light-mode .employee-card {
    background: rgba(250, 250, 250, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(194, 154, 50, 0.2);
}

:root.light-mode .stat-item {
    background: rgba(255, 255, 255, 0.6);
}

:root.light-mode .btn-secondary {
    background-color: rgba(240, 240, 240, 0.8);
    color: var(--text-main);
}

:root.light-mode .btn-secondary:hover {
    background-color: rgba(220, 220, 220, 0.8);
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

:root.light-mode .tab-btn.active {
    background: rgba(200, 200, 200, 0.5);
    color: var(--accent);
}

/* --- APP LAYOUT --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    z-index: 10;
    position: relative;
}

.sidebar {
    width: 280px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 15px 25px;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

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

.tab-btn.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(194, 154, 50, 0.05);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

:root.light-mode .sidebar-profile {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0,0,0,0.05);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
    border: 1px solid var(--accent);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-nickname {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
}

.sidebar-username {
    color: var(--text-muted);
    font-size: 11px;
}

.main-content {
    flex: 1;
    padding: 40px 60px;
    overflow-y: auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
}

.tab-content.active {
    display: block;
}

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

/* --- EMPLOYEE CARDS --- */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.employee-card {
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.employee-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-color: var(--accent);
}

.employee-avatar {
    width: 60px;
    height: 60px;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    border: 1px solid var(--light);
}

.employee-info {
    display: flex;
    flex-direction: column;
}

.employee-name {
    color: var(--text-main);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.employee-rank {
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.employee-id {
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 5px;
}

.loading-text {
    color: var(--accent);
    animation: pulseBorder 1.5s infinite;
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--accent);
}

/* --- TACTICAL TABLE --- */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 30px;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.table-tactical {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-tactical th {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.table-tactical td {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.table-tactical tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table-tactical .col-primary {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.table-tactical .col-secondary {
    font-size: 14px;
    color: var(--text-muted);
}

.table-tactical .col-tertiary {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
}

.text-missing-admin {
    color: var(--critical);
    font-weight: 600;
}

.text-missing-user {
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.5;
}

.btn-edit {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: var(--accent);
    color: var(--bg-base);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- MODAL --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-base);
    border: 1px solid var(--accent);
    padding: 30px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 0 1px var(--accent-glow);
    position: relative;
}

.modal-title {
    color: var(--accent);
    font-size: 18px;
    margin: 0 0 20px 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.form-input {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

:root.light-mode .table-container {
    background: rgba(250, 250, 250, 0.7);
}
:root.light-mode .table-tactical th {
    background: rgba(230, 230, 230, 0.8);
    color: var(--text-main);
}
:root.light-mode .table-tactical td {
    border-color: rgba(0,0,0,0.05);
}
:root.light-mode .form-input {
    background: #fff;
    color: #000;
}
