:root {
    --ink: #0f1c2e;
    --ink-soft: #3d4f66;
    --muted: #6b7c91;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-solid: #ffffff;
    --line: rgba(15, 28, 46, 0.08);
    --teal: #0d9488;
    --teal-dark: #0f766e;
    --teal-soft: #ccfbf1;
    --sky: #0284c7;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --rose: #e11d48;
    --rose-soft: #ffe4e6;
    --emerald: #059669;
    --emerald-soft: #d1fae5;
    --sidebar: #0b1626;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --radius: 14px;
    --shadow: 0 18px 40px rgba(15, 28, 46, 0.08);
    --font: "Figtree", system-ui, sans-serif;
    --display: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body.app-body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(13, 148, 136, 0.18), transparent 55%),
        radial-gradient(900px 500px at 100% 0%, rgba(2, 132, 199, 0.14), transparent 50%),
        linear-gradient(160deg, #edf3f7 0%, #e8eef4 45%, #f4f7fa 100%);
    background-attachment: fixed;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal); }

/* Shell */
.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #0b1626 0%, #122033 100%);
    color: #d6e0ec;
    padding: 1.4rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1040;
    transition: transform 0.28s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.4rem 0.55rem;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #14b8a6, #0284c7);
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}

.brand-name {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.1;
}

.brand-tag {
    font-size: 0.75rem;
    color: #8ea0b5;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #b7c5d6;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar .nav-link i { font-size: 1.05rem; opacity: 0.9; }

.sidebar .nav.nav-link:hover,
.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.22), rgba(20, 184, 166, 0.08));
    color: #5eead4;
    box-shadow: inset 3px 0 0 #14b8a6;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.45rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(20, 184, 166, 0.2);
    color: #5eead4;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.user-email {
    font-size: 0.82rem;
    color: #e8eef6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.user-role {
    font-size: 0.72rem;
    color: #8ea0b5;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn-logout {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: #d6e0ec;
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.main-area {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.6rem 2rem 0.5rem;
}

