:root {
    /* Color Palette - User Preferred (Refined from Image) */
    --primary-color: #0096d6;
    /* Bright Cyan/Blue */
    --primary-hover: #007bb1;
    --secondary-color: #717171;

    /* Icon Helper */
    --icon-size: 1.25rem;

    /* Medium Grey */
    --accent-color: #375a6d;
    /* Dark Slate Blue */

    /* Light Theme Settings */
    --bg-main: #f5f7f9;
    /* Light Grey/White bg */
    --bg-card: #ffffff;
    --bg-white: #ffffff;
    --bg-sidebar-old: #3b5664;
    --bg-sidebar: #345C72;
    /* Dark Slate Blue Sidebar */

    --text-main: #334155;
    /* Dark Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-light: #ffffff;

    --border-color: #e2e8f0;
    /* Slate 200 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, ::after, ::before {
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 0.95rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
}

/* Typography Extensions */
.display-1 {
    font-size: calc(1.625rem + 4.5vw);
    font-weight: 300 !important;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.display-2 {
    font-size: calc(1.575rem + 3.9vw);
    font-weight: 300 !important;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.display-3 {
    font-size: calc(1.525rem + 3.3vw);
    font-weight: 300 !important;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

@media (min-width: 1200px) {
    .display-1 {
        font-size: 5rem;
    }

    .display-2 {
        font-size: 4.5rem;
    }

    .display-3 {
        font-size: 4rem;
    }
}

/* Sidebar*/
/* -------------------------------------------------------------------------- */
.sidebar,
.sidebar ul,
.sidebar ol,
.sidebar li,
.nav-menu,
.nav-menu ul,
.nav-menu li {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    text-indent: 0 !important;
    padding: 0;
    margin: 0;
    background-image: none !important;
}

.sidebar li::before,
.sidebar li::after {
    content: none !important;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.0rem 0.5rem;
    font-size: 1.0rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-menu {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-header {
    padding: 1.5rem 1.5rem 0.5rem !important;
    font-size: 0.725rem !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.3) !important;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    pointer-events: none;
}

/* Standardized Nav Links (Consistency Rule #3) */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    /* Unified dimmed state */
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.nav-link i {
    width: 24px;
    margin-right: 0.85rem;
    font-size: 1.1rem;
    opacity: 0.8;
    text-align: center;
}

/* Sub-links (REMOVED INDENTATION per User Requirement #3) */
.sub-link {
    padding-left: 1.5rem !important;
    /* Identical to main links */
}

/* Hover & Active States (Only differences allowed) */
.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding-left: 1.7rem;
}

.sub-link:hover {
    padding-left: 1.7rem !important;
    /* Identical to main links */
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}



.sidebar-footer {
    padding: 1.5rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ip-display {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-top: 1rem;
}

/* -------------------------------------------------------------------------- */
/* Main Content Area                                                          */
/* -------------------------------------------------------------------------- */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem;
    transition: var(--transition);
    max-width: calc(100vw - 260px);
}

/* Header / Top Bar (Flex Row Fix #1) */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2.5rem;
    gap: 2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* User & Notification Controls */
.notification-dropdown,
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.user-trigger {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 0.75rem;
    white-space: nowrap !important;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.user-trigger:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    /* Prevent shrinking/folding */
}

.user-name-display {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dropdowns */
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 240px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    z-index: 2001;
    /* Higher than sidebar */
    margin-top: 0.75rem;
    overflow: hidden;
}

#notificationDropdown.active .dropdown-content,
#userDropdown.active .dropdown-content {
    display: block !important;
}

.dropdown-header {
    padding: 1rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.dropdown-item {
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    /* Interaction indication */
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #f8fafc;
}

/* Message Styles */
.msg-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.msg-subject {
    font-weight: 600;
    color: var(--text-main);
}

.msg-meta {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.msg-date {
    font-size: 0.725rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.msg-date i {
    font-size: 0.7rem;
    opacity: 0.8;
}

.unread-label {
    color: #ef4444;
    /* Alert red */
    font-weight: 600;
}

/* Privilege Badges */
.privilege-container {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.privilege-item {
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 1rem;
    text-transform: capitalize;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}



.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}



/* DataTables Styling */
.dataTables_empty {
    padding: 3rem !important;
    text-align: center !important;
    color: var(--text-muted) !important;
    font-size: 0.95rem;
    font-weight: 500;
    background-color: #fafbfc !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-header span,
    .nav-link span,
    .nav-header {
        display: none;
    }

    .main-wrapper {
        margin-left: 80px;
        max-width: calc(100vw - 80px);
    }

    .nav-link {
        justify-content: center;
        padding: 1.25rem 0;
    }

    .nav-link i {
        margin-right: 0;
    }
}

/* -------------------------------------------------------------------------- */
/* Forms & Inputs                                                             */
/* -------------------------------------------------------------------------- */
.form-label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.875rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-main);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #cbd5e1;
    /* Visible slate-300 border */
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.form-control:focus {
    color: var(--text-main);
    background-color: #fff;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(0, 150, 214, 0.1);
}

.form-control-lg {
    padding: 0.8rem 1.25rem;
    font-size: 1.1rem;
}

/* -------------------------------------------------------------------------- */
/* Login Page Specific Styles (Ref: login.php)                                */
/* -------------------------------------------------------------------------- */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #dbeafe;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    /* Base style for login header fallback - color matches user screenshot */
    color: #1e3a8a;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 1.125rem;
    color: #3b82f6;
}

.login-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    width: 95%;
    /* Responsive Fit */
    max-width: 450px;
    border: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }
}

.login-page .form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #475569;
}

.login-page .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-page .form-control:focus {
    outline: none;
    border-color: #3b82f6;
}

.login-page .ip-display {
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
    margin: 1rem 0 2rem;
    background: transparent;
}

.login-page .btn-primary {
    width: 100%;
    background: #2563eb;
    color: white;
    padding: 0.875rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
    cursor: pointer;
    transition: background 0.2s;
}

.login-page .btn-primary:hover {
    background: #1d4ed8;
}

.login-page .position-relative { position: relative; width: 100%; }
.login-page .position-absolute { position: absolute; }
.login-page .top-50 { top: 50%; }
.start-0 { left: 0; }
.login-page .translate-middle-y { transform: translateY(-50%); }
.login-page .ms-3 { margin-left: 1rem; }
.login-page .ps-5 { padding-left: 3rem !important; }
.login-page .text-muted { color: #64748b !important; }
.login-page .text-center { text-align: center; }

.footer-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #475569;
}

.footer-links a {
    color: #3b82f6;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.privacy-link {
    display: block;
    margin-top: 1rem;
}

.login-v2 {
    background: #345C72 !important; /* Brand Dark Slate Blue Background */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.login-v2 .login-header img {
    max-width: 230px;
    height: auto;
    margin-bottom: 2rem;
}

.login-v2 .footer-links, .login-v2 .footer-links a {
    color: rgba(255,255,255,0.7) !important;
}

.login-v2 .footer-links a:hover {
    color: #fff !important;
}

/* Minimal Spinner CSS */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.d-none { display: none !important; }

.login-page .alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.login-page .alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.login-page .alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.mb-4 { margin-bottom: 1.5rem !important; }
.cursor-pointer { cursor: pointer; }

.text-center { text-align: center !important; }