* { box-sizing: border-box; }

:root {
    --bg: #f7f9fc;
    --bg-2: #eef3fb;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #e2e8f0;
    --soft: #f8fafc;
    --accent: #2563eb;
    --accent-2: #06b6d4;
    --accent-dark: #1d4ed8;
    --sidebar: #0f172a;
    --sidebar-2: #111827;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #d97706;
    --purple: #7c3aed;
    --shadow: 0 24px 60px rgba(15, 23, 42, .08);
    --shadow-sm: 0 10px 24px rgba(15, 23, 42, .06);
    --radius: 22px;
}

html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-weight: 400;
    line-height: 1.5;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.11), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(6,182,212,.13), transparent 32rem),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 18px;
    overflow-y: auto;
    color: #e5edf8;
    background:
        linear-gradient(180deg, rgba(37,99,235,.14), rgba(15,23,42,0) 26%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 16px 0 50px rgba(15,23,42,.14);
    z-index: 50;
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
}

.brand-mark, .brand-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    letter-spacing: -.03em;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 16px 32px rgba(37,99,235,.28);
}
.brand-mark.has-logo {
    padding: 6px;
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(226,232,240,.9);
}
.brand-mark img, .brand-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 12px;
}

.brand-copy strong,
.brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -.03em;
}

.brand-copy span,
.brand span {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 12px;
}

.sidebar-profile {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr);
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    backdrop-filter: blur(14px);
}

.profile-avatar,
.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
}

.sidebar-profile strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.sidebar-profile span {
    display: block;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 5px;
}

.nav-label {
    margin: 15px 10px 6px;
    color: #718096;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 15px;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
    transition: .18s ease;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    transform: translateX(2px);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(6,182,212,.82));
    box-shadow: 0 16px 34px rgba(37,99,235,.28);
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.nav-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sidebar-logout {
    margin-top: auto;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
}

.sidebar-backdrop { display: none; }

.main-content {
    min-width: 0;
    padding: 26px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: -26px -26px 26px;
    padding: 22px 26px;
    background: rgba(247,249,252,.78);
    border-bottom: 1px solid rgba(226,232,240,.72);
    backdrop-filter: blur(18px);
}

.page-heading { min-width: 0; }
.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 11px;
    font-weight: 600;
}

h1, h2, h3 {
    margin-top: 0;
    color: var(--ink);
    letter-spacing: -.025em;
    font-weight: 700;
}
h1 { margin-bottom: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.08; }
h2 { margin-bottom: 8px; font-size: 22px; }
h3 { margin-bottom: 8px; font-size: 18px; }

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 auto;
}

.quick-search {
    max-width: 360px;
    width: min(34vw, 360px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    box-shadow: var(--shadow-sm);
}
.quick-search span { color: var(--muted); font-weight: 700; }
.quick-search input {
    border: 0;
    padding: 0;
    outline: 0;
    width: 100%;
    background: transparent;
    color: var(--ink);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 194px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.84);
    box-shadow: var(--shadow-sm);
}
.user-pill strong { display:block; max-width: 140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size: 13px; }
.user-pill small { display:block; margin-top: 1px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }

.icon-button {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.icon-button span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    border-radius: 99px;
    background: var(--ink);
}

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

.card {
    position: relative;
    padding: 22px;
    border: 1px solid rgba(226,232,240,.92);
    border-radius: var(--radius);
    background: rgba(255,255,255,.92);
    box-shadow: var(--shadow-sm);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.stat {
    overflow: hidden;
    min-height: 132px;
    display: grid;
    align-content: space-between;
    gap: 10px;
}
.stat::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -34px;
    width: 105px;
    height: 105px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(37,99,235,.13), transparent 70%);
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat strong { display:block; font-size: 36px; letter-spacing: -.06em; line-height: 1; }
.stat small { color: var(--muted-2); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: #dbeafe;
    font-weight: 700;
    font-size: 20px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 15px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 12px 24px rgba(37,99,235,.20);
    font-size: 14px;
    font-weight: 600;
    transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37,99,235,.26); }
