/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100;200;300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

/* Design Tokens / Brand Colors */
:root {
  --fontFamily: "Outfit", "Roboto", sans-serif;

  /* Brand primary */
  --primaryColor: #8b2a35;
  --primaryColorHover: #73212a;

  /* Brand secondary — the accent. Settings > Appearance overrides this. */
  --secondaryColor: #00cae3;
  --secondaryColorHover: #00b6cc;

  /* Semantic colors (status, alerts) */
  --dangerColor: #e74c3c;
  --infoColor: var(--secondaryColor);
  --warningColor: #ffb264;
  --successColor: #2ed47e;

  /* Text & surfaces */
  --textMain: #3b2224;
  --textMuted: #7a5557;
  --whiteColor: #ffffff;
  --bodyColor: #7a5557;

  /* Backgrounds */
  --appBackground: rgba(245, 232, 224, 0.92);
  --surfaceColor: rgba(255, 248, 244, 0.98);
  --surfaceBorder: rgba(139, 42, 53, 0.12);
  --surfaceBorder: color-mix(in srgb, var(--primaryColor) 12%, transparent);

  --transition: 0.3s ease;
  --fontSize: 16px;

  /* Legacy token names used throughout this file but never defined, so every
     rule referencing them was dead. Aliased onto the live tokens so they follow
     Settings > Appearance instead of falling back to nothing. */
  --daxaColor: var(--primaryColor);
  --blackColor: var(--textMain);
  --lightGrayColor: color-mix(in srgb, var(--primaryColor) 6%, #fff);

  /* Layout — driven by Settings > Appearance via theme.php.
     Defaults here reproduce the previous hardcoded look exactly, so the
     stylesheet still stands on its own if theme.php fails to load. */
  --sidebarWidth: 280px;
  --densityScale: 1;                              /* compact .8 | comfortable 1 | spacious 1.25 */
  --cardPadding: calc(28px * var(--densityScale));
  --cardGap: calc(24px * var(--densityScale));
  --contentPaddingY: calc(32px * var(--densityScale));
  --contentPaddingX: calc(40px * var(--densityScale));
  --navItemPaddingY: calc(14px * var(--densityScale));
  --radiusCard: 16px;
  --radiusControl: 12px;
  --borderBoxShadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
  --cardShadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;
  --hoverShadow: rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--fontFamily);
  font-size: var(--fontSize);
  font-weight: 400;
  color: var(--textMain);
  background-color: var(--appBackground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--appBackground);
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebarWidth);
  background: var(--surfaceColor);
  box-shadow: var(--borderBoxShadow);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  overflow-y: auto;
  border-radius: 0 20px 20px 0;
  transition: var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 32px 24px 24px 24px;
  border-bottom: 1px solid var(--surfaceBorder);
  background: var(--primaryColor);
  color: var(--whiteColor);
  border-radius: 0 20px 0 0;
}

.sidebar-header .avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--cardShadow);
}

.sidebar-header .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-title {
  font-weight: 600;
  font-size: 1.1em;
  margin-bottom: 4px;
}

.sidebar-title a {
  color: var(--whiteColor);
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-title a:hover {
  opacity: 0.8;
}

.sidebar-role {
  font-size: 0.9em;
  opacity: 0.8;
  font-weight: 300;
}

.sidebar-nav-label {
  color: var(--textMuted);
  font-size: 0.85em;
  font-weight: 500;
  margin: 24px 24px 8px 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding: 0 16px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--textMain);
  text-decoration: none;
  padding: var(--navItemPaddingY) 16px;
  border-radius: var(--radiusControl);
  transition: var(--transition);
  font-size: 0.95em;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.sidebar nav a i {
  font-size: 20px;
  opacity: 0.7;
  transition: var(--transition);
}

.sidebar nav a:hover i,
.sidebar nav a.active i {
  opacity: 1;
}

.sidebar nav a:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--primaryColor);
  transform: scaleY(0);
  transition: var(--transition);
}

.sidebar nav a:hover:before,
.sidebar nav a.active:before {
  transform: scaleY(1);
}

.sidebar nav a:hover {
  background: rgba(139, 42, 53, 0.08);
  background: color-mix(in srgb, var(--primaryColor) 8%, transparent);
  color: var(--primaryColor);
  transform: translateX(4px);
}

.sidebar nav a.active {
  background: rgba(139, 42, 53, 0.12);
  background: color-mix(in srgb, var(--primaryColor) 12%, transparent);
  color: var(--primaryColor);
  font-weight: 600;
}

.sidebar-logout {
  margin: 16px 24px 24px 24px;
  padding: 16px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dangerColor);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: var(--radiusControl);
  transition: var(--transition);
  font-size: 0.95em;
  font-weight: 500;
}

.logout-btn:hover {
  background: rgba(231, 76, 60, 0.1);
  transform: translateX(4px);
}

.logout-btn i {
  font-size: 18px;
  transition: var(--transition);
}

.sidebar-footer {
  margin: 0 24px 24px 24px;
  color: var(--textMuted);
  font-size: 0.8em;
  text-align: center;
  opacity: 0.7;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebarWidth);
  padding: var(--contentPaddingY) var(--contentPaddingX);
  min-width: 0;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  background: var(--surfaceColor);
  padding: 24px 32px;
  border-radius: var(--radiusCard);
  box-shadow: var(--cardShadow);
  border-left: 4px solid var(--primaryColor);
}

.main-header h1 {
  margin: 0;
  font-size: 2em;
  font-weight: 600;
  color: var(--primaryColor);
}

.main-subtitle {
  color: var(--bodyColor);
  font-size: 1em;
  margin-top: 8px;
  font-weight: 300;
}

.main-actions {
  display: flex;
  gap: 16px;
}

/* Button Styles */
.btn {
  border: none;
  border-radius: var(--radiusControl);
  padding: 12px 24px;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--fontFamily);
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primaryColor);
  color: var(--whiteColor);
  border: 1px solid transparent;
}

.btn-primary:hover {
  background: var(--primaryColorHover);
}

/* The square icon button — the client page's Edit pencil, and now every add
   button in the app. It carries no .btn baggage: no shadow, no 12/24 padding,
   no overflow box. Each add button used to be its own sentence ("+ New
   Appointment", "+ Add New Client", "Add New Staff") and on a phone those
   words were the widest thing in the page header; the sentence moved to title
   and aria-label, which is what a tooltip and a screen reader read anyway. */
.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radiusControl, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--primaryColor);
  transition: var(--transition, background-color .15s ease);
  /* For a "+" typed straight into the button. A material icon child overrides
     both below. The add buttons use a typed "+" rather than the icon: it is
     one glyph in the page's own font, so it needs nothing loaded and cannot
     show up as the word "add" while a webfont is still in flight. */
  color: var(--whiteColor, #fff);
  font-family: var(--fontFamily);
  font-size: 22px;
  line-height: 1;
}

.icon-btn:hover { background: var(--primaryColorHover, var(--primaryColor)); }
.icon-btn i { color: var(--whiteColor, #fff); font-size: 20px; }

.btn-secondary {
  background: var(--surfaceColor);
  color: var(--primaryColor);
  border: 1px solid rgba(139, 42, 53, 0.35);
  border: 1px solid color-mix(in srgb, var(--primaryColor) 35%, transparent);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primaryColor);
  color: var(--whiteColor);
}

/* A button with nothing to do is faded and says so on the cursor, and it does
   not light up under the pointer — the bulk GESY action spends most of its life
   in this state, and a live-looking button that ignores the click reads as a
   fault in the app. */
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-danger {
  background: var(--dangerColor);
  color: var(--whiteColor);
  border: 1px solid transparent;
}

.btn-danger:hover {
  filter: brightness(0.93);
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
}

/* Cards */
.card {
  background: var(--surfaceColor);
  border-radius: var(--radiusCard);
  box-shadow: var(--cardShadow);
  padding: var(--cardPadding);
  margin-bottom: var(--cardGap);
  transition: var(--transition);
  border: 1px solid var(--surfaceBorder);
}

.card:hover,
.stat-card:hover,
.stat-item:hover {
  box-shadow: var(--hoverShadow);
  transform: translateY(-4px);
}

/* Stats Cards — one definition for every stats strip in the app: the main
   pages (.stats-cards), the leaves page (.stats-grid) and the staff cards
   (.staff-stats), which used to each carry their own sizes and colours. */
.stats-cards,
.stats-grid,
.staff-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Calendar status bar (inspired by new React calendar StatusBar) */
.calendar-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 16px;
  margin-top: 8px;
  border-top: 1px solid var(--surfaceBorder);
  font-size: 0.9em;
  color: var(--textMuted);
}

/* Each count links to the appointments filtered to it. They keep the bar's
   quiet muted text — three blue underlined links under the calendar would
   read as the loudest thing on the page — and show themselves on hover. */
.calendar-status-bar span,
.calendar-status-bar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radiusControl, 8px);
  padding: 2px 6px;
  transition: var(--transition);
}

.calendar-status-bar a:hover,
.calendar-status-bar a:focus-visible {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primaryColor);
}

.calendar-status-bar strong {
  color: var(--primaryColor);
}

/* Slightly modernized event styling */
.fc .fc-timegrid-event,
.fc .fc-daygrid-event {
  border-radius: 8px;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  font-size: 12px;
}

.stat,
.stat-card,
.stat-item {
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 18px 14px;
  margin-bottom: 0;
  background: var(--surfaceColor);
  border: 1px solid var(--surfaceBorder);
  border-radius: var(--radiusCard);
  box-shadow: var(--cardShadow);
}

.stat:before,
.stat-card:before,
.stat-item:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primaryColor);
}

.stat-title,
.stat-label {
  color: var(--bodyColor);
  font-size: 0.8em;
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.stat-value,
.stat-number {
  font-size: 1.9em;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--primaryColor);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stat-sub {
  color: var(--successColor);
  font-size: 0.8em;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Section Titles */
.section-title {
  font-weight: 600;
  font-size: 1.2em;
  margin-bottom: 16px;
  color: var(--textMain);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title:before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primaryColor);
  border-radius: 2px;
}

/* Dashboard Layout */
.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

.dashboard-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radiusControl);
  padding: 4px;
}

.tab {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--bodyColor);
  font-weight: 500;
  font-size: 0.9em;
  transition: var(--transition);
  flex: 1;
  text-align: center;
}

.tab.active {
  background: var(--surfaceColor);
  color: var(--primaryColor);
  box-shadow: var(--cardShadow);
  font-weight: 600;
}

.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
}

/* Calendar */
.calendar-placeholder {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: var(--radiusCard);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bodyColor);
  font-weight: 500;
  border: 2px dashed rgba(0, 0, 0, 0.1);
}

#calendar {
  background: var(--whiteColor);
  border-radius: 12px;
  box-shadow: var(--cardShadow);
  padding: 24px;
  margin-top: 20px;
  height: 100%;
  min-height: 700px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* FullCalendar Custom Styles */
.fc-theme-standard td, .fc-theme-standard th {
  border: 1px solid rgba(0, 0, 0, 0.05);
}


.fc-timegrid-slot-minor {
  border-top: 1px solid rgba(0, 0, 0, 0.03);
}

.fc-event {
  border-radius: 8px !important;
  /* The border is the appointment's identity — its GESY option, else its
     treatment type, both from Settings (appointmentEventColors() in gesy.php).
     border-style and -width only: the colour arrives inline from FullCalendar,
     and a `border:` shorthand here would reset it to currentColor. This used to
     be `border: none`, which threw that colour away — the entry showed nothing
     but its status background. */
  border-style: solid !important;
  border-width: 3px !important;
  box-sizing: border-box !important;
  font-size: 13px !important;
  padding: 6px 10px !important;
  margin: 3px 6px !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  box-shadow: var(--cardShadow) !important;
  min-height: 24px !important;
}

/* Cancelled appointments styling */
/* Cancelled is shown without touching the colour: the chip keeps the therapy's
   own colour and is faded and struck through instead. Repainting it grey made
   the calendar change colour as appointments were worked through, and buried
   which treatment the slot had been booked for. */
