:root {
    --color-bg: #0B0B0D;
    --color-surface: #17171B;
    --color-surface-alt: #1F1F24;
    --color-primary: #7A0C0C;
    --color-primary-dark: #3D0505;
    --color-accent: #D21F1F;
    --color-accent-dark: #A31616;
    --color-text: #ECECEC;
    --color-muted: #9C9CA3;
    --color-border: #2B2B30;
    --radius-card: 14px;
    --radius-control: 8px;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
}

h1, h2, h3, h4, h5, .brand {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    color: var(--color-text);
}

/* Sidebar */
#sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.flex-grow-1 {
    margin-left: 250px;
}

#sidebar-container {
    background: linear-gradient(180deg, var(--color-primary-dark), #000000) !important;
    border: none !important;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 14.5px;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-link.active {
    background-color: rgba(255,255,255,0.09);
    color: #fff;
    border-left-color: var(--color-accent);
    font-weight: 500;
}

.sidebar-brand {
    font-family: 'Sora', sans-serif;
    color: #fff;
    padding: 20px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Navbar */
#navbar-container .navbar {
    background-color: var(--color-surface) !important;
    border-bottom: 1px solid var(--color-border) !important;
}

.role-badge {
    background-color: var(--color-accent);
    color: #fff;
    font-weight: 500;
    text-transform: capitalize;
}

/* Cards & surfaces */
.surface-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 24px;
    color: var(--color-text);
}

/* Buttons */
.btn-accent {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius-control);
}

.btn-accent:hover {
    background-color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    color: #fff;
}

.btn, .form-control, .form-select {
    border-radius: var(--radius-control);
}

