* {
    box-sizing: border-box;
}

:root {
    --ems-sidebar-width: 230px;
    --ems-sidebar-collapsed-width: 76px;
    --ems-content-padding-x: 16px;
    --ems-content-padding-y: 20px;
    --ems-nav-overlay-max: 1024px;
}

html {
    width: 100%;
}

body {
    margin: 0;
    width: 100%;
    min-width: 320px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: radial-gradient(circle at 20% 20%, #f8fbff 0%, #f3f6fb 45%, #eef3fa 100%);
    color: #1f2937;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, p {
    margin: 0;
}

.app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: var(--ems-sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #0b1224 48%, #070d1a 100%);
    color: #e5e7eb;
    padding: 16px 12px;
    height: 100vh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    transition: width 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06), 8px 0 28px rgba(2, 6, 23, 0.4);
    z-index: 90;
}

.sidebar-nav {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    margin-bottom: 8px;
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.sidebar-footer-nav {
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    padding-top: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    flex-shrink: 0;
}

.logo-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #2f3c52;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    padding: 3px;
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.logo-fallback {
    color: #dbeafe;
    font-size: 10px;
    font-weight: 700;
}

.brand-text {
    white-space: nowrap;
}

.sidebar-toggle {
    width: 100%;
    margin-bottom: 12px;
    border: 1px solid #334155;
    background: #1f2937;
    color: #cbd5e1;
    border-radius: 8px;
    padding: 6px 8px;
    text-align: left;
    font-size: 11px;
}

.sidebar-toggle:hover {
    background: #263449;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5e1;
    padding: 9px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    text-decoration: none;
    border: 1px solid transparent;
    width: 100%;
    box-sizing: border-box;
}

.nav-top-link {
    margin-bottom: 6px;
}

.nav-sub-link {
    padding-left: 12px;
    font-size: 11.5px;
}

.sidebar-group {
    margin-bottom: 4px;
}

.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
    padding: 9px 10px;
    border-radius: 10px;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-group-toggle:hover {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(129, 140, 248, 0.28);
}

.sidebar-group.is-open .sidebar-group-toggle {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.28), rgba(59, 130, 246, 0.1));
    border-color: rgba(129, 140, 248, 0.35);
    color: #ffffff;
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding-left: 8px;
    margin-left: 6px;
    border-left: 1px solid rgba(148, 163, 184, 0.2);
    transition: max-height 0.28s ease, opacity 0.22s ease, margin 0.22s ease, padding 0.22s ease;
}

.sidebar-group.is-open .sidebar-submenu {
    max-height: 320px;
    opacity: 1;
    padding-top: 4px;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.sidebar-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: transform 0.25s ease;
}

.sidebar-chevron svg {
    width: 14px;
    height: 14px;
}

.sidebar-group.is-open .sidebar-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.22), rgba(59, 130, 246, 0.12));
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #bfdbfe;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.nav-sub-link .nav-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 8px;
}

.nav-sub-link .nav-icon svg {
    width: 15px;
    height: 15px;
}

.nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-align: left;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.24), rgba(59, 130, 246, 0.1));
    color: #ffffff;
    text-decoration: none;
    border-color: rgba(129, 140, 248, 0.28);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.2);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon,
.sidebar-group-toggle:hover .nav-icon,
.sidebar-group.is-open .sidebar-group-toggle .nav-icon {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.45), rgba(59, 130, 246, 0.28));
    border-color: rgba(191, 219, 254, 0.35);
    color: #ffffff;
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #a5b4fc, #6366f1);
}

.nav-logout:hover {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.22), rgba(239, 68, 68, 0.08));
    border-color: rgba(248, 113, 113, 0.35);
}

.nav-logout .nav-icon {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.12));
    color: #fecaca;
}

