:root {
    --blue-1: #1e3a8a;
    --blue-2: #2563eb;
    --orange-1: #f97316;
    --orange-2: #c2410c;
    --card-bg: rgba(255, 255, 255, 0.12);
    --card-border: rgba(255, 255, 255, 0.25);
    --text-light: #f8fafc;
    --text-muted: #cbd5e1;
    --input-bg: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-light);
}

a { text-decoration: none; }

/* ---------- Auth pages (login / forgot / reset / landing) ---------- */
.auth-body {
    min-height: 100vh;
}

.auth-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--blue-1) 0%, var(--blue-2) 45%, var(--orange-1) 100%);
}

.auth-shape {
    position: absolute;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    transform: rotate(-15deg);
}

.shape-1 { width: 140px; height: 60px; top: 18%; left: 8%; }
.shape-2 { width: 180px; height: 70px; top: 32%; left: 22%; }

.auth-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 36px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.auth-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    font-size: 34px;
}

.auth-card h1 {
    margin: 0 0 4px;
    font-size: 26px;
    font-weight: 700;
}

.auth-subtitle {
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-group {
    text-align: left;
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .icon {
    position: absolute;
    left: 14px;
    opacity: 0.85;
    font-size: 15px;
}

.input-wrap input {
    width: 100%;
    padding: 13px 14px 13px 40px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-light);
    font-size: 15px;
    outline: none;
}

.input-wrap input::placeholder { color: rgba(255,255,255,0.6); }
.input-wrap input:focus { border-color: rgba(255,255,255,0.6); }

.toggle-pw {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 15px;
    opacity: 0.85;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-me input { accent-color: var(--orange-1); width: 16px; height: 16px; }

.link-orange {
    color: #fdba74;
    font-weight: 600;
}
.link-orange:hover { color: #fed7aa; }

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--orange-1), var(--orange-2));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(194, 65, 12, 0.4);
    transition: transform 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.back-link {
    display: block;
    margin-top: 22px;
    color: var(--text-muted);
    font-size: 14px;
}
.back-link:hover { color: #fff; }

.alert {
    text-align: left;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 18px;
}
.alert-error {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
}
.alert-success {
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}
.alert-info {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--text-light);
    word-break: break-all;
}

/* ---------- Landing page ---------- */
.landing-hero {
    text-align: center;
    max-width: 640px;
}
.landing-hero .auth-icon { width: 88px; height: 88px; font-size: 42px; border-radius: 22px; }
.landing-hero h1 {
    font-size: 44px;
    margin: 20px 0 6px;
    font-weight: 800;
}
.landing-hero p.tagline {
    font-size: 18px;
    color: var(--text-muted);
    margin: 0 0 26px;
}
.landing-hero .desc-box {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px 20px;
    font-size: 14px;
    margin-bottom: 30px;
}
.landing-hero .btn-primary { max-width: 260px; margin: 0 auto; }

/* ---------- Dashboard (light theme) ---------- */
:root {
    --sb-bg-1: #1a2544;
    --sb-bg-2: #0f172e;
    --content-bg: #f1f5f9;
    --panel-bg: #ffffff;
    --panel-border: #e5e7eb;
    --ink: #1e293b;
    --ink-soft: #64748b;
    --ink-faint: #94a3b8;
    --c-blue: #2563eb;
    --c-orange: #f97316;
    --c-green: #22c55e;
    --c-red: #ef4444;
    --c-purple: #8b5cf6;
    --c-teal: #14b8a6;
    --c-amber: #f59e0b;
}

.dash-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--content-bg);
    color: var(--ink);
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--sb-bg-1), var(--sb-bg-2));
    padding: 20px 14px;
    flex-shrink: 0;
    overflow-x: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-backdrop { display: none; }
