:root {
  --bg: #0e0f14;
  --bg2: #14151c;
  --bg3: #1c1e28;
  --bg4: #252838;
  --border: #2e3148;
  --border-light: #3a3e5c;
  --text: #e8eaf0;
  --text2: #9a9db8;
  --text3: #6b6e8a;
  --accent: #6c63ff;
  --accent2: #8b84ff;
  --accent-dim: rgba(108,99,255,0.15);
  --green: #3dd68c;
  --green-dim: rgba(61,214,140,0.12);
  --red: #ff5c7a;
  --red-dim: rgba(255,92,122,0.12);
  --yellow: #f5b944;
  --yellow-dim: rgba(245,185,68,0.12);
  --blue: #4db8ff;
  --blue-dim: rgba(77,184,255,0.12);
  --orange: #ff8c42;
  --pink: #ff6eb4;
  --teal: #3dd6c8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6);
  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
}

html[data-theme="light"] {
  --bg: #f4f5f7;
  --bg2: #ffffff;
  --bg3: #eef0f5;
  --bg4: #e4e6ef;
  --border: #d4d7e3;
  --border-light: #c0c4d6;
  --text: #1a1c2e;
  --text2: #4a4d6a;
  --text3: #8084a0;
  --accent: #5b54e8;
  --accent2: #6c63ff;
  --accent-dim: rgba(91,84,232,0.1);
  --green: #1fa864;
  --green-dim: rgba(31,168,100,0.1);
  --red: #e03355;
  --red-dim: rgba(224,51,85,0.1);
  --yellow: #d49a10;
  --yellow-dim: rgba(212,154,16,0.1);
  --blue: #1a8fd1;
  --blue-dim: rgba(26,143,209,0.1);
  --orange: #d4631a;
  --pink: #d44e96;
  --teal: #1aaba0;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14);
}

/* Theme toggle button */
#theme-toggle {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: none; border: none;
  color: var(--text3);
  font-family: var(--font); font-size: 12px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
#theme-toggle:hover { background: var(--bg3); color: var(--text); }
#theme-toggle .theme-icon { font-size: 15px; width: 20px; text-align: center; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ─── LAYOUT ─────────────────────────────────── */
#app { display: flex; height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────── */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.25s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.logo-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}
.logo-text span { color: var(--accent2); }

.sidebar-user {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.user-card:hover { background: var(--bg4); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.user-role { font-size: 11px; color: var(--text3); }
.user-switch { font-size: 10px; color: var(--text3); cursor: pointer; }

/* Calendar switcher */
.cal-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.cal-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3);
  margin-bottom: 8px; padding-left: 6px;
}
.cal-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}
.cal-item:hover { background: var(--bg3); }
.cal-item.active { background: var(--accent-dim); }
.cal-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.cal-label { font-size: 13px; flex: 1; }
.cal-badge {
  font-size: 10px; font-weight: 600;
  background: var(--accent-dim); color: var(--accent2);
  padding: 1px 6px; border-radius: 10px;
}

/* Nav */
.sidebar-nav {
  padding: 10px 10px;
  flex: 1;
  overflow-y: auto;
}
.nav-group-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3);
  padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 13px; font-weight: 400;
  transition: all 0.15s;
  margin-bottom: 1px;
  user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent2); font-weight: 500; }
.nav-item .nav-icon { font-size: 15px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  background: var(--red); color: #fff;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}

.sidebar-tz {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
}
.tz-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--bg3); border-radius: var(--radius-sm);
  cursor: pointer;
}
.tz-selector select {
  background: none; border: none; color: var(--text2);
  font-family: var(--font); font-size: 12px;
  cursor: pointer; outline: none; width: 100%;
}
.tz-selector select option { background: var(--bg3); }

/* ─── MAIN AREA ──────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex; align-items: center; gap: 16px;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 18px; font-weight: 600; letter-spacing: -0.3px;
  flex: 1;
}
.topbar-title span { color: var(--text3); font-weight: 400; font-size: 14px; margin-left: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(108,99,255,0.35); }
.btn-secondary { background: var(--bg4); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg3); border-color: var(--border-light); }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,92,122,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(61,214,140,0.2); }
.btn-success:hover { background: var(--green); color: #000; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* ─── PAGE CONTENT ────────────────────────────── */
.page { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.page.active { display: flex; }

/* ─── CALENDAR PAGE ───────────────────────────── */
#page-calendar {
  flex-direction: column;
}
.cal-toolbar {
  padding: 12px 24px;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cal-toolbar .fc-nav { display: flex; gap: 4px; }

#calendar-wrap {
  flex: 1;
  padding: 20px 24px;
  overflow: auto;
}