.btn-outline-secondary {
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline-secondary:hover {
    background-color: var(--color-surface-alt);
    color: #fff;
    border-color: var(--color-border);
}

.btn-outline-danger { color: #E24C4C; border-color: #6B1616; }
.btn-outline-danger:hover { background-color: #6B1616; color: #fff; }

.btn-outline-success { color: #3FBF5F; border-color: #1E5C2E; }
.btn-outline-success:hover { background-color: #1E5C2E; color: #fff; }

.btn-outline-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-outline-primary:hover { background-color: var(--color-accent); color: #fff; }

/* Form fields */
.form-control, .form-select {
    background-color: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}
.form-control:focus, .form-select:focus {
    background-color: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(210,31,31,0.25);
}
.form-control::placeholder { color: var(--color-muted); }
.form-label { color: var(--color-text); }

/* Table */
.table-institute {
    --bs-table-bg: transparent;
    --bs-table-color: var(--color-text);
    --bs-table-striped-bg: rgba(240, 231, 231, 0.02);
    --bs-table-hover-bg: rgba(247, 243, 243, 0.03);
    --bs-table-border-color: var(--color-border);
    color: var(--color-text);
}
.table-institute thead th {
    background-color: var(--color-surface-alt) !important;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted) !important;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
}
.table-institute tbody td {
    background-color: transparent !important;
    color: var(--color-text) !important;
    vertical-align: middle;
    font-size: 14.5px;
    border-color: var(--color-border);
}
.table-institute tbody tr:hover td { background-color: rgba(255,255,255,0.02) !important; }

.status-pill {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
}
.status-active { background-color: rgba(63,191,95,0.15); color: #3FBF5F; }
.status-inactive { background-color: rgba(226,76,76,0.15); color: #E24C4C; }

/* Modals */
.modal-content {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.modal-header, .modal-footer { border-color: var(--color-border); }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

a { color: var(--color-accent); }

/* Dropdown menus */
.dropdown-menu { background-color: var(--color-surface-alt); border-color: var(--color-border); }
.dropdown-item { color: var(--color-text); }
.dropdown-item:hover { background-color: var(--color-primary-dark); color: #fff; }


.form-control:disabled, .form-select:disabled {
    background-color: var(--color-surface-alt) !important;
    color: var(--color-muted) !important;
    opacity: 1;
    border-color: var(--color-border);
}


input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--color-surface-alt) inset !important;
    -webkit-text-fill-color: var(--color-text) !important;
    caret-color: var(--color-text) !important;
}
.surface-card.stat-card {
    border: 1px solid var(--color-border);
    border-top: 4px solid #D21F1F !important;
}
.dash-stat {
    padding: 12px 14px !important;
    border: 1.5px solid #D21F1F !important;
    background-color: var(--color-surface) !important;
}
.dash-stat .small {
    font-size: 12px !important;
}
.dash-stat .fs-4 {
    font-size: 19px !important;
    margin: 0 !important;
}

/* ===== Dashboard White Card Redesign ===== */
.stat-card-light {
    background-color: #ffffff;
    border: 1px solid #F0DEDE;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.stat-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.stat-card-light .stat-label {
    font-size: 12px;
    color: #6A6A70;
    font-weight: 600;
}
.stat-card-light .stat-value {
    font-size: 19px;
    font-weight: 700;
    color: #1A1A1E;
    margin-top: 2px;
}
.stat-card-light .stat-trend {
    font-size: 11px;
    color: #2E9E4F;
    font-weight: 600;
    margin-top: 6px;
}
.stat-card-light .stat-trend .muted-trend {
    color: #9A9AA0;
    font-weight: 500;
}

.chart-card-light, .list-card-light {
    background-color: #ffffff;
    border: 1px solid #F0DEDE;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chart-card-light h6, .list-card-light h6 {
    color: #1A1A1E !important;
    font-weight: 700;
    font-size: 14px;
    margin: 0;
}
.chart-card-header, .list-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.chart-card-header .title-group, .list-card-header .title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.title-icon-badge {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: #FBE7E7;
    color: #D21F1F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.period-pill {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: #8A8A93;
    font-weight: 600;
    cursor: pointer;
}
.period-pill.active {
    background: #D21F1F;
    color: #fff;
}
.view-all-link {
    font-size: 12px;
    color: #D21F1F !important;
    font-weight: 600;
    text-decoration: none;
}

.legend-light-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    color: #4A4A50;
    padding: 5px 0;
    gap: 16px;
}
.legend-light-item strong { color: #1A1A1E; }
.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}

.list-card-light .list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #F2EDED;
    color: #1A1A1E;
    font-size: 13px;
}
.list-card-light .list-row:last-child { border-bottom: none; }
.list-card-light .muted-light { color: #9A9AA0; font-size: 11.5px; }
.lead-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #FBE7E7;
    color: #D21F1F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.deadline-datebox {
    width: 40px;
    text-align: center;
    background: #FBE7E7;
    color: #D21F1F;
    border-radius: 8px;
    padding: 4px 0;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}
.deadline-datebox .dl-day { font-size: 14px; display:block; }
.pill-tag {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}
.stat-card-light {
    display: flex;
    align-items: center;
    gap: 12px;
}


/* ===== Profile Avatar ===== */
.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-border);
}
.navbar-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.avatar-upload-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    border: 2px dashed var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    font-size: 26px;
    margin: 0 auto;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}
.avatar-upload-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}
.avatar-upload-label {
    text-align: center;
    font-size: 13px;
    color: var(--color-muted);
    margin-top: 8px;
}

/* Fix table text visibility inside light dashboard cards */
.list-card-light .table-institute thead th {
    background-color: #F8F3F3 !important;
    color: #6A6A70 !important;
    border-bottom: 1px solid #F0DEDE;
}
.list-card-light .table-institute tbody td {
    color: #1A1A1E !important;
    border-color: #F2EDED;
}
.list-card-light .table-institute tbody tr:hover td {
    background-color: #FBF7F7 !important;
}
.list-card-light .status-pill.status-active {
    background-color: rgba(46,158,79,0.12);
    color: #2E9E4F;
}
.list-card-light .status-pill.status-inactive {
    background-color: rgba(210,31,31,0.12);
    color: #D21F1F;
}
.list-card-light .btn-outline-secondary {
    color: #4A4A50 !important;
    border-color: #D8D8DC !important;
    background-color: #ffffff !important;
}
.list-card-light .btn-outline-secondary:hover {
    background-color: #F5F0F0 !important;
    color: #1A1A1E !important;
}
/* ===== Scrollable sidebar ===== */
#sidebar-container {
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}
#sidebar-container::-webkit-scrollbar { width: 6px; }
#sidebar-container::-webkit-scrollbar-track { background: transparent; }
#sidebar-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); border-radius: 3px; }
#sidebar-container::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }
.sidebar-brand {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-primary-dark);
}

/* ===== Employee attendance status pills ===== */
.att-pills { display: inline-flex; gap: 6px; }
.att-pill {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    background: transparent;
    user-select: none;
    margin: 0;
}
.att-pill:hover { color: var(--color-text); }
.btn-check:checked + .att-present { background: rgba(46,158,79,0.18); border-color: #2E9E4F; color: #3DBE68; }
.btn-check:checked + .att-absent { background: rgba(210,31,31,0.18); border-color: #D21F1F; color: #F05252; }
.btn-check:checked + .att-leave { background: rgba(232,115,10,0.18); border-color: #E8730A; color: #F59A3C; }


.status-pill.status-leave {
    background-color: rgba(232, 115, 10, 0.15);
    color: #F59A3C;
}