.fc-event.cancelled-appointment {
  opacity: 0.45 !important;
}

.fc-event.cancelled-appointment .fc-event-title {
  text-decoration: line-through !important;
}

.fc-event-title {
  font-weight: 600 !important;
  white-space: pre-line !important;
}

.fc-timegrid-event {
  border-radius: 8px !important;
}

.fc-timegrid-event-harness {
  margin: 2px 4px !important;
}

.fc-header-toolbar {
  margin-bottom: 20px !important;
  padding: 16px !important;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radiusControl);
}

.fc-button {
  background: var(--primaryColor) !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  box-shadow: var(--cardShadow) !important;
  transition: var(--transition) !important;
}

.fc-button:hover {
  background: var(--primaryColorHover) !important;
  transform: translateY(-1px) !important;
}

.fc-button:disabled {
  background: var(--bodyColor) !important;
  opacity: 0.5 !important;
}

.fc-today-button {
  background: var(--whiteColor) !important;
  color: var(--primaryColor) !important;
  border: 2px solid var(--primaryColor) !important;
}

.fc-today-button:hover {
  background: var(--primaryColorHover) !important;
  color: var(--whiteColor) !important;
}

/* Google Calendar-Style Enhanced Styling */
.fc {
  font-family: var(--fontFamily);
  background: var(--whiteColor);
  border-radius: var(--radiusCard);
  box-shadow: var(--cardShadow);
  overflow: hidden;
  margin: 0;
}

.fc-toolbar {
  background: var(--whiteColor);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 0 !important;
  padding: 16px 20px !important;
  border-radius: 0 !important;
}

.fc-toolbar-title {
  font-size: 1.375rem !important;
  font-weight: 600 !important;
  color: var(--blackColor) !important;
  margin: 0 !important;
}

.fc-button-group {
  display: flex;
  gap: 4px;
}

.fc-button {
  background: var(--whiteColor) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  color: var(--blackColor) !important;
  border-radius: 6px !important;
  font-size: 0.875rem !important;
  min-width: 44px !important;
  height: 36px !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.fc-button:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  transform: none !important;
}

.fc-button-active,
.fc-button-active:hover {
  background: var(--primaryColor) !important;
  border-color: var(--primaryColor) !important;
  color: var(--whiteColor) !important;
}

.fc-today-button {
  background: var(--primaryColor) !important;
  color: var(--whiteColor) !important;
  border-color: var(--primaryColor) !important;
}

.fc-today-button:hover {
  background: var(--primaryColor) !important;
  opacity: 0.9 !important;
}

.fc-prev-button,
.fc-next-button {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  min-width: 36px !important;
}

/* ── The day strip ──────────────────────────────────────────────────────────
   Five weeks of days above the calendar, each carrying the number of
   appointments on it, and a bar underneath showing which of them the grid is
   currently showing. Everything is driven by the theme's own tokens, so it
   follows the palette rather than pinning a second one. */
.day-strip {
  margin-bottom: 18px;
}

.day-strip-days {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 10px;
  /* The bar below is the scroll indicator; a second one is noise. */
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.day-strip-days::-webkit-scrollbar { display: none; }

.day-strip-day {
  flex: 0 0 auto;
  width: 48px;
  padding: 6px 0 7px;
  border: none;
  background: none;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-family: var(--fontFamily);
  transition: var(--transition);
}

.day-strip-day:hover:not(:disabled) { background: rgba(0, 0, 0, 0.04); }

.day-strip-weekday {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bodyColor);
}

.day-strip-date {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--blackColor);
}

.day-strip-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.05);
  color: var(--bodyColor);
}

/* A day with something on it tints its badge; an empty day stays quiet, so
   the strip reads as "where the work is" at a glance. */
.day-strip-day.has-appointments .day-strip-count {
  background: #eef0fe;
  background: color-mix(in srgb, var(--primaryColor) 14%, transparent);
  color: var(--primaryColor);
}

/* The days the grid is showing. */
.day-strip-day.is-shown { background: rgba(0, 0, 0, 0.05); }

/* Today is the one fixed point in the strip, so it is the filled one. */
.day-strip-day.is-today { background: var(--primaryColor); }
.day-strip-day.is-today .day-strip-weekday,
.day-strip-day.is-today .day-strip-date { color: var(--whiteColor, #fff); }
.day-strip-day.is-today .day-strip-count {
  background: rgba(0, 0, 0, 0.2);
  color: var(--whiteColor, #fff);
}

/* Closed in Settings: the grid does not show it, so neither does this. */
.day-strip-day.is-closed { opacity: 0.4; cursor: default; }

.day-strip-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
}

.day-strip-range {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primaryColor), var(--primaryColorHover, var(--primaryColor)));
  transition: left 0.2s ease, width 0.2s ease;
}

@media (max-width: 768px) {
  .day-strip-day { width: 42px; }
  .day-strip-date { font-size: 16px; }
}

/* Calendar Grid Styling */
.fc-scrollgrid {
  border: none !important;
  border-radius: 0 !important;
}