/* FullCalendar overrides */
.fc {
  --fc-border-color: var(--border);
  --fc-button-bg-color: var(--bg4);
  --fc-button-border-color: var(--border);
  --fc-button-hover-bg-color: var(--bg3);
  --fc-button-hover-border-color: var(--border-light);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  --fc-today-bg-color: rgba(108,99,255,0.08);
  --fc-page-bg-color: var(--bg2);
  --fc-neutral-bg-color: var(--bg3);
  --fc-list-event-hover-bg-color: var(--bg3);
  font-family: var(--font) !important;
  height: 100%;
}
.fc .fc-toolbar-title { font-size: 16px !important; font-weight: 600 !important; color: var(--text) !important; }
.fc .fc-button { font-family: var(--font) !important; font-size: 12px !important; font-weight: 500 !important; color: var(--text2) !important; border-radius: var(--radius-sm) !important; padding: 5px 12px !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active { background: var(--accent) !important; border-color: var(--accent) !important; color: #fff !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border) !important; }
.fc .fc-col-header-cell { background: var(--bg3) !important; }
.fc .fc-col-header-cell-cushion { color: var(--text2) !important; font-size: 12px !important; font-weight: 500 !important; padding: 8px 4px !important; text-decoration: none !important; }
.fc .fc-daygrid-day-number { color: var(--text2) !important; font-size: 12px !important; text-decoration: none !important; }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { color: var(--accent2) !important; font-weight: 700 !important; }
.fc .fc-event { border-radius: 4px !important; border: none !important; font-size: 11px !important; font-weight: 500 !important; cursor: pointer; }
.fc .fc-event-title { font-size: 11px !important; }
.fc .fc-timegrid-slot { height: 28px !important; }
.fc .fc-timegrid-slot-label { color: var(--text3) !important; font-size: 11px !important; }
.fc-scrollgrid { border-radius: var(--radius) !important; overflow: hidden; }
.fc .fc-list-event td { color: var(--text) !important; background: transparent !important; }
.fc .fc-list-day-cushion { background: var(--bg3) !important; color: var(--text2) !important; }
.fc .fc-list-event:hover td { background: var(--bg3) !important; }

/* ─── FILTER BAR ─────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.filter-chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text2);
  background: transparent;
  transition: all 0.15s;
  user-select: none;
}
.filter-chip:hover { border-color: var(--border-light); color: var(--text); }
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent2); }

/* ─── PANELS (right-side drawer) ─────────────── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 900;
  backdrop-filter: blur(2px);
}
.overlay.open { display: block; }

.drawer {
  position: fixed; top: 0; right: -520px;
  width: 500px; height: 100%;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 950;
  transition: right 0.28s cubic-bezier(0.16,1,0.3,1);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.drawer.open { right: 0; }
.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 600; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* Drawer tab bar */
.upd-tab {
  background: none; border: none; cursor: pointer;
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--text3); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.upd-tab:hover { color: var(--text1); }
.upd-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.upd-panel { flex: 1; overflow-y: auto; min-height: 0; }
.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── FORM ELEMENTS ──────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text2); margin-bottom: 6px; letter-spacing: 0.02em;
}
.form-label .required { color: var(--red); }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font); font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.form-help { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 36px; height: 20px;
  background: var(--bg4); border-radius: 10px;
  cursor: pointer; transition: background 0.2s;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle::after {
  content: ''; position: absolute;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  top: 2px; left: 2px;
  transition: left 0.2s;
}
.toggle.on::after { left: 18px; }
.toggle-label { font-size: 13px; color: var(--text2); }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-light);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.checkbox.checked { background: var(--accent); border-color: var(--accent); }
.checkbox.checked::after { content: '✓'; font-size: 10px; color: #fff; font-weight: 700; }

/* Color picker */
.color-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch {
  width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: all 0.15s;
}
.color-swatch.selected { border-color: #fff; transform: scale(1.15); }

/* Time block */
.time-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.time-block-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.time-block-title { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── STATUS BADGES ──────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-pending { background: var(--yellow-dim); color: var(--yellow); }
.badge-approved { background: var(--green-dim); color: var(--green); }
.badge-denied { background: var(--red-dim); color: var(--red); }
.badge-cancelled { background: var(--bg4); color: var(--text3); }
.badge-info { background: var(--blue-dim); color: var(--blue); }

/* ─── TABLE ──────────────────────────────────── */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg3);
  color: var(--text3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text2); vertical-align: middle; }
tbody td:first-child { color: var(--text); }

/* ─── APPROVALS PAGE ─────────────────────────── */
/* ─── APPROVALS TABLE ────────────────────────── */
.approvals-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.approvals-tbl thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.at-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; }
.at-row:last-child { border-bottom: none; }
.at-row:hover { background: var(--bg3); }
.at-row td { padding: 9px 12px; vertical-align: middle; }
.at-person { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.at-name { font-size: 13px; font-weight: 500; }
.at-sub { font-size: 11px; color: var(--text3); }
.at-type { white-space: nowrap; font-weight: 500; }
.at-type-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.at-dates { font-size: 12px; color: var(--text2); }
.at-note { font-size: 11px; color: var(--text3); font-style: italic; margin-top: 2px; }
.at-note.red { color: var(--red); font-style: normal; }
.at-days { font-size: 12px; color: var(--text3); white-space: nowrap; text-align: right; }
.at-recur { font-size: 11px; }
.at-status { white-space: nowrap; }
.at-actions { white-space: nowrap; text-align: right; }
.at-roles { white-space: nowrap; }
.at-since { font-size: 12px; color: var(--text3); white-space: nowrap; }
.at-leaves { font-size: 12px; color: var(--text3); text-align: right; white-space: nowrap; }

/* keep approval-card for My Requests page */
.approval-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.approval-card:hover { border-color: var(--border-light); }
.approval-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.approval-info { flex: 1; }
.approval-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.approval-meta { font-size: 12px; color: var(--text3); display: flex; gap: 12px; flex-wrap: wrap; }
.approval-meta span { display: flex; align-items: center; gap: 4px; }
.approval-note { font-size: 12px; color: var(--text3); font-style: italic; margin-bottom: 10px; }
.approval-actions { display: flex; gap: 8px; align-items: center; }
.denial-reason {
  flex: 1;
}

/* ─── REPORTS PAGE ───────────────────────────── */
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.metric-value {
  font-size: 28px; font-weight: 700; letter-spacing: -1px;
  line-height: 1; margin-bottom: 4px;
}
.metric-label { font-size: 12px; color: var(--text3); }
.metric-change { font-size: 11px; margin-top: 6px; }
.metric-change.up { color: var(--green); }
.metric-change.down { color: var(--red); }

.chart-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 20px;
}
.chart-title { font-size: 13px; font-weight: 600; margin-bottom: 16px; color: var(--text2); }