.sidebar-close { display: none; }

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding: 4px 8px;
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.15s ease;
}
.sidebar .brand:hover { background: rgba(255,255,255,0.06); }
.sidebar .brand .auth-icon {
    width: 38px; height: 38px; font-size: 18px; margin: 0; border-radius: 10px;
    background: linear-gradient(135deg, var(--c-orange), #c2410c);
}
.sidebar .brand .brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar .brand .brand-text strong { font-size: 14px; color: #fff; }
.sidebar .brand .brand-text small { font-size: 10px; color: #94a3b8; letter-spacing: 0.3px; }

.sidebar .nav-section-label {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin: 18px 10px 8px;
}
.sidebar .nav-section-label:first-of-type { margin-top: 4px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #b6c0d6;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 3px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar .nav-item-wrap { position: relative; }
.sidebar .nav-item-wrap a { justify-content: space-between; }
.sidebar .nav-item-wrap a .nav-a-left { display: flex; align-items: center; gap: 10px; }
.sidebar .nav-chevron {
    font-size: 16px; opacity: 0.85; line-height: 1;
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}
.sidebar .nav-chevron:hover { background: rgba(255,255,255,0.15); opacity: 1; }
.sidebar .nav-chevron.open { transform: rotate(180deg); }
.sidebar .nav-submenu {
    padding-left: 30px;
    margin-bottom: 3px;
}
.sidebar .nav-submenu a {
    font-size: 12.5px;
    padding: 8px 12px;
    color: #93a0bd;
}
.sidebar .nav-submenu a::before { content: '↳ '; opacity: 0.6; }
.sidebar .nav-submenu-title { display: none; }
.sidebar .nav-submenu a.active {
    background: rgba(249,115,22,0.18);
    color: #fdba74;
    font-weight: 600;
}
.sidebar nav a.active {
    background: linear-gradient(135deg, var(--c-orange), #ea580c);
    color: #fff;
    font-weight: 600;
}

.main-content { flex: 1; min-width: 0; }

/* ---------- Desktop sidebar collapse (icon-only rail) ---------- */
@media (min-width: 901px) {
    .dash-wrapper.sidebar-collapsed .sidebar { width: 72px; overflow: visible; }
    .dash-wrapper.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 4px 0; }
    .dash-wrapper.sidebar-collapsed .sidebar .brand-text,
    .dash-wrapper.sidebar-collapsed .sidebar .nav-section-label,
    .dash-wrapper.sidebar-collapsed .sidebar .nav-label,
    .dash-wrapper.sidebar-collapsed .sidebar .nav-chevron {
        display: none;
    }
    .dash-wrapper.sidebar-collapsed .sidebar nav a,
    .dash-wrapper.sidebar-collapsed .sidebar .nav-item-wrap a {
        justify-content: center;
        padding: 12px 0;
    }
    .dash-wrapper.sidebar-collapsed .sidebar .nav-a-left { justify-content: center; }

    /* Flyout submenu: hover a collapsed parent icon to reveal its children */
    /* Invisible bridge over the visual gap so the cursor never leaves the
       hoverable area while moving from the icon to the flyout panel. */
    .dash-wrapper.sidebar-collapsed .sidebar .nav-item-wrap::after {
        content: '';
        position: absolute;
        top: 0;
        left: 100%;
        width: 12px;
        height: 100%;
    }
    .dash-wrapper.sidebar-collapsed .sidebar .nav-submenu {
        display: none !important;
        position: absolute;
        left: 100%;
        top: 0;
        margin-left: 10px;
        min-width: 200px;
        padding: 8px;
        background: linear-gradient(180deg, var(--sb-bg-1), var(--sb-bg-2));
        border-radius: 12px;
        box-shadow: 0 12px 32px rgba(0,0,0,0.4);
        z-index: 60;
    }
    .dash-wrapper.sidebar-collapsed .sidebar .nav-item-wrap:hover .nav-submenu {
        display: block !important;
    }
    .dash-wrapper.sidebar-collapsed .sidebar .nav-submenu-title {
        display: block;
        font-size: 10.5px;
        font-weight: 700;
        color: #64748b;
        letter-spacing: 0.6px;
        text-transform: uppercase;
        padding: 6px 10px 8px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        margin-bottom: 4px;
        white-space: nowrap;
    }
    .dash-wrapper.sidebar-collapsed .sidebar .nav-submenu a {
        white-space: nowrap;
        padding: 9px 10px;
    }
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--panel-border);
    padding: 14px 28px;
    gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-titles { min-width: 0; }
.sidebar-toggle {
    width: 38px; height: 38px; flex-shrink: 0; border: 1px solid var(--sb-bg-2);
    background: linear-gradient(180deg, var(--sb-bg-1), var(--sb-bg-2));
    border-radius: 10px; color: #fff; cursor: pointer;
    font-size: 16px; display: flex; align-items: center; justify-content: center;
    transition: opacity 0.15s ease;
}
.sidebar-toggle:hover { opacity: 0.85; }
.crumb-box {
    display: flex; align-items: center; gap: 6px; flex-shrink: 1; min-width: 0;
    padding: 8px 16px; border: 1px solid var(--panel-border); border-radius: 10px;
    background: #fff; font-size: 14px; color: var(--ink-soft);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb-box .crumb-home {
    flex-shrink: 0;
    text-decoration: none;
    border-radius: 6px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.15s ease;
}
.crumb-box .crumb-home:hover { background: #f1f5f9; }
.crumb-box .crumb-sep { color: var(--ink-faint); }
.crumb-box .crumb-seg { overflow: hidden; text-overflow: ellipsis; }
.crumb-box .crumb-current { font-weight: 700; color: var(--ink); }
.topbar .top-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--ink-soft);
    min-width: 180px;
}
.search-box input {
    border: none; background: transparent; outline: none; font-size: 13px; color: var(--ink); width: 100%;
}

.bell-btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid var(--panel-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    cursor: pointer;
}
.bell-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-red); border: 2px solid #fff; }

.avatar-menu { position: relative; }
.avatar-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 4px 6px; border-radius: 10px;
    color: var(--ink);
}
.avatar-btn:hover { background: #f1f5f9; }
.avatar-circle {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--c-purple), #6d28d9);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.avatar-dropdown {
    display: none;
    position: absolute; right: 0; top: 46px;
    background: #fff; border: 1px solid var(--panel-border); border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    min-width: 160px; overflow: hidden; z-index: 20;
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown a, .avatar-dropdown button {
    display: block; width: 100%; text-align: left;
    padding: 11px 16px; font-size: 13.5px; color: var(--ink);
    background: none; border: none; cursor: pointer;
}
.avatar-dropdown a:hover, .avatar-dropdown button:hover { background: #f8fafc; }
.avatar-dropdown .logout-item { color: var(--c-red); }

.content-inner { padding: 24px 28px; }

.welcome-banner {
    position: relative;
    overflow: hidden;
    background: linear-gradient(120deg, var(--c-blue) 0%, #4f46e5 45%, var(--c-orange) 100%);
    border-radius: 18px;
    padding: 22px 28px;
    color: #fff;
    margin-bottom: 22px;
}
.welcome-banner .wb-greet { font-size: 13px; opacity: 0.9; }
.welcome-banner h2 { margin: 4px 0 2px; font-size: 22px; }
.welcome-banner .wb-date { font-size: 13px; opacity: 0.85; margin-bottom: 14px; }
.welcome-banner .wb-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.welcome-banner .pill {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.welcome-banner .wb-icon {
    position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
    font-size: 64px; opacity: 0.25;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.stat-card .icon-badge {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; margin-bottom: 12px;
}
.stat-card .value { font-size: 22px; font-weight: 800; color: var(--ink); }
.stat-card .label { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.stat-card .delta { font-size: 12px; margin-top: 8px; font-weight: 600; }
.delta-up { color: var(--c-green); }
.delta-down { color: var(--c-red); }
.delta-flat { color: var(--ink-faint); }
.delta-warn { color: var(--c-amber); }

.icon-blue { background: rgba(37,99,235,0.12); color: var(--c-blue); }
.icon-green { background: rgba(34,197,94,0.12); color: #16a34a; }
.icon-orange { background: rgba(249,115,22,0.12); color: var(--c-orange); }
.icon-red { background: rgba(239,68,68,0.12); color: var(--c-red); }
.icon-purple { background: rgba(139,92,246,0.12); color: var(--c-purple); }
.icon-teal { background: rgba(20,184,166,0.12); color: var(--c-teal); }

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.panel-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 16px;
}
.panel-header h3 { margin: 0; font-size: 15px; color: var(--ink); }
.panel-header .panel-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.chart-panel-animate {
    opacity: 0;
    animation: chartPanelFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.15s;
}
.grid-2 .chart-panel-animate:nth-of-type(2) { animation-delay: 0.28s; }
@keyframes chartPanelFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
.panel-header .panel-link { font-size: 13px; color: var(--c-orange); font-weight: 600; }
.live-badge {
    background: rgba(34,197,94,0.12); color: #16a34a;
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.year-select {
    font-size: 12.5px; border: 1px solid var(--panel-border); border-radius: 8px;
    padding: 5px 10px; color: var(--ink); background: #f8fafc;
}

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

.module-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-faint);
}
.module-placeholder .big-icon { font-size: 48px; margin-bottom: 14px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-grid .panel { margin-bottom: 0; }
.settings-heading { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
.settings-grid .module-sub { margin-bottom: 16px; }
@media (max-width: 900px) {
    .settings-grid { grid-template-columns: 1fr; }
}

.quick-links { display: flex; flex-direction: column; gap: 10px; }
.quick-link-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border: 1px solid var(--panel-border); border-radius: 12px;
    text-decoration: none; color: var(--ink); transition: background 0.15s ease, border-color 0.15s ease;
}
.quick-link-card:hover { background: #f8fafc; border-color: var(--c-orange); }
.quick-link-card .quick-link-icon { font-size: 22px; }
.quick-link-card strong { display: block; font-size: 14px; color: var(--ink); }
.quick-link-card small { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.qa-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.qa-row .icon-badge { width: 30px; height: 30px; font-size: 14px; margin-bottom: 0; }
.qa-blue { background: rgba(37,99,235,0.08); }
.qa-orange { background: rgba(249,115,22,0.08); }
.qa-green { background: rgba(34,197,94,0.08); }
.qa-purple { background: rgba(139,92,246,0.08); }

.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
    text-align: left;
    color: var(--ink-faint);
    font-weight: 600;
    padding: 10px 8px;
    border-bottom: 1px solid var(--panel-border);
}
table.data-table td { padding: 12px 8px; border-bottom: 1px solid #f1f5f9; color: var(--ink); }

.badge { padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-paid, .badge-active, .badge-running, .badge-delivered, .badge-available { background: rgba(34,197,94,0.12); color: #16a34a; }
.badge-pending, .badge-low { background: rgba(245,158,11,0.14); color: #b45309; }
.badge-overdue, .badge-inactive, .badge-out { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-completed, .badge-dispatched { background: rgba(37,99,235,0.12); color: var(--c-blue); }
.badge-in-transit { background: rgba(139,92,246,0.12); color: var(--c-purple); }

.badge-dyn-green { background: rgba(34,197,94,0.12); color: #16a34a; }
.badge-dyn-red { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-dyn-blue { background: rgba(37,99,235,0.12); color: #2563eb; }
.badge-dyn-orange { background: rgba(249,115,22,0.12); color: #c2410c; }
.badge-dyn-purple { background: rgba(139,92,246,0.12); color: #7c3aed; }
.badge-dyn-teal { background: rgba(20,184,166,0.12); color: #0f766e; }
.badge-dyn-amber { background: rgba(245,158,11,0.14); color: #b45309; }

.color-swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: middle; }
.color-swatch.green { background: #22c55e; }
.color-swatch.red { background: #ef4444; }
.color-swatch.blue { background: #2563eb; }
.color-swatch.orange { background: #f97316; }
.color-swatch.purple { background: #8b5cf6; }
.color-swatch.teal { background: #14b8a6; }
.color-swatch.amber { background: #f59e0b; }

.bulk-bar {
    display: none;
    align-items: center; gap: 12px; flex-wrap: wrap;
    background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px;
    padding: 10px 16px; margin-bottom: 14px; font-size: 13.5px; color: var(--ink);
}
.bulk-bar.active { display: flex; }
.bulk-bar select { padding: 8px 12px; }
.btn-secondary.danger-text { color: var(--c-red); border-color: #fecaca; }
.btn-secondary.danger-text:hover { background: rgba(239,68,68,0.08); }
input.row-check-worker, #selectAllWorkers { width: 16px; height: 16px; accent-color: var(--c-orange); cursor: pointer; }

.pagination-top { margin-top: 0; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--panel-border); }
#workersTableContainer { transition: opacity 0.15s ease; }

.entries-select {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--ink-soft);
}
.entries-select select { width: auto; min-width: 64px; padding: 8px 10px; }

.export-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.export-label { white-space: nowrap; }
.export-sep { color: var(--ink-faint); }
.export-input { width: 64px; padding: 7px 8px; border: 1px solid var(--panel-border); border-radius: 8px; font-size: 13px; background: #f8fafc; color: var(--ink); }
.btn-export {
    border: none; border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 700;
    cursor: pointer; color: #fff; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px; text-decoration: none;
}
.btn-export.excel { background: #1d6f42; }
.btn-export.excel:hover { background: #185c37; }

/* ---------- CRUD module pages ---------- */
.module-toolbar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    margin-bottom: 18px;
}
.module-toolbar h2 { margin: 0; font-size: 19px; color: var(--ink); }
.module-toolbar .module-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

.mini-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.mini-stat {
    background: var(--panel-bg);
    border: 1px solid #eef0f3;
    border-radius: 14px;
    padding: 18px 18px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mini-stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.09); }
.mini-stat, .stat-card {
    opacity: 0;
    animation: cardFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.mini-stat:nth-child(1), .stat-card:nth-child(1) { animation-delay: 0.04s; }
.mini-stat:nth-child(2), .stat-card:nth-child(2) { animation-delay: 0.1s; }
.mini-stat:nth-child(3), .stat-card:nth-child(3) { animation-delay: 0.16s; }
.mini-stat:nth-child(4), .stat-card:nth-child(4) { animation-delay: 0.22s; }
.mini-stat:nth-child(5), .stat-card:nth-child(5) { animation-delay: 0.28s; }
.mini-stat:nth-child(6), .stat-card:nth-child(6) { animation-delay: 0.34s; }
.mini-stat:nth-child(n+7), .stat-card:nth-child(n+7) { animation-delay: 0.34s; }
@keyframes cardFadeUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.09); }
.mini-stat .icon-badge {
    width: 46px; height: 46px; font-size: 21px; margin-bottom: 0; flex-shrink: 0; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
}
.mini-stat .icon-badge.icon-dot { font-size: 22px; }
.mini-stat .value { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.mini-stat .label { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.sort-link:hover { color: var(--ink); }
.sort-link .arrow { font-size: 10px; opacity: 0.6; }

.count-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.count-pill.zero { background: rgba(34,197,94,0.12); color: #16a34a; }
.count-pill.nonzero { background: rgba(245,158,11,0.15); color: #b45309; }

.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.view-row { display: flex; flex-direction: column; gap: 3px; }
.view-row .view-label { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.view-row .view-value { font-size: 14.5px; color: var(--ink); font-weight: 600; }
.btn-view {
    height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(37,99,235,0.25);
    background: rgba(37,99,235,0.08); color: var(--c-blue); cursor: pointer; font-size: 12.5px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px; margin-right: 4px;
    white-space: nowrap;
}
.btn-view:hover { background: rgba(37,99,235,0.15); }
table.data-table td.actions-cell { white-space: nowrap; }

.filter-bar {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    margin-bottom: 16px;
}
.filter-bar .filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-input, .filter-select {
    padding: 9px 14px; border: 1px solid var(--panel-border); border-radius: 10px;
    font-size: 13px; background: #f8fafc; color: var(--ink);
}
.filter-input { min-width: 200px; }

.btn-add {
    background: linear-gradient(135deg, var(--c-orange), #c2410c);
    color: #fff; border: none; padding: 10px 18px; border-radius: 10px;
    font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-secondary {
    background: #f1f5f9; border: 1px solid var(--panel-border); color: var(--ink);
    padding: 10px 18px; border-radius: 10px; font-size: 13.5px; cursor: pointer; font-weight: 600;
}

.icon-btn {
    height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(22,163,74,0.25);
    background: rgba(22,163,74,0.08); color: #16a34a; cursor: pointer; font-size: 12.5px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px; margin-right: 4px;
    white-space: nowrap;
}
.icon-btn:hover { background: rgba(22,163,74,0.15); }
.icon-btn.danger {
    width: 30px; padding: 0; border-color: rgba(239,68,68,0.25);
    background: rgba(239,68,68,0.08); color: #ef4444;
}
.icon-btn.danger:hover { background: rgba(239,68,68,0.15); border-color: #fecaca; }

.pagination {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 16px; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; gap: 10px;
}
.pagination .pages { display: flex; gap: 6px; }
.pagination .pages a, .pagination .pages span {
    min-width: 30px; height: 30px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid var(--panel-border); color: var(--ink); text-decoration: none; font-size: 13px;
}
.pagination .pages a:hover { background: #f1f5f9; }
.pagination .pages .active { background: var(--c-orange); color: #fff; border-color: var(--c-orange); }
.pagination .pages .disabled { opacity: 0.4; pointer-events: none; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.5);
    display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 88vh;
    overflow-y: auto; padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.modal-box-lg { max-width: 720px; }

.perm-matrix-wrap { max-height: 360px; overflow-y: auto; border: 1px solid var(--panel-border); border-radius: 10px; margin-top: 16px; }
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-matrix th {
    position: sticky; top: 0; background: #f8fafc; text-align: center; padding: 8px 10px;
    border-bottom: 1px solid var(--panel-border); color: var(--ink-soft); font-weight: 700; font-size: 12px;
}
.perm-matrix th.perm-section-col, .perm-matrix td.perm-section-col { text-align: left; }
.perm-matrix td { padding: 7px 10px; text-align: center; border-bottom: 1px solid #f1f5f9; color: var(--ink); }
.perm-matrix .perm-group-row td {
    background: #fff7ed; color: var(--c-orange); font-weight: 700; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.4px; padding: 6px 10px;
}
.perm-check { width: 16px; height: 16px; accent-color: var(--c-orange); cursor: pointer; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-header .modal-title { margin: 0; font-size: 17px; color: var(--ink); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink-soft); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.form-field input, .form-field select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--panel-border); border-radius: 8px;
    font-size: 13.5px; color: var(--ink); background: #fff;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.toast {
    position: fixed; top: 20px; right: 20px; z-index: 200;
    background: #16a34a; color: #fff; padding: 12px 20px; border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.18); font-size: 13.5px; font-weight: 600;
}
.toast.error { background: #dc2626; }

.confirm-box {
    background: #fff; border-radius: 16px; width: 100%; max-width: 380px;
    padding: 28px 24px 24px; box-shadow: 0 24px 60px rgba(0,0,0,0.25); text-align: center;
}
.confirm-icon {
    width: 56px; height: 56px; border-radius: 50%; background: rgba(239,68,68,0.1);
    color: #ef4444; font-size: 24px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.confirm-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--ink); }
.confirm-message { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.confirm-actions .btn-secondary, .confirm-actions .btn-danger-solid { flex: 1; padding: 10px 0; }
.btn-danger-solid {
    background: #ef4444; color: #fff; border: none; border-radius: 10px;
    font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.btn-danger-solid:hover { background: #dc2626; }

.report-tabs {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
    border-bottom: 1px solid var(--panel-border); padding-bottom: 0;
}
.report-tab {
    padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
    text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.report-tab:hover { color: var(--ink); }
.report-tab.active { color: var(--c-orange); border-bottom-color: var(--c-orange); }
.date-filter-label {
    display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600;
    color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.3px;
}
.date-filter-label .filter-input { margin-top: 0; }

.empty-row td { text-align: center; color: var(--ink-faint); padding: 30px 8px; }
.low-stock-flag { color: var(--c-amber); font-weight: 700; }
.out-stock-flag { color: var(--c-red); font-weight: 700; }

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .search-box { display: none; }
    .form-grid { grid-template-columns: 1fr; }

    /* ---------- Mobile off-canvas sidebar drawer ---------- */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px;
        max-width: 82vw;
        z-index: 300;
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0,0,0,0.3);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .dash-wrapper.sidebar-mobile-open .sidebar { transform: translateX(0); }
    .sidebar-close {
        display: flex;
        position: absolute;
        top: 14px;
        right: 14px;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 8px;
        background: rgba(255,255,255,0.08);
        color: #cbd5e1;
        font-size: 15px;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
    }
    .sidebar-close:hover { background: rgba(255,255,255,0.16); color: #fff; }
    .sidebar .brand-text,
    .sidebar .nav-section-label,
    .sidebar .nav-label,
    .sidebar .nav-chevron {
        display: initial;
    }
    .sidebar .nav-a-left { justify-content: flex-start; }

    .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
        z-index: 290; opacity: 0; pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .dash-wrapper.sidebar-mobile-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

    .topbar { padding: 12px 16px; }
    .avatar-name { display: none; }
    .content-inner { padding: 16px; }
}