.fc-col-header {
  background: var(--whiteColor);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.fc-col-header-cell {
  background: var(--whiteColor) !important;
  font-weight: 600 !important;
  color: var(--blackColor) !important;
  padding: 16px 8px !important;
  text-align: center !important;
  font-size: 0.875rem !important;
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.fc-col-header-cell:last-child {
  border-right: none !important;
}

/* Time Grid Styling */
.fc-timegrid-slot {
  border-color: rgba(0, 0, 0, 0.08) !important;
  height: 40px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

.fc-timegrid-slot:hover {
  background-color: rgba(121, 109, 246, 0.08) !important;
}

.fc-timegrid-slot-lane:hover {
  background-color: rgba(121, 109, 246, 0.05) !important;
}

  /* Add visual feedback for empty slots */
  .fc-timegrid-slot-lane:hover::after {
    content: '+ New Appointment';
    position: absolute;
    background: var(--primaryColor);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    z-index: 10;
    pointer-events: none;
    margin-top: 2px;
    margin-left: 2px;
    opacity: 0.9;
  }
  
  /* Mobile-specific tap feedback */
@media (max-width: 800px) {
    .fc-timegrid-slot-lane:active {
      background-color: rgba(121, 109, 246, 0.15) !important;
    }
  }

.fc-timegrid-slot-label {
  color: var(--bodyColor) !important;
  font-weight: 500 !important;
  font-size: 0.75rem !important;
  padding: 8px 12px !important;
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: #fafbfc !important;
}

.fc-timegrid-slot-lane {
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

.fc-timegrid-col {
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.fc-timegrid-col:last-child {
  border-right: none !important;
}

/* A half-hour chip now lives in a 40px row: the card-sized 6px/3px box left
   about 18px for the text. Two classes deep so it outranks the .fc-event
   padding below, which the day-grid month and week chips still want. */
.fc .fc-timegrid-event {
  padding: 3px 7px !important;
  border-width: 2px !important;
}

/* Enhanced Event Styling */
.fc-event {
  /* See the .fc-event rule above: the border carries the colour from Settings. */
  border-style: solid !important;
  border-width: 3px !important;
  box-sizing: border-box !important;
  border-radius: 6px !important;
  padding: 6px 8px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  margin: 2px !important;
  font-size: 0.8rem !important;
  line-height: 1.3 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  transition: var(--transition) !important;
  /* No touch-action on a chip. Its only effect here was suppressing
     double-tap zoom on the appointment, and it left the chip declaring a
     pannable gesture that FullCalendar's drag has to fight. The tap-delay
     reason to set it applies to the lanes and buttons, not to this. What
     actually makes a chip draggable on touch is eventLongPressDelay in
     index.php. */
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

.fc-event:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.fc-event-title {
  font-weight: 600 !important;
  white-space: pre-line !important;
}

.fc-event-time {
  font-size: 0.75rem !important;
  opacity: 0.9 !important;
}

/* Today highlighting */
.fc-day-today {
  background: rgba(121, 109, 246, 0.03) !important;
}

.fc-day-today .fc-col-header-cell {
  background: var(--primaryColor) !important;
  color: var(--whiteColor) !important;
}

.fc-day-today .fc-timegrid-slot-label {
  background: rgba(121, 109, 246, 0.05) !important;
}

/* Mobile-specific calendar styles */
@media (max-width: 800px) {
  .fc {
    font-size: 0.8rem;
    margin: 0;
    touch-action: manipulation;
    -webkit-touch-callout: none;
  }
  
  .fc-toolbar {
    padding: 12px 16px !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .fc-toolbar-title {
    font-size: 1.125rem !important;
    text-align: center !important;
  }
  
  .fc-toolbar-chunk {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  .fc-button {
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    min-width: 44px !important;
    height: 44px !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  
  .fc-prev-button,
  .fc-next-button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }
  
  .fc-col-header-cell {
    padding: 12px 4px !important;
    font-size: 0.8rem !important;
  }
  
  .fc-timegrid-slot {
    height: 48px !important;
    min-height: 44px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
  }
  
  .fc-timegrid-slot-label {
    font-size: 0.75rem !important;
    padding: 8px 10px !important;
    font-weight: 500 !important;
  }
  
  .fc-timegrid-slot-lane {
    min-height: 44px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
  }
  
  .fc-event {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
    margin: 3px !important;
    min-height: 45px !important;
    line-height: 1.2 !important;
    /* See the .fc-event rule above — chips declare no touch-action. */
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
  }
  
  .fc-event-time {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
  }
  
  /* Touch-friendly calendar grid */
  .fc-timegrid-col {
    touch-action: manipulation !important;
  }
  
  .fc-timegrid-slot-lane {
    touch-action: manipulation !important;
  }
  
  /* Make calendar card take full width on mobile */
  .card {
    margin: 0 0 12px !important;
    border-radius: min(var(--radiusCard), 8px) !important;
  }
  .stats-cards > .card, .stats-grid > .card, .staff-stats > .card { margin-bottom: 0 !important; }
  
  .main-content {
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom)) !important;
  }
  
  .content-wrapper {
    padding: 8px !important;
  }

  /* Removed: `.fc-scrollgrid { overflow-x: auto; -webkit-overflow-scrolling:
     touch }`. .fc-scrollgrid is FullCalendar's <table>; turning it into a
     scroll container with momentum scrolling puts it on its own iOS
     compositing layer, and the event chips inside are absolutely positioned
     children of that layer — they stopped receiving taps and drags on the
     phone while working fine on the desktop. FullCalendar ships its own
     scrollers (.fc-scroller), so nothing here needed the override. */

  /* Fix calendar sizing on mobile */
  #calendar {
    width: 100% !important;
    height: auto !important;
    min-height: 700px !important;
    padding: 12px !important;
  }

  /* Improve event text readability */
  .fc-event-title {
    font-weight: 600 !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
  }

  /* The hour gutter is narrowed with the rest of the grid — see the
     max-width:1024px block. It used to be pinned at 65px, a whole column's
     worth of a seven-column week. */
}

/* Lists */
.side-list {
  margin-bottom: 16px;
}

.side-list > div {
  margin-bottom: 12px;
    padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  transition: var(--transition);
}

.side-list > div:hover {
  background: color-mix(in srgb, var(--primaryColor) 5%, transparent);
}

.side-list-title {
  font-weight: 600;
  color: var(--blackColor);
  margin-bottom: 4px;
}

.side-list-sub {
  color: var(--bodyColor);
  font-size: 0.9em;
}

/* Badges
   A status badge is a label, not a button that shouts: a pale tint with the
   state's colour in the text carries the same meaning as a saturated pill and
   sits quietly in a row of them. */
.badge {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-success,
.badge-paid {
  background: #eef6f0;
  border-color: #cfe3d6;
  color: #1f6b41;
}

.badge-warning,
.badge-pending {
  background: #fdf5e8;
  border-color: #eddfc2;
  color: #8a5d0b;
}

.badge-danger,
.badge-cancel,
.badge-cancelled {
  background: #fbeeed;
  border-color: #eed2ce;
  color: #a8322a;
}

.badge-info {
  background: #eef3f9;
  border-color: #d2ddea;
  color: #1f5286;
}

.badge-secondary {
  background: #f1f2f4;
  border-color: #dfe2e6;
  color: #5a636c;
}

/* The status badge doubles as the paid toggle. It reads as a control by
   darkening under the cursor, not by looking like a button. */
.badge-btn {
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.badge-btn:hover {
  filter: brightness(0.97);
  border-color: currentColor;
}

/* A badge that cannot be clicked has to look it. The GESY money badge is dead
   until the therapy has passed, and one that still reads as live just swallows
   the tap — which is indistinguishable from the app being broken. Same weight
   of fade as a disabled row action. */
.badge-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.badge-btn:disabled:hover {
  filter: none;
  border-color: transparent;
}

/* A status cell carries the payment badge and, on a GESY appointment, the
   scheme's own. They wrap onto a second line instead of widening the column. */
.data-table td .badge { margin-left: 0; }
.data-table td .badge + .badge { margin-left: 6px; }

/* Amount Styles */
.amount {
  font-weight: 600;
  color: var(--primaryColor);
  font-size: 1.1em;
}

/* Action Button Styles - Matching the image design */
.appointment-actions {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
}

/* One quiet outlined square per action. The colour belongs to the icon, and
   only on hover — a row of solid blue/green/red tiles turns a list of ten
   appointments into a colour chart nobody can read a status off. */
.appointment-actions .action-btn {
  width: 34px !important;
  height: 34px !important;
  border: 1px solid #dfe2e6 !important;
  border-radius: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease !important;
  background: var(--whiteColor, #fff) !important;
  color: #5a636c !important;
}

.appointment-actions .action-btn:hover {
  background: #f4f5f7 !important;
}

.appointment-actions .action-btn i {
  color: inherit !important;
  font-size: 18px !important;
}

.appointment-actions .action-btn.action-edit:hover {
  border-color: #b7cbe4 !important;
  color: #1f5286 !important;
}

.appointment-actions .action-btn.action-paid:hover {
  border-color: #bcd9c8 !important;
  color: #1f6b41 !important;
}

.appointment-actions .action-btn.action-pending:hover,
.appointment-actions .action-btn.action-unpaid:hover {
  border-color: #e3d2ad !important;
  color: #8a5d0b !important;
}

.appointment-actions .action-btn.action-cancel:hover,
.appointment-actions .action-btn.action-delete:hover {
  border-color: #e5c4c0 !important;
  color: #a8322a !important;
}

.appointment-actions .action-btn:disabled {
  opacity: .4 !important;
  cursor: not-allowed !important;
}

.appointment-actions .action-btn:disabled:hover {
  background: var(--whiteColor, #fff) !important;
  border-color: #dfe2e6 !important;
  color: #5a636c !important;
}

/* Lit: this appointment is cancelled, and the button now restores it. */
.appointment-actions .action-btn.action-cancel.is-on {
  background: #fbeeed !important;
  border-color: #e5c4c0 !important;
  color: #a8322a !important;
}

/* Tab Content Styles */
.tab-content {
  margin-top: 20px;
}

.client-overview {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.overview-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
}

.overview-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--blackColor);
  font-size: 18px;
  font-weight: 600;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

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

.info-item label {
  font-weight: 500;
  color: var(--bodyColor);
  font-size: 14px;
}

.info-item span {
  color: var(--blackColor);
  font-size: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e9ecef;
}

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

.activity-date {
  font-size: 14px;
  color: var(--bodyColor);
  min-width: 80px;
}

.activity-details {
  flex: 1;
  min-width: 0;
}

/* The therapy name opens the appointment. Styled as the heading it replaced:
   a row of underlined links down the list would be noise, so it shows itself
   on hover and on keyboard focus, like the client name on a card. */
.activity-open {
  border: none;
  background: none;
  padding: 0;
  font-family: var(--fontFamily);
  font-size: inherit;
  font-weight: 700;
  color: var(--blackColor);
  text-align: left;
  cursor: pointer;
}

.activity-open:hover,
.activity-open:focus-visible {
  color: var(--primaryColor);
  text-decoration: underline;
}

/* The badges are the same controls as everywhere else, so they keep to the
   end of the row and wrap rather than squeezing the name. */
.activity-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

/* The app's page numbers, wherever a list is paged. Small square buttons —
   .btn is a 12/24px form control and reads as an action, which a page number
   is not. */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
}

.pager-page {
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background: var(--whiteColor);
  color: var(--bodyColor);
  font-family: var(--fontFamily);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.pager-page:hover {
  border-color: var(--primaryColor);
  color: var(--primaryColor);
}

.pager-page.is-current {
  background: var(--primaryColor);
  border-color: var(--primaryColor);
  color: var(--whiteColor);
}

/* The stretch a pager skips. Not a button: there is nothing to click. */
.pager-gap {
  display: flex;
  align-items: flex-end;
  padding: 0 2px;
  color: var(--bodyColor);
  font-size: 14px;
  user-select: none;
}

/* A thumb needs more than 32px. */
@media (max-width: 800px) {
  .pager-page {
    min-width: 40px;
    min-height: 40px;
  }
}

.medical-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.medical-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--blackColor);
  font-size: 16px;
  font-weight: 600;
}

.medical-section p {
  margin: 0;
  color: var(--bodyColor);
}

/* Mobile Appointments Styles */
.mobile-appointments {
  display: none;
}

.appointment-card {
  background: var(--whiteColor);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--cardShadow);
  border-left: 4px solid var(--primaryColor);
}

/* The name gets a row, the badges get the next one. A GESY appointment
   carries three of them, which beside a name left about four characters of
   room — "Michalis Constantinou" broke mid-word and ran under the badges. */
.appointment-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.card-client {
  flex: 1 1 auto;
  min-width: 0;
}

/* The name links to the client's profile, styled as the heading it replaced:
   these cards are a list, and a blue underlined name in every row of it is
   noise. The link shows itself on hover and on keyboard focus. */
.card-client-name {
  font-weight: 700;
  color: var(--blackColor);
  text-decoration: none;
}

.card-client-name:hover,
.card-client-name:focus-visible {
  color: var(--primaryColor);
  text-decoration: underline;
}

/* The pencil sits at the end of the first row whether or not there is a name
   beside it — client_details.php renders these cards without one. */
.card-edit-btn {
  margin-left: auto;
}

/* Its own row, always: a full-width basis leaves nothing to squeeze. */
.card-badges {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.appointment-status {
  display: flex;
  align-items: center;
}

.appointment-details {
  margin-bottom: 16px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.detail-label {
  font-weight: 500;
  color: var(--bodyColor);
  font-size: 14px;
}

.detail-value {
  color: var(--blackColor);
  font-size: 14px;
  text-align: right;
}

.mobile-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mobile-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 14px;
}

/* Responsive table/mobile display */
@media (max-width: 768px) {
  .desktop-table {
    display: none !important;
  }
  
  .mobile-appointments {
    display: block;
  }
}

@media (min-width: 769px) {
  .desktop-table {
    display: table;
  }
  
  .mobile-appointments {
    display: none !important;
  }
}

/* Search Bar */
.search-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--whiteColor);
  border-radius: 12px;
  box-shadow: var(--cardShadow);
}

.search-bar input, .search-bar select {
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 0.95em;
  background: var(--whiteColor);
  transition: var(--transition);
  font-family: var(--fontFamily);
}

.search-bar input:focus, .search-bar select:focus {
  outline: none;
  border-color: var(--daxaColor);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primaryColor) 10%, transparent);
}

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--whiteColor);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--cardShadow);
}

/* A date or time field reads as a field, not as a widget with a glyph parked in
   it. display:none, not opacity:0 — invisible was not enough, the indicator kept
   its ~20px and clipped "18/09/2026" to "18/09/202". Clicking the field still
   opens the picker: sidebar.php calls showPicker() on every page. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  display: none;
}

.data-table th, .data-table td {
  padding: 16px;
    text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* A header row labels the columns; it is not a band of colour across the top.
   Flat tint, one hairline under it, and the labels a shade lighter than the
   data so the eye lands on the rows. */
.data-table th {
  background: #f7f8fa;
  color: #5a636c;
  font-weight: 600;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid #e3e6ea;
  padding-top: 11px;
  padding-bottom: 11px;
}

.data-table tr:hover {
  background: color-mix(in srgb, var(--primaryColor) 2%, transparent);
}

/* Cancelled: the row fades instead of wearing a badge. It stays readable, and
   stays findable under Cancelled in the status filter. Hovering brings it back
   to full strength, so it can still be read and restored. */
.data-table tr.row-cancelled {
  opacity: .5;
}

.data-table tr.row-cancelled:hover {
  opacity: 1;
}

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

.client-name {
  font-weight: 600;
  color: var(--blackColor);
}

.client-dob {
  color: var(--bodyColor);
  font-size: 0.9em;
}

/* One segmented control, not coloured chips: the appointments filters and the
   staff list's card/table switch are the same thing, so they are one style.
   It lived in appointments.php, which is why the staff page grew its own. */
.filter-tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 20px;
  padding: 3px;
  background: #f1f2f4;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
}

.filter-tab {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
  color: #5a636c;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}

.filter-tab:hover {
  color: #1f2933;
}

.filter-tab.active {
  background: var(--whiteColor, #fff);
  color: #1f2933;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

/* ── The ⋮ row menu ────────────────────────────────────────────────────────
   Shared by the client and staff lists; the behaviour is in action_menu.php.
   position:fixed because an open menu is moved to <body> — a .card ancestor
   with a hover transform breaks fixed positioning for everything inside it. */
.action-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-dropdown {
  position: fixed;
  background: var(--whiteColor, #fff);
  border: 1px solid var(--surfaceBorder, #ddd);
  border-radius: 8px;
  box-shadow: var(--hoverShadow, 0 2px 10px rgba(0, 0, 0, 0.15));
  z-index: 9999;
  min-width: 180px;
  overflow: hidden;
  padding: 4px;
}

/* An icon each, so the actions are scannable rather than a column of
   sentences — and so the staff list's Edit and Delete stop being two
   coloured buttons competing with the row. */
.action-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font-family: var(--fontFamily);
  font-size: 14px;
  color: var(--blackColor);
}

.action-dropdown button:hover { background: rgba(0, 0, 0, 0.05); }

.action-dropdown button i {
  font-size: 18px;
  color: var(--bodyColor);
}

/* Deleting is the one that cannot be undone from here. */
.action-dropdown button.is-danger,
.action-dropdown button.is-danger i { color: var(--dangerColor, #dc3545); }
.action-dropdown button.is-danger:hover { background: #fdecea; }

/* ── Page access toggles (staff.php) ─────────────────────────────────────── */
.permissions-who {
  color: var(--bodyColor);
  margin: 0 0 14px;
}

.permissions-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 20px;
}

/* Two classes deep on purpose. These rows are <label>s inside a modal, and
   `.modal-content label` (0,1,1) sets display:block, which outranks a lone
   class and would flatten the row: the switch is a <span>, an inline one
   ignores its width, and its absolutely-positioned knob then lands on top of
   the name. */
.permissions-list .permission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  margin-bottom: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 400;
}

.permission-row:hover { background: rgba(0, 0, 0, 0.03); }

/* The row itself carries the state too, for anyone who cannot tell the two
   switch colours apart. */
.permission-row:has(.permission-toggle:checked) { background: rgba(46, 158, 91, 0.08); }

/* The switch reads first, then what it governs. */
.permission-name {
  display: block;
  flex: 1;
  font-weight: 500;
  color: var(--bodyColor);
  transition: var(--transition);
}

/* Off is not just "not on": the row goes quiet, the switch goes grey-red, and
   the name loses its weight. Two states that differ only by a pale tint are
   the kind of thing you check twice and still get wrong. */
.permission-toggle:checked ~ .permission-name {
  color: var(--blackColor);
  font-weight: 600;
}

/* The checkbox stays in the DOM and keeps the label, the keyboard and the
   form value; the switch beside it is what gets drawn. */
/* Kept in the DOM for the label, the keyboard and the form value, but out of
   the layout. The reset is not decoration: `.modal-content input` gives every
   field 12/16px of padding and a 2px border, which would inflate this into an
   invisible ~32px box sitting over whatever is next to it. */
.permissions-list .permission-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  margin: 0;
}

.permission-switch {
  position: relative;
  /* Never inline: an inline span drops its width and the knob spills out. */
  display: block;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #e4576b;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

.permission-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--whiteColor, #fff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
}

/* Green for on, red for off: this is a permission, and the two states should
   be tellable apart across the room, not only side by side. */
.permission-toggle:checked + .permission-switch { background: #2e9e5b; }
.permission-toggle:checked + .permission-switch::after { transform: translateX(18px); }
.permission-toggle:focus-visible + .permission-switch {
  outline: 2px solid var(--primaryColor);
  outline-offset: 2px;
}

.btn-menu {
  background: none;
  border: none;
  font-size: 1.2em;
  color: var(--bodyColor);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-menu:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--daxaColor);
}

/* Chart Placeholder */
.chart-placeholder {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primaryColor) 10%, transparent) 0%, rgba(121, 109, 246, 0.1) 100%);
  border-radius: 12px;
  height: 220px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bodyColor);
  font-weight: 500;
  border: 2px dashed color-mix(in srgb, var(--primaryColor) 20%, transparent);
}