.btn.secondary {
    background: #f1f5f9;
    color: var(--ink);
    box-shadow: none;
    border: 1px solid var(--line);
}
.btn.secondary:hover { background: #e2e8f0; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 12px 24px rgba(220,38,38,.2); }
.btn.success { background: linear-gradient(135deg, #22c55e, #16a34a); box-shadow: 0 12px 24px rgba(22,163,74,.2); }
.btn.small { min-height: 34px; padding: 7px 10px; border-radius: 11px; font-size: 12px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
th, td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #475569;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: .15s ease; }
tbody tr:hover td { background: #f8fbff; }
td small { color: var(--muted); line-height: 1.45; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid > label { align-self: start; }
label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border .16s ease, box-shadow .16s ease, background .16s ease;
}
select {
    height: 44px;
    min-height: 44px;
    align-self: start;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: rgba(37,99,235,.62);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}
input[type="file"] { padding: 9px; background: #f8fafc; }

.searchbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f8fafc;
}
.searchbar input, .searchbar select { width: auto; min-width: 240px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.badge-success { background: #dcfce7; color: var(--green); }
.badge-warning { background: #fef3c7; color: var(--yellow); }
.badge-danger { background: #fee2e2; color: var(--red); }
.badge-muted { background: #e2e8f0; color: var(--muted); }

.alert {
    border-radius: 16px;
    padding: 13px 15px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: #fff;
}
.alert.success { border-color: #bbf7d0; background: #f0fdf4; color: var(--green); }
.alert.error { border-color: #fecaca; background: #fef2f2; color: var(--red); }

.tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tabs a {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.8);
    color: var(--muted);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.tabs a.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: transparent;
    color: #fff;
}

.profile-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}
.profile-title h2 { margin: 0 0 6px; font-size: 26px; }
.profile-title p { margin: 0; color: var(--muted); }
.info-list { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.info-list div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
}
.info-list small { display:block; color: var(--muted); margin-bottom: 4px; }
.info-list strong { display:block; }

/* Login redesign */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 20% 15%, rgba(37,99,235,.25), transparent 22rem),
        radial-gradient(circle at 82% 80%, rgba(6,182,212,.23), transparent 24rem),
        #0f172a;
    color: #fff;
}
.login-shell {
    width: min(1060px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 32px;
    background: rgba(255,255,255,.08);
    box-shadow: 0 28px 100px rgba(0,0,0,.32);
    backdrop-filter: blur(18px);
}
.login-hero {
    position: relative;
    min-height: 610px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    background:
        linear-gradient(135deg, rgba(37,99,235,.84), rgba(6,182,212,.62)),
        linear-gradient(135deg, #1e293b, #0f172a);
}
.login-hero::after {
    content: "";
    position: absolute;
    inset: auto -120px -150px auto;
    width: 360px;
    height: 360px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}
.login-brand .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; border: 1px solid rgba(255,255,255,.2); }
.login-brand .brand-mark.has-logo { background: rgba(255,255,255,.96); border-color: rgba(255,255,255,.45); }
.login-brand strong { display:block; font-size: 20px; }
.login-brand span { color: rgba(255,255,255,.75); font-size: 12px; }
.login-copy { position: relative; z-index: 1; max-width: 560px; }
.login-copy h1 { color: #fff; font-size: clamp(34px, 5vw, 58px); line-height: .96; margin-bottom: 18px; }
.login-copy p { color: rgba(255,255,255,.83); font-size: 16px; line-height: 1.75; margin: 0; }
.login-chips { position: relative; z-index:1; display:flex; flex-wrap:wrap; gap:10px; }
.login-chips span { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.15); border:1px solid rgba(255,255,255,.18); font-size: 12px; font-weight: 600; }
.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 46px;
    background: rgba(255,255,255,.96);
    color: var(--ink);
}
.login-card h2 { font-size: 30px; margin-bottom: 6px; }
.login-card .note { margin-bottom: 22px; }
.login-card .grid { gap: 16px; }
.login-card .btn { width: 100%; min-height: 48px; }
.login-help {
    margin-top: 18px;
    padding: 14px;
    border-radius: 18px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

/* Employee 201 file preview/cards */
.record-summary .stat small { color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.file-card {
    display: grid;
    grid-template-rows: 160px auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.file-card-body { padding: 14px; display: grid; gap: 7px; }
.file-card-body span { color: var(--ink); font-size: 13px; font-weight: 600; word-break: break-word; }
.file-card-body small, .file-card-body p { color: var(--muted); margin: 0; font-size: 12px; line-height: 1.45; }
.file-preview {
    min-width: 64px;
    min-height: 58px;
    overflow: hidden;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: #f8fafc;
    color: var(--muted);
}
.file-card > .file-preview { border-radius: 0; border: 0; min-height: 160px; }
.file-preview img { width: 100%; height: 100%; object-fit: cover; display:block; }
.file-preview.image-preview { padding: 0; }
.pdf-preview span, .generic-preview span { font-weight: 700; font-size: 28px; color: var(--accent); }
.pdf-preview small, .generic-preview small { display:block; color: var(--muted); font-size: 12px; }
.file-preview.compact { min-height: 42px; min-width: 58px; display: inline-grid; padding: 6px; font-weight: 700; color: var(--accent); }
td .file-preview { width: 78px; height: 58px; display: inline-grid; vertical-align: middle; }
td .file-preview img { width: 78px; height: 58px; object-fit: cover; }
.record-list { display: grid; gap: 12px; }
.record-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 240px);
    gap: 14px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.record-main { display: grid; gap: 7px; }
.record-title { display:flex; justify-content:space-between; gap: 10px; flex-wrap:wrap; }
.record-main p { margin: 0; color: var(--muted); }
.record-main small { color: var(--muted); line-height: 1.45; display:block; }
.record-attachment { display: grid; gap: 8px; }
.record-attachment .file-preview { min-height: 150px; }
.existing-file { border: 1px solid var(--line); border-radius: 16px; padding: 12px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; background: var(--soft); }

/* Employee profile picture support */
.employee-cell { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.employee-profile-header { align-items: center; }
.employee-profile-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.employee-avatar {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: var(--accent);
    font-weight: 700;
    background: linear-gradient(135deg, #dbeafe, #cffafe);
    border: 1px solid #bfdbfe;
}
.employee-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.employee-avatar.small { width: 44px; height: 44px; border-radius: 15px; font-size: 13px; }
.employee-avatar.large { width: 76px; height: 76px; border-radius: 24px; font-size: 22px; }
.employee-avatar.xlarge { width: 96px; height: 96px; border-radius: 28px; font-size: 28px; }
.avatar-placeholder span { line-height: 1; }

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    gap: 18px;
    margin-bottom: 18px;
}
.hero-card {
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 85% 10%, rgba(255,255,255,.18), transparent 16rem),
        linear-gradient(135deg, #1d4ed8, #06b6d4);
}
.hero-card h2 { color: #fff; font-size: clamp(28px, 4vw, 42px); line-height: 1; margin-bottom: 12px; }
.hero-card p { color: rgba(255,255,255,.86); line-height: 1.65; max-width: 720px; }
.hero-card .btn.secondary { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.22); }
.quick-actions { display: grid; gap: 10px; }
.quick-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
    font-weight: 600;
}
.quick-action:hover { border-color: rgba(37,99,235,.45); background: #eff6ff; }
.quick-action span { color: var(--muted); font-size: 12px; font-weight: 500; }

.swal-modern { border-radius: 24px !important; }

@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-hero { grid-template-columns: 1fr; }
    .quick-search { display: none; }
}

@media (max-width: 980px) {
    .app-shell { display: block; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 320px);
        height: 100vh;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 40;
        display: none;
        background: rgba(15,23,42,.48);
        backdrop-filter: blur(3px);
    }
    .sidebar-open .sidebar-backdrop { display: block; }
    .main-content { padding: 18px; }
    .topbar {
        margin: -18px -18px 20px;
        padding: 16px 18px;
        align-items: center;
    }
    .icon-button { display: inline-grid; place-items:center; flex: 0 0 auto; }
    .topbar-actions { flex: 0 0 auto; }
    .user-pill { min-width: 0; }
    .user-pill div:last-child { display: none; }
    .grid-2, .grid-3, .grid-4, .form-grid, .info-list { grid-template-columns: 1fr; }
    .card-header { flex-direction: column; }
    .searchbar input, .searchbar select { width: 100%; min-width: 0; }
    .record-item { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { min-height: 360px; }
    .login-card { padding: 34px 24px; }
}

@media (max-width: 640px) {
    .login-page { padding: 14px; }
    .login-hero { padding: 26px; }
    .topbar { gap: 10px; }
    .eyebrow { font-size: 9px; }
    h1 { font-size: 23px; }
    .card { padding: 18px; border-radius: 20px; }
    th, td { padding: 12px 11px; }
    .actions .btn { width: 100%; }
    .employee-profile-left { align-items: flex-start; }
    .employee-avatar.xlarge { width: 76px; height: 76px; border-radius: 22px; }
}

/* Leave form attachments + separated memo monitoring */
.file-card-leave {
    border-color: rgba(37,99,235,.22);
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.memo-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.memo-summary-panel,
.memo-monitoring-section {
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.section-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.section-title-row h3 { margin-bottom: 4px; }
.memo-summary-list {
    display: grid;
    gap: 10px;
    max-height: 430px;
    overflow: auto;
    padding-right: 4px;
}
.memo-summary-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
    transition: .18s ease;
}
.memo-summary-item:hover {
    border-color: rgba(37,99,235,.35);
    background: #eff6ff;
    transform: translateY(-1px);
}
.memo-summary-name strong {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.memo-summary-name small,
.memo-summary-count small,
.memo-summary-meta span {
    color: var(--muted);
    font-size: 12px;
}
.memo-summary-count {
    min-width: 58px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
}
.memo-summary-count strong {
    display: block;
    font-size: 20px;
    line-height: 1;
    font-weight: 650;
    color: var(--accent);
}
.memo-summary-meta {
    display: grid;
    gap: 3px;
    min-width: 86px;
}
.memo-count-pill {
    display: inline-grid;
    min-width: 34px;
    height: 30px;
    place-items: center;
    padding: 0 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--accent);
    border: 1px solid #bfdbfe;
    font-weight: 650;
}

@media (max-width: 1100px) {
    .memo-summary-grid { grid-template-columns: 1fr; }
    .memo-summary-item { grid-template-columns: 44px minmax(0,1fr) auto; }
    .memo-summary-meta { grid-column: 2 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
}

@media (max-width: 720px) {
    .section-title-row { flex-direction: column; }
    .memo-summary-item { grid-template-columns: 44px minmax(0,1fr); }
    .memo-summary-count,
    .memo-summary-meta { grid-column: 2 / -1; text-align: left; }
    .memo-summary-count { justify-self: start; }
}

/* Better long-table handling, scoped filters, and searchable employee pickers */
.stacked-card { display: grid; gap: 18px; }
.section-block {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px;
    background: #fbfdff;
}
.separated-section + .separated-section { margin-top: 18px; }
.section-title-row.clean {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 14px;
}
.section-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f8fafc;
}
.section-toolbar.compact { padding: 10px; margin-bottom: 12px; }
.section-toolbar input,
.section-toolbar select {
    width: auto;
    min-width: 220px;
    background: #fff;
}
.section-toolbar .section-search { flex: 1 1 260px; min-width: 260px; }
.table-scroll {
    max-height: min(62vh, 620px);
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}
.table-wrap table { min-width: 880px; }
.table-wrap::-webkit-scrollbar,
.memo-summary-list::-webkit-scrollbar,
.employee-picker-list::-webkit-scrollbar { width: 10px; height: 10px; }
.table-wrap::-webkit-scrollbar-thumb,
.memo-summary-list::-webkit-scrollbar-thumb,
.employee-picker-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid #fff;
}
.table-wrap::-webkit-scrollbar-track,
.memo-summary-list::-webkit-scrollbar-track,
.employee-picker-list::-webkit-scrollbar-track { background: #f8fafc; }

.employee-picker-label { position: relative; align-content: start; }
.employee-picker-label { align-self: start; }
.form-grid > label:has(select) { align-self: start; }
.employee-picker {
    position: relative;
    display: grid;
    gap: 8px;
}
.employee-picker-selected {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 13px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    color: #334155;
    font-size: 13px;
}
.employee-picker-search { padding-left: 38px; }
.employee-picker::before {
    content: "⌕";
    position: absolute;
    left: 14px;
    top: 58px;
    z-index: 2;
    color: var(--muted);
    font-weight: 600;
}
.employee-picker-list {
    display: none;
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: 104px;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}
.employee-picker.is-open .employee-picker-list {
    display: grid;
}
.employee-picker-list::before {
    content: "Search results";
    display: block;
    padding: 2px 4px 6px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.employee-picker-list.is-empty::after {
    content: "No matching employee found.";
    display: block;
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: var(--muted);
    background: #f8fafc;
    font-size: 13px;
}
.employee-option {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 9px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    background: #fff;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: .16s ease;
}
.employee-option:hover,
.employee-option.is-selected {
    border-color: rgba(37,99,235,.36);
    background: #eff6ff;
}
.employee-option strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.employee-option small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.employee-option.is-hidden,
tbody tr.is-hidden,
.memo-summary-item.is-hidden { display: none !important; }
.filter-empty {
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    color: var(--muted);
    background: #f8fafc;
}
.empty-state { padding: 10px; }

@media (max-width: 720px) {
    .section-block { padding: 12px; border-radius: 18px; }
    .section-toolbar { align-items: stretch; }
    .section-toolbar input,
    .section-toolbar select,
    .section-toolbar .section-search { width: 100%; min-width: 0; }
    .table-scroll { max-height: 58vh; }
    .employee-picker-list { top: 104px; max-height: 230px; }
}

/* Apply vertical scrolling to every table area once records become long. */
.table-wrap {
    max-height: min(62vh, 620px);
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

/* Portal, notifications, IT, and leave authorization form additions */
.notification-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    color: var(--ink);
}
.notification-pill strong {
    min-width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #dbeafe;
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
}
.portal-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 90% 10%, rgba(255,255,255,.22), transparent 24rem),
        linear-gradient(135deg, #0f172a, #1d4ed8 56%, #06b6d4);
}
.portal-hero h2,
.portal-hero p { color: #fff; }
.portal-hero p { margin: 6px 0 0; color: rgba(255,255,255,.82); }
.portal-hero-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.portal-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 18px 0;
}
.portal-stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}
.portal-stat strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
    letter-spacing: -.04em;
}
.portal-stat small { color: var(--muted-2); }
.portal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 18px;
    margin-bottom: 18px;
}
.portal-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.paper-form-preview,
.paper-leave-panel {
    border: 1px solid #d8dee8;
    border-radius: 18px;
    background: #fff;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.72);
}
.paper-form-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    text-align: left;
}
.paper-form-logo.dark { justify-content: flex-start; }
.paper-form-logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
}
.paper-form-logo strong {
    display: block;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 20px;
    letter-spacing: .08em;
}
.paper-form-logo span {
    display: block;
    font-size: 11px;
    letter-spacing: .48em;
    color: var(--muted);
}
.paper-form-preview h4,
.paper-leave-panel h3 {
    text-align: center;
    margin: 10px 0 16px;
    font-size: 17px;
}
.paper-form-lines {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid #111827;
    margin-bottom: 14px;
}
.paper-form-lines span {
    padding: 8px 10px;
    border-bottom: 1px solid #111827;
    font-size: 13px;
}
.paper-form-lines span:nth-child(odd) { border-right: 1px solid #111827; }
.paper-form-lines span:nth-last-child(-n+2) { border-bottom: 0; }
.leave-paper-form {
    margin-top: 16px;
}
.notification-list,
.mobile-list {
    display: grid;
    gap: 10px;
}
.notification-item,
.mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}
.notification-item.unread {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.notification-item p,
.mobile-row p { margin: 4px 0 0; color: var(--muted); }
.notification-item small,
.mobile-row small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.mobile-row strong { display: block; font-weight: 600; }

@media (max-width: 1180px) {
    .portal-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-grid,
    .portal-grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .notification-pill { padding: 8px 10px; }
    .portal-hero,
    .portal-hero-main,
    .notification-item,
    .mobile-row {
        align-items: stretch;
        flex-direction: column;
    }
    .portal-stat-grid { grid-template-columns: 1fr; }
    .paper-form-lines { grid-template-columns: 1fr; }
    .paper-form-lines span,
    .paper-form-lines span:nth-child(odd) { border-right: 0; }
    .paper-form-lines span:nth-last-child(2) { border-bottom: 1px solid #111827; }
    .paper-form-logo { justify-content: flex-start; }
    .paper-form-logo strong { font-size: 16px; }
    .paper-form-logo span { letter-spacing: .22em; }
    .topbar-actions { width: 100%; }
}

/* Mobile app polish and notification fixes */
.notification-count-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
}
.admin-notification-list .notification-item { align-items: flex-start; }

@media (max-width: 760px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        background: linear-gradient(180deg, #eef5ff 0%, #f8fbff 42%, #ffffff 100%);
    }

    body {
        -webkit-text-size-adjust: 100%;
    }

    .app-shell {
        display: block;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .sidebar {
        width: min(86vw, 318px);
        max-width: 318px;
        padding: 16px 14px;
        border-radius: 0 28px 28px 0;
        box-shadow: 24px 0 70px rgba(15,23,42,.34);
    }

    .sidebar-brand { min-height: 44px; }
    .brand-mark,
    .brand-logo { width: 42px; height: 42px; border-radius: 15px; }
    .brand-copy strong { font-size: 16px; }
    .sidebar-profile { border-radius: 20px; }
    .nav-label { margin-top: 18px; }
    .nav-link { min-height: 48px; border-radius: 17px; font-size: 15px; }

    .main-content {
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        padding: 0 14px 24px;
        overflow-x: hidden;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        width: auto;
        min-height: 88px;
        display: grid;
        grid-template-columns: 46px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        margin: 0 -14px 18px;
        padding: 14px;
        border-bottom: 1px solid rgba(226,232,240,.75);
        border-radius: 0 0 26px 26px;
        background: rgba(248,251,255,.94);
        backdrop-filter: blur(18px);
        box-shadow: 0 12px 35px rgba(15,23,42,.07);
    }

    .icon-button {
        width: 46px;
        height: 46px;
        border-radius: 16px;
        box-shadow: 0 10px 24px rgba(15,23,42,.08);
    }

    .page-heading {
        min-width: 0;
        overflow: hidden;
    }

    .page-heading .eyebrow {
        display: none;
    }

    .page-heading h1 {
        margin: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        color: var(--ink);
        font-size: clamp(20px, 6vw, 26px);
        line-height: 1.05;
        letter-spacing: -.045em;
        word-break: normal;
    }

    .topbar-actions {
        width: auto !important;
        min-width: 0;
        flex: 0 0 auto;
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        align-items: center;
    }

    .quick-search {
        display: none !important;
    }

    .notification-pill {
        min-width: 54px;
        min-height: 42px;
        padding: 7px 8px;
        gap: 5px;
        border-radius: 999px;
        box-shadow: 0 10px 22px rgba(15,23,42,.08);
    }

    .notification-pill span {
        font-size: 16px;
        line-height: 1;
    }

    .notification-pill strong {
        min-width: 22px;
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .user-pill {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 4px;
        border-radius: 17px;
        justify-content: center;
        box-shadow: 0 10px 22px rgba(15,23,42,.08);
    }

    .user-avatar,
    .profile-avatar {
        width: 36px;
        height: 36px;
        border-radius: 14px;
        font-size: 16px;
    }

    .user-pill > div:last-child {
        display: none !important;
    }

    .card,
    .grid,
    .grid > *,
    .dashboard-hero,
    .dashboard-hero > *,
    .portal-grid,
    .portal-grid > *,
    .portal-stat-grid,
    .portal-stat-grid > *,
    .section-block,
    .stacked-card,
    .memo-monitoring-section,
    .paper-leave-panel,
    .paper-form-preview,
    .form-grid,
    .table-wrap {
        min-width: 0;
        max-width: 100%;
    }

    .card {
        width: 100%;
        padding: 18px;
        border-radius: 24px;
        box-shadow: 0 14px 34px rgba(15,23,42,.06);
    }

    .card:hover { box-shadow: 0 14px 34px rgba(15,23,42,.06); }

    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .card-header .actions,
    .actions {
        width: 100%;
    }

    .card-header .btn,
    .actions .btn {
        width: 100%;
    }

    .grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .portal-grid,
    .portal-grid.three,
    .portal-stat-grid,
    .dashboard-hero,
    .memo-summary-grid,
    .form-grid,
    .info-list {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px;
    }

    .portal-hero {
        flex-direction: column;
        align-items: stretch;
        border-radius: 26px;
        padding: 20px;
    }

    .portal-hero-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .portal-hero h2 {
        font-size: 27px;
        line-height: 1.02;
    }

    .portal-actions,
    .portal-actions .btn {
        width: 100%;
    }

    .portal-stat strong { font-size: 28px; }

    .employee-profile-left {
        width: 100%;
        align-items: center;
        gap: 12px;
    }

    .employee-avatar.xlarge {
        width: 78px;
        height: 78px;
        border-radius: 24px;
    }

    .profile-title h2 {
        font-size: 25px;
        line-height: 1.14;
    }

    .info-list div {
        border-radius: 18px;
        padding: 13px;
    }

    .section-toolbar,
    .searchbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
        border-radius: 20px;
    }

    .section-toolbar input,
    .section-toolbar select,
    .section-toolbar .section-search,
    .searchbar input,
    .searchbar select {
        width: 100%;
        min-width: 0;
    }

    input, select, textarea {
        min-height: 48px;
        border-radius: 16px;
        font-size: 15px;
    }

    select { height: 48px; }

    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 20px;
    }

    .table-wrap table {
        min-width: 640px;
        width: max-content;
    }

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

    th {
        font-size: 10px;
        letter-spacing: .07em;
    }

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

    .record-item,
    .mobile-row,
    .notification-item {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
        border-radius: 18px;
    }

    .notification-item .actions,
    .mobile-row .actions {
        width: 100%;
    }

    .notification-item .btn,
    .mobile-row .btn {
        width: 100%;
    }

    .paper-form-logo {
        justify-content: flex-start;
        gap: 10px;
    }

    .paper-form-logo strong {
        font-size: 15px;
        letter-spacing: .04em;
    }

    .paper-form-logo span {
        letter-spacing: .18em;
        font-size: 10px;
    }

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

    .paper-form-lines span,
    .paper-form-lines span:nth-child(odd) {
        border-right: 0;
    }

    .paper-form-lines span:nth-last-child(2) {
        border-bottom: 1px solid #111827;
    }

    .employee-picker-list {
        position: absolute;
        top: 104px;
        max-height: 245px;
    }

    .NotiflixNotify {
        max-width: calc(100vw - 24px) !important;
    }
}

@media (max-width: 420px) {
    .topbar {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        padding: 12px;
    }

    .icon-button { width: 44px; height: 44px; }
    .notification-pill { min-width: 50px; padding-inline: 7px; }
    .user-pill { width: 42px; min-width: 42px; height: 42px; }
    .user-avatar { width: 34px; height: 34px; }
    .page-heading h1 { font-size: clamp(19px, 6vw, 24px); }
    .card { padding: 16px; border-radius: 22px; }
    .table-wrap table { min-width: 560px; }
}

/* Email TFA / forgot password polish */
.password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.password-field input { min-width: 0; }
.password-toggle,
.link-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 12px;
}
.password-toggle {
    background: #eef5ff;
    border: 1px solid #dbeafe;
}
.password-toggle:hover,
.link-button:hover {
    background: #eff6ff;
}
.login-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}
.login-links a:hover { text-decoration: underline; }
.security-shell { max-width: 940px; }
.security-links { margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.otp-input {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: .24em;
}
.checkbox-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #f8fafc;
}
.checkbox-card input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--accent);
}
.checkbox-card span { display: grid; gap: 3px; }
.checkbox-card small { color: var(--muted); font-size: 12px; }
.alert.success {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}
@media (max-width: 640px) {
    .login-links { flex-direction: column; align-items: flex-start; }
    .security-links { align-items: center; }
    .password-field { grid-template-columns: 1fr; }
    .password-toggle { width: 100%; }
    .otp-input { font-size: 24px; }
}