/* Simple bar chart */
.bar-chart { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%; border-radius: 4px 4px 0 0;
  transition: height 0.4s cubic-bezier(0.34,1.56,0.64,1);
  min-height: 2px;
  background: linear-gradient(to top, var(--accent), var(--accent2));
  position: relative; cursor: pointer;
}
.bar:hover::after {
  content: attr(data-val);
  position: absolute; bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg4); color: var(--text);
  font-size: 11px; padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}
.bar-label { font-size: 10px; color: var(--text3); }

/* Donut chart */
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut-chart {
  position: relative; width: 120px; height: 120px; flex-shrink: 0;
}
.donut-chart svg { transform: rotate(-90deg); }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-legend { flex: 1; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.donut-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─── MANAGE PAGES ───────────────────────────── */
.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.manage-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.manage-card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.manage-card-sub { font-size: 12px; color: var(--text3); margin-bottom: 16px; }

.leave-type-item, .user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg3); border-radius: var(--radius-sm);
  margin-bottom: 8px; border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.leave-type-item:hover, .user-item:hover { border-color: var(--border-light); }
.leave-type-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.leave-type-info { flex: 1; min-width: 0; }
.leave-type-name { font-size: 13px; font-weight: 500; }
.leave-type-meta { font-size: 11px; color: var(--text3); }
.leave-type-actions { display: flex; gap: 4px; }

.access-role-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
}
.role-admin { background: rgba(108,99,255,0.2); color: var(--accent2); }
.role-approver { background: rgba(245,185,68,0.15); color: var(--yellow); }
.role-viewer { background: var(--bg4); color: var(--text3); }
.role-member { background: rgba(61,214,140,0.12); color: var(--green); }

/* ─── EMPTY STATES ────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text3);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 14px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
.empty-state-sub { font-size: 12px; }

/* ─── TABS ───────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 3px;
}
.tab {
  padding: 6px 14px; border-radius: 5px;
  font-size: 12px; font-weight: 500; color: var(--text3);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.tab.active { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.tab:hover:not(.active) { color: var(--text2); }

/* ─── SEARCH ─────────────────────────────────── */
.search-wrap { position: relative; }
.search-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font); font-size: 13px;
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-sm);
  outline: none;
  width: 220px;
  transition: border-color 0.15s, width 0.2s;
}
.search-input:focus { border-color: var(--accent); width: 260px; }
.search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 14px; pointer-events: none;
}

/* ─── NOTIFICATION TOAST ─────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
@media (max-width: 768px) {
  #toast-container { bottom: 72px; right: 12px; left: 12px; }
  .toast { min-width: 0; max-width: 100%; }
}
.toast {
  background: var(--bg4); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  pointer-events: all;
  animation: slideUp 0.25s ease;
  min-width: 260px; max-width: 360px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ─── MODAL ──────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 480px; max-width: 95vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
.modal-sm { width: 380px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.modal-title { font-size: 15px; font-weight: 600; flex: 1; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ─── DIVIDER ────────────────────────────────── */
.divider {
  border: none; border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ─── SECTION HEADER ─────────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.section-title { font-size: 15px; font-weight: 600; flex: 1; }
.section-sub { font-size: 12px; color: var(--text3); }

/* Scrollable page body */
.page-body {
  flex: 1; overflow-y: auto; padding: 24px;
}

/* ─── RECURRING PREVIEW ──────────────────────── */
.recur-preview {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12px; color: var(--text2);
  margin-top: 8px;
}
.recur-preview strong { color: var(--text); }

/* ─── DELEGATION CARD ────────────────────────── */
.delegation-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.delegation-card .del-info { flex: 1; }
.delegation-card .del-name { font-size: 13px; font-weight: 500; }
.delegation-card .del-meta { font-size: 11px; color: var(--text3); }

/* ─── OUTLOOK INVITE TAG ─────────────────────── */
.outlook-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500;
  background: #0078d4; color: #fff;
}

