/* ═══════════════════════════════════════════════════════════════
   HRMS — Standard Mode
   Professional enterprise theme: clean blue, white sidebar,
   flat cards, minimal shadows, standard border-radius
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary:       #1d6fb4;
  --primary-dark:  #155a96;
  --primary-light: #e8f0fc;
  --secondary:     #0891b2;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #2563eb;
  --dark:          #1e293b;
  --gray:          #6b7280;
  --light:         #f5f7fa;
  --border:        #d1d5db;
  --sidebar-bg:    #1e40af;
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: var(--dark);
  font-size: 13.5px;
}

/* ─── Auth Page ──────────────────────────────────────────────── */
#auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f9;
  padding: 40px 20px;
}

.auth-shell {
  display: flex;
  width: 100%;
  max-width: 960px;
  min-height: 600px;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(21,101,192,0.15);
}

/* ── Form Panel ── */
.auth-form-panel {
  width: 50%;
  display: flex;
  align-items: center;
  padding: 56px;
}
.auth-form-inner { width: 100%; max-width: 380px; margin: 0 auto; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 48px;
}
.auth-brand-logo { font-size: 20px; }
.auth-brand-name { font-size: 15px; font-weight: 700; color: #0d47a1; letter-spacing: .2px; }
.auth-brand-name b { font-weight: 800; }

.auth-heading {
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
}
.auth-subheading {
  color: #64748b;
  font-size: 14.5px;
  margin: 0 0 32px;
}
.auth-form-note {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}

.auth-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.auth-row-center { justify-content: center; margin-top: 14px; margin-bottom: 0; }
.auth-link {
  font-size: 13px;
  color: #1565c0;
  text-decoration: none;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; }

.auth-input-group {
  position: relative;
  margin-bottom: 20px;
}
.auth-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}
.auth-input {
  padding-left: 42px !important;
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 10px !important;
  height: 50px;
  font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.auth-input:focus {
  border-color: #1565c0 !important;
  box-shadow: 0 0 0 3px rgba(21,101,192,.12) !important;
  background: #fff !important;
}
.auth-input-pwd {
  padding-right: 44px !important;
}
.auth-input-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 6px;
  opacity: .65;
  z-index: 2;
  transition: opacity .2s;
}
.auth-input-toggle:hover {
  opacity: 1;
}
.auth-btn {
  width: 100%;
  justify-content: center;
  padding: 15px;
  background: #1565c0;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: background .2s, transform .1s;
}
.auth-btn:hover  { background: #1976d2; transform: translateY(-1px); }
.auth-btn:active { background: #0d47a1; transform: translateY(0); }

/* ── Illustration Panel ── */
.auth-illustration-panel {
  width: 50%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #1565c0 0%, #1976d2 50%, #0d47a1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  text-align: center;
}
.auth-blob {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.09);
}
.auth-blob-1 { width: 240px; height: 240px; top: -70px;  left: -70px; }
.auth-blob-2 { width: 150px; height: 150px; bottom: -50px; right: -30px; background: rgba(255,255,255,0.08); }
.auth-blob-3 { width: 90px;  height: 90px;  top: 55%;    right: 20px; background: rgba(255,255,255,0.07); }

.auth-illustration {
  position: relative;
  z-index: 1;
  margin-bottom: 28px;
  filter: drop-shadow(0 16px 28px rgba(0,0,0,0.18));
}
.auth-illustration-text { position: relative; z-index: 1; }
.auth-illustration-text h3 {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}
.auth-illustration-text p {
  color: rgba(255,255,255,0.75);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 860px) {
  .auth-illustration-panel { display: none; }
  .auth-form-panel { width: 100%; padding: 44px 32px; }
  .auth-shell { max-width: 460px; min-height: 0; }
}

/* ─── Layout ─────────────────────────────────────────────────── */
#app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-logo .logo-badge {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.sidebar-logo span {
  color: white;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.sidebar-logo small {
  display: block;
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  font-weight: 400;
}

.sidebar-nav { padding: 8px 0; }

.nav-section-label {
  padding: 14px 18px 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  font-size: 15px;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  border-left-color: #ffffff;
}

.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }

/* Topbar */
#topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 99;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  cursor: pointer;
  border: 1px solid #bfdbfe;
}

.user-badge .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.user-badge .name { font-weight: 600; font-size: 13px; color: var(--dark); }
.user-badge .role { font-size: 11px; color: var(--gray); }

/* Main Content */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 20px 24px;
  min-height: calc(100vh - var(--topbar-height));
  /* Explicit width so children using width:100% resolve correctly */
  width: calc(100vw - var(--sidebar-width));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* ─── Page Sections ──────────────────────────────────────────── */
.page-section { display: none; }
.page-section.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
}