.page-title {
    margin: 0;
    font-family: var(--display);
    font-size: clamp(1.55rem, 2vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.content-area {
    padding: 1rem 2rem 2.5rem;
    animation: fadeUp 0.45s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Panels & forms */
.panel {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-body { padding: 1.35rem 1.4rem; }
.panel-header {
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.stat-tile {
    position: relative;
    padding: 1.2rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.stat-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 40px rgba(15, 28, 46, 0.12);
}

.stat-tile::after {
    content: "";
    position: absolute;
    inset: auto -20% -40% auto;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    opacity: 0.16;
}

.stat-tile.employees::after { background: var(--sky); }
.stat-tile.total::after { background: var(--teal); }
.stat-tile.pending::after { background: var(--amber); }
.stat-tile.approved::after { background: var(--emerald); }
.stat-tile.rejected::after { background: var(--rose); }

.stat-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.stat-value {
    margin-top: 0.35rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.stat-tile.employees .stat-icon { background: #e0f2fe; color: var(--sky); }
.stat-tile.total .stat-icon { background: var(--teal-soft); color: var(--teal-dark); }
.stat-tile.pending .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-tile.approved .stat-icon { background: var(--emerald-soft); color: var(--emerald); }
.stat-tile.rejected .stat-icon { background: var(--rose-soft); color: var(--rose); }

.btn-primary {
    --bs-btn-bg: var(--teal);
    --bs-btn-border-color: var(--teal);
    --bs-btn-hover-bg: var(--teal-dark);
    --bs-btn-hover-border-color: var(--teal-dark);
    --bs-btn-active-bg: var(--teal-dark);
    --bs-btn-active-border-color: var(--teal-dark);
    border-radius: 10px;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
}

.btn-outline-primary {
    --bs-btn-color: var(--teal-dark);
    --bs-btn-border-color: rgba(13, 148, 136, 0.35);
    --bs-btn-hover-bg: var(--teal);
    --bs-btn-hover-border-color: var(--teal);
    border-radius: 10px;
    font-weight: 600;
}

.btn-ghost {
    border: 1px solid var(--line);
    background: var(--surface-solid);
    border-radius: 10px;
    color: var(--ink);
}

.btn-success-soft {
    background: var(--emerald-soft);
    color: var(--emerald);
    border: none;
    border-radius: 10px;
    font-weight: 600;
}

.btn-success-soft:hover { background: #a7f3d0; color: #047857; }

.btn-danger-soft {
    background: var(--rose-soft);
    color: var(--rose);
    border: none;
    border-radius: 10px;
    font-weight: 600;
}

.btn-danger-soft:hover { background: #fecdd3; color: #be123c; }

.form-control, .form-select {
    border-radius: 10px;
    border-color: rgba(15, 28, 46, 0.12);
    padding: 0.65rem 0.85rem;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(13, 148, 136, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--ink-soft);
}

.table-modern {
    margin: 0;
    vertical-align: middle;
}

.table-modern thead th {
    background: #f7fafc;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    padding: 0.9rem 1rem;
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 0.95rem 1rem;
    border-color: var(--line);
}

.table-modern tbody tr {
    transition: background 0.15s ease;
}

.table-modern tbody tr:hover {
    background: rgba(13, 148, 136, 0.04);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-pending { background: var(--amber-soft); color: #b45309; }
.badge-approved { background: var(--emerald-soft); color: #047857; }
.badge-rejected { background: var(--rose-soft); color: #be123c; }

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.filter-pills a {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 28, 46, 0.04);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.filter-pills a.active,
.filter-pills a:hover {
    background: var(--teal-soft);
    color: var(--teal-dark);
    border-color: rgba(13, 148, 136, 0.2);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
}

.empty-state i {
    font-size: 2.4rem;
    color: var(--teal);
    opacity: 0.7;
}

.search-bar {
    max-width: 320px;
}

.alert-soft-success {
    background: var(--emerald-soft);
    color: #047857;
    border: none;
    border-radius: 12px;
}

.alert-soft-danger {
    background: var(--rose-soft);
    color: #be123c;
    border: none;
    border-radius: 12px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.meta-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.9rem 1rem;
}

.meta-item .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.meta-item .value {
    font-weight: 600;
    color: var(--ink);
}

/* Auth */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}

.auth-visual {
    position: relative;
    padding: 3rem;
    color: white;
    background:
        linear-gradient(145deg, rgba(11, 22, 38, 0.82), rgba(13, 148, 136, 0.55)),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(160deg, #0b1626, #0f766e);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.auth-visual::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(94, 234, 212, 0.28), transparent 65%);
    top: -80px;
    right: -60px;
    animation: pulseGlow 6s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.12); opacity: 1; }
}

.auth-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.auth-hero {
    position: relative;
    z-index: 1;
    max-width: 480px;
}

.auth-hero h1 {
    font-family: var(--display);
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 600;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.auth-hero p {
    font-size: 1.08rem;
    opacity: 0.88;
    max-width: 40ch;
}

.auth-form-wrap {
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(700px 400px at 90% 10%, rgba(13, 148, 136, 0.12), transparent 60%),
        #f5f8fb;
}

.auth-card {
    width: min(420px, 100%);
    background: white;
    border-radius: 18px;
    padding: 2rem;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    animation: fadeUp 0.5s ease both;
}

.demo-creds {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #f0fdfa;
    border: 1px dashed rgba(13, 148, 136, 0.35);
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.demo-creds strong { color: var(--teal-dark); }

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.access-denied {
    min-height: 70vh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem;
}

@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(280px, 86vw);
        transform: translateX(-105%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(11, 22, 38, 0.45);
        z-index: 1035;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
    .topbar, .content-area { padding-left: 1.15rem; padding-right: 1.15rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-visual { min-height: 280px; padding: 2rem; }
    .meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