/* Mobile Menu */
/* ── Mobile bottom tab bar ──────────────────────────────────────────────────
   Replaces the floating hamburger: four destinations always one tap away, and
   More opens the same sidebar drawer the hamburger used to. */
.d-lg-none { display: none; }

.bottom-tab-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Under modals (1000) and the drawer, above page content. */
  z-index: 900;
  background: var(--whiteColor);
  border-top: 1px solid var(--surfaceBorder);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tab-nav > a,
.bottom-tab-nav > button {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px 6px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--bodyColor);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.2;
}

.bottom-tab-nav i {
  font-size: 22px;
}

.bottom-tab-nav > a span,
.bottom-tab-nav > button span {
  /* Long labels ("Appointments") shrink rather than widen their tab. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-tab-nav > a.active {
  color: var(--primaryColor);
  font-weight: 600;
}

/* Drawer close button, mirroring the tab bar's More. */
.sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-overlay.active {
  pointer-events: auto;
}

.mobile-overlay.active {
  opacity: 1;
}

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--whiteColor);
  padding: 32px;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--hoverShadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* A field is a flex item in most of these forms, and a flex item refuses to
   shrink below its content by default: one long treatment name or placeholder
   and the row pushes the modal sideways. Nothing in a modal scrolls sideways,
   so let them shrink and clip what still will not fit. */
.modal-content { overflow-x: hidden; }

.modal-content form > div,
.modal-content form > div > div,
.modal-content .form-group,
.modal-content input,
.modal-content select,
.modal-content textarea {
  min-width: 0;
}

.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.5em;
  color: var(--bodyColor);
  cursor: pointer;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  color: var(--dangerColor);
  background: rgba(231, 76, 60, 0.1);
}

/* Form Styles */
.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-content label {
  font-weight: 500;
  color: var(--blackColor);
  margin-bottom: 6px;
  display: block;
}

.modal-content input, .modal-content select, .modal-content textarea {
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 0.95em;
  transition: var(--transition);
  font-family: var(--fontFamily);
  background: var(--whiteColor);
}

.modal-content input:focus, .modal-content select:focus, .modal-content textarea:focus {
  outline: none;
  border-color: var(--daxaColor);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primaryColor) 10%, transparent);
}

.modal-content textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.form-row-flex {
  display: flex;
  gap: 10px;
}

@media (max-width: 600px) {
  .form-row-flex {
    flex-direction: column;
    gap: 0;
  }
  .form-row-flex > div {
    margin-bottom: 10px;
  }
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-group input[readonly] {
  background-color: rgba(0, 0, 0, 0.03);
  cursor: not-allowed;
  opacity: 0.7;
}

/* A password field and the button that reveals it. Here rather than on a page,
   because the Settings card and the login form both use it and a reveal that
   looks different on the two is worse than no reveal at all.
   Two classes deep on purpose: login.php restates `.form-group input` in its
   own <style>, which would otherwise win and take the padding away. */
.pw-field { position: relative; }

.form-group .pw-field input {
  width: 100%;
  padding-right: 44px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--textMuted, #888);
  cursor: pointer;
}

.pw-toggle:hover { color: var(--primaryColor); background: rgba(0, 0, 0, 0.04); }
.pw-toggle i { font-size: 20px; }

.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid rgba(0, 0, 0, 0.05);
}

/* ── The client forms ───────────────────────────────────────────────────────
   The label sits beside its field rather than above it and the pairs go two to
   a line, which is what got fourteen fields onto one screen. Where they still
   do not fit — a short window, a phone — the modal scrolls, up and down only,
   and the button bar sticks to the bottom edge so Save is never somewhere off
   the end of the form. The scrolling is the box's own, not a flex child sized
   to the leftover height: that depends on a min-height:0 further up the tree
   holding, and when it did not the fields were simply clipped.

   The wrapper rows in the markup are taken out of the layout with
   display:contents so every field is a cell of the one grid. They stay in the
   markup because they are what the field toggles switch off; client_fields.php
   sets display:none on them inline, which outranks the contents here, so a
   disabled field still disappears. */
.modal-content.modal-compact {
  max-width: 900px;
  /* No padding at the bottom: the button bar sticks there and brings its
     own. */
  padding: 20px 24px 0;
  overflow-y: auto;      /* up and down */
  overflow-x: hidden;    /* never sideways */
}

.modal > .modal-content.modal-compact > form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 32px;
  align-items: start;
}

/* Not .form-group: dissolving one of those would split a label from its
   field. */
.modal-content.modal-compact form > div:not(.form-actions):not(.form-group) {
  display: contents;
}

/* The pair itself: name on the left, field on the right, one line each.
   min-width:0 because a grid item sizes to its content by default, and a long
   placeholder would push the field past the edge of the modal. */
.modal-content.modal-compact .form-group {
  display: grid;
  grid-template-columns: minmax(70px, 110px) 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 0;
}

.modal-content.modal-compact label {
  margin: 0;
  text-align: right;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--bodyColor);
}

/* A box of prose is taller than its name — the label goes to the top of it
   rather than floating beside the middle. */
.modal-content.modal-compact .form-group:has(textarea) { align-items: start; }
.modal-content.modal-compact .form-group:has(textarea) label { margin-top: 9px; }

.modal-content.modal-compact input,
.modal-content.modal-compact select,
.modal-content.modal-compact textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 12px;
}

.modal-content.modal-compact h2 { margin: 0 0 14px; flex: 0 0 auto; }
.modal-content.modal-compact textarea { min-height: 56px; }
.modal-content.modal-compact .form-row { margin-bottom: 0; }

/* Save and Cancel keep the bottom edge, on top of whatever is scrolling past
   underneath. */
.modal-content.modal-compact .form-actions {
  grid-column: 1 / -1;
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: var(--whiteColor);
  margin-top: 6px;
  padding: 14px 0 20px;
}

/* One pair per line on a phone: two would leave each field about 120px wide,
   which is narrower than the values people type into them. It still scrolls
   there — a phone cannot hold fourteen fields at once — but with the finger,
   not a bar: a scrollbar drawn over a 300px-wide field costs width the field
   needs, and nobody drags one on a touch screen anyway. Keeping that scroll
   off the page behind it is already done, by the overscroll-behavior the
   full-screen modal rule further down sets on this same element. */
@media (max-width: 768px) {
  .modal > .modal-content.modal-compact > form { grid-template-columns: 1fr; }

  .modal > .modal-content.modal-compact {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;            /* Firefox */
  }

  .modal > .modal-content.modal-compact::-webkit-scrollbar {
    display: none;                    /* Safari, Chrome */
  }
}

/* Suggestions */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--whiteColor);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
  display: none;
  box-shadow: var(--cardShadow);
}

.suggestions div {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

.suggestions div:hover {
  background: color-mix(in srgb, var(--primaryColor) 5%, transparent);
  color: var(--daxaColor);
}

.suggestions div:last-child {
  border-bottom: none;
}

.suggestions .no-results {
  color: var(--bodyColor);
  font-style: italic;
  cursor: default;
  text-align: center;
}

.suggestions .no-results:hover {
  background: transparent;
}



/* Birthday Section */
.birthday-summary {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  font-size: 1em;
  color: var(--blackColor);
  font-weight: 500;
}

.birthday-summary #birthdayCount {
  font-weight: 700;
  color: var(--daxaColor);
  font-size: 1.2em;
  margin-left: 8px;
}

.birthdays-list {
  border-top: 2px solid rgba(0, 0, 0, 0.05);
  padding-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.birthday-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  transition: var(--transition);
}

/* The row is a link to the client — it must not read as one. */
a.birthday-item {
  color: inherit;
  text-decoration: none;
}

.birthday-item:hover {
  background: color-mix(in srgb, var(--primaryColor) 5%, transparent);
}

.birthday-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.birthday-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.birthday-info strong {
  font-size: 1em;
  color: var(--blackColor);
  font-weight: 600;
}

.birthday-date {
  font-size: 0.9em;
  color: var(--bodyColor);
  font-weight: 500;
}

.birthday-age {
  font-size: 0.8em;
  color: var(--bodyColor);
  font-style: italic;
}

.birthday-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.birthday-phone {
  font-size: 0.85em;
  color: var(--bodyColor);
}

.birthday-days {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--daxaColor);
  background: color-mix(in srgb, var(--primaryColor) 10%, transparent);
  padding: 4px 12px;
  border-radius: 20px;
}

.no-birthdays {
  text-align: center;
  color: var(--bodyColor);
  font-style: italic;
  padding: 24px;
}

/* Leaves Section */
.leaves-summary {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  font-size: 1em;
  color: var(--blackColor);
  font-weight: 500;
}

.leaves-list {
  border-top: 2px solid rgba(0, 0, 0, 0.05);
  padding-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.leave-item {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  transition: var(--transition);
}

.leave-item:hover {
  background: color-mix(in srgb, var(--primaryColor) 5%, transparent);
}

.leave-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.leave-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.leave-dates {
  font-size: 0.9em;
  color: var(--bodyColor);
  font-weight: 500;
}

.leave-reason {
  font-size: 0.85em;
  color: var(--bodyColor);
  font-style: italic;
}

.no-leaves {
  color: var(--bodyColor);
  font-style: italic;
  text-align: center;
  padding: 24px;
}

/* Leave Status Styles */
.leave-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.status-approved {
  background-color: #e8f5e8;
  color: #2e7d32;
  border: 1px solid #4caf50;
}

.status-pending {
  background-color: #fff3e0;
  color: #f57c00;
  border: 1px solid #ff9800;
}

.status-rejected {
  background-color: #ffebee;
  color: #d32f2f;
  border: 1px solid #f44336;
}

/* Client Selection */
.client-selection-container {
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: var(--whiteColor);
  box-shadow: var(--cardShadow);
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
}

.client-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: var(--transition);
}

.client-item:hover {
  background: color-mix(in srgb, var(--primaryColor) 5%, transparent);
}

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

.client-item.selected {
  background: color-mix(in srgb, var(--primaryColor) 10%, transparent);
  border-left: 4px solid var(--daxaColor);
}

.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--daxaColor) 0%, var(--primaryColor) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--whiteColor);
  font-weight: 600;
  font-size: 1.1em;
  margin-right: 16px;
  flex-shrink: 0;
  box-shadow: var(--cardShadow);
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-weight: 600;
  color: var(--blackColor);
  margin: 0 0 4px 0;
  font-size: 0.95em;
}