.page-header p { color: var(--gray); font-size: 13px; margin-top: 2px; }

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
  background: white;
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.cyan   { background: #e0f7fa; color: #0891b2; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.amber  { background: #fef9c3; color: #d97706; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.blue   { background: #dbeafe; color: #1d6fb4; }

.stat-info h3 { font-size: 26px; font-weight: 800; color: var(--dark); line-height: 1.1; }
.stat-info p  { color: var(--gray); font-size: 12px; font-weight: 600; margin-top: 3px; }
.stat-badge   { font-size: 11px; padding: 2px 7px; border-radius: 4px; margin-top: 5px; display: inline-block; font-weight: 600; }
.stat-badge.up      { background: #dcfce7; color: #166534; }
.stat-badge.down    { background: #fee2e2; color: #991b1b; }
.stat-badge.neutral { background: #f1f5f9; color: var(--gray); }

/* ─── Cards & Panels ─────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
}

.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
}

.card-header h5 { font-size: 14px; font-weight: 700; color: var(--dark); }
.card-body { padding: 18px; }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  background: #f3f4f6;
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f3f5;
  font-size: 13px;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success  { background: #dcfce7; color: #166534; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-gray     { background: #f1f5f9; color: var(--gray); }
.badge-purple   { background: #ede9fe; color: #6d28d9; }
.badge-cyan     { background: #e0f7fa; color: #0e7490; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; border-color: var(--primary-dark); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border-color: #15803d; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: white; border-color: #b91c1c; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; border-color: #b45309; }
.btn-outline { background: white; color: var(--dark); border-color: var(--border); }
.btn-outline:hover { background: #f3f4f6; border-color: #9ca3af; }
.btn-sm   { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: #374151; margin-bottom: 5px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
  color: var(--dark);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,111,180,0.12);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control-sm { padding: 5px 9px; font-size: 12px; border-radius: 4px; }

/* ─── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: white;
  border-radius: 8px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
  border-radius: 8px 8px 0 0;
}

.modal-header h3,
.modal-header h5 { font-size: 15px; font-weight: 700; color: var(--dark); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray); padding: 4px 6px; border-radius: 4px; }
.modal-close:hover { background: #e5e7eb; color: var(--dark); }
.modal-body   { padding: 18px 20px; }
.modal-footer { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: #f9fafb; border-radius: 0 0 8px 8px; }

/* Employee form tabs */
.emp-tab, .self-tab {
  background: none; border: none; padding: 10px 16px; font-size: 13px;
  font-weight: 500; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.emp-tab:hover,  .self-tab:hover  { color: var(--primary); }
.emp-tab.active, .self-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ─── Search & Filter ────────────────────────────────────────── */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-bar input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  outline: none;
  background: white;
}

.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,111,180,0.12); }

.search-bar .search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 13px;
}

/* ─── Tabs ───────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  transition: color 0.15s, border-color 0.15s;
  border-radius: 0;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }

/* ─── Progress Bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  height: 7px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.4s ease;
}

/* ─── Rating Stars ───────────────────────────────────────────── */
.stars { color: #f59e0b; font-size: 14px; }

/* ─── Avatar ─────────────────────────────────────────────────── */
.emp-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast {
  padding: 11px 18px;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease;
  border-left: 4px solid rgba(255,255,255,0.4);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { background: #15803d; }
.toast.error   { background: #b91c1c; }
.toast.warning { background: #b45309; }
.toast.info    { background: #1d4ed8; }

/* ─── Loader ─────────────────────────────────────────────────── */
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px;
  color: var(--gray);
  flex-direction: column;
  gap: 14px;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--gray);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; opacity: 0.4; }
.empty-state h4 { font-size: 15px; font-weight: 600; margin-bottom: 5px; color: var(--dark); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #topbar, #main-content { left: 0; margin-left: 0; }
  .modal-box { width: 95vw; }
}

/* ─── Chart Container ────────────────────────────────────────── */
.chart-container { position: relative; }

/* ─── Info Grid ──────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item .label { font-size: 11.5px; color: var(--gray); font-weight: 500; margin-bottom: 2px; }
.info-item .value { font-size: 13px; font-weight: 600; color: var(--dark); }

/* ─── Payslip ────────────────────────────────────────────────── */
.payslip-header {
  background: var(--primary);
  color: white;
  padding: 20px;
  border-radius: 6px 6px 0 0;
}

.payslip-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; }
.payslip-table .total-row td { font-weight: 700; background: #f8fafc; }

/* ─── Timeline ───────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px;
  background: #e5e7eb;
}

.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item h6 { font-size: 13px; font-weight: 600; }
.timeline-item p  { font-size: 12px; color: var(--gray); }

/* ── Employee Profile Drawer ─────────────────────────────────── */
#emp-profile-drawer {
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
#emp-profile-drawer.open {
  transform: translateX(0) !important;
}

.epd-tab {
  transition: background 0.12s, color 0.12s;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}

/* ── Dashboard ───────────────────────────────────────────────── */
#dash-greeting {
  background: var(--sidebar-bg);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(29,111,180,0.3);
}


/* ================================================================
   Calendar Page -- full width + full height, sidebar stays
   ================================================================ */

/* Calendar section fills the entire content area
   (JS sets main-content padding=0 when calendar is active) */
#page-calendar.active {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  height: calc(100vh - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

/* Header keeps its own internal padding */
#page-calendar .page-header {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 13px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

#page-calendar #cal-legend-row {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 7px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #f9fafb;
}

/* Grid wrapper fills all remaining space, full width, no rounded corners */
#page-calendar #cal-grid-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100% !important;
  border-radius: 0 !important;
  border: none !important;
}

/* day-name header row: fixed height */
#page-calendar #cal-grid-wrap > div:first-child {
  flex-shrink: 0;
}

/* grid cells fill height equally via grid-auto-rows: 1fr */
#page-calendar #cal-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid !important;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
}

/* detail panel docks below grid when a date is selected */
#page-calendar #cal-detail-panel {
  flex-shrink: 0;
  margin-top: 0 !important;
  border-top: 2px solid var(--primary);
  max-height: 200px;
  overflow-y: auto;
}
