/* DayOff — Leave Management Styles */
:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg: #f1f5f9;
    --card-bg: #fff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0d9488;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}
.sidebar-brand a {
    display: flex; align-items: center; gap: .6rem;
    padding: 1rem;
    text-decoration: none; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 1.05rem; font-weight: 800; color: #fff; }
.brand-sub { font-size: .62rem; font-weight: 600; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.sidebar-menu {
    list-style: none; padding: .5rem 0; flex: 1; overflow-y: auto;
}
.sidebar-menu .menu-label {
    padding: .5rem 1rem .2rem; font-size: .65rem; font-weight: 700;
    color: var(--text-muted); letter-spacing: 1.5px;
}
.sidebar-menu li a {
    display: flex; align-items: center; gap: .5rem;
    padding: .55rem 1rem; margin: 1px .5rem;
    color: var(--sidebar-text); text-decoration: none;
    border-radius: var(--radius-sm); font-size: .85rem;
    transition: background .15s;
}
.sidebar-menu li a:hover { background: rgba(255,255,255,.08); }
.sidebar-menu li.active a {
    background: var(--sidebar-active); color: #fff; font-weight: 600;
}
.menu-icon { font-size: .75rem; width: 18px; text-align: center; }
.menu-badge {
    background: var(--danger); color: #fff; font-size: .65rem;
    padding: 1px 6px; border-radius: 8px; margin-left: auto; font-weight: 700;
}
.sidebar-footer {
    padding: 1rem; border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { display: flex; flex-direction: column; }
.user-name { font-size: .82rem; font-weight: 600; color: #fff; }
.user-role { font-size: .7rem; color: var(--text-muted); }
.logout-link { font-size: .78rem; color: var(--text-muted); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* Main Content */
.main-content {
    margin-left: 240px; flex: 1; min-height: 100vh;
    display: flex; flex-direction: column;
}
.topbar {
    background: var(--card-bg); padding: .8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.3rem; cursor: pointer; }
.page-title { font-size: 1.1rem; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.content-body { padding: 1.5rem; flex: 1; }
.main-footer {
    padding: .8rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-size: .75rem; color: var(--text-muted);
}
.main-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Notification Bell */
.notif-bell { position: relative; cursor: pointer; }
.bell-icon { font-size: 1.2rem; }
.notif-count {
    position: absolute; top: -4px; right: -6px;
    background: var(--danger); color: #fff; font-size: .6rem;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.notif-dropdown {
    display: none; position: absolute; right: 0; top: 100%; margin-top: .5rem;
    width: 300px; background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow-md); z-index: 200; max-height: 400px; overflow-y: auto;
}
.notif-dropdown.show { display: block; }
.notif-item {
    padding: .7rem 1rem; border-bottom: 1px solid var(--border);
    font-size: .82rem; cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--border-light); }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-time { font-size: .7rem; color: var(--text-muted); margin-top: .2rem; }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: .85rem; }

/* Cards */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
    padding: .8rem 1rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: .92rem;
}
.card-body { padding: 1rem; }

/* Stats Grid */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 1.2rem; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-info { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

/* Balance Cards */
.balance-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .8rem; margin-bottom: 1.5rem;
}
.balance-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 1rem; box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.balance-type { font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .3rem; }
.balance-value { font-size: 1.3rem; font-weight: 800; }
.balance-detail { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; }
.balance-bar {
    height: 6px; background: var(--border-light); border-radius: 3px;
    overflow: hidden; margin-top: .5rem;
}
.balance-bar-fill {
    height: 100%; border-radius: 3px;
    background: var(--primary);
    transition: width .3s;
}

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border);
    font-size: .85rem;
}
.data-table th {
    font-weight: 600; color: var(--text-secondary);
    background: var(--border-light); position: sticky; top: 0;
}
.data-table tr:hover td { background: #f8fafc; }
.data-table td a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: 2px 10px; border-radius: 10px;
    font-size: .72rem; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 600; border: none;
    cursor: pointer; text-decoration: none;
    transition: background .15s, transform .1s;
    font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text-secondary); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-xs { padding: .2rem .5rem; font-size: .72rem; }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--border-light); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: .5rem .7rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .88rem;
    font-family: inherit; transition: border-color .15s;
    background: var(--card-bg); color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2rem; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.form-check {
    display: flex; align-items: center; gap: .4rem;
    font-size: .85rem; cursor: pointer;
}