.client-details {
  color: var(--bodyColor);
  font-size: 0.85em;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.client-status {
  margin-left: auto;
  flex-shrink: 0;
}

.client-status .badge {
  font-size: 0.75em;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.client-search-header {
  position: sticky;
  top: 0;
  background: var(--whiteColor);
  z-index: 10;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}

.no-clients-found {
  text-align: center;
  padding: 40px 20px;
  color: var(--bodyColor);
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }
  
  .dashboard-side {
    flex-direction: row;
    gap: 24px;
  }
  
  .dashboard-side .card {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    border-radius: 0 20px 20px 0;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 16px 16px calc(72px + env(safe-area-inset-bottom));
  }
  
  /* Title and action on one row. This stacked because the action used to be
     "+ Add New Client" and needed the width; it is a 40px square now, and a
     header two rows tall pushed the page content down for nothing. It still
     wraps if a page carries wider actions — reports.php has a select and an
     export button — rather than squeezing them. */
  .main-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
  }

  /* The title has to be allowed to shrink, or the row will not hold: a flex
     item's min-width is its own content by default, so a long page name
     pushed the action onto a second row however much room was left. */
  .main-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }
  
  .main-header h1 {
    font-size: 1.5em;
  }
  
  .main-actions {
    width: auto;
  }
  
  /* Two-up all the way down: one column made a phone scroll past four
     oversized cards before reaching the page content. */
  .stats-cards,
  .stats-grid,
  .staff-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }
  
  /* Pages carry 3, 4 or 5 stats. A lone card on the last row spans the width
     instead of sitting half-empty next to a gap. */
  .stats-cards .stat:last-child:nth-child(odd),
  .stats-grid .stat-card:last-child:nth-child(odd),
  .staff-stats .stat-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  
  .stat,
  .stat-card,
  .stat-item {
    padding: 14px 12px;
  }
  
  .stat-title,
  .stat-label {
    font-size: 0.75em;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
  }
  
  .stat-value,
  .stat-number {
    font-size: 1.6em;
  }
  
  .stat-sub {
    font-size: 0.75em;
  }
  
  /* A phone has room for a wider menu than a table cell suggests, but not for
     one that runs off the screen. */
  .action-dropdown {
    min-width: 200px;
    max-width: 80vw;
  }

  /* Recent Activity is a scannable list, not prose: ten rows at the desktop
     size pushed the pager off the bottom of the phone. The date is the
     quieter half, so it drops furthest. */
  .activity-item {
    padding: 9px 0;
    gap: 6px 10px;
    flex-wrap: wrap;
  }

  /* Three badges beside a date and a name leave the name about a word. They
     take the row under it instead, the way the appointment card's do. */
  .activity-badges {
    flex-basis: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  
  .activity-date {
    font-size: 12px;
    min-width: 62px;
  }
  
  .activity-details {
    font-size: 13px;
    line-height: 1.35;
  }
  
  .dashboard-side {
    flex-direction: column;
  }
  
  .bottom-tab-nav.d-lg-none { display: flex; }
  .sidebar-close.d-lg-none { display: flex; }
  
  .mobile-overlay {
    display: none;
  }
  
  .mobile-overlay.active {
    display: block;
  }
  
  /* Filter tabs responsive */
  .filter-tabs {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
  }
  
  .filter-tab {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.9em;
  }
  
  /* Search bar responsive */
  .search-bar {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }
  
  .search-bar input,
  .search-bar select {
    width: 100%;
    margin-bottom: 0;
  }
  
  /* Data table responsive */
  .data-table {
    font-size: 0.9em;
    min-width: 100%;
  }
  
  .data-table th,
  .data-table td {
    padding: 8px 6px;
    min-width: 80px;
  }
  
  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    min-width: 100px;
  }
  
  .data-table th {
    background: var(--lightGrayColor);
    position: sticky;
    top: 0;
    z-index: 2;
  }
  
  .data-table th:first-child {
    z-index: 3;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* Action buttons responsive */
  .action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }
  
  .action-btn {
    padding: 6px 8px;
    font-size: 0.8em;
    min-width: 32px;
  }
  
  .modal-content {
    width: 95%;
    max-width: 400px;
    margin: 20px auto;
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-row .form-group {
    margin-bottom: 16px;
  }
  
  .birthday-summary,
  .leaves-summary {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .birthday-item,
  .leave-item {
    padding: 12px;
    text-align: left;
  }
  
  .birthday-info,
  .leave-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .birthday-contact {
    margin-top: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .client-item {
    padding: 12px;
  }
  
  .client-avatar {
    width: 40px;
    height: 40px;
    font-size: 1em;
  }
  
  .client-details {
    flex-direction: column;
    gap: 4px;
  }
  
  .client-status {
    margin-left: 0;
    margin-top: 8px;
  }
  
  #calendar {
    padding: 16px;
    font-size: 14px;
    min-height: 500px;
    height: 100%;
  }
  
  .fc-header-toolbar {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }
  
  .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .fc-button {
    padding: 8px 12px !important;
    font-size: 13px !important;
    min-height: 40px;
  }
  
  .fc-button-group .fc-button {
    margin: 0 2px;
  }
  
  .fc-timegrid-slot {
    height: 44px !important;
  }
  
  .fc-timegrid-slot-label {
    font-size: 12px;
  }
  
  .fc-event {
    font-size: 11px !important;
    padding: 2px 4px !important;
  }
  
  .fc-event-title {
    font-size: 10px !important;
    line-height: 1.2;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom));
  }
  
  .main-header h1 {
    font-size: 1.5em;
  }
  
  .card {
    padding: 20px;
  }
  
  /* Filter tabs stack on small screens */
  .filter-tab {
    min-width: 100px;
    font-size: 0.85em;
    padding: 8px 12px;
  }
  
  /* Table adjustments for small screens */
  .data-table {
    font-size: 0.8em;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 4px;
    min-width: 60px;
  }
  
  .action-btn {
    padding: 4px 6px;
    font-size: 0.75em;
    min-width: 28px;
  }
  
  .modal-content {
    width: 98%;
    margin: 10px auto;
    padding: 16px;
    max-height: 90vh;
  }

  .form-actions {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  
  #calendar {
    min-height: 400px;
    height: 100%;
    padding: 12px;
  }
  
  .fc-header-toolbar {
    padding: 8px;
  }
  
  .fc-button {
    padding: 6px 8px !important;
    font-size: 12px !important;
    min-height: 36px;
  }
  
  .fc-timegrid-slot {
    height: 40px !important;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--daxaColor) 0%, var(--primaryColor) 100%);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primaryColor) 0%, var(--daxaColor) 100%);
}

/* Animation Classes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.fade-in {
  /* animation: fadeIn 0.3s ease forwards; */ /* Fade-in animations disabled */
}

.slide-in {
  animation: slideIn 0.3s ease forwards;
}

/* Focus Styles */
*:focus {
  outline: 2px solid var(--daxaColor);
  outline-offset: 2px;
}

/* Selection Styles */
::selection {
  background: color-mix(in srgb, var(--primaryColor) 20%, transparent);
  color: var(--blackColor);
}

