/* ==================== RECORDS / CALENDAR PAGE ==================== */
.cal-page { padding: 0; }
.cal-header { margin-bottom: 16px; }
.cal-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.cal-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0; }
.cal-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cal-view-sw { display: flex; gap: 2px; background: var(--dark-600); border-radius: 8px; padding: 3px; }
.cal-view-btn { display: flex; align-items: center; gap: 5px; padding: 6px 14px; border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.cal-view-btn.active { background: var(--dark-700); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.cal-view-btn:hover:not(.active) { color: var(--text-secondary); }
.cal-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; position: relative; z-index: 10; }
.cal-filters .filter-group { flex: 0 0 auto; position: relative; }
.cal-filters .emp-multi-select { min-width: 220px; }
/* Ensure team filter dropdown isn't clipped */
.cal-filters .team-filter-dropdown,
.cal-filters .tf-dropdown { position: absolute; z-index: 100; }

/* KPI Row */
.cal-kpi-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-kpi { display: flex; align-items: center; gap: 10px; background: var(--dark-700); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; flex: 1; min-width: 110px; }
.cal-kpi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-kpi-num { font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.cal-kpi-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 1px; }

/* Navigation */
.cal-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-nav-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--dark-700); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
.cal-nav-btn:hover { background: var(--dark-600); color: var(--text-primary); }
.cal-nav-title { font-size: 16px; font-weight: 700; color: var(--text-primary); min-width: 180px; text-align: center; }
.cal-nav-today { padding: 5px 14px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--accent, #818cf8); font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.cal-nav-today:hover { background: rgba(129,140,248,0.1); }

/* ===== GRID VIEW ===== */
.cal-grid { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--dark-800); }
.cal-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--dark-700); }
.cal-wday { padding: 10px 8px; text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); }
.cal-wday-fri { color: #ef4444; }
.cal-grid-body { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-cell {
    min-height: 110px; padding: 8px 10px;
    border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column; background: var(--dark-700); position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--dark-600); box-shadow: inset 0 0 0 1px rgba(129,140,248,0.2); z-index: 1; }
.cal-empty { background: var(--dark-800); cursor: default; min-height: 60px; }
.cal-empty:hover { background: var(--dark-800); box-shadow: none; }
.cal-today { background: rgba(129,140,248,0.06); }
.cal-today::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #818cf8; }
.cal-today .cal-day-num { background: #818cf8; color: #fff; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 11px; }
.cal-friday { background: rgba(239,68,68,0.02); }
.cal-friday .cal-day-num { color: #ef4444; }
.cal-friday::after { content: 'OFF'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 10px; font-weight: 700; color: rgba(239,68,68,0.15); letter-spacing: 2px; }
.cal-holiday { background: rgba(225,29,72,0.04); }
.cal-holiday::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #e11d48; }

.cal-cell-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.cal-day-num { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.cal-hol-badge { font-size: 8px; font-weight: 600; color: #e11d48; background: rgba(225,29,72,0.1); padding: 2px 6px; border-radius: 4px; white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.cal-att-pct { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: rgba(34,197,94,0.08); color: #22c55e; }

.cal-pills { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; align-content: flex-start; }
.cal-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; line-height: 1.5; display: inline-flex; align-items: center; gap: 3px; }
.cal-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.cal-p { background: rgba(34,197,94,0.10); color: #22c55e; } .cal-p::before { background: #22c55e; }
.cal-a { background: rgba(239,68,68,0.10); color: #ef4444; } .cal-a::before { background: #ef4444; }
.cal-s { background: rgba(245,158,11,0.10); color: #f59e0b; } .cal-s::before { background: #f59e0b; }
.cal-v { background: rgba(129,140,248,0.10); color: #818cf8; } .cal-v::before { background: #818cf8; }
.cal-o { background: rgba(6,182,212,0.10); color: #06b6d4; } .cal-o::before { background: #06b6d4; }

.cal-bar { height: 4px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; margin-top: auto; }
.cal-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; min-width: 2px; }

/* ===== LIST VIEW ===== */
.cal-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--dark-700); }
.cal-list-header { display: flex; border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 2; background: var(--dark-600); }
.cal-list-emp-head { min-width: 190px; max-width: 190px; padding: 10px 14px; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; border-right: 1px solid var(--border); }
.cal-list-days-head { display: grid; overflow-x: auto; }
.cal-list-hd { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--text-muted); padding: 8px 0; }
.cal-list-hd.cal-list-fri { color: #ef4444; background: rgba(239,68,68,0.03); }
.cal-list-hd.cal-list-hol { color: #e11d48; background: rgba(225,29,72,0.04); }
.cal-list-body { max-height: 550px; overflow-y: auto; overflow-x: hidden; }
.cal-list-row { display: flex; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.cal-list-row:hover { background: rgba(255,255,255,0.02); }
.cal-list-row:nth-child(even) { background: rgba(255,255,255,0.01); }
.cal-list-emp { min-width: 190px; max-width: 190px; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--border); position: sticky; left: 0; background: var(--dark-700); z-index: 1; }
.cal-list-row:nth-child(even) .cal-list-emp { background: rgba(255,255,255,0.01); }
.cal-list-row:hover .cal-list-emp { background: rgba(255,255,255,0.02); }
.cal-list-emp-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-list-emp-sub { font-size: 9px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.cal-list-days { display: grid; overflow-x: auto; }

.cal-list-cell { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; min-height: 34px; border-right: 1px solid rgba(255,255,255,0.02); }
.cal-list-fri { background: rgba(239,68,68,0.03); }
.cal-list-hol { background: rgba(225,29,72,0.04); }
.cal-list-present { color: #22c55e; background: rgba(34,197,94,0.06); }
.cal-list-absent { color: #ef4444; background: rgba(239,68,68,0.05); }
.cal-list-sick { color: #f59e0b; background: rgba(245,158,11,0.06); }
.cal-list-vac { color: #818cf8; background: rgba(129,140,248,0.06); }
.cal-list-ot { color: #06b6d4; background: rgba(6,182,212,0.06); }
.cal-list-comp { color: #10b981; background: rgba(16,185,129,0.06); }
.cal-list-ded { color: #ef4444; background: rgba(239,68,68,0.04); font-style: italic; }
.cal-list-sched { color: var(--text-muted); opacity: 0.15; }

/* Legend */
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 14px 0; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Day Detail Modal */
.cal-day-tab { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.cal-day-tab.active { background: var(--tab-color, #818cf8); color: #fff; border-color: transparent; }
.cal-day-tab:hover:not(.active) { background: rgba(255,255,255,0.04); color: var(--text-secondary); }
.cal-day-emp { padding: 10px 0; border-bottom: 1px solid var(--border); }
.cal-day-emp:last-child { border-bottom: none; }
.cal-day-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--dark-600), var(--dark-500, var(--dark-600))); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }

/* Responsive */
@media (max-width: 1100px) { .cal-cell { min-height: 90px; padding: 6px 7px; } .cal-pill { font-size: 9px; padding: 1px 5px; } .cal-att-pct { font-size: 9px; padding: 1px 4px; } }
@media (max-width: 800px) { .cal-kpi-row { gap: 6px; } .cal-kpi { padding: 8px 10px; min-width: 80px; } .cal-kpi-num { font-size: 14px; } .cal-cell { min-height: 70px; padding: 4px 5px; } .cal-pill { font-size: 8px; padding: 0 3px; } .cal-pill::before { display: none; } .cal-hol-badge { display: none; } }