/* 
   BioSanté Premium Medical Dashboard Style Sheet
   Designed for Moroccan clinical laboratories.
   Integrates Doctolib, Stripe, and Linear design paradigms.
*/

/* Fonts are loaded via <link> tags in each HTML file — not @import, which blocks rendering. */

:root {
  --color-deep-blue: #0F2D5E;
  --color-mid-blue: #1B4F8A;
  --color-teal: #87CAEC;
  --color-teal-dark: #0084B4;
  --color-light-blue: #D6EAF8;
  --color-surface: #F4F6F9;
  --color-white: #FFFFFF;
  --color-text-primary: #1A1A2E;
  --color-text-secondary: #3D5A80;
  --color-border: #E0E6F0;
  --color-red: #C0392B;
  --color-green: #1E8449;
  --color-amber: #F1C40F;
  --color-blue: #3498DB;
  --color-gray: #95A5A6;
  
  --shadow-sm: 0 2px 4px rgba(15, 45, 94, 0.03);
  --shadow-md: 0 6px 16px rgba(15, 45, 94, 0.06);
  --shadow-lg: 0 12px 28px rgba(15, 45, 94, 0.1);
  --shadow-premium: 0 20px 40px -15px rgba(15, 45, 94, 0.15);

  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius-xl: 4px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /*
   * Type scale — 5 levels, fixed rem, ratios 1.09 / 1.17 / 1.29 / 1.44
   * xs → sm → body → title → display
   * 11px → 12px → 14px → 18px → 26px
   */
  --text-xs:      0.6875rem;   /* 11px — metadata, copyright, tooltips */
  --text-sm:      0.75rem;     /* 12px — column headers, badges, form labels */
  --text-body:    0.875rem;    /* 14px — body text, table rows, inputs, nav */
  --text-title:   1.125rem;    /* 18px — modal headers, section titles */
  --text-display: 1.625rem;    /* 26px — page titles */
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--text-body);
  line-height: 1.5;
  font-kerning: normal;
  font-optical-sizing: auto;
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.spin { animation: spin 0.9s linear infinite; }
.fade-up { animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fade-in { animation: fadeIn 0.25s ease-out forwards; }
.slide-in-right { animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes scaleIn { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.scale-in { animation: scaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
  opacity: 0.5;
}

/* Sidebar Styling */
.sidebar {
  width: 240px;
  background: var(--color-deep-blue);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  color: var(--color-white);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 8px 0 32px rgba(15, 45, 94, 0.12);
  z-index: 10;
}

.sidebar-header {
  padding: 24px 20px 16px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(135, 202, 236, 0.35);
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Poppins', sans-serif;
  color: var(--color-white);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.logo-sub {
  color: rgba(135, 202, 236, 0.92);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  padding-left: 44px;
}

.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
  margin: 0 16px 12px;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 12px;
  overflow-y: auto;
}

.sidebar-nav::before {
  content: 'Navigation';
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.22);
  padding: 6px 14px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  margin-bottom: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--color-white);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.93);
  color: var(--color-deep-blue);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* JSX nav buttons — hover only (active/inactive states controlled via inline styles) */
.nav-btn:hover:not([aria-current="page"]) {
  background: rgba(255, 255, 255, 0.09) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-deep-blue);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(135, 202, 236, 0.35);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  color: var(--color-white);
  font-size: var(--text-body);
  font-weight: 600;
}

.user-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
}

.footer-copyright {
  color: rgba(255, 255, 255, 0.2);
  font-size: var(--text-xs);
  margin-top: 12px;
  text-align: center;
}

/* Main Area Layout */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.topbar {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  z-index: 5;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-tag.ok {
  color: #1E8449;
  background: #EAFAF1;
  border: 1px solid #A9DFBF;
}

.status-tag.version {
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn-bordered {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, border-color 0.15s;
}

.icon-btn-bordered:hover {
  background: var(--color-surface);
  border-color: var(--color-text-secondary);
  color: var(--color-text-primary);
}

.top-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-light-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-teal);
  cursor: pointer;
  transition: transform 0.2s;
}

.top-avatar:hover {
  transform: scale(1.05);
}

/* Page Header & Top Sections */
.page-container {
  flex: 1;
  overflow: auto;
  padding: 24px 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-title {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-display);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.5px;
  text-wrap: balance;
}

