/* ===== CSS Variables & Reset ===== */
:root {
    --bg: #faf9f7;
    --bg-card: #ffffff;
    --bg-sidebar: #000001;
    --bg-muted: #f5f3f0;
    --text: #1a1110;
    --text-muted: #78716c;
    --text-sidebar: #faf9f7;
    --text-sidebar-muted: rgba(250, 249, 247, .6);
    --primary: #f4911a;
    --primary-hover: #e57f06;
    --accent: #e87ab1;
    --border: #e7e5e4;
    --border-sidebar: rgba(255, 255, 255, .1);
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -4px rgba(0, 0, 0, .06);
    --gradient: linear-gradient(135deg, #f4911a 0%, #e87ab1 100%);
    font-family: 'Hind', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Layout ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    border-right: 1px solid var(--border-sidebar);
    transition: transform .2s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border-sidebar);
}

.sidebar-header img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-header span {
    font-family: 'Lexend Deca', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-group-label {
    padding: 8px 16px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-sidebar-muted);
    font-weight: 600;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-sidebar-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: .875rem;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text-sidebar);
}

.sidebar-item.active {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-weight: 500;
}

.sidebar-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-item .badge-count {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    font-size: .7rem;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .6
    }
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-sidebar);
}

.sidebar-footer .user-info {
    margin-bottom: 10px;
}

.sidebar-footer .user-name {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-sidebar);
}

.sidebar-footer .user-role {
    font-size: .75rem;
    color: var(--text-sidebar-muted);
    text-transform: capitalize;
}

.sidebar-footer .logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-sidebar-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    padding: 0;
}

.sidebar-footer .logout-btn:hover {
    color: var(--text-sidebar);
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 16px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand img {
    height: 96px;
    width: auto;
    margin-bottom: 12px;
    display: block;
    margin-inline: auto;
}

.login-brand h1 {
    font-family: 'Lexend Deca', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: #581c87;
}

.login-brand p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-description {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-content {
    padding: 12px 24px 24px;
}

.card-glass {
    box-shadow: var(--shadow-lg);
    border: none;
}

.card-admin {
    border: 1px solid rgba(194, 65, 12, .2);
}

/* ===== Stat Cards ===== */
.stats-grid {
    display: grid;
    gap: 16px;
}

.stats-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stats-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.stats-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
}

.stat-label {
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-icon {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-sub {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
}

.btn-primary:hover {
    opacity: .9;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
}

.btn-icon {
    padding: 8px;
}

.btn-full {
    width: 100%;
}

.btn-approve {
    color: #059669;
    border-color: #059669;
}

.btn-approve:hover {
    background: #ecfdf5;
}

.btn-reject {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-reject:hover {
    background: #fef2f2;
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ===== Inputs ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: .8rem;
    font-weight: 500;
}

.form-label .required {
    color: #dc2626;
    font-weight: 700;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border .15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(194, 65, 12, .15);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.form-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-full {
    grid-column: 1 / -1;
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
}

.password-toggle:hover {
    color: var(--text);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

thead {
    background: var(--bg-muted);
}

th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: rgba(0, 0, 0, .015);
}

td.truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.font-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: .75rem;
}

.table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px !important;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge-amber {
    background: #fef3c7;
    color: #92400e;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.badge-purple {
    background: #f3e8ff;
    color: #6b21a8;
}

.badge-muted {
    background: var(--bg-muted);
    color: var(--text-muted);
}

/* ===== Tabs ===== */
.tabs-list {
    display: flex;
    gap: 4px;
    background: var(--bg-muted);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 16px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: calc(var(--radius) - 2px);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    transition: all .15s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Dialog/Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== Toast ===== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    animation: slideIn .3s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-weight: 600;
    font-size: .85rem;
}

.toast-desc {
    font-size: .78rem;
    color: var(--text-muted);
}

.toast-destructive {
    border-left: 4px solid #dc2626;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-family: 'Lexend Deca', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.page-title-syne {
    font-family: 'Lexend Deca', sans-serif;
}

.space-y>*+* {
    margin-top: 24px;
}

/* ===== Leave Balance Grid ===== */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.balance-item {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg-muted);
}

.balance-value {
    font-size: 1.8rem;
    font-weight: 700;
}

/* ===== Profile Card ===== */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(194, 65, 12, .1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    padding: 6px 0;
}

.profile-info-row .label {
    color: var(--text-muted);
}

.profile-info-row .value {
    font-weight: 500;
    text-transform: capitalize;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ===== Utility ===== */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.text-xs {
    font-size: .75rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.capitalize {
    text-transform: capitalize;
}

.font-medium {
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.italic {
    font-style: italic;
}

/* ===== SVG Icons (inline) ===== */
svg.icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== Responsive ===== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 60;
    background: var(--bg-sidebar);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 56px;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ===== Custom Cursor ===== */
/* Default cursor is kept visible as requested */

.cb-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    contain: layout style size;
    pointer-events: none;
    will-change: transform;
    transition: opacity 3s, color 0.4s;
    color: var(--primary);
}

.cb-cursor:before {
    content: "";
    position: absolute;
    top: -25px;
    left: -25px;
    width: 50px;
    height: 50px;
    transform: scale(0);
    background: currentColor;
    border-radius: 50%;
    transition: transform 0.3s ease-in-out, opacity 1s;
    opacity: 1 !important;
}

.cb-cursor-text {
    position: absolute;
    top: -50px;
    left: -50px;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0) rotate(10deg);
    opacity: 0;
    color: white;
    font-weight: 700;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0;
    transition: opacity 0.4s, transform 0.3s;
}

.cb-cursor.-visible:before {
    transform: scale(0.2);
}

.cb-cursor.-active:before {
    transform: scale(1.2);
    opacity: 0.1 !important;
    transition-duration: 0.2s;
}

/* Fallback for dot when hovering / Outline-like behavior on site */
.cb-cursor.-active:after {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    width: 10px;
    height: 10px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.5;
    transition: all 0.2s;
}

.cb-cursor.-text:before {
    opacity: 0.85 !important;
    transform: scale(1.7);
}

.cb-cursor.-text .cb-cursor-text {
    opacity: 1;
    transform: scale(1);
}

.cb-cursor.-hidden:before {
    transform: scale(0);
}

@media (max-width: 767.98px) {
    .cb-cursor {
        display: none !important;
    }
}