/* Print Styles */
@media print {
  .sidebar,
  .bottom-tab-nav,
  .mobile-overlay,
  .main-actions {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* Custom Calendar Grid Styles */
.custom-calendar-container {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: white;
}

.custom-calendar-table { 
  width: 100%; 
  border-collapse: collapse; 
  margin-bottom: 0;
  table-layout: fixed;
}

.custom-calendar-table th, 
.custom-calendar-table td { 
  border: 1px solid #eee; 
  text-align: center; 
  min-width: 80px; 
  padding: 0; 
  vertical-align: top;
}

.time-header {
  width: 80px;
  min-width: 80px;
  background: #f8f9fa;
  border-right: 2px solid #e0e0e0;
  position: sticky;
  left: 0;
  z-index: 10;
}

.calendar-slot { 
  cursor: pointer; 
  background: #fafaff; 
  position: relative; 
  height: 38px; 
  transition: background 0.2s; 
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  min-height: 44px; /* Minimum touch target size */
}

.calendar-slot:hover { background: #e8eaff; }
.calendar-slot:active { background: #d1e7ff; }

.calendar-appt { 
  border-radius: 4px; 
  padding: 2px 4px; 
  margin: 2px 0; 
  font-size: 0.95em; 
  background: #b2f2bb; 
  color: #222; 
  font-weight: 500; 
  box-shadow: 0 1px 2px rgba(0,0,0,0.04); 
}

.time-label { 
  font-size: 0.9em; 
  color: #888; 
  background: #f8f9fa; 
  border-right: 2px solid #e0e0e0;
  position: sticky;
  left: 0;
  z-index: 10;
  font-weight: 500;
}

.appt-title { white-space: pre-line; }
.empty-slot-indicator { pointer-events: none; }

/* Scrollbar styling */
.custom-calendar-container::-webkit-scrollbar {
  width: 8px;
}

.custom-calendar-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.custom-calendar-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.custom-calendar-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .custom-calendar-container {
    max-height: 600px;
  }
  
  .custom-calendar-table th,
  .custom-calendar-table td {
    min-width: 80px;
    font-size: 0.85em;
    padding: 8px 4px;
    height: 60px;
  }
  
  .time-header,
  .time-label {
    width: 70px;
    min-width: 70px;
    font-size: 0.8em;
    font-weight: 500;
  }

  .calendar-appt {
    font-size: 0.8rem !important;
    padding: 4px 6px !important;
    line-height: 1.2 !important;
  }
}

/* Status Card Design */
.status-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: var(--whiteColor);
  box-shadow: var(--cardShadow);
  transition: var(--transition);
}

.status-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f79f3 0%, #796df6 100%);
  border-radius: 16px 16px 0 0;
}


.status-card-title {
  text-align: center;
  font-size: 0.85em;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  margin-top: 16px;
}

.status-pill {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 16px 16px 16px;
}

.status-pill span {
  background: linear-gradient(135deg, #2ed47e 0%, #1e9e5a 100%);
  color: #000;
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  padding: 8px 20px;
  border-radius: 50px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(46, 212, 126, 0.3);
  transition: var(--transition);
}

/* Status variations */
.status-pill.status-inactive span {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.status-pill.status-followup span {
  background: linear-gradient(135deg, #ffb264 0%, #f39c12 100%);
  box-shadow: 0 2px 8px rgba(255, 178, 100, 0.3);
}

/* Hover effects */
.status-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--hoverShadow);
}

.status-pill span:hover {
  transform: scale(1.05);
}

.client-search-container {
  position: relative;
  width: 100%;
}

@media (max-width: 600px) {
  .client-search-container .suggestions {
    left: 0 !important;
    right: 0 !important;
    min-width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }
}
/* ── Small-screen fallbacks ──────────────────────────────────────────────────
   The pages that were never given responsive rules: their tables stretched the
   page sideways and the cards ran off the edge. Each wide block scrolls inside
   its own box instead. */
@media (max-width: 768px) {
  .client-table-container,
  .appointment-table-container,
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Pages whose tables have no wrapper to scroll — make the table the box. */
  .staff-table,
  .leaves-table,
  .settings-container table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card {
    padding: calc(18px * var(--densityScale));
  }

  /* Settings rows are inline flex with a fixed label column; stack them. */
  .settings-container .form-group[style*="flex"] {
    flex-wrap: wrap;
  }
}

/* ── Mobile sizing: tap targets, and buttons that don't all become bars ─────── */
@media (max-width: 768px) {
  /* Compact but still thumb-sized; below ~36px the miss rate climbs. */
  .btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.875em;
  }

  .action-btn {
    min-height: 32px;
    min-width: 32px;
  }

  /* Page-level actions sit at the end of the header row and wrap together if
     there is no room, instead of becoming a stack of full-width bars. */
  .main-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  /* Inline buttons keep their own width — a toolbar of them turning into a
     stack of full-width bars is what made these screens unusable. Only the
     page actions and a form's own submit stretch. */
  .btn {
    width: auto;
    padding: 7px 12px;
    font-size: 0.85em;
  }

  .modal-content button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  .card {
    padding: 16px;
    margin-bottom: 16px;
  }

  .main-header {
    padding: 12px 14px;
  }

  .action-btn {
    padding: 6px 8px;
    font-size: 0.8em;
  }
}


/* ── Mobile modals: full-screen sheet ────────────────────────────────────────
   On a phone a modal takes the whole page: a fixed header holds the title and
   close, a fixed footer holds the form's actions, and only the fields between
   them scroll. `.modal >` outranks the page-level <style> blocks in
   clients.php / appointments.php, which load after this file. */
@media (max-width: 768px) {
  .modal {
    align-items: stretch;
    justify-content: stretch;
    backdrop-filter: none;
  }

  .modal > .modal-content {
    width: 100%;
    /* The inline min-width (up to 700px) pushed the page sideways, the inline
       max-width (down to 300px) left it a floating card — a style attribute
       only loses to !important. */
    min-width: 0 !important;
    max-width: none !important;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0 16px;
    border: none;
    border-radius: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Column + a growing form keeps the action bar on the bottom edge even
       when the form is shorter than the screen. */
    display: flex;
    flex-direction: column;
  }

  .modal > .modal-content > form {
    flex: 1 0 auto;
  }

  /* Header band: full-bleed so scrolling fields don't show through the gutters. */
  .modal > .modal-content > .close {
    position: sticky;
    top: 0;
    right: auto;
    margin: 10px 0 0 auto;
    z-index: 3;
  }

  .modal > .modal-content > h2,
  .modal > .modal-content > h3 {
    position: sticky;
    top: 0;
    z-index: 2;
    /* Pull up alongside the close button, which is the preceding sibling. */
    margin: -42px -16px 16px;
    padding: 12px 48px 12px 16px;
    font-size: 1.15em;
    line-height: 1.3;
    background: var(--whiteColor);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  /* ── Fields: one per line, full width ───────────────────────────────────── */
  /* flex-wrap alone does nothing here — the children carry flex:1, so they
     shrink instead of wrapping. Turn the row itself into a column. */
  .modal-content form > div[style*="display:flex"]:not(:has(> .btn)),
  .modal-content form > div[style*="display: flex"]:not(:has(> .btn)),
  .modal-content .form-row-flex,
  .modal-content .form-row {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
  }

  .modal-content .form-row .form-group,
  .modal-content .form-row-flex > div {
    width: 100%;
    margin-bottom: 0;
  }

  /* 10px + the form's 6px gap matches the 16px between plain label/field pairs. */
  .modal-content .form-group {
    margin-bottom: 10px;
  }

  /* A tight gap binds each label to its own field; the label's top margin is
     what separates one field from the next. The form is a flex column with no
     per-field wrapper, so a single gap can't do both. */
  .modal-content form {
    gap: 6px;
  }

  .modal-content form > label {
    margin: 12px 0 0;
  }

  .modal-content label {
    font-size: 0.9em;
  }

  .modal-content input,
  .modal-content select,
  .modal-content textarea {
    width: 100%;
    box-sizing: border-box;
    /* 16px is the threshold below which iOS zooms the page on field focus. */
    font-size: 16px;
    padding: 10px 12px;
  }

  .modal-content input[type="checkbox"],
  .modal-content input[type="radio"] {
    width: auto;
  }

  .modal-content textarea {
    min-height: 72px;
  }

  /* ── Actions: pinned to the bottom, every button on screen ──────────────── */
  /* Either a .form-actions wrapper or a bare div of buttons ending the form. */
  .modal > .modal-content .form-actions,
  .modal > .modal-content form > div:last-child:has(> .btn) {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    /* auto pushes the bar to the bottom edge when the form is short; it
       collapses to 0 once the form is long enough to scroll and sticky takes
       over. */
    margin: auto -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--whiteColor);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  /* Share the row: one fills it, two sit side by side, more wrap. */
  .modal > .modal-content .form-actions .btn,
  .modal > .modal-content form > div:last-child:has(> .btn) > .btn {
    flex: 1 1 40%;
    width: auto;
    justify-content: center;
  }
}

/* ── Appointment form rows ──────────────────────────────────────────────────
   One markup, two layouts. On a desktop each field keeps its label above it and
   the Date/From and Duration/Price pairs sit side by side, which is what the
   modal has always looked like. On a phone the label moves to the left of its
   own field so a row costs one line instead of two, and the date and time share
   that line — a form that used to need two screens now needs one. */
@media (min-width: 769px) {
  .appt-pair {
    display: flex;
    gap: 10px;
  }

  .appt-pair > .appt-row {
    flex: 1;
  }

  .appt-row-fields {
    display: contents;
  }

  /* Date over its input, From over its own, two equal columns — the pair reads
     as two fields even though one label sits outside the wrapper. */
  .appt-row-datetime {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 10px;
  }

  .appt-row-datetime > label { grid-area: 1 / 1; }
  .appt-row-datetime input[type="date"] { grid-area: 2 / 1; }
  .appt-row-datetime .appt-inline-label { grid-area: 1 / 2; }
  .appt-row-datetime input[type="time"] { grid-area: 2 / 2; }
}

@media (max-width: 768px) {
  /* Label left, field right, both on one line. The field keeps its own width
     rather than filling the row — a date, a time, a price and a treatment name
     are all different lengths, and stretching each to the full width is what
     made the form twice as tall as it needed to be. */
  /* Every label + control pair, whatever wrapper the page wrote it in: the
     .appt-row markup, client_details.php's .form-row-flex columns, or the
     inline-flex columns on appointments.php and index.php. Matching all three
     is what saves rewriting six forms to say the same thing. */
  .modal-content .appt-row,
  .modal-content .form-group,
  .modal-content .form-row-flex > div,
  .modal-content form > div[style*="display:flex"]:not(:has(> .btn)) > div,
  .modal-content form > div[style*="display: flex"]:not(:has(> .btn)) > div {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
  }

  /* One label column for the whole form. Each row sizing its own label is what
     left the fields starting at seven different x positions; a fixed column
     lines them all up. 120px clears the longest label, "Treatment Type *".
     No wrapping either — a field too wide for what is left must shrink, not
     drop below its label, which is what .client-search-container's width:100%
     used to do. */
  .modal-content .appt-row > label,
  .modal-content .form-group > label,
  .modal-content .form-row-flex > div > label,
  .modal-content form > div[style*="flex"] > div > label {
    /* min() keeps the column from eating a narrow phone: 120px on a 390px
       screen, proportionally less on a 320px one, and the same width on every
       row either way, which is what does the aligning. */
    flex: 0 0 min(120px, 34%);
    max-width: min(120px, 34%);
  }

  .modal-content .appt-row > *:not(label),
  .modal-content .form-group > *:not(label),
  .modal-content .form-row-flex > div > *:not(label),
  .modal-content form > div[style*="flex"] > div > *:not(label) {
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-content .appt-row .client-search-container,
  .modal-content .form-group .client-search-container,
  .modal-content .form-row-flex .client-search-container,
  .modal-content form .client-search-container {
    width: auto;
    min-width: 0;
  }

  /* A row that sits straight in the form gets the 6px that, with the form's own
     6px gap, matches the 12px between rows inside a wrapper. */
  .modal-content form > .appt-row {
    margin-bottom: 6px;
  }

  .modal-content .appt-row > label,
  .modal-content .form-group > label,
  .modal-content .form-row-flex > div > label,
  .modal-content form > div[style*="display:flex"] > div > label,
  .modal-content form > div[style*="display: flex"] > div > label {
    margin: 0;
  }

  /* A textarea is the exception: it keeps its label above and the full width,
     because a sentence of notes has nowhere to go on half a phone row. */
  .modal-content .form-group:has(> textarea),
  .modal-content .form-row-flex > div:has(> textarea),
  .modal-content form > div[style*="flex"] > div:has(> textarea) {
    display: block;
  }

  .modal-content .form-group:has(> textarea) > label,
  .modal-content .form-row-flex > div:has(> textarea) > label,
  .modal-content form > div[style*="flex"] > div:has(> textarea) > label {
    display: block;
    margin-bottom: 6px;
  }

  /* Every field fills its column, so the boxes share a left edge and a right
     edge. Sizing each one to its own content (field-sizing) lined the labels up
     but left the boxes ragged — a 60px price next to a 220px name. */
  .modal-content .appt-row input,
  .modal-content .appt-row select,
  .modal-content .appt-row textarea,
  .modal-content .form-group > input,
  .modal-content .form-group > select,
  .modal-content .form-row-flex > div > input,
  .modal-content .form-row-flex > div > select,
  .modal-content form > div[style*="display:flex"] > div > input,
  .modal-content form > div[style*="display:flex"] > div > select,
  .modal-content form > div[style*="display: flex"] > div > input,
  .modal-content form > div[style*="display: flex"] > div > select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  /* Notes sits on its row like any other field; the box takes what is left and
     stays a single line tall, which the user can drag open. "Current therapy
     reason" keeps its own line above a taller box — it is the longer answer. */
  .modal-content .appt-row-notes > textarea {
    flex: 1 1 auto;
    width: auto;
    min-height: 0;
    height: 44px;
    resize: vertical;
  }

  /* The pair stops being a pair: each row gets its own line. */
  .modal-content .appt-pair {
    display: block;
  }

  /* 6px + the row's own 6px bottom margin = the 12px every other row gets. */
  .modal-content .appt-pair > .appt-row + .appt-row {
    margin-top: 6px;
  }

  /* Date and time sit side by side; the time needs no label beside it. */
  .modal-content .appt-row-fields {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Date and time split the one field column. The date needs the room: ten
     characters of "18/09/2026" against the time's five. Both run on trimmed
     side padding — 16px font cannot shrink (iOS zooms below it), so the room
     has to come from the padding or the value gets clipped. */
  .modal-content .appt-row-fields > input[type="date"],
  .modal-content .appt-row-fields > input[type="time"] {
    padding-left: 8px;
    padding-right: 8px;
    min-width: 0;
  }

  .modal-content .appt-row-fields > input[type="date"] {
    flex: 1 1 62%;
  }

  .modal-content .appt-row-fields > input[type="time"] {
    flex: 1 1 38%;
  }

  .modal-content .appt-inline-label {
    display: none;
  }

  /* Past prices for this client are a desk-side reference, not something to
     scroll past on a phone. */
  .modal-content #editAppointmentPriceHistoryContainer,
  .modal-content #appointmentPriceHistoryContainer {
    display: none;
  }

  /* GESY: the tickbox and its label on one line, the dropdown on the next. The
     "GESY option" label repeats the tickbox beside it and the settings hint is
     a sentence of explanation — neither earns a line on a phone. The dropdown
     does: "GESY B — client pays €10.00" does not fit what is left of the row
     beside the label column, and a select truncates rather than wraps. */
  .modal-content .gesy-field {
    gap: 8px 12px;
    flex-wrap: wrap;
  }

  /* The tickbox and the word GESY together stand in for the label column, so
     the dropdown starts where every field above it starts rather than at the
     tickbox. 16px box + 12px gap + 92px word fills the 120px column. */
  .modal-content .gesy-field > .gesy-enabled {
    flex: 0 0 16px;
  }

  .modal-content .gesy-field > label[for$="esyEnabled"] {
    flex: 0 0 auto;
  }

  .modal-content .gesy-field > .appt-i { margin-left: -8px; }

  .modal-content .gesy-field .gesy-enabled:checked ~ .gesy-option-wrap {
    display: flex;
    flex-basis: 100%;
    min-width: 0;
  }

  .modal-content .gesy-field .gesy-option-wrap > label,
  .modal-content .gesy-field .gesy-option-wrap > small {
    display: none;
  }

  /* The "type a name and we'll suggest" preamble explains the field that is
     directly below it; on a phone it costs two lines to say so. */
  .modal-content .form-intro {
    display: none;
  }

  /* The longest option is ~27 characters; at the form's own size it still
     overruns the box on a 320px screen, and the arrow crops it. */
  .modal-content .gesy-field .gesy-option-wrap > select {
    width: 100%;
    max-width: none;
    font-size: 13px;
  }
}

/* ── Calendar: month overview + agenda day ──────────────────────────────────
   Month is a glance, not a booking surface: the event pills are hidden and
   each day carries a coloured dot per treatment with how many therapies it
   holds (painted by paintMonthTherapyCounts() in index.php). */
.fc-dayGridMonth-view .fc-daygrid-event-harness,
.fc-dayGridMonth-view .fc-daygrid-more-link {
  display: none;
}

.fc-dayGridMonth-view .fc-daygrid-day-frame {
  min-height: 62px;
}

.therapy-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px 4px;
  /* The frame is a flex column, so this pins the badges to the day's bottom
     whatever height the row settles on. */
  margin-top: auto;
}

.therapy-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--blackColor);
}

