/* ═══════════════════════════════════════════════════════
   CMMS SGelectronica - Global Design System
   Shared across all pages (sidebar + layout + tokens)
═══════════════════════════════════════════════════════ */

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

:root {
    --primary: #4b8bfc;
    --primary-light: #70a7ff;
    --primary-glow: rgba(75, 139, 252, 0.15);
    --secondary: #9f75ff;
    --bg: #1b1f2e; /* Soft dark slate background */
    --bg2: #161925;
    --surface: rgba(27, 31, 46, 0.85); /* Neumorphic surface */
    --surface2: #161925;
    --border: rgba(255, 255, 255, 0.04);
    --text: #e2e8f0;
    --text-muted: #8393a7;
    --text-secondary: #cbd5e1;
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --sidebar-w: 270px;
    --radius: 0.75rem;
    --radius-lg: 1.25rem;

    /* Neumorphic Shadows */
    --nm-shadow-out: 8px 8px 16px #11131c, -8px -8px 16px #252b40;
    --nm-shadow-in: inset 4px 4px 8px #11131c, inset -4px -4px 8px #252b40;
    --nm-shadow-out-sm: 4px 4px 8px #11131c, -4px -4px 8px #252b40;
    --nm-shadow-in-sm: inset 2px 2px 4px #11131c, inset -2px -2px 4px #252b40;
}

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Ambient glows with floating animation */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -10%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(75, 139, 252, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: floatGlow1 25s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    bottom: -15%;
    right: -5%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(159, 117, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: floatGlow2 20s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -20px) scale(1.05); }
    100% { transform: translate(-10px, 20px) scale(0.95); }
}

@keyframes floatGlow2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 30px) scale(1.08); }
    100% { transform: translate(40px, -20px) scale(0.92); }
}

/* ════════════════════════════════
   SIDEBAR – Neumorphic Design
════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    padding: 1.5rem 1rem;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.logo {
    padding: 1rem 0.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.logo img {
    max-width: 160px;
    height: 48px;
    object-fit: contain;
    filter: brightness(1.15) drop-shadow(0 0 6px rgba(75, 139, 252, 0.15));
}

.nav_links {
    flex: 1;
    list-style: none;
    padding: 0.5rem 0.2rem;
    overflow-y: auto;
}

.nav-group-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.6;
    padding: 1.2rem 0.75rem 0.5rem;
}

.nav_links li {
    margin-bottom: 8px;
}

.nav_links a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: var(--bg);
    box-shadow: 3px 3px 6px #11131c, -3px -3px 6px #252b40;
    border: none;
}

.nav_links a .nav-icon {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nav_links a:hover {
    color: var(--text);
    box-shadow: 1px 1px 2px #11131c, -1px -1px 2px #252b40;
    transform: translateY(1px);
}

.nav_links a:active {
    box-shadow: var(--nm-shadow-in-sm);
}

.nav_links a.active {
    box-shadow: var(--nm-shadow-in-sm);
    color: #fff;
    background: rgba(75, 139, 252, 0.05);
    font-weight: 600;
    border: none;
}

.nav_links a.active::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 35%;
    height: 30%;
    width: 3.5px;
    background: var(--primary);
    border-radius: 99px;
    box-shadow: 0 0 8px var(--primary);
}

/* ── User Panel ── */
.user-panel {
    padding: 1rem 0.2rem 0;
    flex-shrink: 0;
}

.user-info-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--bg);
    box-shadow: var(--nm-shadow-in-sm);
    border-radius: 1rem;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
}

.client-logo {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    object-fit: contain;
    background: var(--bg);
    box-shadow: var(--nm-shadow-in-sm);
    padding: 3px;
    display: none;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg);
    box-shadow: 3px 3px 6px #11131c, -3px -3px 6px #252b40;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: none;
    color: #fca5a5;
    border-radius: 1rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 600;
    box-shadow: 3px 3px 6px #11131c, -3px -3px 6px #252b40;
    transition: all 0.2s;
}

.btn-logout:hover {
    box-shadow: 1px 1px 3px #11131c, -1px -1px 3px #252b40;
    color: #fff;
    transform: translateY(1px);
}
.btn-logout:active {
    box-shadow: var(--nm-shadow-in-sm);
}

/* ════════════════════════════════
   MAIN CONTENT WRAPPER
════════════════════════════════ */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 2.1rem;
    font-weight: 950;
    letter-spacing: -0.025em;
    color: var(--text);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1.15;
}