/* ─── USER SWITCHER DROPDOWN ─────────────────── */
.user-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 200;
  margin-top: 4px;
}
.user-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  transition: background 0.12s;
}
.user-dropdown-item:hover { background: var(--bg4); }
.user-dropdown-item.current { color: var(--accent2); }

/* ─── PEOPLE FILTER POPOVER ──────────────────── */
.people-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 12px; font-weight: 500;
  color: var(--text2); cursor: pointer;
  transition: all 0.15s;
  position: relative;
  user-select: none;
}
.people-filter-btn:hover { background: var(--bg3); border-color: var(--border-light); color: var(--text); }
.people-filter-btn.has-filter { background: var(--accent-dim); border-color: var(--accent); color: var(--accent2); }
.people-filter-btn .pf-count {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
  min-width: 16px; text-align: center;
}

.people-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px); right: 0;
  width: 272px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  animation: popIn 0.15s ease;
}
.people-popover.open { display: block; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.popover-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.popover-title { font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: 0.04em; text-transform: uppercase; flex: 1; }
.popover-actions { display: flex; gap: 6px; }
.popover-action {
  font-size: 11px; color: var(--accent2); cursor: pointer;
  padding: 2px 6px; border-radius: 4px;
  transition: background 0.12s;
}
.popover-action:hover { background: var(--accent-dim); }

.people-list {
  max-height: 320px; overflow-y: auto;
  padding: 6px 8px;
}
.person-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.person-row:hover { background: var(--bg3); }
.person-row.hidden-user { opacity: 0.45; }

.person-check {
  width: 16px; height: 16px; flex-shrink: 0;
  border-radius: 4px;
  border: 1.5px solid var(--border-light);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  font-size: 10px; color: #fff; font-weight: 700;
}
.person-row:not(.hidden-user) .person-check {
  background: var(--accent); border-color: var(--accent);
}
.person-row:not(.hidden-user) .person-check::after { content: '✓'; }

.person-name { font-size: 13px; flex: 1; }
.person-cal-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.popover-footer {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text3);
  text-align: center;
}

/* wrapper needs relative for popover positioning */
#people-filter-wrap { position: relative; }
.bypass-banner {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(90deg, rgba(245,185,68,0.12), rgba(245,185,68,0.06));
  border: 1px solid rgba(245,185,68,0.28);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 12px; color: var(--yellow);
  margin-bottom: 14px;
}
.bypass-banner strong { font-weight: 600; }

.behalf-section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.behalf-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.behalf-title {
  font-size: 12px; font-weight: 600; color: var(--yellow);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.behalf-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 700;
  background: rgba(245,185,68,0.15); color: var(--yellow);
  border: 1px solid rgba(245,185,68,0.25);
}

.bypass-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 700;
  background: rgba(245,185,68,0.12); color: var(--yellow);
  border: 1px solid rgba(245,185,68,0.2);
}

.user-bypass-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: rgba(245,185,68,0.08);
  border: 1px solid rgba(245,185,68,0.18);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px; color: var(--yellow);
  transition: all 0.15s;
  white-space: nowrap;
}
.user-bypass-toggle:hover { background: rgba(245,185,68,0.15); }
.user-bypass-toggle.active { background: rgba(245,185,68,0.2); border-color: rgba(245,185,68,0.4); }

/* ─── ACCESS PAGE — USER CARDS ───────────────── */
.user-access-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
  cursor: pointer;
}
.user-access-card:hover { border-color: var(--border-light); }
.user-access-card.inactive { opacity: 0.65; }

.user-access-header { display: flex; align-items: center; gap: 12px; }
.user-access-info { flex: 1; min-width: 0; }
.user-access-name { font-size: 14px; font-weight: 600; }
.user-access-email { font-size: 11px; color: var(--text3); }
.user-access-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.period-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
  background: var(--green-dim); color: var(--green);
  border: 1px solid rgba(61,214,140,0.2);
}
.period-pill.ended {
  background: var(--bg4); color: var(--text3);
  border-color: var(--border);
}
.active-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(61,214,140,0.2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(61,214,140,0.2); }
  50%       { box-shadow: 0 0 0 5px rgba(61,214,140,0.05); }
}
.inactive-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text3); flex-shrink: 0;
}

/* ─── PERIOD TIMELINE IN DRAWER ──────────────── */
.period-timeline { position: relative; padding-left: 22px; }
.period-timeline::before {
  content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border); border-radius: 2px;
}
.period-entry {
  position: relative; margin-bottom: 18px;
}
.period-entry::before {
  content: ''; position: absolute; left: -18px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--bg2);
  box-shadow: 0 0 0 2px var(--green);
}
.period-entry.ended::before {
  background: var(--text3); box-shadow: 0 0 0 2px var(--text3);
}
.period-entry-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.period-range { font-size: 13px; font-weight: 500; }
.period-note  { font-size: 11px; color: var(--text3); font-style: italic; }
.period-cal-tag {
  font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 8px; background: var(--bg4); color: var(--text3);
}

