:root {
    --navy-950: #061525;
    --navy-900: #081b30;
    --navy-800: #0d2946;
    --navy-700: #153b60;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --slate-950: #0f172a;
    --slate-700: #334155;
    --slate-500: #64748b;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --surface: #ffffff;
    --background: #f3f6fa;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --shadow-lg: 0 28px 70px rgba(2, 15, 30, .18);
    --shadow-md: 0 15px 38px rgba(15, 23, 42, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--slate-950); }
a { color: inherit; }
button, input, select { font: inherit; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.eyebrow.dark { color: var(--blue-600); }

/* Login */
.login-page {
    min-height: 100vh;
    background: #eaf0f6;
    padding: 28px;
    display: grid;
    place-items: center;
}
.login-shell {
    width: min(1160px, 100%);
    min-height: min(720px, calc(100vh - 56px));
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    background: var(--surface);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.login-brand-panel {
    position: relative;
    overflow: hidden;
    padding: 58px;
    background:
        radial-gradient(circle at 75% 20%, rgba(59, 130, 246, .32), transparent 28%),
        radial-gradient(circle at 20% 88%, rgba(14, 165, 233, .18), transparent 32%),
        linear-gradient(145deg, var(--navy-950), var(--navy-800));
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.login-brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .14;
    background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 86%);
}
.brand-mark, .brand-copy, .login-feature-grid { position: relative; z-index: 2; }
.brand-mark img { width: 170px; max-height: 82px; object-fit: contain; object-position: left center; filter: drop-shadow(0 12px 24px rgba(0,0,0,.24)); }
.brand-copy { margin: auto 0; }
.brand-copy h1 { margin: 14px 0 12px; font-size: clamp(44px, 6vw, 72px); line-height: .98; letter-spacing: -.055em; }
.brand-copy p { margin: 0; color: #cbd5e1; font-size: 17px; line-height: 1.7; max-width: 420px; }
.login-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.login-feature-grid div { min-width: 0; padding: 17px; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: rgba(255,255,255,.065); backdrop-filter: blur(8px); }
.login-feature-grid span { color: #60a5fa; font-size: 10px; font-weight: 800; }
.login-feature-grid strong, .login-feature-grid small { display: block; }
.login-feature-grid strong { margin: 8px 0 5px; font-size: 13px; }
.login-feature-grid small { color: #94a3b8; font-size: 10px; line-height: 1.45; }
.brand-orbit { position: absolute; border: 1px solid rgba(96,165,250,.28); border-radius: 50%; z-index: 1; }
.orbit-one { width: 370px; height: 370px; right: -190px; top: 110px; }
.orbit-two { width: 250px; height: 250px; right: -110px; top: 170px; }
.login-form-panel { display: grid; place-items: center; padding: 52px; background: linear-gradient(145deg, #fff, #f8fafc); }
.login-card { width: min(410px, 100%); }
.mobile-logo { display: none; }
.login-card h2 { margin: 10px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.login-intro { margin: 0 0 28px; color: var(--slate-500); line-height: 1.6; }
.login-form { display: grid; gap: 19px; }
.login-form label > span, .field-label { display: block; margin-bottom: 8px; color: var(--slate-700); font-size: 12px; font-weight: 750; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .admin-select, .search-input {
    width: 100%;
    height: 52px;
    border: 1px solid var(--slate-200);
    border-radius: 13px;
    background: #fff;
    color: var(--slate-950);
    outline: 0;
    transition: border-color .18s, box-shadow .18s;
}
.input-wrap input { padding: 0 68px 0 52px; }
.input-wrap input:focus, .admin-select:focus, .search-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.input-icon { position: absolute; left: 15px; z-index: 1; min-width: 23px; color: var(--blue-600); font-size: 10px; font-weight: 900; letter-spacing: -.03em; }
.input-icon.lock { font-size: 12px; }
.password-toggle { position: absolute; right: 11px; border: 0; background: transparent; color: var(--blue-600); font-size: 11px; font-weight: 800; cursor: pointer; padding: 8px; }
.primary-button, .outline-button, .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 11px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.primary-button { min-height: 52px; padding: 0 18px; border: 0; color: #fff; background: linear-gradient(135deg, var(--blue-600), #1d4ed8); box-shadow: 0 11px 24px rgba(37,99,235,.24); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(37,99,235,.30); }
.primary-button.compact { min-height: 42px; }
.outline-button { min-height: 40px; padding: 0 15px; border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700); }
.outline-button:hover { border-color: #bfdbfe; color: var(--blue-600); background: #eff6ff; }
.icon-button { min-height: 38px; padding: 0 13px; border: 1px solid var(--slate-200); background: #fff; color: var(--slate-700); }
.secure-note { margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #94a3b8; font-size: 10px; }
.secure-note span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(22,163,74,.12); }
.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 11px; font-size: 12px; line-height: 1.5; }
.alert.danger { border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; }
.alert.warning { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; }
.alert.success { border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; }

/* Portal shell */
.portal-page { min-height: 100vh; background: var(--background); }
.portal-layout { min-height: 100vh; display: grid; grid-template-columns: 268px minmax(0, 1fr); }
.portal-sidebar { position: sticky; top: 0; height: 100vh; padding: 25px 18px 18px; background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); color: #fff; display: flex; flex-direction: column; z-index: 40; }
.portal-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 24px; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.1); }
.portal-brand img { width: 48px; height: 44px; object-fit: contain; }
.portal-brand strong, .portal-brand span { display: block; }
.portal-brand strong { font-size: 14px; }
.portal-brand span { margin-top: 3px; color: #94a3b8; font-size: 9px; }
.sidebar-nav { flex: 1; overflow: auto; padding: 22px 4px; }
.nav-caption { display: block; margin: 0 10px 9px; color: #64748b; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav-caption.admin-caption { margin-top: 24px; }
.sidebar-nav a { display: flex; align-items: center; gap: 11px; min-height: 43px; margin: 3px 0; padding: 8px 10px; border-radius: 10px; color: #cbd5e1; font-size: 11px; font-weight: 650; text-decoration: none; transition: .18s; }
.sidebar-nav a:hover, .sidebar-nav a.active { color: #fff; background: rgba(59,130,246,.16); }
.nav-symbol { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 26px; border-radius: 8px; background: rgba(255,255,255,.08); color: #93c5fd; font-size: 8px; font-weight: 900; }
.sidebar-profile { display: grid; grid-template-columns: 36px minmax(0, 1fr) 24px; gap: 10px; align-items: center; padding: 13px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.05); }
.profile-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #dbeafe; background: #1d4ed8; font-size: 12px; font-weight: 800; }
.sidebar-profile strong, .sidebar-profile span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-profile strong { font-size: 10px; }
.sidebar-profile span { margin-top: 4px; color: #94a3b8; font-size: 8px; }
.sidebar-profile > a { color: #94a3b8; text-decoration: none; font-size: 14px; }
.portal-main { min-width: 0; display: flex; flex-direction: column; }
.portal-topbar { position: sticky; top: 0; z-index: 30; height: 76px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e7edf4; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.topbar-title span, .topbar-title strong { display: block; }
.topbar-title span { color: var(--slate-500); font-size: 9px; }
.topbar-title strong { margin-top: 4px; font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.portal-content { width: min(1390px, 100%); margin: 0 auto; padding: 34px; }
.welcome-panel { position: relative; overflow: hidden; min-height: 190px; padding: 36px 40px; border-radius: var(--radius-xl); color: #fff; background: linear-gradient(125deg, var(--navy-900), #123b63); display: flex; align-items: center; justify-content: space-between; gap: 24px; box-shadow: var(--shadow-md); }
.welcome-panel::after { content: ""; position: absolute; width: 380px; height: 380px; right: -180px; top: -210px; border: 50px solid rgba(96,165,250,.11); border-radius: 50%; }
.welcome-panel > * { position: relative; z-index: 1; }
.welcome-panel h1 { margin: 10px 0 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.045em; }
.welcome-panel p { margin: 0; color: #cbd5e1; font-size: 13px; }
.access-summary { min-width: 205px; padding: 18px 20px; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; background: rgba(255,255,255,.07); display: flex; align-items: center; gap: 14px; }
.access-summary > span { font-size: 36px; font-weight: 800; color: #93c5fd; }
.access-summary strong, .access-summary small { display: block; }
.access-summary strong { font-size: 11px; }
.access-summary small { margin-top: 4px; color: #94a3b8; font-size: 9px; }
.section-heading { margin: 34px 2px 17px; display: flex; align-items: end; justify-content: space-between; }
.section-heading span { color: var(--blue-600); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.section-heading h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.025em; }
.module-count { color: var(--slate-500); font-size: 10px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card { position: relative; min-height: 235px; padding: 22px; border: 1px solid #e3eaf2; border-radius: var(--radius-lg); background: #fff; text-decoration: none; display: flex; flex-direction: column; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.module-card::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 0; background: var(--module-color); transition: height .25s; }
.module-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--module-color) 35%, #e3eaf2); box-shadow: 0 18px 38px rgba(15,23,42,.09); }
.module-card:hover::before { height: 100%; }
.module-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; color: var(--module-color); background: color-mix(in srgb, var(--module-color) 10%, #fff); font-size: 11px; font-weight: 900; }
.module-status { float: right; color: var(--slate-500); font-size: 8px; font-weight: 700; }
.module-status i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: #22c55e; }
.module-copy { margin-top: 17px; }
.module-copy h3 { margin: 14px 0 8px; font-size: 16px; letter-spacing: -.02em; }
.module-copy p { margin: 0; color: var(--slate-500); font-size: 10px; line-height: 1.65; }
.module-open { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--slate-100); color: var(--module-color); font-size: 10px; font-weight: 800; display: flex; justify-content: space-between; }
.portal-footer { margin-top: auto; padding: 22px 34px; color: #94a3b8; font-size: 9px; text-align: center; }
.empty-state { padding: 55px 24px; border: 1px dashed #cbd5e1; border-radius: var(--radius-lg); background: #fff; text-align: center; }
.empty-icon, .message-icon { width: 58px; height: 58px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 16px; font-size: 24px; font-weight: 900; }
.empty-icon, .message-icon.denied { color: #b91c1c; background: #fee2e2; }
.empty-state h2 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { max-width: 520px; margin: 0 auto 22px; color: var(--slate-500); font-size: 12px; line-height: 1.65; }
.sidebar-backdrop { display: none; }

/* Access admin */
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.admin-toolbar h1 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.04em; }
.admin-toolbar p { margin: 7px 0 0; color: var(--slate-500); font-size: 11px; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.admin-card { border: 1px solid #e2e8f0; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 8px 25px rgba(15,23,42,.045); }
.admin-card-head { padding: 21px 23px; border-bottom: 1px solid var(--slate-100); }
.admin-card-head h2 { margin: 0; font-size: 15px; }
.admin-card-head p { margin: 6px 0 0; color: var(--slate-500); font-size: 10px; }
.admin-card-body { padding: 22px 23px; }
.admin-select, .search-input { padding: 0 14px; }
.employee-summary { margin: 18px 0; padding: 16px; border-radius: 13px; background: #f8fafc; display: flex; align-items: center; gap: 12px; }
.employee-summary strong, .employee-summary span { display: block; }
.employee-summary strong { font-size: 12px; }
.employee-summary span { margin-top: 4px; color: var(--slate-500); font-size: 9px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-item { position: relative; min-height: 88px; padding: 14px 52px 14px 14px; border: 1px solid var(--slate-200); border-radius: 13px; cursor: pointer; transition: .18s; }
.permission-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.permission-item input { position: absolute; opacity: 0; }
.permission-item .toggle { position: absolute; right: 14px; top: 16px; width: 32px; height: 18px; border-radius: 999px; background: #cbd5e1; transition: .18s; }
.permission-item .toggle::after { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(15,23,42,.22); transition: .18s; }
.permission-item input:checked + .toggle { background: var(--blue-600); }
.permission-item input:checked + .toggle::after { transform: translateX(14px); }
.permission-item strong, .permission-item small { display: block; }
.permission-item strong { font-size: 11px; }
.permission-item small { margin-top: 6px; color: var(--slate-500); font-size: 8px; line-height: 1.5; }
.admin-permission { margin-top: 12px; border-color: #fde68a; background: #fffbeb; }
.admin-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }
.summary-list { display: grid; gap: 8px; max-height: 520px; overflow: auto; }
.summary-row { padding: 12px; border: 1px solid var(--slate-100); border-radius: 11px; display: flex; justify-content: space-between; gap: 10px; text-decoration: none; }
.summary-row:hover { border-color: #bfdbfe; background: #f8fbff; }
.summary-row strong, .summary-row span { display: block; }
.summary-row strong { font-size: 10px; }
.summary-row span { margin-top: 4px; color: var(--slate-500); font-size: 8px; }
.summary-count { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #eff6ff; color: var(--blue-600); font-size: 10px; font-weight: 900; }
.audit-table { width: 100%; border-collapse: collapse; }
.audit-table th, .audit-table td { padding: 11px 9px; border-bottom: 1px solid var(--slate-100); text-align: left; font-size: 9px; }
.audit-table th { color: var(--slate-500); font-size: 8px; text-transform: uppercase; letter-spacing: .05em; }
.badge { display: inline-flex; padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.badge.on { color: #166534; background: #dcfce7; }
.badge.off { color: #991b1b; background: #fee2e2; }

/* Generic message */
.message-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #dbeafe, transparent 35%), #f1f5f9; }
.message-card { width: min(540px, 100%); padding: 44px; border: 1px solid #e2e8f0; border-radius: 24px; background: #fff; box-shadow: var(--shadow-md); text-align: center; }
.message-card h1 { margin: 12px 0 10px; font-size: 27px; letter-spacing: -.04em; }
.message-card p { margin: 0; color: var(--slate-500); font-size: 12px; line-height: 1.75; }
.message-actions { margin-top: 24px; display: flex; justify-content: center; gap: 10px; }

@media (max-width: 1120px) {
    .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .login-page { padding: 0; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
    .login-brand-panel { display: none; }
    .login-form-panel { padding: 28px 20px; }
    .mobile-logo { display: block; margin-bottom: 30px; }
    .mobile-logo img { width: 145px; max-height: 70px; object-fit: contain; object-position: left; }
    .portal-layout { grid-template-columns: 1fr; }
    .portal-sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 268px; transition: transform .22s; }
    body.sidebar-open .portal-sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(2,10,20,.52); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .menu-toggle { display: block; }
    .portal-topbar { justify-content: flex-start; padding: 0 20px; }
    .topbar-actions { margin-left: auto; }
    .portal-content { padding: 24px 20px; }
}
@media (max-width: 640px) {
    .login-card h2 { font-size: 29px; }
    .welcome-panel { padding: 27px 24px; align-items: flex-start; flex-direction: column; }
    .access-summary { min-width: 0; width: 100%; }
    .module-grid, .permission-grid { grid-template-columns: 1fr; }
    .module-card { min-height: 215px; }
    .topbar-actions .outline-button { display: none; }
    .portal-content { padding: 18px 14px; }
    .portal-topbar { height: 66px; }
    .admin-toolbar { align-items: flex-start; flex-direction: column; }
    .message-card { padding: 32px 20px; }
    .message-actions { flex-direction: column; }
}