.page-subtitle {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-top: 5px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn-primary {
  padding: 10px 22px;
  border-radius: var(--radius-md);
  background: var(--color-deep-blue);
  border: none;
  color: var(--color-white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s, filter 0.15s, transform 0.08s;
}

.btn-primary:hover {
  filter: brightness(1.12);
}

.btn-primary:active {
  filter: brightness(0.88);
  transform: scale(0.97);
}

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

.btn-secondary {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s, border-color 0.15s, transform 0.08s;
}

.btn-secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-text-secondary);
}

.btn-secondary:active {
  filter: brightness(0.97);
  transform: scale(0.98);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--color-deep-blue);
  outline-offset: 2px;
}

/* Close / dismiss button — shared across all modal overlays */
.close-modal-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}

.close-modal-btn:hover {
  color: var(--color-text-primary);
  background-color: var(--color-surface);
}

.close-modal-btn:focus-visible {
  outline: 2px solid var(--color-teal);
  outline-offset: 2px;
}

/* Stat Strip — surface summary row replacing hero-metric KPI card grid */
.stat-strip {
  display: flex;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  overflow: hidden;
}

.stat-cell {
  flex: 1;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid var(--color-border);
  min-width: 0;
}

.stat-cell:last-child {
  border-right: none;
}

.stat-n {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-cell--primary .stat-n {
  color: var(--color-deep-blue);
}

.stat-cell--danger .stat-n {
  color: var(--color-red);
}

.stat-lbl {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search and Filters Layout */
.filter-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 14px 16px;
  margin-bottom: 8px;
}

.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.actions-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  border: 1px solid var(--color-border);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.search-input-wrap:focus-within {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(135, 202, 236, 0.2);
  background: var(--color-white);
}

.search-input {
  border: none;
  background: transparent;
  font-size: var(--text-body);
  font-family: inherit;
  color: var(--color-text-primary);
  outline: none;
  width: 100%;
}

/* General inputs & Selects */
input[type="text"], input[type="date"], select, textarea {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-size: var(--text-body);
  color: var(--color-text-primary);
  background-color: var(--color-white);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-teal) !important;
  box-shadow: 0 0 0 3px rgba(135, 202, 236, 0.2) !important;
}

.filter-card input[type="date"],
.filter-card input[type="text"] {
  padding: 7px 10px;
  font-size: var(--text-body);
}

/* Table Design System */
.table-container {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.b-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.b-table th {
  padding: 14px 18px;
  background-color: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
}

.b-table td {
  padding: 14px 18px;
  font-size: var(--text-body);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.b-table tbody tr:last-child td {
  border-bottom: none;
}

/* Long-text overflow protection for table cells */
.b-table .cell-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.b-table .cell-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.b-table tbody tr {
  transition: background-color 0.15s;
}

.b-table tbody tr:hover {
  background-color: rgba(135, 202, 236, 0.05);
}

/* Badges styling */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
}

.badge.cnss { background: #EBF5FB; color: #1B4F8A; }
.badge.cnops { background: #E8F8F5; color: #0B5345; }
.badge.mutuelle { background: #F5EEF8; color: #6C3483; }
.badge.none { background: #F2F3F4; color: #566573; }

/* Action Button Groups */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 8px;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}

.action-icon-btn:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.action-icon-btn.danger:hover {
  background: #FDEDEC;
  color: var(--color-red);
}

/* Toast Notification Styles */
.toast-container {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--color-deep-blue);
  color: var(--color-white);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-body);
  font-weight: 500;
  min-width: 260px;
  max-width: 340px;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { background: var(--color-green); }
.toast.error { background: var(--color-red); }
.toast.info { background: var(--color-mid-blue); }
.toast.warning { background: #9A6F00; }

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 45, 94, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-premium);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-white);
}

.modal-header h3 {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--color-text-primary);
  text-wrap: balance;
}

.modal-header p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--color-surface);
}

/* Form Helper Layouts */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-group label span.required {
  color: var(--color-red);
}

.radio-group {
  display: flex;
  gap: 12px;
}

.radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
  font-size: 14px;
  font-weight: 500;
  background: var(--color-white);
}

.radio-label input {
  accent-color: var(--color-deep-blue);
}

.radio-label.active {
  border-color: var(--color-deep-blue);
  background: var(--color-light-blue);
  color: var(--color-deep-blue);
  font-weight: 600;
}

.text-error {
  font-size: 12px;
  color: var(--color-red);
  margin-top: 4px;
}

/* AI Panel Glassmorphism Panel styles */
.ai-panel {
  width: clamp(280px, 28vw, 380px);
  background: var(--color-white);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  box-shadow: -4px 0 24px rgba(15, 45, 94, 0.03);
  z-index: 9;
}

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

.ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-light-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-title {
  font-weight: 600;
  font-size: var(--text-body);
  color: var(--color-text-primary);
}

.ai-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
}

.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg.assistant {
  align-self: flex-start;
}

.ai-msg-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--color-light-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--text-body);
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-msg.user .ai-msg-bubble {
  background: var(--color-deep-blue);
  color: var(--color-white);
  border-bottom-right-radius: 2px;
}

.ai-msg.assistant .ai-msg-bubble {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-bottom-left-radius: 2px;
}

.ai-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

.ai-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ai-preset-btn {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.ai-preset-btn:hover {
  background: var(--color-light-blue);
  color: var(--color-deep-blue);
  border-color: var(--color-teal);
}

.ai-input-wrap {
  display: flex;
  gap: 8px;
}

.ai-input {
  flex: 1;
}

.ai-send-btn {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-deep-blue);
  border: none;
  cursor: pointer;
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s, opacity 0.12s;
}

.ai-send-btn:hover:not(:disabled) {
  background: var(--color-mid-blue);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-dots-loader {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  animation: pulse 1s infinite;
}

/* ─────────────────────────────────────────────────────────────
   RENDEZ-VOUS (APPOINTMENTS) PAGE SPECIFIC STYLES
   ───────────────────────────────────────────────────────────── */

.scheduling-layout {
  display: flex;
  height: calc(100vh - 61px); /* minus topbar height */
  overflow: hidden;
}

/* Left Sidebar Panel */
.scheduler-sidebar {
  width: 280px;
  border-right: 1px solid var(--color-border);
  background-color: #F8FAFD;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 16px;
  gap: 20px;
}

.sidebar-section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Compact Mini Calendar */
.mini-calendar {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.mini-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.mini-cal-month {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--color-text-primary);
}

.mini-cal-nav {
  display: flex;
  gap: 2px;
}

.mini-cal-nav button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-cal-nav button:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.mini-cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.mini-cal-day-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-cal-day {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  padding: 6px 0;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}

.mini-cal-day:hover:not(.empty) {
  background-color: var(--color-light-blue);
  color: var(--color-deep-blue);
}

.mini-cal-day.today {
  background-color: rgba(15, 45, 94, 0.08);
  border: 1px solid var(--color-deep-blue);
  color: var(--color-deep-blue);
  font-weight: 700;
}

.mini-cal-day.selected {
  background-color: var(--color-deep-blue) !important;
  color: var(--color-white) !important;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(15, 45, 94, 0.2);
}

.mini-cal-day.has-appt::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--color-teal);
}

.mini-cal-day.empty {
  cursor: default;
  opacity: 0.25;
}

/* Quick Filters */
.quick-filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-body);
  color: var(--color-text-secondary);
  text-align: left;
  transition: background-color 0.12s, color 0.12s;
  font-weight: 500;
}

.quick-filter-btn:hover {
  background-color: rgba(15, 45, 94, 0.04);
  color: var(--color-text-primary);
}

.quick-filter-btn.active {
  background-color: var(--color-white);
  color: var(--color-deep-blue);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(15, 45, 94, 0.2);
}

.quick-filter-count {
  font-size: 11px;
  background-color: var(--color-border);
  color: var(--color-text-secondary);
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}

.quick-filter-btn.active .quick-filter-count {
  background-color: var(--color-light-blue);
  color: var(--color-deep-blue);
}

/* Staff Filter Segmented Control */
.segmented-control {
  display: flex;
  background: var(--color-border);
  border-radius: var(--radius-md);
  padding: 2.5px;
  gap: 2.5px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}

.segment-btn.active {
  background-color: var(--color-white);
  color: var(--color-deep-blue);
  box-shadow: var(--shadow-sm);
}

.staff-list-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.staff-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-primary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.staff-checkbox-item:hover {
  background-color: rgba(15, 45, 94, 0.03);
}

.staff-checkbox-item input {
  accent-color: var(--color-deep-blue);
}

.staff-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Scheduler Main Content Area */
.scheduler-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--color-white);
  overflow: hidden;
  height: 100%;
}

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

.schedule-date-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.schedule-actions {
  display: flex;
  gap: 8px;
}