.leave-impact-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12px; margin-bottom: 4px;
}
.leave-impact-row.stays      { background: var(--green-dim); color: var(--green); }
.leave-impact-row.deactivated { background: var(--red-dim);   color: var(--red);   }

.badge-deactivated { background: rgba(100,100,120,0.2); color: var(--text3); }

/* ─── LEAVE BALANCE ──────────────────────────── */
.balance-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 10px;
}
.balance-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.balance-type-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.balance-info { flex: 1; min-width: 0; }
.balance-label { font-size: 12px; font-weight: 500; }
.balance-numbers { font-size: 11px; color: var(--text3); }
.balance-bar-wrap {
  flex: 1; height: 6px; background: var(--bg4);
  border-radius: 3px; overflow: hidden; min-width: 80px;
}
.balance-bar {
  height: 100%; border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.balance-remaining {
  font-size: 12px; font-weight: 700; min-width: 36px; text-align: right;
}

/* In the leave request drawer — compact inline balance */
.drawer-balance-strip {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap;
}
.dbs-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text2);
  padding: 3px 8px; background: var(--bg4); border-radius: 10px;
}
.dbs-item.warning { color: var(--yellow); background: var(--yellow-dim); }
.dbs-item.danger  { color: var(--red);    background: var(--red-dim);    }

/* ─── BLACKOUT PERIOD ITEMS ──────────────────── */
.blackout-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(255,92,122,0.06);
  border: 1px solid rgba(255,92,122,0.18);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.blackout-item-info { flex: 1; }
.blackout-item-range { font-size: 13px; font-weight: 500; color: var(--red); }
.blackout-item-reason { font-size: 11px; color: var(--text3); margin-top: 2px; }
.blackout-cal-tag {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 8px; flex-shrink: 0;
}

/* Blackout warning in leave drawer */
.blackout-warning {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--red-dim); border: 1px solid rgba(255,92,122,0.3);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: var(--red); margin-bottom: 12px;
}

/* ─── COMMENT THREAD ──────────────────────────── */
.comment-bubble {
  display: flex; gap: 8px; margin-bottom: 10px;
}
.comment-bubble.mine { flex-direction: row-reverse; }
.comment-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff;
  flex-shrink: 0; align-self: flex-end;
}
.comment-body { max-width: 82%; }
.comment-text {
  background: var(--bg4); border-radius: 12px 12px 12px 2px;
  padding: 8px 11px; font-size: 13px; line-height: 1.4;
  color: var(--text);
}
.comment-bubble.mine .comment-text {
  background: var(--accent-dim); border-radius: 12px 12px 2px 12px;
  color: var(--accent2);
}
.comment-meta {
  font-size: 10px; color: var(--text3);
  margin-top: 3px; padding: 0 4px;
}
.comment-bubble.mine .comment-meta { text-align: right; }

/* ─── MY TEAM PAGE ───────────────────────────── */
.team-member-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px;
}
.team-member-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.team-member-balances { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 8px; }
.team-balance-tile {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 8px 10px; text-align: center;
}
.team-balance-tile .tbt-val { font-size: 18px; font-weight: 700; line-height: 1; }
.team-balance-tile .tbt-label { font-size: 10px; color: var(--text3); margin-top: 2px; }
.team-status-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
  background: var(--bg4); color: var(--text3);
}
.team-status-badge.out { background: var(--red-dim); color: var(--red); }
.team-status-badge.soon { background: var(--yellow-dim); color: var(--yellow); }

/* ─── EMAIL DIGEST PREVIEW ───────────────────── */
.digest-preview-wrap {
  background: #1a1b24; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.digest-email-chrome {
  background: var(--bg3); border-bottom: 1px solid var(--border);
  padding: 10px 16px; font-size: 11px; color: var(--text3);
  display: flex; gap: 16px;
}
.digest-body {
  padding: 24px; font-size: 13px; line-height: 1.6;
  max-height: 600px; overflow-y: auto;
}
.digest-header-band {
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; color: #fff;
}
.digest-section { margin-bottom: 20px; }
.digest-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3);
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
  margin-bottom: 10px;
}
.digest-leave-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  margin-bottom: 4px; background: var(--bg3);
}
.digest-alert-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  margin-bottom: 4px; background: var(--yellow-dim);
  color: var(--yellow); font-size: 12px;
}

/* ─── RESPONSIVE TWEAKS ──────────────────────── */
/* ══════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE SYSTEM
   Breakpoints: 480 (xs), 640 (sm), 768 (md), 1024 (lg)
   ══════════════════════════════════════════════ */

/* ─── MOBILE BOTTOM NAV ──────────────────────── */
#mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 300;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-nav-inner {
  display: flex; align-items: stretch;
  height: 100%; gap: 2px;
}
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  color: var(--text3);
  font-size: 10px; font-weight: 500;
  transition: all 0.15s;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item:active { background: var(--bg3); transform: scale(0.95); }
.mobile-nav-item.active { color: var(--accent2); }
.mobile-nav-item .mob-icon { font-size: 20px; line-height: 1; }
.mobile-nav-item .mob-badge {
  position: absolute; top: 5px; right: calc(50% - 14px);
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 8px; min-width: 14px; text-align: center;
}