/* Alerts */
.alert {
    padding: .7rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .88rem; font-weight: 500;
    animation: slideDown .3s;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: ''; position: absolute; left: .5rem; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.2rem; }
.timeline-dot {
    position: absolute; left: -1.2rem; top: .2rem;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--card-bg);
}
.timeline-dot.approved { background: var(--success); }
.timeline-dot.rejected { background: var(--danger); }
.timeline-dot.cancelled { background: var(--text-muted); }
.timeline-dot.pending { background: var(--warning); }
.timeline-time { font-size: .72rem; color: var(--text-muted); }
.timeline-action { font-size: .85rem; font-weight: 500; }
.timeline-detail { font-size: .78rem; color: var(--text-secondary); margin-top: .2rem; }

/* Calendar */
.calendar-wrapper { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.calendar-header {
    padding: 1rem; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.calendar-nav { display: flex; align-items: center; gap: .5rem; }
.calendar-nav button {
    background: var(--border-light); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .3rem .8rem; cursor: pointer; font-family: inherit; font-weight: 600;
    transition: background .15s;
}
.calendar-nav button:hover { background: var(--border); }
.calendar-month { font-size: 1.1rem; font-weight: 700; min-width: 200px; text-align: center; }
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
}
.calendar-day-header {
    padding: .5rem; text-align: center; font-size: .75rem;
    font-weight: 700; color: var(--text-muted); background: var(--border-light);
    border-bottom: 1px solid var(--border);
}
.calendar-day {
    min-height: 90px; padding: .3rem; border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border); position: relative;
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day.other-month { background: var(--border-light); }
.calendar-day.today { background: var(--primary-light); }
.calendar-day.holiday { background: #fef3c7; }
.calendar-day-num {
    font-size: .75rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: .2rem;
}
.calendar-day.today .calendar-day-num { color: var(--primary); font-weight: 800; }
.calendar-event {
    font-size: .65rem; padding: 1px 4px; border-radius: 3px;
    margin-bottom: 1px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; color: #fff; font-weight: 600;
    cursor: pointer;
}
.calendar-event:hover { opacity: .85; }
.holiday-label {
    font-size: .6rem; color: #92400e; font-weight: 600;
    font-style: italic;
}
.calendar-day.blackout { background: #fee2e2; }
.blackout-label {
    font-size: .6rem; color: #991b1b; font-weight: 600;
    font-style: italic;
}

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--card-bg); border-radius: var(--radius);
    width: 90%; max-width: 600px; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-header {
    padding: 1rem 1.2rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700;
}
.modal-close {
    background: none; border: none; font-size: 1.3rem;
    cursor: pointer; color: var(--text-muted);
}
.modal-body { padding: 1.2rem; }
.modal-footer {
    padding: .8rem 1.2rem; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: .5rem;
}

/* Login page */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}
.login-card {
    background: #fff; border-radius: var(--radius); padding: 2rem;
    width: 380px; box-shadow: var(--shadow-md);
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { font-size: 1.3rem; font-weight: 800; }
.login-brand p { font-size: .85rem; color: var(--text-muted); }

/* Filters bar */
.filters-bar {
    display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filters-bar select, .filters-bar input {
    padding: .4rem .6rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .82rem; font-family: inherit;
    background: var(--card-bg);
}

/* Who's out */
.out-today { display: flex; flex-wrap: wrap; gap: .5rem; }
.out-chip {
    display: flex; align-items: center; gap: .4rem;
    padding: .3rem .8rem; border-radius: 20px;
    font-size: .8rem; font-weight: 500;
    background: var(--border-light); border: 1px solid var(--border);
}
.out-chip-dot {
    width: 8px; height: 8px; border-radius: 50%;
}

/* Empty state */
.empty-state {
    text-align: center; padding: 3rem; color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* Detail view */
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: .8rem;
}
.detail-item { }
.detail-label { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.detail-value { font-size: .9rem; font-weight: 500; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: .5rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .balance-grid { grid-template-columns: repeat(2, 1fr); }
    .calendar-day { min-height: 60px; }
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Gantt Timeline */
.gantt-wrapper {
    background: var(--card-bg); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.gantt-header {
    padding: .8rem 1rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: .5rem;
}
.gantt-nav { display: flex; align-items: center; gap: .4rem; }
.gantt-month-title { font-size: 1.05rem; font-weight: 700; min-width: 180px; text-align: center; }
.gantt-legend { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.gantt-legend-item { display: flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--text-secondary); font-weight: 500; }
.gantt-legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

.gantt-scroll {
    overflow-x: auto; overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
.gantt-table {
    width: 100%; border-collapse: collapse;
    table-layout: fixed; min-width: 900px;
}
.gantt-table thead { position: sticky; top: 0; z-index: 2; }

.gantt-name-col {
    width: 170px; min-width: 170px; max-width: 170px;
    position: sticky; left: 0; z-index: 3;
    background: var(--border-light); padding: .5rem .6rem;
    font-size: .78rem; font-weight: 600; color: var(--text-secondary);
    border-bottom: 1px solid var(--border); border-right: 2px solid var(--border);
    text-align: left;
}
.gantt-name-cell {
    width: 170px; min-width: 170px; max-width: 170px;
    position: sticky; left: 0; z-index: 1;
    background: var(--card-bg); padding: .35rem .6rem;
    border-bottom: 1px solid var(--border); border-right: 2px solid var(--border);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-emp-name { font-size: .8rem; font-weight: 600; color: var(--text); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.gantt-emp-dept { font-size: .65rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }

.gantt-day-header {
    padding: .25rem .1rem; text-align: center;
    border-bottom: 1px solid var(--border); border-right: 1px solid var(--border-light);
    background: var(--border-light);
    font-size: .65rem; font-weight: 500; color: var(--text-muted);
    min-width: 32px;
}
.gantt-day-header .gantt-day-dow { display: block; font-size: .58rem; line-height: 1; }
.gantt-day-header .gantt-day-num { display: block; font-size: .72rem; font-weight: 700; color: var(--text-secondary); line-height: 1.3; }
.gantt-day-header.gantt-weekend { background: #f8f5f0; }
.gantt-day-header.gantt-weekend .gantt-day-num { color: var(--text-muted); }
.gantt-day-header.gantt-holiday { background: #fef3c7; }
.gantt-day-header.gantt-holiday .gantt-day-num { color: #92400e; }
.gantt-day-header.gantt-today { background: var(--primary-light); }
.gantt-day-header.gantt-today .gantt-day-num { color: var(--primary); font-weight: 800; }

.gantt-cell {
    position: relative;
    padding: 0; height: 38px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border-light);
    overflow: visible;
    min-width: 32px;
}
.gantt-cell.gantt-weekend { background: #faf8f5; }
.gantt-cell.gantt-holiday { background: #fffbeb; }
.gantt-cell.gantt-today { background: var(--primary-light); }

.gantt-bar {
    position: absolute;
    top: 5px; left: 1px;
    height: 26px;
    border-radius: 4px;
    z-index: 1;
    display: flex; align-items: center;
    padding: 0 4px;
    cursor: pointer;
    opacity: .88;
    transition: opacity .15s;
    white-space: nowrap; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.gantt-bar:hover { opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.gantt-bar-text {
    font-size: .6rem; font-weight: 600; color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,.2);
    overflow: hidden; text-overflow: ellipsis;
}

.gantt-table tbody tr:hover .gantt-name-cell { background: #f8fafc; }
.gantt-table tbody tr:hover .gantt-cell:not(.gantt-weekend):not(.gantt-holiday):not(.gantt-today) { background: #fcfcfd; }

@media (max-width: 768px) {
    .gantt-wrapper { display: none; }
}