.therapy-count i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Agenda (Day) rows: finger-sized, and the treatment dot carries the colour. */
.fc-list-event-dot {
  border-width: 5px;
}

.fc-list-event td {
  padding: 12px 14px;
  cursor: pointer;
}

@media (max-width: 800px) {
  /* Four view buttons plus prev/next/today do not fit one phone row. */
  .fc-header-toolbar.fc-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 12px !important;
  }

  .fc-toolbar-chunk {
    display: flex;
    align-items: center;
  }

  .fc-dayGridMonth-view .fc-daygrid-day-frame {
    min-height: 52px;
  }

  /* Week on a phone is a day grid (see the view config in index.php): the
     stacked header already carries the weekday and the date, so the in-cell
     number would only repeat it, and the chips wrap instead of truncating. */
  .fc-timeGridWeek-view .fc-daygrid-day-top {
    display: none;
  }

  .fc-timeGridWeek-view .fc-daygrid-day-frame {
    min-height: 120px;
  }

  .fc-timeGridWeek-view .fc-daygrid-event {
    padding: 4px 5px !important;
    margin: 2px !important;
    min-height: 0 !important;
    font-size: 0.7rem !important;
    white-space: normal;
  }

  /* Chips read title-first, the way the phone's own calendar does: the name
     is what you scan for and the time is the detail under it. FullCalendar
     stacks time-over-title, so the frame is reversed rather than re-templated
     through eventContent — the DOM order still reads time-then-title, which
     is what a screen reader should hear. */
  /* Both chip shapes share one frame (.fc-event-main-frame): .fc-h-event is
     the day-grid week, .fc-timegrid-event the 3-day grid. A short event keeps
     FullCalendar's own side-by-side row — stacking two lines inside a 15-minute
     harness only clips them. */
  .fc-h-event .fc-event-main-frame,
  .fc-timegrid-event:not(.fc-timegrid-event-short) .fc-event-main-frame {
    flex-direction: column-reverse;
    /* column-reverse runs bottom-to-top, so flex-end is the top of the chip —
       without it the text sinks to the bottom of a tall harness. */
    justify-content: flex-end;
  }

  .fc-event .fc-event-time {
    font-weight: 500 !important;
    opacity: 0.75 !important;
  }

  .fc-timegrid-event {
    padding: 5px 7px !important;
    box-shadow: none !important;
  }
}

/* ── Week chips on a narrow screen ──────────────────────────────────────────
   Above 800px the week is still a time grid, and seven columns on a tablet
   leave each one about 45px wide. The card-sized chip box (6px padding, a
   harness gutter, a 0.8rem font) left roughly 20px of text width, so
   `pre-line` + `break-word` broke every name down the column one letter per
   row. The chip gets a hairline box and a font that keeps a name on one line;
   what still overflows is clipped with an ellipsis rather than stacked.
   Only the time-grid week needs this — below 800px the week is a day grid,
   whose chips are full-width blocks and want to wrap. */