/* ─── MOBILE HEADER ──────────────────────────── */
#mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  z-index: 300;
  padding: 0 12px;
  align-items: center; gap: 10px;
  padding-top: env(safe-area-inset-top, 0px);
}
.mob-hamburger {
  width: 40px; height: 40px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.mob-hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: all 0.2s;
}
.mob-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mob-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mob-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mob-logo { font-size: 16px; font-weight: 700; flex: 1; }
.mob-logo span { color: var(--accent2); }
.mob-actions { display: flex; gap: 6px; align-items: center; }

/* ─── MOBILE SIDEBAR OVERLAY ─────────────────── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 350; backdrop-filter: blur(2px);
}
#sidebar-overlay.open { display: block; }

/* ─── TABLET (≤ 1024px) ──────────────────────── */
@media (max-width: 1024px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .manage-grid { grid-template-columns: 1fr; }

  /* Drawer goes full width minus a safe strip */
  .drawer { width: 420px; right: -440px; }
}

/* ─── MOBILE (≤ 768px) ───────────────────────── */
@media (max-width: 768px) {
  /* Show mobile chrome, hide desktop chrome */
  #mobile-header { display: flex; }
  #mobile-nav { display: block; }
  .topbar { display: none; }

  /* Sidebar becomes a fixed slide-in panel */
  #sidebar {
    position: fixed; top: 0; left: -280px; bottom: 0;
    width: 280px; min-width: 0;
    z-index: 400;
    transition: left 0.28s cubic-bezier(0.16,1,0.3,1);
    padding-top: 56px; /* clear mobile header */
    overflow-y: auto;
  }
  #sidebar.open { left: 0; }

  /* Main shifts down for header, up for bottom nav */
  #main {
    padding-top: 56px;
    padding-bottom: 60px;
  }

  /* Drawer: full width on mobile */
  .drawer {
    width: 100%; right: -100%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    top: auto; bottom: -100%;
    height: 92dvh;
    transition: bottom 0.3s cubic-bezier(0.16,1,0.3,1);
  }
  .drawer.open { bottom: 0; right: 0; }

  /* Modals: full-width bottom sheet on mobile */
  .modal-overlay { align-items: flex-end; }
  .modal, .modal-sm {
    width: 100%; max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 90dvh;
    animation: sheetIn 0.25s ease;
  }
  @keyframes sheetIn {
    from { opacity: 1; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Calendar toolbar: stack filters + controls */
  .cal-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .filter-bar { order: 2; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter-bar::-webkit-scrollbar { display: none; }
  #people-filter-wrap { order: 1; margin-left: auto; }
  .cal-toolbar > div:last-child { order: 0; width: 100%; justify-content: flex-end; }

  /* Calendar wrap: tighter padding */
  #calendar-wrap { padding: 8px 8px; }

  /* Form rows: single column */
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 10px; }

  /* Page body: tighter padding */
  .page-body { padding: 14px; }

  /* Section header: wrap on small */
  .section-header { flex-wrap: wrap; gap: 8px; }
  .section-header .tabs { order: 3; width: 100%; }

  /* Approvals / Access tables: hide less-important columns on mobile */
  .approvals-tbl thead th:nth-child(3),
  .approvals-tbl thead th:nth-child(4) { display: none; }
  .at-row td:nth-child(3),
  .at-row td:nth-child(4) { display: none; }

  /* My Requests card: compress */
  .approval-meta { flex-wrap: wrap; gap: 6px; }
  .approval-actions { flex-wrap: wrap; }

  /* Tables: hide on mobile, show card-style list instead */
  .table-wrap table thead { display: none; }
  .table-wrap table tbody tr {
    display: flex; flex-wrap: wrap;
    padding: 12px; gap: 4px;
    border-bottom: 1px solid var(--border);
  }
  .table-wrap table tbody td {
    padding: 2px 4px; font-size: 12px;
  }
  .table-wrap table tbody td:first-child {
    width: 100%; font-weight: 600; margin-bottom: 4px;
  }

  /* Reports metrics: single column on very small */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 22px; }

  /* Chart side-by-side → stacked */
  #page-reports .page-body > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .chart-card { padding: 14px; }

  /* Manage access: single col already, just tighten */
  .user-item { flex-wrap: wrap; }

  /* People popover: full width */
  .people-popover { width: calc(100vw - 24px); right: auto; left: 0; }

  /* Behalf section tighter */
  .behalf-section { padding: 10px; }

  /* Topbar search hidden on mobile (handled by mobile header search) */
  .search-wrap { display: none; }

  /* Back button not needed (bottom nav handles it) */
  #btn-back-calendar { display: none !important; }

  /* Leave type items wrap */
  .leave-type-item { flex-wrap: wrap; }
  .leave-type-actions { width: 100%; justify-content: flex-end; margin-top: 4px; }

  /* Delegation cards */
  .delegation-card { flex-wrap: wrap; }

  /* FullCalendar mobile tweaks */
  .fc .fc-toolbar { flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-title { font-size: 14px !important; }
  .fc .fc-button { padding: 4px 8px !important; font-size: 11px !important; }
  .fc .fc-daygrid-day-number { font-size: 11px !important; }
  .fc .fc-event-title { font-size: 10px !important; }
}

/* ─── EXTRA SMALL (≤ 480px) ─────────────────── */
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 12px; }
  .metric-value { font-size: 20px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 12px; }
  .bar-chart { height: 80px; }
  .people-popover { width: calc(100vw - 16px); }
  .user-item select { width: 90px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   SCHEDULER
═══════════════════════════════════════════════════════════════ */

/* ── toolbar ── */
.sched-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sched-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sched-date-nav button {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 14px;
  line-height: 1;
  transition: background .15s;
}
.sched-date-nav button:hover { background: var(--bg4); color: var(--text); }
.sched-date-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 120px;
  text-align: center;
}