.page-header .subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.date-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    box-shadow: var(--nm-shadow-out-sm);
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.section-card,
.card-panel {
    background: var(--bg);
    box-shadow: var(--nm-shadow-out);
    border-radius: 1.8rem;
    padding: 2.2rem;
    margin-bottom: 1.5rem;
    border: none;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4.5px;
    height: 19px;
    background: var(--primary);
    border-radius: 99px;
    box-shadow: 0 0 6px var(--primary);
}

/* ── Common table styles ── */
/* ── Common table styles ── */
table {
    width: 100%;
    border-collapse: collapse;
}

thead tr {
    border-bottom: 2px solid #11131c;
    background: rgba(0, 0, 0, 0.05);
}

th {
    padding: 0.85rem 1.1rem;
    text-align: left;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

td {
    padding: 1rem 1.1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

tbody tr {
    transition: all 0.22s ease;
}

table:not(.no-hover):not(.cv-table):not(.pai-table) tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--text) !important;
}

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

/* ── Buttons ── */
.btn-primary {
    background: var(--bg);
    color: #ffffff !important;
    border: none;
    padding: 0.6rem 1.35rem;
    border-radius: 0.85rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 3px 3px 6px #11131c, -3px -3px 6px #252b40;
}

.btn-primary:hover {
    box-shadow: 1px 1px 3px #11131c, -1px -1px 3px #252b40;
    transform: translateY(1px);
    color: #ffffff !important;
}
.btn-primary:active {
    box-shadow: var(--nm-shadow-in-sm);
}

.btn-danger {
    background: var(--bg);
    color: #fca5a5;
    border: none;
    padding: 0.5rem 1.15rem;
    border-radius: 0.85rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 3px 3px 6px #11131c, -3px -3px 6px #252b40;
}

.btn-danger:hover {
    box-shadow: 1px 1px 3px #11131c, -1px -1px 3px #252b40;
    color: #fff;
    transform: translateY(1px);
}

/* ── Status / Priority badges ── */
.status-badge,
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Forms ── */
/* ── Forms ── */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
    background: var(--bg);
    box-shadow: var(--nm-shadow-in-sm);
    border: none;
    color: var(--text);
    border-radius: 0.85rem;
    padding: 0.7rem 0.95rem;
    font-family: inherit;
    font-size: 0.88rem;
    width: 100%;
    transition: box-shadow 0.25s;
    outline: none;
}

select option {
    background-color: var(--bg);
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: inset 2px 2px 5px #0a0b12, inset -2px -2px 5px #2d344d;
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[style*="flex"] {
    display: flex !important;
}

.modal-content {
    background: var(--bg);
    box-shadow: 20px 20px 60px #0c0d14, -20px -20px 60px #2a3148;
    border-radius: 2rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 850px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: fadeSlideUp 0.3s ease;
    border: none;
}

.close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.7rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

/* ── Animations ── */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* ── Tabs Navigation ── */
.tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
}
.tabs::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
.tab {
    flex-shrink: 0;
}

/* ════════════════════════════════
   MOBILE HAMBURGER BUTTON
════════════════════════════════ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: rgba(14, 22, 43, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    cursor: pointer;
    padding: 10px 9px;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.mobile-menu-btn:hover {
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

.mobile-menu-btn:hover span {
    background: var(--primary-light);
}

/* Hamburger → X animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ── Sidebar Overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.65);
    backdrop-filter: blur(6px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ── Table Responsive Wrapper ── */
.table-responsive,
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.75rem;
}

/* Scroll fade hint for tables on mobile */
.table-responsive::after,
.table-container::after {
    content: '';
    position: sticky;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    background: linear-gradient(to right, transparent, rgba(3, 7, 18, 0.4));
    display: none;
}

/* ── Grid Utility Classes ── */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ── Form Row — inline flex that stacks on mobile ── */
.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row > * {
    flex: 1;
    min-width: 0;
}

/* ════════════════════════════════
   RESPONSIVE — TABLET (≤1024px)
════════════════════════════════ */
@media (max-width: 1024px) {
    :root {
        --sidebar-w: 240px;
    }

    .main-content {
        padding: 1.5rem 1.75rem;
    }

    .stat-value {
        font-size: 2.2rem;
    }

    .section-card,
    .card-panel {
        padding: 1.4rem;
        border-radius: 1.25rem;
    }

    .stat-card {
        padding: 1.3rem 1.4rem;
        border-radius: 1.25rem;
    }

    .stat-icon {
        width: 46px;
        height: 46px;
        font-size: 1.35rem;
    }
}

