/* ============================================
   Patterly — Core Styles
   Brand: navy #1a2332, coral #ff6b6b, teal #2ec4b6
   ============================================ */

:root {
  /* Brand */
  --navy: #1a2332;
  --navy-light: #2a3a52;
  --coral: #ff6b6b;
  --coral-light: #ff8a8a;
  --teal: #2ec4b6;
  --teal-light: #5dd9cd;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  /* Functional */
  --danger: #e74c3c;
  --warning: #f39c12;
  --success: #27ae60;
  --info: #3498db;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Layout */
  --sidebar-width: 240px;
  --topnav-height: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: var(--space-md);
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo h1 {
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: var(--space-xs);
}

.tagline {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.login-footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--space-xs);
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
  color: var(--gray-800);
}

.form-group input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.15);
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--teal);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) { background: var(--teal-light); }

.btn-full { width: 100%; }

.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--gray-400);
  background: var(--gray-100);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================
   DASHBOARD — Top Nav
   ============================================ */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-height);
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
}

.topnav-brand {
  font-size: 1.2rem;
  font-weight: 700;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topnav-user {
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* ---- Sidebar ---- */

.sidebar {
  position: fixed;
  top: var(--topnav-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: var(--space-lg) 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55rem var(--space-lg);
  font-size: 0.9rem;
  color: var(--gray-700);
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--gray-100);
  color: var(--navy);
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(46, 196, 182, 0.1);
  color: var(--teal);
  font-weight: 600;
  border-right: 3px solid var(--teal);
}

.sidebar-link.disabled {
  color: var(--gray-400);
  pointer-events: none;
}

.sidebar-icon { font-size: 1.1rem; }

/* ---- Main Content ---- */

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topnav-height);
  padding: var(--space-xl);
  min-height: calc(100vh - var(--topnav-height));
}

.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h2 {
  font-size: 1.5rem;
  color: var(--navy);
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* ---- Stats Grid ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--space-xs);
}

.stat-card--alert .stat-value { color: var(--warning); }
.stat-card--danger .stat-value { color: var(--danger); }

/* ---- Charts ---- */

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.chart-card h3 {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: var(--space-md);
}

/* ---- Cards ---- */

.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: var(--space-xl);
}

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
  font-size: 0.95rem;
  color: var(--gray-700);
}

/* ---- Tables ---- */

.table-responsive {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 0.65rem var(--space-lg);
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--gray-100);
}

.data-table th {
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gray-50);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.table-loading,
.table-empty {
  text-align: center;
  padding: var(--space-xl) !important;
  color: var(--gray-500);
}

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-sick { background: #fef2f2; color: var(--danger); }
.badge-unauthorized { background: #fff7ed; color: #c2410c; }
.badge-holiday { background: #ecfdf5; color: var(--success); }
.badge-other { background: var(--gray-100); color: var(--gray-600); }

/* ---- Status ---- */

.status {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-confirmed { background: #ecfdf5; color: var(--success); }
.status-pending { background: #fffbeb; color: var(--warning); }
.status-cancelled { background: var(--gray-100); color: var(--gray-500); }

/* ---- Alerts ---- */

.alerts-list {
  padding: var(--space-md) var(--space-lg);
}

.alert-item {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  border-left: 4px solid var(--info);
  background: #eff6ff;
}

.alert-item.alert-high,
.alert-item.alert-critical {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.alert-item.alert-medium,
.alert-item.alert-warning {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.alert-item.alert-low {
  border-left-color: var(--teal);
  background: #f0fdfa;
}

.alert-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-800);
}

.alert-detail {
  font-size: 0.82rem;
  color: var(--gray-600);
  margin-top: 2px;
}

.alert-date {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: var(--space-xs);
}

/* ============================================
   MODALS
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--space-md);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}

.modal-close:hover {
  color: var(--gray-800);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--gray-200);
}

/* ============================================
   FORM ELEMENTS (extended)
   ============================================ */

.form-select,
.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
  color: var(--gray-800);
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.15);
}

.form-textarea {
  resize: vertical;
  font-family: inherit;
}

.form-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--gray-700);
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

/* ============================================
   FILTER BAR
   ============================================ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: flex-end;
  margin-bottom: var(--space-lg);
  background: var(--white);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 140px;
}

.filter-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ============================================
   PAGE HEADER ROW
   ============================================ */

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

/* ============================================
   TABLE ACTIONS
   ============================================ */

.actions-cell {
  display: flex;
  gap: var(--space-xs);
}

.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable:hover {
  color: var(--teal);
}

/* ============================================
   BADGE EXTENSIONS
   ============================================ */

.badge-authorized { background: #ecfdf5; color: var(--success); }
.badge-medical { background: #eff6ff; color: var(--info); }
.badge-disability { background: #f5f3ff; color: #7c3aed; }

/* ============================================
   BUTTON DANGER
   ============================================ */

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

/* ============================================
   HEATMAP
   ============================================ */

.heatmap-container {
  margin-bottom: var(--space-md);
}

.heatmap-row {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.heatmap-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  transition: transform 0.15s;
}

.heatmap-cell:hover {
  transform: scale(1.08);
}

.heatmap-day {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
}

.heatmap-count {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-800);
}

/* ============================================
   BRADFORD GAUGE
   ============================================ */

.bradford-gauge {
  text-align: center;
  padding: var(--space-lg) 0;
}

.gauge-score {
  font-size: 3rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: var(--space-md);
}

.gauge-bar {
  position: relative;
  height: 12px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: visible;
  margin: 0 var(--space-md) var(--space-md);
}

.gauge-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
  background: var(--teal);
}

.gauge-markers {
  position: relative;
  height: 1.5rem;
}

.gauge-markers span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--gray-500);
  top: 0;
}

.gauge-label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: var(--space-sm);
}

/* ============================================
   RESPONSIVE (extended)
   ============================================ */

@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .form-row {
    flex-direction: column;
  }

  .page-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .heatmap-row {
    gap: 4px;
  }

  .heatmap-cell {
    width: 56px;
    height: 56px;
  }

  .modal {
    margin: var(--space-sm);
    max-height: 85vh;
  }

  .actions-cell {
    flex-direction: column;
    gap: 2px;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* ============================================
   HOLIDAY PAGE
   ============================================ */

/* --- Tabs --- */

.holidays-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: var(--gray-700);
}

.tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* --- Entitlement Bar --- */

.entitlement-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.entitlement-bar {
  position: relative;
  height: 20px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.entitlement-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--teal);
  border-radius: var(--radius-full) 0 0 var(--radius-full);
  transition: width 0.5s ease;
}