.app-shell.sidebar-collapsed .sidebar {
    width: var(--ems-sidebar-collapsed-width);
    min-width: var(--ems-sidebar-collapsed-width);
    max-width: var(--ems-sidebar-collapsed-width);
    padding: 16px 8px;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .sidebar-toggle span,
.app-shell.sidebar-collapsed .nav-text,
.app-shell.sidebar-collapsed .sidebar-chevron {
    display: none;
}

.app-shell.sidebar-collapsed .brand {
    justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
    text-align: center;
    padding: 8px 0;
}

.app-shell.sidebar-collapsed .nav-link,
.app-shell.sidebar-collapsed .sidebar-group-toggle {
    justify-content: center;
    padding: 10px 8px;
}

.app-shell.sidebar-collapsed .sidebar-submenu {
    display: none !important;
    max-height: 0 !important;
    opacity: 0 !important;
}

.app-shell.sidebar-collapsed .sidebar-group.is-open .sidebar-submenu {
    display: none !important;
}

.app-shell.sidebar-collapsed .nav-icon {
    margin: 0;
}

.content {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
    padding: var(--ems-content-padding-y) var(--ems-content-padding-x) 28px;
    scroll-margin-top: 12px;
}

.app-shell .content > .topbar,
.app-shell .content > .topbar-subline,
.app-shell .content > .stats-grid,
.app-shell .content > .panel,
.app-shell .content > section.panel,
.app-shell .content > .profile-hero,
.app-shell .content > .profile-page-grid,
.app-shell .content > .settings-page {
    width: 100%;
    max-width: none;
}

.topbar {
    width: 100%;
    max-width: none;
    position: relative;
    z-index: 40;
    overflow: visible;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #dfe7f2;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.topbar h2 {
    font-size: 24px;
    letter-spacing: 0.2px;
}

.topbar p {
    color: #6b7280;
    margin-top: 4px;
}

.topbar-subtitle {
    color: #1e3a8a !important;
    font-weight: 700;
    font-size: 15px;
    margin-top: 6px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #dbe3f0;
    background: #f8fafc;
    color: #334155;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.topbar-toggle:hover {
    background: #eff6ff;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 41;
    overflow: visible;
}

.topbar-subline {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -8px;
    margin-bottom: 14px;
}

.topbar-spacer {
    width: 1px;
}

.profile-datetime {
    font-size: 14px;
    color: #64748b;
    background: linear-gradient(180deg, #f8fafc, #edf2f8);
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    padding: 6px 11px;
    letter-spacing: 0.2px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.datetime-icon {
    display: inline-flex;
    animation: pulse-tick 1.6s infinite;
}

@keyframes pulse-tick {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

.profile-menu {
    position: relative;
    z-index: 42;
    overflow: visible;
    flex-shrink: 0;
}

.profile-trigger {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #dbe3f0;
    color: #1f2937;
    border-radius: 999px;
    padding: 4px 10px 4px 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    max-width: min(220px, 42vw);
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
    border-color: #bfdbfe;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.28);
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.profile-avatar-lg {
    width: 42px;
    height: 42px;
    font-size: 15px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
    text-align: left;
}

.profile-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.02em;
}

.profile-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.profile-trigger[aria-expanded="true"] .profile-caret {
    transform: rotate(180deg);
    color: #2563eb;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 248px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    padding: 8px;
    display: none;
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.show {
    display: block;
}

.profile-dropdown-head {
    padding: 10px;
    margin-bottom: 6px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 55%, #ffffff 100%);
    border: 1px solid #dbeafe;
}

.profile-dropdown-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-dropdown-text {
    min-width: 0;
}

.profile-dropdown-text strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role-badge {
    display: inline-flex;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
}

.profile-dropdown-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}

.profile-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #475569;
    flex-shrink: 0;
}

.profile-dropdown a:hover {
    background: #f8fafc;
    text-decoration: none;
}

.profile-dropdown a:hover .profile-menu-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.profile-dropdown .danger-link {
    color: #b91c1c;
}

.profile-dropdown .danger-link .profile-menu-icon {
    background: #fee2e2;
    color: #b91c1c;
}

.profile-dropdown .danger-link:hover {
    background: #fef2f2;
}

.panel {
    width: 100%;
    max-width: none;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #dfe7f2;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.stats-grid {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stats-grid--triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(155deg, #ffffff 0%, #f4f7fc 52%, #e8edf6 100%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    padding: 12px 14px 10px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 28px -14px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.05);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: -35% -20% auto auto;
    width: 68%;
    height: 85%;
    border-radius: 50%;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), transparent 62%);
}

.stat-card > * {
    position: relative;
    z-index: 1;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 18px 36px -14px rgba(15, 23, 42, 0.18),
        0 4px 12px rgba(15, 23, 42, 0.08);
}

.stat-card-total {
    background: linear-gradient(145deg, #172554 0%, #1d4ed8 42%, #3b82f6 88%, #60a5fa 100%);
    border-color: rgba(147, 197, 253, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 14px 36px -12px rgba(29, 78, 216, 0.55),
        0 4px 14px rgba(23, 37, 84, 0.25);
}

.stat-card-total::before {
    background: radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.35), transparent 55%);
    opacity: 0.55;
}

.stat-card-total:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 20px 44px -12px rgba(29, 78, 216, 0.62),
        0 6px 18px rgba(23, 37, 84, 0.3);
}

.stat-card-total .stat-label,
.stat-card-total .stat-value {
    color: #f0f9ff;
}

.stat-card-total .stat-label {
    color: rgba(240, 249, 255, 0.88);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 600;
}

.stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.stat-head .stat-label {
    margin-bottom: 0;
}

.stat-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    line-height: 1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0;
    line-height: 1.3;
}

.stat-card-valid {
    background: linear-gradient(145deg, #064e3b 0%, #047857 40%, #059669 85%, #10b981 100%);
    border-color: rgba(110, 231, 183, 0.42);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 14px 36px -12px rgba(4, 120, 87, 0.5),
        0 4px 14px rgba(6, 78, 59, 0.28);
}

.stat-card-valid::before {
    background: radial-gradient(circle at 20% 15%, rgba(167, 243, 208, 0.45), transparent 58%);
    opacity: 0.5;
}

.stat-card-valid:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.16) inset,
        0 20px 44px -12px rgba(4, 120, 87, 0.55),
        0 6px 18px rgba(6, 78, 59, 0.32);
}

.stat-card-valid .stat-label,
.stat-card-valid .stat-value {
    color: #ecfdf5;
}

.stat-card-valid .stat-label {
    color: rgba(236, 253, 245, 0.9);
}

.stat-card-expiring {
    background: linear-gradient(145deg, #713f12 0%, #b45309 38%, #d97706 82%, #f59e0b 100%);
    border-color: rgba(253, 230, 138, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.14) inset,
        0 14px 36px -12px rgba(180, 83, 9, 0.48),
        0 4px 14px rgba(113, 63, 18, 0.28);
}

.stat-card-expiring::before {
    background: radial-gradient(circle at 22% 18%, rgba(254, 243, 199, 0.5), transparent 55%);
    opacity: 0.55;
}

.stat-card-expiring:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 20px 44px -12px rgba(180, 83, 9, 0.55),
        0 6px 18px rgba(113, 63, 18, 0.32);
}

.stat-card-expiring .stat-label,
.stat-card-expiring .stat-value {
    color: #fffbeb;
}

.stat-card-expiring .stat-label {
    color: rgba(255, 251, 235, 0.9);
}