/* ── table wrapper ── */
.sched-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.sched-table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
  table-layout: fixed;
}
.sched-table th,
.sched-table td {
  border-right: 1px solid var(--border);
  padding: 0;
}
.sched-table thead tr {
  background: var(--bg3);
  position: sticky;
  top: 0;
  z-index: 2;
}

/* name column */
.sched-name-col {
  width: 200px !important;
  min-width: 200px;
  max-width: 200px;
  position: sticky;
  left: 0;
  background: var(--bg2);
  z-index: 3;
  border-right: 2px solid var(--border-light) !important;
}
thead .sched-name-col { background: var(--bg3); z-index: 4; }

/* time header cells */
.sched-slot-hdr {
  width: 36px;
  min-width: 36px;
  font-size: 10px;
  color: var(--text3);
  text-align: left;
  padding: 4px 2px !important;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: visible;
}

/* user name cell */
.sched-user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  min-height: 44px;
}
.sched-user-info { flex: 1; min-width: 0; }
.sched-user-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-user-hours { font-size: 10px; color: var(--text3); margin-top: 1px; font-family: var(--mono); }
.sched-edit-btn { opacity: 0; transition: opacity .15s; padding: 2px 5px !important; font-size: 12px !important; }
.sched-row:hover .sched-edit-btn { opacity: 1; }

/* slot cells */
.sched-slot {
  height: 36px;
  padding: 0 !important;
  position: relative;
  cursor: default;
  transition: filter .1s;
}
.sched-slot:hover { filter: brightness(1.15); }
.sched-slot.work          { background: rgba(61,214,140,0.22); }
.sched-slot.brk           { background: repeating-linear-gradient(45deg, rgba(245,185,68,0.18), rgba(245,185,68,0.18) 3px, transparent 3px, transparent 8px); }
.sched-slot.off           { background: var(--bg3); }
.sched-slot.leave-approved{ background: rgba(108,99,255,0.35); }
.sched-slot.leave-pending { background: repeating-linear-gradient(45deg, rgba(108,99,255,0.25), rgba(108,99,255,0.25) 3px, transparent 3px, transparent 8px); }
.sched-slot.leave-denied, .sched-slot.leave-cancelled { background: var(--bg3); opacity: 0.5; }

.sched-slot-label {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text2);
  pointer-events: none;
}

/* override row highlight */
.sched-row-override .sched-name-col { border-left: 3px solid var(--yellow) !important; }

/* coverage footer row */
.sched-coverage-row td {
  border-top: 2px solid var(--border);
  padding: 3px 0;
}

/* ── legend ── */
.sched-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.sched-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text3);
}
.sched-chip {
  display: inline-block;
  width: 20px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sched-chip.work           { background: rgba(61,214,140,0.35); }
.sched-chip.brk            { background: repeating-linear-gradient(45deg, rgba(245,185,68,0.4), rgba(245,185,68,0.4) 3px, transparent 3px, transparent 8px); border: 1px solid rgba(245,185,68,0.3); }
.sched-chip.off            { background: var(--bg3); border: 1px solid var(--border); }
.sched-chip.leave-approved { background: rgba(108,99,255,0.4); }
.sched-chip.leave-pending  { background: repeating-linear-gradient(45deg, rgba(108,99,255,0.3), rgba(108,99,255,0.3) 3px, transparent 3px, transparent 8px); border: 1px solid rgba(108,99,255,0.3); }

/* ── edit schedule drawer ── */
.sched-days-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sched-day-cb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: var(--bg3);
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.sched-day-cb.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sched-break-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.sched-override-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

/* ── page sub-panels (consolidated pages) ── */
.emp-panel, .opt-panel, .rpt-panel, .sch-panel { display: block; }

/* ── section subheading inside drawer ── */
.sched-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  margin: 16px 0 8px;
}