.entitlement-bar-pending {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--warning);
  transition: width 0.5s ease, left 0.5s ease;
}

.entitlement-bar-legend {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  color: var(--gray-600);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* --- Calendar --- */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.calendar-nav h3 {
  min-width: 180px;
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
}

.cal-header {
  background: var(--gray-50);
  padding: 0.4rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
}

.cal-cell {
  background: var(--white);
  min-height: 52px;
  padding: 0.3rem;
  position: relative;
}

.cal-empty {
  background: var(--gray-50);
}

.cal-day {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
}

.cal-weekend .cal-day {
  color: var(--gray-400);
}

.cal-today {
  box-shadow: inset 0 0 0 2px var(--teal);
}

.cal-approved {
  background: rgba(46, 196, 182, 0.12);
}

.cal-pending {
  background: rgba(243, 156, 18, 0.12);
}

.cal-bank-holiday {
  background: rgba(99, 102, 241, 0.08);
}

.cal-indicator {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 0.6rem;
  font-weight: 700;
}

.cal-ind-holiday { color: #6366f1; }

.cal-ind-approved { color: var(--success); }

.cal-ind-pending { color: var(--warning); }

.cal-legend {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  justify-content: center;
  font-size: 0.78rem;
  color: var(--gray-600);
}

/* --- Days Calc Display --- */

.days-calc-display {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}

.days-calc-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--teal);
}

.days-calc-label {
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* --- Stat card teal --- */

.stat-card--teal .stat-value { color: var(--teal); }

/* ============================================
   RESPONSIVE
   ============================================ */

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

  .main-content {
    margin-left: 0;
    padding: var(--space-md);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem var(--space-md);
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: var(--space-lg);
  }

  .topnav-user {
    display: none;
  }

  .cal-cell {
    min-height: 40px;
    padding: 0.15rem;
  }

  .cal-day { font-size: 0.7rem; }

  .cal-indicator { font-size: 0.5rem; }

  .holidays-tabs { overflow-x: auto; }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .entitlement-bar-header {
    flex-direction: column;
    gap: 2px;
  }
}

/* ============================================
   SMALL SCREEN (320px) — EXTRA BREAKPOINT
   ============================================ */

@media (max-width: 375px) {
  .topnav {
    padding: 0 var(--space-sm);
  }

  .topnav-brand {
    font-size: 1rem;
  }

  .main-content {
    padding: var(--space-sm);
  }

  .page-header h2 {
    font-size: 1.2rem;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .card-header {
    padding: var(--space-sm) var(--space-md);
  }

  .data-table th,
  .data-table td {
    padding: 0.4rem var(--space-sm);
    font-size: 0.75rem;
  }

  .filter-bar {
    padding: var(--space-md);
  }

  .modal {
    margin: var(--space-xs);
    max-height: 90vh;
  }

  .modal-header {
    padding: var(--space-md);
  }

  .modal-body {
    padding: var(--space-md);
  }

  .btn {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .btn {
    flex: 1;
  }

  .heatmap-cell {
    width: 48px;
    height: 48px;
  }

  .heatmap-day {
    font-size: 0.65rem;
  }

  .heatmap-count {
    font-size: 0.9rem;
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TOUCH-FRIENDLY TAP TARGETS (min 44px)
   ============================================ */

@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-sm {
    min-height: 36px;
  }

  .sidebar-link {
    min-height: 44px;
  }

  .tab-btn {
    min-height: 44px;
  }

  .report-tab-btn {
    min-height: 44px;
  }

  .modal-close {
    min-height: 44px;
    min-width: 44px;
  }

  .form-group input,
  .form-input,
  .form-select {
    min-height: 44px;
  }

  .checkbox-label {
    min-height: 44px;
  }

  .cal-cell {
    min-height: 44px;
  }
}

/* ============================================
   ACCESSIBILITY — FOCUS STATES
   ============================================ */

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(46, 196, 182, 0.2);
}

.sidebar-link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
  background: var(--gray-100);
}

.form-group input:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.15);
}

a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.tab-btn:focus-visible,
.report-tab-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

/* ============================================
   SKIP LINK (accessibility)
   ============================================ */

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--teal);
  color: var(--white);
  padding: var(--space-sm) var(--space-md);
  z-index: 9999;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) 0;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