.stat-card-expired {
    background: linear-gradient(145deg, #7f1d1d 0%, #b91c1c 40%, #dc2626 85%, #f87171 100%);
    border-color: rgba(252, 165, 165, 0.42);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 14px 36px -12px rgba(185, 28, 28, 0.48),
        0 4px 14px rgba(127, 29, 29, 0.28);
}

.stat-card-expired::before {
    background: radial-gradient(circle at 22% 18%, rgba(254, 226, 226, 0.45), transparent 55%);
    opacity: 0.5;
}

.stat-card-expired:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.16) inset,
        0 20px 44px -12px rgba(185, 28, 28, 0.55),
        0 6px 18px rgba(127, 29, 29, 0.32);
}

.stat-card-expired .stat-label,
.stat-card-expired .stat-value {
    color: #fef2f2;
}

.stat-card-expired .stat-label {
    color: rgba(254, 242, 242, 0.9);
}

.stat-card-total .stat-icon,
.stat-card-valid .stat-icon,
.stat-card-expiring .stat-icon,
.stat-card-expired .stat-icon {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.stat-card-missing {
    background: linear-gradient(145deg, #334155 0%, #475569 45%, #64748b 100%);
    border-color: rgba(203, 213, 225, 0.35);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 14px 32px -12px rgba(51, 65, 85, 0.45),
        0 4px 12px rgba(30, 41, 59, 0.2);
}

.stat-card-missing::before {
    background: radial-gradient(circle at 25% 20%, rgba(226, 232, 240, 0.25), transparent 58%);
    opacity: 0.45;
}

.stat-card-missing .stat-label,
.stat-card-missing .stat-value {
    color: #f1f5f9;
}

.stat-card-missing .stat-label {
    color: rgba(241, 245, 249, 0.88);
}

.stat-card-missing .stat-icon {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.table-toolbar {
    display: grid;
    grid-template-columns: 1fr 180px auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.visa-toolbar {
    grid-template-columns: 1fr minmax(140px, 200px) minmax(120px, 170px);
}

.visa-toolbar .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 2px;
}

.location-report-toolbar {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}

.location-report-toolbar > .toolbar-item:first-child {
    grid-column: span 2;
}

.location-report-toolbar .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 2px;
}

.report-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolbar-item label,
.go-to-form label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.toolbar-small select {
    margin-top: 0;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.toolbar-actions .btn,
.toolbar-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.table-wrap {
    width: 100%;
    max-width: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e5e7eb;
}

th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
    white-space: nowrap;
    font-size: 12px;
}

th {
    background: #f8fafc;
    color: #374151;
}

tr:hover td {
    background: #f1f7ff;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
}

label {
    display: block;
    font-size: 13px;
    color: #4b5563;
}

button,
.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    background: #2563eb;
    color: #ffffff;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover,
.btn:hover {
    background: #1d4ed8;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 14px rgba(37, 99, 235, 0.24);
}

.btn-primary-glow {
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

.btn-label-short {
    display: none;
}

@media (max-width: 768px) {
    .btn-topbar-compact .btn-label-full {
        display: none;
    }

    .btn-topbar-compact .btn-label-short {
        display: inline;
    }
}

.btn-secondary {
    background: #475569;
}

.btn-secondary:hover {
    background: #334155;
}

.btn-danger {
    background: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #d97706;
}

.btn-warning:hover {
    background: #b45309;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 7px;
}

.table-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.table-actions .btn {
    flex: 0 0 auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.table-actions .btn-sm {
    padding: 7px 11px;
    font-size: 12px;
}

th.col-actions,
td.col-actions {
    width: max-content;
    min-width: 300px;
    white-space: nowrap;
    vertical-align: middle;
}

th.col-email,
td.col-email,
th.col-mobile,
td.col-mobile {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.form-grid-full {
    grid-column: 1 / -1;
}

.leave-form-grid textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.status-pill-leave-pending { background: #fef3c7; color: #92400e; }
.status-pill-leave-approved { background: #dcfce7; color: #166534; }
.status-pill-leave-rejected { background: #fee2e2; color: #991b1b; }
.status-pill-leave-cancelled { background: #e5e7eb; color: #374151; }

.employee-autocomplete {
    position: relative;
}

.employee-autocomplete-input-wrap {
    position: relative;
}

.employee-autocomplete-input {
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
}

.employee-autocomplete-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.employee-autocomplete-input.is-searching {
    background-image: linear-gradient(90deg, #f8fafc 0%, #eef2ff 50%, #f8fafc 100%);
    background-size: 200% 100%;
    animation: employeeSearchPulse 0.9s ease-in-out infinite;
}

@keyframes employeeSearchPulse {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.employee-autocomplete-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 50;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.employee-autocomplete-option {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid #f1f5f9;
}

.employee-autocomplete-option:last-child {
    border-bottom: none;
}

.employee-autocomplete-option strong {
    font-size: 13px;
    color: #1e293b;
}

.employee-autocomplete-option span {
    font-size: 13px;
    color: #475569;
}

.employee-autocomplete-option small {
    font-size: 11px;
    color: #64748b;
}

.employee-autocomplete-option:hover,
.employee-autocomplete-option.is-active {
    background: #f5f3ff;
}

.employee-autocomplete-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: #64748b;
}

.employee-autocomplete-hint {
    margin: 6px 0 0;
    font-size: 12px;
}

.profile-page-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* —— My Profile page (premium) —— */
.profile-page-topbar {
    border: 1px solid rgba(219, 231, 255, 0.85);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 255, 0.96) 100%);
}

.profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 26px 28px;
    margin-bottom: 22px;
    border-radius: 16px;
    overflow: hidden;
    color: #f8fafc;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 38%, #2563eb 72%, #3b82f6 100%);
    border: 1px solid rgba(147, 197, 253, 0.35);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 20px 48px -16px rgba(30, 58, 138, 0.55);
}

.profile-hero::before {
    content: "";
    position: absolute;
    inset: -40% 35% auto -25%;
    height: 140%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, transparent 62%);
    pointer-events: none;
}

.profile-hero-avatar {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(8px);
}

.profile-hero-body {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.profile-hero-kicker {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(226, 232, 240, 0.85);
}

.profile-hero-name {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.profile-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 23, 42, 0.2);
}

.profile-pill--role {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.profile-pill--status-active {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(187, 247, 208, 0.45);
    color: #dcfce7;
}

.profile-pill--status-inactive {
    background: rgba(248, 113, 113, 0.22);
    border-color: rgba(254, 202, 202, 0.4);
    color: #fee2e2;
}

.profile-pill--muted {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(226, 232, 240, 0.95);
    font-weight: 600;
}

.profile-pill--warn {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(253, 230, 138, 0.45);
    color: #fef9c3;
    font-weight: 600;
}

.profile-card {
    position: relative;
    padding: 22px 22px 20px;
    border-radius: 14px;
    border: 1px solid rgba(219, 227, 239, 0.95);
    background: linear-gradient(165deg, #ffffff 0%, #f8faff 48%, #f1f5f9 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 14px 36px -18px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 20px 44px -18px rgba(15, 23, 42, 0.16),
        0 4px 12px rgba(15, 23, 42, 0.07);
}

.profile-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #60a5fa, #818cf8);
    opacity: 0.95;
}

.profile-card--security::before {
    background: linear-gradient(90deg, #0f766e, #14b8a6, #2dd4bf);
}

.profile-card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.profile-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #1d4ed8;
    background: linear-gradient(145deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.profile-card-icon--lock {
    font-size: 20px;
    background: linear-gradient(145deg, #ecfdf5, #d1fae5);
    border-color: #a7f3d0;
    color: #047857;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.12);
}

.profile-card-titles {
    min-width: 0;
}

.profile-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.profile-card-sub {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
}

.profile-page .profile-form label {
    font-weight: 600;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-page .profile-form input:not([readonly]) {
    margin-top: 8px;
    border: 1px solid #c7d7eb;
    border-radius: 10px;
    padding: 11px 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-page .profile-form input:not([readonly]):focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.profile-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
}

.profile-btn-security {
    background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
}

.profile-btn-security:hover {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.34);
}

.profile-note {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.profile-note strong {
    color: #1e293b;
}

.profile-form input[readonly] {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #475569;
    border-color: #e2e8f0;
}

.profile-flash {
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.profile-page .message.success.profile-flash {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #6ee7b7;
    color: #065f46;
}

.profile-page .message.error.profile-flash {
    background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #991b1b;
}

.message {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.success {
    background: #e7f7ec;
    color: #176a34;
    border: 1px solid #b8e7c8;
}

.error {
    background: #fdecec;
    color: #a21a1a;
    border: 1px solid #f7c9c9;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}

.status-valid {
    background: #dcfce7;
    color: #166534;
}

.status-expiring {
    background: #fef3c7;
    color: #92400e;
}

.status-expired {
    background: #fee2e2;
    color: #991b1b;
}

.status-missing {
    background: #e5e7eb;
    color: #374151;
}

.visa-date-valid {
    color: #166534;
    font-weight: 700;
}

.visa-date-expired {
    color: #b91c1c;
    font-weight: 700;
}

.visa-date-missing {
    color: #6b7280;
    font-weight: 600;
}

.visa-days-expired {
    color: #b91c1c;
    font-weight: 700;
}

.visa-days-warning {
    color: #b45309;
    font-weight: 700;
}

.visa-alert-panel h3 {
    margin: 0 0 8px;
}

.visa-alert-panel > .muted {
    font-size: 11px;
}

.visa-alert-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: 12px;
}

.visa-alert-cron {
    margin-top: 12px;
    margin-bottom: 0;
}

.visa-alert-cron code {
    font-size: 12px;
}

.mail-settings-panel {
    margin-bottom: 8px;
}

.mail-settings-form .mail-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.mail-settings-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mail-settings-form .form-field label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.mail-settings-form input[type="text"],
.mail-settings-form input[type="email"],
.mail-settings-form input[type="number"],
.mail-settings-form textarea {
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.mail-settings-form textarea {
    resize: vertical;
    min-height: 120px;
}

.mail-settings-subtitle {
    margin: 0 0 10px;
    font-size: 16px;
    color: #1e3a8a;
}

.mail-placeholder-hint code {
    margin-right: 6px;
    font-size: 11px;
}

.mail-schedule-panel {
    margin-top: 1rem;
}

.mail-schedule-heading {
    margin: 1rem 0 0.35rem;
    font-size: 0.95rem;
}

.mail-schedule-steps {
    margin: 0 0 1rem 1.1rem;
    padding: 0;
}

.mail-cron-code {
    display: block;
    overflow-x: auto;
    padding: 0.65rem 0.75rem;
    margin: 0.5rem 0 1rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
    font-size: 0.82rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.mail-settings-note {
    margin: 14px 0;
    font-size: 12px;
}

.form-field-check {
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .mail-settings-form .mail-settings-grid {
        grid-template-columns: 1fr;
    }
}

.login-body {
    margin: 0;
    overflow-x: hidden;
    width: 100%;
}

.login-split {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Left — gradient hero (violet / indigo palette) */
.login-hero.login-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    background: linear-gradient(152deg, #312e81 0%, #4c1d95 28%, #6d28d9 55%, #7c3aed 78%, #8b5cf6 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 20%, rgba(251, 191, 36, 0.15), transparent 40%),
        radial-gradient(circle at 10% 90%, rgba(99, 102, 241, 0.35), transparent 50%);
    pointer-events: none;
}

.login-hero-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    text-align: center;
}

.login-hero-visual {
    width: 100%;
    max-width: 420px;
    animation: loginHeroFloat 6s ease-in-out infinite;
}

.login-hero-visual img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 20px 40px rgba(15, 23, 42, 0.25));
}

@keyframes loginHeroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-hero-content {
    max-width: 420px;
}

.login-hero-content h1 {
    margin: 0 0 12px;
    font-size: clamp(20px, 2.2vw, 24px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.login-hero-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* Right — auth panel */
.login-auth.login-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: linear-gradient(180deg, #faf5ff 0%, #f5f3ff 50%, #ede9fe 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 32px 32px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(229, 231, 235, 0.9);
}

.login-box-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-box-logo {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(145deg, #7c3aed 0%, #6366f1 55%, #8b5cf6 100%);
    box-shadow: 0 6px 16px rgba(109, 40, 217, 0.4);
}

.login-box-header h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.login-box-sub {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

.login-error {
    margin-bottom: 16px;
}

.login-box-form .login-field {
    margin-bottom: 18px;
}

.login-box-form .login-field label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.login-box-form .login-field input {
    width: 100%;
    margin-top: 0;
    padding: 12px 14px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-box-form .login-field input::placeholder {
    color: #9ca3af;
}

.login-box-form .login-field input:hover {
    border-color: #d1d5db;
}

.login-box-form .login-field input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.22);
}

/* Password field + visibility toggle */
.login-password-wrap {
    position: relative;
    display: block;
}

.login-box-form .login-password-wrap input {
    width: 100%;
    padding-right: 52px;
    margin-top: 0;
}

.login-box-form button.login-eye-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    box-shadow: none;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease;
}

.login-box-form button.login-eye-toggle:hover,
.login-box-form button.login-eye-toggle:focus {
    transform: translateY(-50%);
    background: #f5f3ff;
    color: #6d28d9;
    box-shadow: none;
    outline: none;
}

.login-box-form button.login-eye-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.35);
}

.login-eye-icon {
    display: block;
    pointer-events: none;
}

.login-eye-hide {
    display: none;
}

.login-eye-toggle.is-visible .login-eye-show {
    display: none;
}

.login-eye-toggle.is-visible .login-eye-hide {
    display: block;
}

.login-btn-gradient {
    width: 100%;
    margin-top: 8px;
    padding: 13px 18px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(90deg, #6d28d9 0%, #7c3aed 45%, #6366f1 100%);
    box-shadow: 0 8px 22px rgba(109, 40, 217, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.login-box-form button.login-btn-gradient:hover,
.login-btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(109, 40, 217, 0.48);
    background: linear-gradient(90deg, #5b21b6 0%, #6d28d9 45%, #4f46e5 100%);
}

.login-btn-gradient:active,
.login-box-form button.login-btn-gradient:active {
    transform: translateY(0);
}

.login-btn-gradient.is-loading {
    opacity: 0.85;
    pointer-events: none;
}

.login-btn-outline {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb;
    box-shadow: none !important;
}

.login-btn-outline:hover {
    background: #e5e7eb !important;
    transform: translateY(-1px);
}

.login-session-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-session-actions .btn {
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    min-height: 44px;
    width: 100%;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .login-split {
        grid-template-columns: 1fr;
    }

    .login-hero.login-side {
        min-height: auto;
        padding: 36px 24px 28px;
    }

    .login-hero-visual {
        max-width: 320px;
    }

    .login-hero-inner {
        gap: 20px;
    }

    .login-auth.login-form {
        padding: 32px 20px 40px;
    }
}

@media (max-width: 480px) {
    .login-hero.login-side {
        min-height: 32vh;
        padding: 32px 20px;
    }

    .login-hero-content h1 {
        font-size: 20px;
    }

    .login-hero-content p {
        font-size: 13px;
    }

    .login-box {
        padding: 28px 22px 24px;
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
    }

    .login-box-header h2 {
        font-size: 20px;
    }

    .login-box-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .login-auth.login-form {
        padding: 24px 16px 32px;
    }

    .login-box-form .login-field input {
        font-size: 16px;
    }

    .login-submit-btn,
    .login-btn-gradient {
        width: 100%;
        min-height: 44px;
    }
}


.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 70px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #1f2937;
    border-radius: 8px;
    font-size: 12px;
    padding: 6px 10px;
}

.password-toggle:hover {
    background: #eff6ff;
}

.muted {
    color: #6b7280;
}

.spacer {
    height: 12px;
}

.pagination-wrap {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: #6b7280;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.go-to-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.go-to-form input[type="number"] {
    width: 90px;
    margin-top: 0;
}

.go-to-form button {
    padding: 8px 12px;
}

.page-link {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #1f2937;
    border-radius: 8px;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    text-decoration: none;
    font-size: 14px;
}

.page-link:hover {
    background: #eff6ff;
    text-decoration: none;
}

.page-link.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.page-link.disabled {
    color: #9ca3af;
    background: #f3f4f6;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

.page-ellipsis {
    color: #6b7280;
    padding: 0 4px;
    font-size: 14px;
}

.dashboard-footer {
    margin-top: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 255, 0.96));
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 12px 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
    flex-wrap: wrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
    position: fixed;
    left: 274px;
    right: 24px;
    bottom: 16px;
    z-index: 40;
}

.dashboard-footer a {
    color: #2563eb;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
}

.dashboard-footer a:hover {
    color: #1d4ed8;
    transform: translateY(-1px);
}

.footer-main {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-pill {
    border: 1px solid #dbe3ef;
    background: #f8fbff;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: #4b5563;
}

.footer-brand {
    border-color: #c7d9ff;
    color: #1e3a8a;
    background: #eef4ff;
    font-weight: 700;
}

.footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.app-shell.sidebar-collapsed .dashboard-footer {
    left: 108px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(2, 6, 23, 0.45);
    pointer-events: none;
}

.app-shell.sidebar-open .sidebar-backdrop {
    display: block;
    pointer-events: auto;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 1200px) {
    .content {
        padding: 16px 14px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

.settings-panel {
    position: relative;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-card {
    border: 1px solid #dbe3ef;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.10);
}

.settings-card h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.settings-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.settings-card-head h3 {
    margin: 0;
}

.settings-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #dbe3ef;
}

.settings-badge svg {
    width: 16px;
    height: 16px;
}

.settings-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 8px;
}

.settings-page .settings-topbar {
    border: 1px solid rgba(219, 227, 239, 0.92);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.95));
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 12px 28px rgba(15, 23, 42, 0.08);
}

.settings-panel-premium {
    border-radius: 16px;
    border-color: #d8e2f0;
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 18px 38px -20px rgba(15, 23, 42, 0.15),
        0 6px 16px rgba(15, 23, 42, 0.06);
}

.settings-main-title {
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.settings-lead {
    max-width: none;
    color: #64748b;
}

.settings-page .settings-grid {
    gap: 16px;
}

.settings-page .settings-card {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    border-color: #dbe6f3;
    background: linear-gradient(160deg, #ffffff 0%, #f9fbff 60%, #f2f6fd 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.92) inset,
        0 12px 30px -18px rgba(15, 23, 42, 0.16),
        0 2px 8px rgba(15, 23, 42, 0.05);
}

.settings-page .settings-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #60a5fa, #818cf8);
    opacity: 0.95;
}

.settings-page .settings-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 20px 40px -20px rgba(15, 23, 42, 0.2),
        0 6px 14px rgba(15, 23, 42, 0.08);
}

.settings-page .settings-card-head {
    margin-bottom: 8px;
}

.settings-page .settings-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: #1e40af;
    background: linear-gradient(145deg, #eff6ff, #dbeafe);
    border-color: #bfdbfe;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.settings-page .settings-card h3 {
    font-size: 18px;
    letter-spacing: -0.01em;
}

.settings-page .settings-actions {
    margin: 12px 0 10px;
}

.settings-page .settings-card input[type="file"] {
    border: 1px solid #d1deef;
    border-radius: 10px;
    background: #ffffff;
    padding: 8px 10px;
}

.settings-page .settings-card .btn {
    font-weight: 600;
}

@media (max-width: 1000px) {
    .table-toolbar {
        grid-template-columns: 1fr;
    }

    .visa-toolbar {
        grid-template-columns: 1fr;
    }

    .location-report-toolbar {
        grid-template-columns: 1fr;
    }

    .location-report-toolbar > .toolbar-item:first-child {
        grid-column: span 1;
    }

    .location-report-toolbar .toolbar-actions {
        justify-content: flex-start;
    }

    .toolbar-actions {
        justify-content: flex-start;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .profile-page-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-footer {
        left: 16px;
        right: 16px;
    }
}

@media (max-width: 640px) {
    .profile-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px 20px;
    }

    .profile-hero-name {
        font-size: 22px;
    }
}

@media (min-width: 1025px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--ems-sidebar-width);
        min-width: var(--ems-sidebar-width);
        max-width: var(--ems-sidebar-width);
    }

    .content {
        margin-left: var(--ems-sidebar-width);
        width: auto;
        min-width: 0;
        min-height: 100vh;
        box-sizing: border-box;
    }

    .app-shell.sidebar-collapsed .sidebar {
        width: var(--ems-sidebar-collapsed-width);
        min-width: var(--ems-sidebar-collapsed-width);
        max-width: var(--ems-sidebar-collapsed-width);
    }

    .app-shell.sidebar-collapsed .content {
        margin-left: var(--ems-sidebar-collapsed-width);
    }

    .sidebar-backdrop {
        display: none !important;
        pointer-events: none !important;
    }
}

@media (max-width: 1024px) {
    .app-shell {
        display: block;
        position: relative;
    }

    .sidebar {
        width: min(240px, 82vw);
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 80;
        border-radius: 0 12px 12px 0;
        padding: 16px 12px;
        transform: translateX(-106%);
        transition: transform 0.25s ease;
        overflow-y: auto;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
    }

    .app-shell.sidebar-open .sidebar-backdrop {
        display: block;
        pointer-events: auto;
    }

    .topbar-toggle {
        display: inline-flex;
    }

    .app-shell.sidebar-collapsed .sidebar {
        width: min(240px, 82vw);
        padding: 16px 12px;
    }

    .app-shell.sidebar-collapsed .brand {
        justify-content: flex-start;
    }

    .app-shell.sidebar-collapsed .brand-text,
    .app-shell.sidebar-collapsed .nav-text {
        display: none;
    }

    .app-shell.sidebar-open .brand-text,
    .app-shell.sidebar-open .nav-text {
        display: inline;
    }

    .app-shell.sidebar-open .nav-link,
    .app-shell.sidebar-open .sidebar-group-toggle {
        justify-content: flex-start;
    }

    .app-shell.sidebar-collapsed .nav-link,
    .app-shell.sidebar-collapsed .sidebar-group-toggle {
        justify-content: center;
        padding: 10px 8px;
    }

    .dashboard-footer {
        position: static;
        margin-top: 14px;
        left: auto;
        right: auto;
        bottom: auto;
    }

    .content {
        margin-left: 0;
        padding: 14px;
        padding-bottom: 16px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: min(260px, 86vw);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        align-items: flex-start;
    }

    .topbar-left > div {
        min-width: 0;
    }

    .topbar-left h2,
    .topbar-left p {
        overflow-wrap: normal;
        word-break: normal;
    }

    .topbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .topbar-actions .btn {
        flex: 0 0 auto;
        min-width: 0;
        text-align: center;
    }

    .profile-menu {
        width: auto;
        max-width: none;
    }

    .profile-trigger {
        width: auto;
        min-height: 38px;
        justify-content: flex-start;
    }

    .profile-trigger {
        max-width: min(200px, 52vw);
    }

    .profile-name {
        max-width: 96px;
    }

    .profile-dropdown {
        right: 0;
        left: auto;
        width: min(260px, calc(100vw - 24px));
        max-width: none;
        box-sizing: border-box;
    }

    .topbar-subline {
        margin-top: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .profile-datetime {
        max-width: 100%;
        font-size: 12px;
        flex-wrap: wrap;
    }

    .topbar-toggle {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .profile-page-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-page .topbar-actions {
        width: 100%;
    }

    .visa-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .visa-toolbar .toolbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .visa-toolbar .toolbar-actions .btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .user-rights-grid {
        grid-template-columns: 1fr;
    }
}

/* Compact premium topbar on phones */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 255, 0.96) 100%);
        border: 1px solid rgba(219, 227, 242, 0.92);
        box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        align-items: center;
        gap: 8px;
    }

    .topbar-left > div {
        min-width: 0;
    }

    .topbar-left p {
        display: none;
    }

    .topbar h2 {
        font-size: 16px;
        font-weight: 800;
        letter-spacing: -0.02em;
        line-height: 1.2;
    }

    .topbar-toggle {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        font-size: 14px;
        border-radius: 10px;
        border-color: rgba(203, 213, 225, 0.95);
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    }

    .topbar-actions {
        flex: 1 1 100%;
        width: 100%;
        gap: 8px;
        flex-wrap: nowrap;
        justify-content: flex-end;
        align-items: center;
    }

    .topbar-actions .btn,
    .topbar-actions .btn-secondary {
        flex: 0 0 auto;
        font-size: 12px;
        padding: 7px 10px;
        min-height: 34px;
    }

    .topbar-actions .btn-primary-glow {
        padding: 6px 11px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.02em;
        line-height: 1.2;
        min-height: 34px;
        border-radius: 999px;
        white-space: nowrap;
        background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
        border: 1px solid rgba(255, 255, 255, 0.22);
        box-shadow:
            0 4px 12px rgba(37, 99, 235, 0.28),
            inset 0 1px 0 rgba(255, 255, 255, 0.22);
    }

    .topbar-actions .btn-primary-glow:hover {
        box-shadow:
            0 6px 16px rgba(37, 99, 235, 0.32),
            inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }

    .profile-menu {
        flex: 0 1 auto;
        min-width: 0;
    }

    .profile-trigger {
        min-height: 36px;
        max-width: min(168px, 46vw);
        padding: 3px 8px 3px 3px;
        gap: 6px;
    }

    .profile-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .profile-name {
        display: block;
        max-width: 72px;
        font-size: 12px;
    }

    .profile-role {
        display: none;
    }

    .profile-caret {
        width: 14px;
        height: 14px;
    }

    .profile-dropdown {
        right: 0;
        left: auto;
        width: min(260px, calc(100vw - 20px));
        border-radius: 14px;
        padding: 8px;
    }

    .profile-page-topbar {
        flex-wrap: nowrap;
        align-items: center;
    }

    .profile-page .topbar-actions {
        width: auto;
    }
}

@media (max-width: 768px) {
    .stats-grid,
    .stats-grid.report-stats,
    .stats-grid.stats-grid--triple {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 8px 9px 7px;
        border-radius: 12px;
    }

    .stat-head {
        margin-bottom: 3px;
        gap: 4px;
        align-items: flex-start;
    }

    .stat-head .stat-label {
        font-size: 8px;
        letter-spacing: 0.04em;
        line-height: 1.2;
        word-break: break-word;
        hyphens: auto;
    }

    .stat-icon {
        width: 20px;
        height: 20px;
        min-width: 20px;
        font-size: 10px;
    }

    .stat-value {
        font-size: 17px;
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.02em;
    }

    .stat-card:hover {
        transform: translateY(-2px);
    }
}

@media (max-width: 640px) {
    .topbar-left {
        width: auto;
        flex: 1 1 auto;
    }

    .topbar-left > div {
        min-width: 0;
    }

    .topbar h2 {
        font-size: 15px;
    }

    .topbar-actions .btn-primary-glow {
        padding: 5px 9px;
        font-size: 10px;
        min-height: 30px;
    }

    .table-actions {
        flex-wrap: nowrap;
    }

    .pagination-wrap {
        align-items: flex-start;
    }

    .go-to-form {
        width: 100%;
    }

    .go-to-form input[type="number"] {
        width: 100%;
        max-width: 120px;
    }

    .footer-main,
    .footer-links {
        width: 100%;
    }
}

@media (min-width: 1024px) and (max-width: 1180px) {
    .content {
        padding: 18px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .panel {
        padding: 16px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 14px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .topbar {
        padding: 14px 16px;
    }

    .topbar h2 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 11px 12px 10px;
    }

    .stat-value {
        font-size: 15px;
    }

    .panel {
        padding: 16px;
    }
}

@media (min-width: 430px) and (max-width: 1024px) {
    .content {
        padding: 12px;
        padding-bottom: 14px;
    }

    .topbar {
        padding: 12px 12px;
        gap: 8px;
    }

    .panel {
        padding: 12px;
    }

    .section-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .table-wrap table {
        min-width: 760px;
    }

    th,
    td {
        padding: 8px;
        font-size: 11px;
    }

    .toolbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

}

@media (min-width: 390px) and (max-width: 429px) {
    .topbar h2 {
        font-size: 19px;
    }

    .topbar-toggle {
        width: 32px;
        height: 32px;
    }

    .panel {
        padding: 10px;
    }

    .table-wrap table {
        min-width: 720px;
    }

    .pagination .page-link {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

@media (max-width: 359px) {
    .content {
        padding: 10px;
    }

    .topbar {
        padding: 10px;
    }

    .topbar h2 {
        font-size: 18px;
    }

    .panel {
        padding: 10px;
    }

    .stat-value {
        font-size: 14px;
    }

    .table-wrap table {
        min-width: 680px;
    }

    input,
    select,
    button,
    .btn {
        font-size: 13px;
    }
}

.user-admin-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.user-profile-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.user-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.user-rights-form {
    display: grid;
    gap: 10px;
    min-width: 260px;
}

.user-rights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #334155;
}

.inline-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
}

.user-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-role-select {
    width: auto;
    min-width: 110px;
    margin-top: 0;
}

.password-reset-form input[type="password"],
.password-reset-form input[type="text"] {
    min-width: 160px;
    margin-top: 0;
}

.user-password-wrap input {
    padding-right: 62px;
}

@media (max-width: 860px) {
    .user-rights-grid {
        grid-template-columns: 1fr;
    }
}

/*
 * Footer overlap fix (employee table + pagination):
 * Below 769px the footer is already position:static in the max-width:768px block.
 * From 769px up, keep the footer in normal document flow so it never covers the table.
 */
@media (min-width: 769px) {
    .dashboard-footer {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 22px;
        width: 100%;
        max-width: none;
    }

    .app-shell.sidebar-collapsed .dashboard-footer {
        left: auto;
    }

    .content {
        padding-bottom: 32px;
    }
}

@media (min-width: 1280px) {
    :root {
        --ems-content-padding-x: 20px;
    }
}

@media (min-width: 1600px) {
    :root {
        --ems-content-padding-x: 24px;
        --ems-content-padding-y: 22px;
    }
}

/* --- Mobile & tablet responsive (v4) --- */
.content {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.topbar-titles {
    min-width: 0;
}

.topbar-titles h2,
.topbar-left h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
}

.page-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -6px 0 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #dfe7f2;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.btn-sm,
.page-action-bar .btn {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
    line-height: 1.25;
}

.btn-topbar-back {
    white-space: nowrap;
}

.visa-alert-panel {
    padding: 14px 16px;
}

.visa-alert-form .btn-warning,
.visa-alert-form .btn-danger {
    min-height: 40px;
}

@media (max-width: 1024px) {
    .topbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .topbar-left {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .topbar--compact .topbar-left {
        flex: 1 1 calc(100% - 52px);
    }

    .topbar-actions {
        flex: 1 1 auto;
        width: auto;
        max-width: 100%;
    }

    .topbar--compact .topbar-actions {
        flex: 0 0 auto;
        width: auto;
        margin-left: auto;
    }

    .page-action-bar .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
        text-align: center;
        justify-content: center;
    }

    .toolbar-actions {
        flex-wrap: wrap;
        width: 100%;
        overflow: visible;
    }

    .toolbar-actions .btn,
    .toolbar-actions button {
        flex: 1 1 calc(50% - 4px);
        min-width: 120px;
        white-space: normal;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .settings-page .settings-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-wrap: wrap;
    }

    .pagination-wrap {
        flex-wrap: wrap;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .topbar h2,
    .topbar-titles h2 {
        font-size: 17px;
        max-width: 100%;
    }

    .topbar-subtitle {
        font-size: 12px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-left > p:not(.topbar-subtitle) {
        display: none;
    }

    .page-action-bar {
        margin-top: 0;
        padding: 8px 10px;
        gap: 6px;
    }

    .page-action-bar .btn {
        flex: 1 1 calc(50% - 3px);
        min-width: 0;
        padding: 7px 8px;
        font-size: 11px;
        min-height: 34px;
    }

    .visa-alert-panel > .muted {
        font-size: 12px;
        line-height: 1.45;
    }

    .visa-alert-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .visa-alert-form .inline-check {
        width: 100%;
    }

    .visa-alert-form .btn {
        width: 100%;
        max-width: none;
        padding: 10px 12px;
        font-size: 13px;
        min-height: 40px;
    }

    .stats-grid.report-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .report-stats .stat-card {
        padding: 8px 6px 7px;
    }

    .report-stats .stat-label {
        font-size: 9px;
        letter-spacing: 0.02em;
        line-height: 1.2;
        hyphens: none;
        word-break: normal;
    }

    .report-stats .stat-value {
        font-size: 15px;
    }

    button,
    .btn {
        max-width: 100%;
    }

    .panel {
        padding: 12px;
    }

    .table-toolbar .toolbar-item {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid.report-stats {
        grid-template-columns: 1fr;
    }

    .report-stats .stat-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
    }

    .report-stats .stat-label {
        font-size: 11px;
        margin: 0;
    }

    .report-stats .stat-value {
        font-size: 18px;
    }

    .page-action-bar .btn {
        flex: 1 1 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid.report-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