/* ─── MY PROFILE PAGE ───────────────────────── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 0 28px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.profile-hero-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.profile-hero-name {
  font-size: 22px; font-weight: 700; margin-bottom: 4px;
}
.profile-hero-meta {
  font-size: 13px; color: var(--text3);
}
.profile-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.profile-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.profile-day-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text3);
  background: var(--bg3);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.profile-day-btn.on {
  background: var(--accent-dim);
  color: var(--accent2);
  border-color: var(--accent2);
}
.profile-break-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.profile-break-row:last-child { border-bottom: none; }
.profile-panel { display: block; }

/* ─── EVENT DETAIL DRAWER ────────────────────── */
#drawer-event { display: flex; flex-direction: column; }
.ed-close-btn {
  position: absolute;
  top: 14px; right: 16px;
  z-index: 2;
}
.ed-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ed-hero {
  position: relative;
  padding: 36px 24px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
}
.ed-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ed-color);
  opacity: .1;
  pointer-events: none;
}
.ed-hero-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 8px;
}
.ed-hero-type {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.ed-hero-status { display: flex; justify-content: center; }

.ed-content { padding: 20px 24px; flex: 1; }

.ed-person {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.ed-person-info { flex: 1; min-width: 0; }
.ed-person-name { font-size: 15px; font-weight: 600; }
.ed-person-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }

.ed-alert {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.ed-alert-approved { background: var(--green-dim); color: var(--green); }
.ed-alert-denied   { background: var(--red-dim);   color: var(--red);   }

.ed-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.ed-meta-item {
  background: var(--bg3);
  padding: 10px 14px;
}
.ed-meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 3px;
}
.ed-meta-value { font-size: 13px; font-weight: 500; color: var(--text); }

.ed-balance {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.ed-balance-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 8px;
  color: var(--text2);
}
.ed-balance-track {
  height: 6px;
  background: var(--bg4);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
.ed-balance-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.ed-balance-sub { font-size: 11px; color: var(--text3); }

.ed-reason {
  font-size: 13px;
  font-style: italic;
  color: var(--text2);
  background: var(--bg3);
  border-left: 3px solid var(--border-light);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 14px;
}

.ed-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bg4);
  border-radius: 20px;
  color: var(--text3);
  margin: 0 4px 8px 0;
}
.ed-pill-yellow { background: rgba(245,185,68,.12); color: var(--yellow); }

.ed-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  text-decoration: none;
  color: var(--text2);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.ed-attachment:hover { border-color: var(--accent); background: var(--bg4); }
.ed-attachment-icon { font-size: 16px; flex-shrink: 0; }
.ed-attachment-name { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-attachment-open { font-size: 11px; color: var(--accent); flex-shrink: 0; }

.ed-submitted { font-size: 11px; color: var(--text3); margin-top: 4px; }

.ed-comments {
  border-top: 1px solid var(--border);
  padding: 16px 24px 20px;
  background: var(--bg2);
}
.ed-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text3);
  margin-bottom: 12px;
}
#comment-thread { margin-bottom: 12px; }
.ed-comment-input-wrap { display: flex; gap: 8px; }
.ed-comment-input-wrap .form-control { flex: 1; font-size: 13px; }

/* ── CALENDAR MODE TOGGLE ─────────────────────────────────────── */
.cal-mode-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}
.cal-mode-btn {
  padding: 4px 14px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.cal-mode-btn.active {
  background: var(--accent);
  color: #fff;
}
.cal-mode-btn:hover:not(.active) { background: var(--bg4); color: var(--text); }

/* ── EVENT DETAIL DRAWER ──────────────────────────────────────── */
.ev-hero {
  padding: 24px 24px 18px;
  position: relative;
}
.ev-hero-cal {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}
.ev-hero-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 6px;
}
.ev-hero-date {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
}
.ev-hero-mode {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.ev-section { padding: 20px 24px; }
.ev-description {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-wrap;
}
.ev-meta-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ev-meta-item { display: flex; flex-direction: column; gap: 2px; }
.ev-meta-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.ev-meta-val   { font-size: 13px; color: var(--text); }
.ev-conn-info  { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.ev-sub-title  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); margin-bottom: 10px; margin-top: 16px; }
.ev-presenters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.ev-presenter  { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); background: var(--bg3); border-radius: 20px; padding: 4px 10px 4px 4px; }
.ev-docs { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-doc-link { font-size: 12px; color: var(--accent); background: var(--accent-dim); border-radius: var(--radius-sm); padding: 4px 10px; text-decoration: none; }
.ev-doc-link:hover { text-decoration: underline; }
.ev-actions { display: flex; gap: 8px; padding: 0 24px 24px; }

/* ── EVENT FORM DRAWER ────────────────────────────────────────── */
.ev-form-body { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.ev-presenter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
}
.ev-presenter-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: background .1s;
}
.ev-presenter-opt:hover { background: var(--bg4); }
.ev-presenter-opt.selected { background: var(--accent-dim); color: var(--text); }
.ev-presenter-check { margin-left: auto; font-size: 12px; color: var(--accent); opacity: 0; }
.ev-presenter-opt.selected .ev-presenter-check { opacity: 1; }
.ev-doc-upload-area {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color .15s;
}
.ev-doc-upload-area:hover { border-color: var(--accent); }
.ev-doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  margin: 2px;
}
.ev-doc-remove { cursor: pointer; color: var(--text3); font-size: 10px; }
.ev-doc-remove:hover { color: var(--red); }

/* FC calendar events distinct styling */
.fc-cal-event { font-weight: 600; }