/* Schedule Timeline Area */
.schedule-scroll-area {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.timeline-container {
  display: grid;
  grid-template-columns: 80px 1fr;
  position: relative;
  min-height: 100%;
}

.sticky-time-column {
  border-right: 1px solid var(--color-border);
  background-color: #F8FAFD;
  position: sticky;
  left: 0;
  z-index: 2;
}

.time-slot-label {
  height: 90px; /* 1 hour is 90px, 30 min is 45px */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px dashed var(--color-border);
  position: relative;
}

.time-slot-label::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.grid-schedule-area {
  position: relative;
  background-color: var(--color-white);
  background-image: 
    linear-gradient(var(--color-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border) 1px, transparent 1px);
  background-size: 100% 45px, 100% 100%; /* 45px represents 30 minutes grid line */
}

/* Current time indicator line */
.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-red);
  z-index: 3;
  pointer-events: none;
}

.current-time-line::before {
  content: '';
  position: absolute;
  left: 0;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-red);
}

/* Appointment Cards */
.appointment-card {
  position: absolute;
  left: 12px;
  width: calc(100% - 24px);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 12px -2px rgba(15, 45, 94, 0.06), 0 2px 4px -1px rgba(15, 45, 94, 0.03);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s, background-color 0.2s, border-color 0.2s, transform 0.1s;
  overflow: hidden;
  z-index: 1;
}

.appointment-card:hover {
  box-shadow: 0 10px 22px -4px rgba(15, 45, 94, 0.12), 0 4px 8px -2px rgba(15, 45, 94, 0.06);
  transform: translateY(-1px);
  z-index: 2;
}

.appointment-card:active {
  cursor: grabbing;
  transform: scale(0.99) translateY(0);
}

.appointment-card.is-dragging {
  box-shadow: 0 12px 28px rgba(15, 45, 94, 0.22), 0 4px 8px rgba(15, 45, 94, 0.08);
  transform: rotate(0.8deg) scale(1.02) !important;
  z-index: 50;
  opacity: 0.92;
  cursor: grabbing;
  transition: none;
}

/* Status styling on cards */
.appointment-card.status-confirmed {
  background-color: rgba(135, 202, 236, 0.12);
  border: 1px solid rgba(135, 202, 236, 0.35);
}
.appointment-card.status-waiting {
  background-color: rgba(241, 196, 15, 0.08);
  border: 1px solid rgba(241, 196, 15, 0.28);
}
.appointment-card.status-inprogress {
  background-color: rgba(52, 152, 219, 0.08);
  border: 1px solid rgba(52, 152, 219, 0.28);
}
.appointment-card.status-completed {
  background-color: rgba(30, 132, 73, 0.07);
  border: 1px solid rgba(30, 132, 73, 0.25);
}
.appointment-card.status-cancelled {
  background-color: rgba(192, 57, 43, 0.06);
  border: 1px solid rgba(192, 57, 43, 0.22);
}
.appointment-card.status-noshow {
  background-color: rgba(149, 165, 166, 0.08);
  border: 1px solid rgba(149, 165, 166, 0.22);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-patient-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-white);
  flex-shrink: 0;
}

.card-patient-name {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.card-time-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
  background-color: rgba(255, 255, 255, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.card-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0;
  gap: 6px;
}

.card-type-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-insurance-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(15, 45, 94, 0.04);
  padding-top: 6px;
  margin-top: 2px;
}

.card-phone {
  font-size: 11px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-quick-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.card-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s, color 0.1s;
}

.card-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--color-text-primary);
}

.card-action-btn.btn-checkin:hover {
  color: var(--color-green);
  background-color: rgba(46, 204, 113, 0.15);
}

.card-action-btn.btn-cancel:hover {
  color: var(--color-red);
  background-color: rgba(231, 76, 60, 0.15);
}

/* Appointment Card Resizer handles */
.card-resizer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  background: transparent;
}

.card-resizer:hover {
  background-color: rgba(15, 45, 94, 0.1);
}

/* Right Detail Drawer */
.detail-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 45, 94, 0.2);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.detail-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 420px;
  background-color: var(--color-white);
  box-shadow: -8px 0 32px rgba(15, 45, 94, 0.12);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #F8FAFD 0%, var(--color-white) 100%);
}

.drawer-header-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-patient-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-white);
}

.drawer-patient-name {
  font-family: 'Poppins', sans-serif;
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--color-text-primary);
}

.drawer-patient-ref {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.drawer-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.drawer-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--color-surface);
  padding: 14px;
  border-radius: var(--radius-md);
}

.drawer-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-info-label {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.drawer-info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.drawer-actions-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-shortcut-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-white);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  color: var(--color-text-primary);
}

.drawer-shortcut-btn:hover {
  background-color: var(--color-light-blue);
  border-color: var(--color-teal);
  color: var(--color-deep-blue);
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-sm);
}