/* ════════════════════════════════
   RESPONSIVE — MOBILE (≤768px)
════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Show hamburger ── */
    .mobile-menu-btn {
        display: flex;
    }

    /* ── Body layout ── */
    body {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    /* ── Sidebar: slide-in from left ── */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 100;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        border-bottom: none;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: none;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
    }

    /* ── Main Content & Containers ── */
    .main-content,
    .container {
        padding: 1rem !important;
        width: 100% !important;
    }

    .main-content {
        padding-top: 4rem !important; /* Space for hamburger button */
        min-height: 100vh;
    }

    /* ── Page header & Title Areas ── */
    .page-header,
    .page-title-area {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .page-header h1,
    .page-title-area h1 {
        font-size: 1.5rem !important;
    }

    .page-header .subtitle,
    .page-title-area p {
        font-size: 0.82rem !important;
    }

    .date-badge {
        font-size: 0.78rem;
        padding: 0.45rem 0.85rem;
    }

    /* ── Section Cards & Sections ── */
    .section-card,
    .card-panel,
    .section {
        padding: 1.15rem !important;
        border-radius: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .section-title,
    .section h2 {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* ── Stat Cards ── */
    .stat-card {
        padding: 1.1rem 1.2rem;
        border-radius: 1rem;
        gap: 1rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        border-radius: 0.75rem;
    }

    .stat-value {
        font-size: 1.85rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-sub {
        font-size: 0.72rem;
    }

    /* ── Tables ── */
    th {
        padding: 0.65rem 0.75rem;
        font-size: 0.68rem;
    }

    td {
        padding: 0.7rem 0.75rem;
        font-size: 0.82rem;
    }

    /* ── Buttons ── */
    .btn-primary {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .btn-danger {
        padding: 0.6rem 1rem;
        font-size: 0.82rem;
        min-height: 44px;
    }

    /* Table action buttons accessibility (tap targets) */
    td button,
    td .btn-edit,
    td .btn-delete,
    td .btn-action,
    td .btn-danger,
    td .action-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 1rem !important;
        min-width: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 2px 4px !important;
        border-radius: 0.5rem !important;
        box-sizing: border-box !important;
    }

    /* ── Forms ── */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    select,
    textarea {
        padding: 0.7rem 0.75rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
        border-radius: 0.55rem;
    }

    label {
        font-size: 0.75rem;
    }

    /* ── Modal ── */
    .modal {
        padding: 0.5rem;
        align-items: flex-end; /* Slide up from bottom on mobile */
    }

    .modal-content {
        padding: 1.5rem;
        border-radius: 1.25rem 1.25rem 0 0;
        max-width: 100% !important;
        max-height: 92vh;
        margin: 0;
        width: 100% !important;
        animation: fadeSlideUpMobile 0.3s ease;
    }

    .close-btn {
        top: 1rem;
        right: 1rem;
        font-size: 1.5rem;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Form Grid — collapse to 1 column ── */
    .form-grid,
    .grid-2col,
    .grid-3col,
    .grid-4col {
        grid-template-columns: 1fr !important;
    }

    .grid-auto {
        grid-template-columns: 1fr !important;
    }

    /* ── Form Row — stack on mobile ── */
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* ── Table containers — ensure scroll + hint ── */
    .table-responsive::after,
    .table-container::after {
        display: block;
    }

    .table-container table,
    .table-responsive table {
        min-width: 600px;
    }

    /* ── Grids inline — force single column on mobile ── */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns:1fr 2fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns: 3fr 1fr"],
    [style*="grid-template-columns:3fr 1fr"],
    [style*="grid-template-columns: 1fr 3fr"],
    [style*="grid-template-columns:1fr 3fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: repeat(auto-fit"],
    [style*="grid-template-columns:repeat(auto-fit"],
    [style*="grid-template-columns: repeat(auto-fill"],
    [style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
    }


    /* ── Inline flex containers — stack vertically ── */
    [style*="display:flex; gap"],
    [style*="display: flex; gap"] {
        flex-direction: column !important;
    }

    /* ── Flex inline — stack vertically ── */
    header,
    .header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        height: auto !important;
        padding: 1rem !important;
    }

    header > div {
        flex-direction: column !important;
    }

    /* ── CSV Drop Zone ── */
    .csv-drop-zone {
        padding: 1.25rem 1rem;
    }
    .csv-drop-zone .drop-icon {
        font-size: 2rem;
    }

    /* ── Scrollbar — wider for touch ── */
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    /* ── Ambient glows — reduce for performance ── */
    body::before,
    body::after {
        display: none;
    }

    /* ── Pagination ── */
    .pagination {
        gap: 0.4rem;
    }
    .pagination button {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-width: 44px;
        min-height: 44px;
    }

    /* ── Import Summary ── */
    .csv-import-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    .import-summary-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Login Card ── */
    .login-card {
        padding: 2rem !important;
        margin: 1.5rem !important;
        max-width: 380px !important;
        border-radius: 1.25rem !important;
    }

    /* ── High-Fidelity Printable CV/PAI Exemption ── */
    .cv-container,
    .pai-container {
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 0 !important;
    }

    #printableCV,
    #printablePAI {
        width: 210mm !important;
        min-width: 210mm !important;
    }

    /* Force restore grids inside A4 sheets */
    #printableCV [style*="grid-template-columns: 3fr 1fr"],
    #printableCV [style*="grid-template-columns:3fr 1fr"] {
        grid-template-columns: 3fr 1fr !important;
    }
    #printableCV [style*="grid-template-columns: 1fr 1fr"],
    #printableCV [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }
    #printableCV [style*="grid-template-columns: 1fr 1fr 1fr"],
    #printableCV [style*="grid-template-columns:1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr 1fr !important;
    }
    #printableCV [style*="grid-template-columns: repeat(4"],
    #printableCV [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Mobile modal animation */
@keyframes fadeSlideUpMobile {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════════════════════════
   RESPONSIVE — SMALL PHONE (≤480px)
════════════════════════════════ */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 3.75rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .section-card,
    .card-panel {
        padding: 1rem;
        border-radius: 0.85rem;
    }

    .modal-content {
        padding: 1.15rem;
    }

    th {
        padding: 0.5rem 0.6rem;
        font-size: 0.65rem;
    }

    td {
        padding: 0.55rem 0.6rem;
        font-size: 0.78rem;
    }

    .login-card {
        padding: 1.5rem 1rem !important;
        margin: 0.75rem !important;
        border-radius: 1rem !important;
    }
}

/* ── Premium Stat Cards Utility ── */
.stat-card {
    background: rgba(14, 22, 43, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 1.6rem 1.8rem;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(25px);
    animation: fadeSlideUp 0.5s ease both;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-card.blue:hover {
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}
.stat-card.green:hover {
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}
.stat-card.amber:hover {
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}
.stat-card.red:hover {
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    opacity: 0.15;
    pointer-events: none;
    filter: blur(15px);
    transition: opacity 0.3s;
}
.stat-card:hover::before {
    opacity: 0.25;
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.amber::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.green::before { background: var(--success); }

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}
.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-card.blue .stat-icon {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.stat-card.amber .stat-icon {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.stat-card.red .stat-icon {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.stat-card.green .stat-icon {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-body {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.45rem;
}

.stat-value {
    font-size: 2.7rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 0.45rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 60%, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Progress Bar ── */
.progress-container {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    margin-top: 0.85rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    position: relative;
}
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: laserShine 2.5s infinite linear;
}

.stat-card.green .progress-bar {
    background: linear-gradient(90deg, #10b981, #34d399);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}



/* Force legibility color defaults for print sheet containers */
#printableCV,
#printableCV td,
#printableCV th,
#printablePAI,
#printablePAI td,
#printableReport,
#printableReport td,
#printableReport th {
    color: #000000;
}

/* Remove global thead gray background overrides on sheets */
#printableCV thead tr,
#printablePAI thead tr,
#printableReport thead tr {
    background: transparent !important;
    border: none !important;
}

/* ═══════════════════════════════════════════════════════
   CSV Drop Zone - Universal Drag & Drop
═══════════════════════════════════════════════════════ */
.csv-drop-zone {
    border: 2px dashed var(--border, rgba(148,163,184,0.3));
    border-radius: 0.75rem;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.02);
    position: relative;
}
.csv-drop-zone:hover,
.csv-drop-zone.dragover {
    border-color: var(--primary, #3b82f6);
    background: rgba(59,130,246,0.06);
    transform: scale(1.01);
    box-shadow: 0 0 20px rgba(59,130,246,0.1);
}
.csv-drop-zone input[type=file] { display: none; }
.csv-drop-zone .drop-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: grayscale(0.3);
    transition: filter 0.3s;
}
.csv-drop-zone:hover .drop-icon,
.csv-drop-zone.dragover .drop-icon { filter: grayscale(0); }

/* CSV Import Summary Cards */
.csv-import-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.csv-import-summary .sum-card {
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(148,163,184,0.15);
}
.csv-import-summary .sum-card .num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}
.csv-import-summary .sum-card .lbl {
    font-size: 0.7rem;
    color: var(--text-secondary, #94a3b8);
    margin-top: 0.25rem;
}
.csv-result-section {
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    max-height: 180px;
    overflow-y: auto;
}
.csv-result-section h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.csv-result-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.8;
}