@media (max-width: 1024px) {
  /* Seven columns need the whole screen. The card's padding, the page gutter
     and the calendar's own padding were costing ~40px a side, so the calendar
     card alone goes edge to edge — the negative margin is the standard
     full-bleed pair, which does not care what the ancestors' padding is. */
  .card-calendar {
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }

  /* The heading keeps its indent; only the grid goes full width. */
  .card-calendar > h2 {
    padding-left: 12px;
    padding-right: 12px;
  }

  #calendar {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* "09" needs about 20px; the rest was gutter the columns wanted. */
  .fc .fc-timegrid-axis {
    width: 34px !important;
  }

  .fc .fc-timegrid-axis-cushion,
  .fc .fc-timegrid-slot-label-cushion {
    padding: 0 3px !important;
    font-size: 10px !important;
  }

  .fc-timeGridWeek-view .fc-timegrid-event-harness {
    margin: 0 !important;
  }

  .fc-timeGridWeek-view .fc-timegrid-event {
    padding: 1px 2px !important;
    margin: 0 !important;
    border-radius: 3px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    box-shadow: none !important;
  }

  /* The whole name, one word per row — no ellipsis. Covers both shapes of the
     week chip: .fc-timegrid-event above 800px, .fc-daygrid-event below it.
     `break-word` splits a word only when it cannot fit a row on its own, which
     is why it used to stack single letters in a ~20px chip and now leaves
     "Andreas" whole, breaking only something the column genuinely cannot hold.
     FullCalendar clips the title (max-height:100%; overflow:hidden), so the
     name is given all the height the appointment's own duration already
     reserves — at 9px and a 30-minute slot that is several rows spare. */
  .fc-timeGridWeek-view .fc-event-title,
  .fc-timeGridWeek-view .fc-event-time {
    font-size: 9px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-height: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* ── Day-detail popover (month grid) ────────────────────────────────────────
   Anchored under the tapped day by JS; the caret follows the day even when
   the card is clamped to the viewport edge. */
.calendar-day-tip {
  /* Absolute, so it scrolls with its day. It is re-parented to <body> before
     being positioned (see showDayTip), so page coordinates are what count. */
  position: absolute;
  z-index: 1200;
  width: min(320px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: 14px 16px 10px;
  background: var(--whiteColor);
  border: 1px solid var(--surfaceBorder);
  border-radius: var(--radiusCard);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.calendar-day-tip[hidden] {
  display: none;
}

.calendar-day-tip-caret {
  position: absolute;
  top: -7px;
  left: var(--tip-caret, 50%);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: var(--whiteColor);
  border-left: 1px solid var(--surfaceBorder);
  border-top: 1px solid var(--surfaceBorder);
  transform: rotate(45deg);
}

.calendar-day-tip.is-above .calendar-day-tip-caret {
  top: auto;
  bottom: -7px;
  transform: rotate(225deg);
}

.calendar-day-tip-close {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
}

.calendar-day-tip-date {
  margin-bottom: 8px;
  padding-right: 24px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blackColor);
}

.calendar-day-tip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 0;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.calendar-day-tip-bar {
  width: 4px;
  align-self: stretch;
  min-height: 30px;
  border-radius: 2px;
  flex-shrink: 0;
}

.calendar-day-tip-text {
  flex: 1;
  min-width: 0;
}

.calendar-day-tip-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--primaryColor);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day-tip-sub {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.calendar-day-tip-time {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

/* The count badges are the popover's trigger, so they read as a control. */
button.therapy-counts {
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
}

button.therapy-counts:hover .therapy-count,
button.therapy-counts:focus-visible .therapy-count {
  color: var(--primaryColor);
}

/* ── Time grid: stacked day headers ─────────────────────────────────────── */
.fc-day-head-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}

.fc-day-head-weekday {
  font-weight: 700;
}

.fc-day-head-date {
  font-weight: 500;
  opacity: 0.75;
}

@media (max-width: 800px) {
  /* Seven columns on a phone: everything shrinks so the grid fits the width
     instead of scrolling sideways. */
  .fc .fc-col-header-cell-cushion {
    padding: 6px 2px;
    font-size: 11px;
  }

  .fc-day-head-date {
    font-size: 10px;
  }

  /* The hour gutter was eating a whole column's worth of width. */
  .fc .fc-timegrid-axis-cushion,
  .fc .fc-timegrid-slot-label-cushion {
    padding: 0 4px;
    font-size: 10px;
  }

  .fc .fc-event-title,
  .fc .fc-event-time {
    font-size: 10px;
  }

  /* Scrolling to the end of the day used to stop under the bottom tab bar:
     the last slots and the status line sat behind it. */
  .calendar-status-bar {
    margin-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  #calendar {
    padding-bottom: 8px;
  }
}

/* Month days are press-and-hold targets: no text selection or iOS callout
   while the finger is down. */
.fc-dayGridMonth-view .fc-daygrid-day-frame {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.fc-dayGridMonth-view .fc-daygrid-day-frame,
.fc-dayGridMonth-view .fc-daygrid-day-number {
  cursor: pointer;
}

/* Stat cards are links now: they keep the card look, and gain the pointer and
   focus ring a link should have. */
a.card.stat {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

a.card.stat:focus-visible {
  outline: 2px solid var(--primaryColor);
  outline-offset: 2px;
}

/* The list arrived from a report stat card: name the number it explains. */
.slice-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--primaryColor);
  background: color-mix(in srgb, var(--primaryColor) 10%, transparent);
  font-size: 0.9rem;
}

.slice-banner a {
  color: var(--primaryColor);
  font-weight: 600;
  white-space: nowrap;
}

/* The re-added total for the rows on screen. Empty unless the slice has one,
   and gap handles the spacing, so it takes no room when it says nothing. */
.slice-total {
  font-weight: 600;
}
.slice-total:empty {
  display: none;
}

/* ── Overlapping appointments ───────────────────────────────────────────────
   Two bookings that cross in time each keep the WHOLE column. FullCalendar
   splits the column between them by default (inline `left`/`right`
   percentages on the harness, z-index rising with stack depth), which leaves
   both chips too narrow to read a name on — a 9:30 booking wore a sliver and
   showed "Anna Konst…".

   At full width the z-index FullCalendar already assigns does the rest: the
   later booking paints over the earlier one, so the earlier chip reads as
   ending where the next begins. fitOverlappingEvents() (assets/js/overlap.js)
   then clamps each chip to the strip that is actually visible, stopping a few
   pixels short so the two do not merge into one block of colour. */
.fc-timegrid-event-harness {
  left: 0 !important;
  right: 0 !important;
  margin-left: 4px !important;
  margin-right: 4px !important;
}

/* Every chip carries its own outline, so where one booking ends and the next
   begins is always visible — including where a chip is clipped against the
   one painted over it, and where two of them share a colour. */
.fc-timegrid-event {
  border: 1px solid rgba(0, 0, 0, 0.45) !important;
  box-sizing: border-box !important;
}

.fc-timegrid-event.is-covered {
  /* Only as tall as the part nothing covers; the rest is cut, not hidden
     under the neighbour. */
  overflow: hidden !important;
  /* A clamped chip has no room for the padding it wears when it owns the
     slot, and the text is the part that should get the space. */
  padding-top: 3px !important;
  padding-bottom: 2px !important;
}

/* FullCalendar gives the title container flex-grow: 1, and the phone layout
   reverses the frame (column-reverse, further up this file) so the time sits
   at the chip's far edge. Clamp such a chip and the time is carried up onto
   the last line of the name and the two render ON TOP of each other — which
   is unreadable, and worse, invisible to a scrollHeight check because
   overlapping is not overflowing.
   flex-shrink: 0 is what turns it back into an honest overflow: the pieces
   keep their natural height, the name sits at the top, and anything that
   does not fit runs off the bottom where `overflow: hidden` cuts it. The
   measurement in overlap.js can then see it and drop the time. */
.fc-timegrid-event.is-covered .fc-event-main-frame {
  flex-grow: 0 !important;
  /* No justify-content here. Both layouts already pack to the visual top —
     the desktop frame is `column` (flex-start), the phone's is
     `column-reverse` (flex-end, further up this file) — and forcing either
     value is wrong for the other. Forcing flex-end pushed the desktop chip's
     content UP past its own top edge: the time rendered at offsetTop -16,
     outside the clip, invisible and impossible to measure, because overflow
     off the top edge does not count towards scrollHeight. */
}

.fc-timegrid-event.is-covered .fc-event-title-container,
.fc-timegrid-event.is-covered .fc-event-time {
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
}

/* Not enough room for both: the name is what identifies the booking. */
.fc-timegrid-event.is-name-only .fc-event-time {
  display: none !important;
}

.fc-timegrid-event.is-name-only {
  line-height: 1.15 !important;
}

/* ── Appointment modals (new + edit, every page): header, Details | Notes
   tabs, a 6-column field grid, footer with SMS + actions. ───────────────── */
.appt-modal .modal-content {
  max-width: 620px; width: 94%; padding: 0; display: flex; flex-direction: column;
  overflow: hidden; position: relative; border-radius: min(var(--radiusCard), 10px);
}
.appt-head { display: flex; align-items: center; gap: 6px; padding: 14px 20px 0; }
.appt-modal .appt-head h2 {
  flex: 1; margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3;
  position: static; padding: 0; background: none;
}
.appt-x, .appt-icon {
  width: 32px; height: 32px; flex: 0 0 32px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: none; color: var(--textMuted); border-radius: 6px; cursor: pointer;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.appt-x:hover, .appt-icon:hover { background: color-mix(in srgb, var(--primaryColor) 7%, transparent); color: var(--textMain); }
.appt-x:focus-visible, .appt-icon:focus-visible, .appt-tab:focus-visible { outline: 2px solid var(--primaryColor); outline-offset: -2px; }
.appt-x i { font-size: 20px; }
.appt-icon i { font-size: 19px; }
.appt-banner { margin: 10px 20px 0; padding: 8px 12px; border-radius: 6px; font-size: 13px;
  background: #fff8e1; border: 1px solid #f1d27a; color: #6b5200; }
.appt-modal form { display: flex; flex-direction: column; min-height: 0; flex: 1; margin: 0; }
.appt-tabs { display: flex; gap: 4px; padding: 0 20px; margin-top: 10px; border-bottom: 1px solid var(--surfaceBorder); }
.appt-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--textMuted);
  transition: color .15s ease-out, border-color .15s ease-out;
}
.appt-tab i { font-size: 17px; }
.appt-tab:hover { color: var(--textMain); }
.appt-tab[aria-selected="true"] { color: var(--primaryColor); border-bottom-color: var(--primaryColor); font-weight: 600; }
.appt-tab:focus:not(:focus-visible) { outline: none; }
.appt-tab.has-content::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--primaryColor); }
.appt-body { padding: 14px 20px 16px; overflow-y: auto; min-height: 0; flex: 1; }
.appt-pane { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 12px; }
.appt-pane[hidden] { display: none; }
.appt-section {
  grid-column: 1 / -1; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--surfaceBorder);
  font-size: 12px; font-weight: 600; color: var(--textMain);
}
.appt-pane > .appt-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.appt-f { grid-column: span var(--span, 6); min-width: 0; position: relative; }
.appt-modal .appt-f > label { display: block; margin: 0 0 4px; font-size: 12px; font-weight: 500; color: var(--textMuted); }
.appt-modal .appt-f input:not([type=checkbox]):not([type=radio]),
.appt-modal .appt-f select, .appt-modal .appt-f textarea {
  width: 100%; box-sizing: border-box; margin: 0; height: 36px; padding: 6px 10px; font-size: 14px;
  border: 1px solid var(--surfaceBorder); border-radius: min(var(--radiusControl), 6px); background: #fff;
}
.appt-modal .appt-f textarea { height: auto; min-height: 72px; resize: vertical; }
.appt-modal .appt-f input[readonly] { background: color-mix(in srgb, var(--primaryColor) 3%, #fff); }
.appt-modal .appt-history { margin-top: 8px !important; background: color-mix(in srgb, var(--primaryColor) 3%, #fff) !important; color: var(--textMuted); }
.appt-modal .gesy-field { margin: 0 !important; padding: 10px 12px; border: 1px solid var(--surfaceBorder); border-radius: min(var(--radiusControl), 6px); }
.appt-foot {
  display: flex; align-items: center; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--surfaceBorder); background: color-mix(in srgb, var(--primaryColor) 2%, #fff);
}
.appt-foot > .appt-sms.appt-sms { margin: 0 auto 0 0 !important; }
.appt-sms label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; cursor: pointer; }
.appt-sms input { width: 16px; height: 16px; margin: 0; }
.appt-foot .btn { height: 34px; min-height: 34px; padding: 0 16px; font-size: 14px; box-shadow: none; transform: none;
  border-radius: min(var(--radiusControl), 6px); }
.appt-foot .btn-secondary { background: #fff; color: var(--textMain); border: 1px solid var(--surfaceBorder); }
.appt-foot .appt-delete { color: #b3261e; }
.appt-foot .appt-delete:hover { background: #fdf0ef; color: #b3261e; }
@media (max-width: 600px) {
  .appt-f { grid-column: span 6; }
  .appt-f.appt-keep { grid-column: span 3; }
  .appt-head, .appt-tabs, .appt-body, .appt-foot { padding-left: 14px; padding-right: 14px; }
}
/* The shared phone rule for "last row of buttons in a modal" (sticky, 40%
   buttons, negative margins) is for the older modals; this footer has its own. */
@media (max-width: 768px) {
  .modal.appt-modal > .modal-content > form > div.appt-foot.appt-foot:last-child {
    position: static; margin: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    flex-wrap: nowrap; gap: 8px; background: color-mix(in srgb, var(--primaryColor) 2%, #fff);
  }
  .modal.appt-modal > .modal-content > form > div.appt-foot.appt-foot:last-child > .btn.btn { flex: 0 0 auto; width: auto; }
  .appt-sms label { font-size: 12px; }
}

/* "i" info: the hint lives in data-tip, shown on hover, focus or tap. */
.appt-i { position: relative; display: inline-flex; vertical-align: middle; padding: 0; margin: 0 0 0 2px; border: 0; background: none; color: var(--textMuted); cursor: help; line-height: 1; }
.appt-i .material-icons { font-size: 15px; }
.appt-i:hover, .appt-i:focus-visible { color: var(--primaryColor); }
.appt-i::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; width: max-content; max-width: 240px; padding: 6px 8px; border-radius: 4px; background: #333; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.35; text-align: left; white-space: normal; visibility: hidden; opacity: 0; transition: opacity .12s; pointer-events: none; }
.appt-i:hover::after, .appt-i:focus::after { visibility: visible; opacity: 1; }

/* ── Structured surfaces ────────────────────────────────────────────────
   Header, cards and stat tiles: flat, bordered, tight radius, no lift on
   hover, no accent bars. Radius follows Settings > Appearance but is capped
   so "rounded" never turns the page into bubbles. */
.main-header {
  margin-bottom: 16px;
  padding: 14px 20px;
  border: 1px solid var(--surfaceBorder);
  border-left: 1px solid var(--surfaceBorder);
  border-radius: min(var(--radiusCard), 8px);
  box-shadow: none;
}
.main-header h1 { font-size: 1.4em; line-height: 1.25; }
.main-header .icon-btn {
  width: 32px; height: 32px; min-width: 32px;
  border: 1px solid var(--surfaceBorder);
  border-radius: min(var(--radiusControl), 6px);
  background: transparent;
  color: var(--primaryColor);
  font-size: 20px; font-weight: 300;
  box-shadow: none;
}
.main-header .icon-btn:hover, .main-header .icon-btn:focus-visible {
  background: var(--primaryColor);
  border-color: var(--primaryColor);
  color: var(--whiteColor, #fff);
}

.card {
  border-radius: min(var(--radiusCard), 8px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  margin-bottom: 16px;
  padding: calc(20px * var(--densityScale));
}
.card:hover, .stat-card:hover, .stat-item:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
a.card.stat:hover { border-color: color-mix(in srgb, var(--primaryColor) 35%, var(--surfaceBorder)); }
.card > h2 { margin: 0 0 12px; font-size: 1.05em; font-weight: 600; line-height: 1.3; }

.stats-cards, .stats-grid, .staff-stats { gap: 12px; margin-bottom: 16px; }
.stat, .stat-card, .stat-item {
  text-align: left;
  padding: 12px 14px;
  border-radius: min(var(--radiusCard), 8px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.stat:before, .stat-card:before, .stat-item:before { content: none; }
.stats-cards > .card, .stats-grid > .card, .staff-stats > .card { margin-bottom: 0; }
.birthday-info { gap: 0; line-height: 1.35; }
.birthday-date, .birthday-age { font-size: 12px; }
.stat-title, .stat-label {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .4px;
  color: var(--textMuted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value, .stat-number { margin: 0; font-size: 1.5em; font-weight: 600; line-height: 1.2; }

.birthday-summary { margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--textMuted); }
.birthday-summary #birthdayCount { margin-left: 4px; font-size: 1em; font-weight: 600; color: var(--textMain); }
.birthdays-list { border-top: 1px solid var(--surfaceBorder); padding-top: 0; }
.birthday-item {
  padding: 10px 4px;
  margin: 0;
  background: none;
  border-radius: 0;
  border-bottom: 1px solid var(--surfaceBorder);
}

@media (max-width: 768px) {
  .main-content { padding: 12px 12px calc(72px + env(safe-area-inset-bottom)); }
  .main-header { padding: 10px 12px; margin-bottom: 12px; }
  .main-header h1 { font-size: 1.2em; }
  .stats-cards, .stats-grid, .staff-stats { gap: 8px; margin-bottom: 12px; }
  .stat, .stat-card, .stat-item { padding: 10px 12px; }
  .stat-title, .stat-label { font-size: 10.5px; letter-spacing: .3px; margin-bottom: 2px; }
  .stat-value, .stat-number { font-size: 1.3em; }
  .card { padding: 14px; margin-bottom: 12px; }
  .birthday-summary { flex-direction: row; text-align: left; gap: 0; }
  .birthday-item { padding: 10px 2px; }
}

/* Settings > SMS Gateway */
.settings-page .gw-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.settings-page .gw-status { font-size: 1.05em; padding-top: 4px; }
.gw-status[data-state=on] { color: var(--successColor, #2e7d32); }
.gw-status[data-state=warn] { color: #b26a00; }
.gw-status[data-state=off], .gw-status[data-state=bad] { color: var(--dangerColor, #c62828); }
a.card.stat.gw-status-card:not(.is-link) { cursor: default; }
a.card.stat.gw-status-card:not(.is-link):hover { border-color: var(--surfaceBorder); }
.gw-status-card.is-link .gw-status::after { content: ' \2197'; font-size: .8em; }
.gw-table-wrap { overflow-x: auto; }
.gw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gw-table th { text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; color: var(--textMuted); padding: 6px 8px; border-bottom: 1px solid var(--surfaceBorder); white-space: nowrap; }
.gw-table td { padding: 8px; border-bottom: 1px solid var(--surfaceBorder); }
.gw-table .num { text-align: right; white-space: nowrap; }
.gw-table .num-l { white-space: nowrap; }
.gw-table td.gw-empty { text-align: center; color: var(--textMuted); padding: 16px 8px; }
.settings-page .gw-refresh { width: 32px; height: 32px; background: transparent; border: 1px solid var(--surfaceBorder); color: var(--primaryColor); border-radius: min(var(--radiusControl), 6px); }
.settings-page .gw-refresh i { color: inherit; font-size: 18px; }
.settings-page .gw-refresh:hover { background: var(--primaryColor); border-color: var(--primaryColor); color: #fff; }
@media (max-width: 480px) {
  .gw-table { font-size: 12px; }
  .gw-table th, .gw-table td { padding: 6px 4px; }
  .gw-table th { font-size: 10px; letter-spacing: .2px; }
}