.drawer-shortcut-btn span {
  font-size: var(--text-sm);
  font-weight: 600;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--color-border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-text-secondary);
  margin-top: 5px;
  flex-shrink: 0;
}

.history-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.history-type {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  background-color: #F8FAFD;
}

.drawer-footer button {
  flex: 1;
}

/* Hover Previews / Context Menus */
.context-menu {
  position: fixed;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 110;
  padding: 4px 0;
  min-width: 160px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px) scale(0.97);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.14s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s 0.14s;
}

.context-menu.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.14s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text-primary);
  text-align: left;
  transition: background-color 0.1s;
}

.context-menu-item:hover {
  background-color: var(--color-surface);
}

.context-menu-item.danger {
  color: var(--color-red);
}

.context-menu-item.danger:hover {
  background-color: #FDEDEC;
}

/* General Layout Structure for Separate HTML pages */
.dashboard-content-layout {
  display: flex;
  height: calc(100vh - 61px);
  overflow: hidden;
}

.primary-content-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN ADAPTATIONS (<= 1024px and <= 768px)
   ───────────────────────────────────────────────────────────── */

/* Backdrop elements */
.sidebar-backdrop, .scheduler-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 45, 94, 0.4);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.active, .scheduler-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Hamburger toggle styling */
.hamburger-btn {
  display: none !important;
}

/* Rendezvous toggle styling (hidden by default on desktop) */
#toggle-sched-sidebar-btn {
  display: none;
}

@media (max-width: 1024px) {
  /* Topbar updates */
  .hamburger-btn {
    display: inline-flex !important;
    margin-right: 8px;
  }
  
  .topbar {
    padding: 12px 16px;
  }
  
  /* Sidebar Drawer styling */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 240px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  /* Stat strip: wrap to 2-column at tablet */
  .stat-strip {
    flex-wrap: wrap;
  }
  .stat-cell {
    flex: 1 1 calc(50% - 1px);
  }
  .stat-cell:nth-child(2) {
    border-right: none;
  }
  .stat-cell:nth-child(3) {
    border-top: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
  }
  .stat-cell:nth-child(4) {
    border-top: 1px solid var(--color-border);
  }
  
  /* Page container adjustments */
  .page-container {
    padding: 16px;
  }
  
  .page-header {
    margin-bottom: 16px;
  }
  
  /* Modal responsive stacking */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .modal-content {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  /* AI panel transitions to drawer */
  .ai-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 340px;
    z-index: 1000;
    box-shadow: -8px 0 32px rgba(15, 45, 94, 0.15);
  }
  
  /* Tables Touch Scanning */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Rendez-vous Scheduler responsive stacking */
  .scheduling-layout {
    position: relative;
  }
  
  .scheduler-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(15, 45, 94, 0.08);
  }
  
  .scheduler-sidebar.active {
    transform: translateX(0);
  }
  
  #toggle-sched-sidebar-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
  }
}

@media (max-width: 768px) {
  /* Smaller tablet & phone layouts */
  .topbar-left .status-tag.ok {
    display: none; /* hide redundant status tag on narrow width */
  }
  
  /* Detail drawer on small devices should span full width or near it */
  .detail-drawer {
    width: 100% !important;
  }
  
  .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .search-input-wrap {
    width: 100%;
  }
  
  /* Responsive buttons scaling */
  .header-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 12px;
  }

  .page-title {
    font-size: 21px;
  }

  .page-subtitle {
    font-size: 13px;
  }

  /* Stat strip: single column on small screens */
  .stat-strip {
    flex-direction: column;
  }
  .stat-cell {
    flex: unset;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    border-top: none !important;
  }
  .stat-cell:last-child {
    border-bottom: none;
  }
  .stat-n {
    font-size: 1.25rem;
  }

  /* Stack actions column, full-width buttons */
  .actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-group {
    flex-direction: column;
  }

  .actions-group .btn-primary,
  .actions-group .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Center and wrap pagination */
  #pagination-controls {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Stack pagination row */
  .table-container > div:last-child {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  /* Topbar: tighter */
  .topbar {
    padding: 10px 12px;
  }

  /* Version tag: hide on very small screens */
  .status-tag.version {
    display: none;
  }
}

/* Touch friendliness adjustments */
@media (pointer: coarse) {
  button,
  .nav-link,
  .context-menu-item,
  .mini-cal-day,
  .quick-filter-btn {
    min-height: 44px;
  }

  .action-icon-btn {
    min-height: 44px;
    padding: 8px 10px;
  }

  .btn-primary, .btn-secondary {
    padding: 12px 20px;
  }
}

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

