/* ============================================================
   NexGravision - Salon Management System Design System
   Reference-matched palette: Deep Navy · Dark Teal · Bright Cyan ·
   Aqua · Ice White. Typography: Cormorant Garamond + Manrope.

   All values below are sampled from the supplied reference screenshot:
   sidebar navy/teal waves, active-menu cyan/aqua pill, sky-blue page
   field, ice-white content cards and dark teal gradient panels.
   ============================================================ */

:root {
  /* Typefaces — timeless serif headlines, humanist sans for data */
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;

  /* Reference palette — exact sampled shades */
  --navy-950: #05253B;      /* deepest sidebar navy */
  --navy-900: #082C46;      /* sidebar navy / dark panel top */
  --navy-800: #0A304E;      /* primary dark navy-teal */
  --navy-700: #0C3B5B;      /* raised navy-teal */
  --teal-700: #0C3B5B;
  --teal-600: #0E5A82;      /* deep teal text and borders */
  --teal-500: #1179AC;      /* primary teal-blue action */
  --teal-400: #178CC0;
  --cyan-500: #1FA9D2;      /* bright cyan */
  --cyan-400: #29B8E6;      /* bright cyan accent / focus */
  --aqua-400: #5CCFE8;      /* aqua */
  --aqua-300: #8FD9EE;      /* light aqua */
  --ice-300: #CDEDF8;       /* ice border */
  --ice-200: #E4F4FB;       /* light aqua surface */
  --ice-100: #F2FAFE;       /* ice white */
  --white: #FFFFFF;
  --ink: #0A2E4A;           /* deep navy headings */
  --ink-2: #1A5476;         /* teal body text */
  --muted: #5E8296;         /* slate-teal labels */

  /* Legacy token names remapped to the reference palette */
  --navy: var(--navy-800);
  --navy-raised: var(--navy-700);
  --violet: var(--teal-500);
  --violet-600: var(--teal-700);
  --lavender: var(--ice-200);
  --pearl: var(--ice-100);
  --sidebar-bg: var(--navy-800);
  --sidebar-raised: var(--navy-700);
  --sidebar-text: var(--ice-100);
  --sidebar-text-2: #D6ECF6;
  --sidebar-text-3: #93BBD0;
  --sidebar-border: rgba(143, 217, 238, 0.16);
  --sidebar-hover: rgba(143, 217, 238, 0.12);
  --sidebar-danger: #F0A0AE;

  --bg: var(--ice-100);
  --surface: var(--white);
  --surface-2: var(--ice-200);
  --border: var(--ice-300);
  --border-strong: var(--aqua-300);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--muted);

  --brand: var(--teal-500);
  --brand-600: var(--teal-700);
  --brand-50: var(--ice-200);
  --brand-100: var(--ice-300);

  --champagne: var(--cyan-500);
  --champagne-50: var(--ice-200);

  /* Semantic accents kept inside the same cool teal/cyan family */
  --green: #1E8FA6;
  --green-600: #156C80;
  --green-50: #E3F5F8;
  --amber: #177E9E;
  --amber-50: #E7F5FB;
  --red: #C8556D;           /* only for destructive / alert states */
  --red-600: #A93E55;
  --red-50: #FBECEF;
  --sky: #1C7FA8;
  --sky-50: #E7F4FA;
  --violet-50: var(--ice-200);

  /* Reference gradients */
  --grad-sidebar: linear-gradient(158deg, #05253B 0%, #082C46 32%, #0A304E 56%, #0C3B5B 78%, #11618C 100%);
  --grad-page:
    radial-gradient(ellipse 110% 55% at 62% 108%, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(ellipse 90% 42% at 18% -8%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 12% 8%, rgba(31, 169, 210, 0.95) 0%, rgba(31, 169, 210, 0) 46%),
    radial-gradient(circle at 93% 24%, rgba(10, 96, 142, 0.85) 0%, rgba(10, 96, 142, 0) 42%),
    radial-gradient(circle at 84% 94%, rgba(212, 241, 250, 0.95) 0%, rgba(212, 241, 250, 0) 48%),
    linear-gradient(135deg, #2FA9D2 0%, #5CC4E4 38%, #9FE0F2 68%, #DDF4FB 100%);
  --grad-active: linear-gradient(90deg, #A7DEEF 0%, #6FC7E4 52%, #2D80AE 100%);
  --grad-dark: linear-gradient(135deg, #082C46 0%, #0A304E 42%, #0E6A9E 100%);
  --grad-light: linear-gradient(160deg, #FFFFFF 0%, #F4FBFE 100%);
  --grad-stat: linear-gradient(160deg, #EAF7FC 0%, #F7FCFF 100%);

  --radius: 18px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(10, 96, 140, 0.07);
  --shadow-md: 0 8px 20px rgba(10, 96, 140, 0.10);
  --shadow-lg: 0 18px 40px rgba(8, 60, 94, 0.18);

  --sidebar-w: 264px;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
.brand-name, .topbar-title h1, .panel-head h3, .modal-head h2,
.stat-value, .edh-name, .profile-hero-info h2, .login-company,
.empty-title, .birthday-info h4, .service-card h4, .setup-head strong {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: -0.02em;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============ Layout (mobile-first) ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: min(var(--sidebar-w), 84vw);
  background: var(--sidebar-bg);
  color: var(--sidebar-text-2);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 37, 59, 0.52);
  backdrop-filter: blur(2px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.main {
  flex: 1;
  margin-left: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============ Brand ============ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  display: grid;
  place-items: center;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-sm);
}

.brand-text { display: flex; flex-direction: column; }
.brand-name { color: var(--sidebar-text); font-weight: 600; font-size: 16px; letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--sidebar-text-3); letter-spacing: 0; }

/* ============ Nav ============ */
.nav { flex: 1; padding: 8px 12px; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { width: 0; height: 0; }
.nav-label {
  font-size: 11px;
  letter-spacing: 0;
  color: var(--sidebar-text-3);
  font-weight: 600;
  padding: 16px 8px 8px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 8px;
  color: var(--sidebar-text-2);
  font-weight: 500;
  font-size: 14px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 2px;
  text-align: left;
}

.nav-item svg { width: 18px; height: 18px; opacity: 0.85; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }

.nav-logout {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--sidebar-text-3);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item .nav-logout svg { width: 16px; height: 16px; opacity: 0.85; }
.nav-item.active .nav-logout svg { color: inherit; opacity: 0.85; }
.nav-logout:hover { background: var(--sidebar-hover); color: var(--sidebar-danger); }
.nav-logout:hover svg { opacity: 1; color: var(--sidebar-danger); }

.sidebar-footer { padding: 16px 16px 20px; border-top: 1px solid var(--sidebar-border); }

.admin-chip { display: flex; align-items: center; gap: 12px; }
.admin-avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(31, 169, 210, 0.20);
  color: var(--sidebar-text);
  font-weight: 600;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.admin-name { color: var(--sidebar-text); font-weight: 600; font-size: 13px; }
.admin-role { color: var(--sidebar-text-3); font-size: 12px; }

/* ============ Topbar ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;
  background: rgba(242, 250, 254, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 12px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.today-chip {
  display: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ============ Content ============ */
/* width:100% is required - .content is a flex-column child (.main) and its
   auto inline margins disable the flex stretch, which would shrink the whole
   page to its content width instead of filling the screen. */
.content { padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); width: 100%; max-width: 1440px; margin-inline: auto; }
.section { display: none; animation: fadeIn 0.4s ease; }
/* Stacked panels inside a section get the same gap as everywhere else
   (hero → panel) - fixes Request Leave / Leaves cards touching. */
.section > .panel + .panel { margin-top: 16px; }
.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ============ Stat cards ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
/* A lone trailing card (odd count in a 2-col grid) stretches across the
   full row instead of leaving a half-empty gap - applied to every section. */
.stat-grid > .stat-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* All sections (admin + employee dashboard): no icon chip on stat cards -
   the value sits directly at the top. */
.stat-card .stat-top { display: none; }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--stat-bg, var(--brand-50));
  color: var(--stat-accent, var(--brand));
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; margin-top: 8px; }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 8px; font-weight: 500; }

/* ============ Panels ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Admin dashboard: every panel full-width, stacked one under another */
.panel-grid.panel-grid-full { grid-template-columns: 1fr; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.panel-body { padding: 8px; }

.link-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 4px 8px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--brand-50); }

/* ============ Toolbar ============ */
.section-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 44px;
  width: 100%;
  min-width: 0;
  /* Compact at EVERY width: the box never stretches across the whole
     toolbar row, whether or not the Clear button is on screen. */
  max-width: 380px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.search-box svg { color: var(--text-3); width: 16px; height: 16px; }
.search-box input { border: none; outline: none; background: none; width: 100%; font-weight: 500; }
.search-box input::placeholder { color: var(--text-3); font-weight: 400; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-600); }

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

.btn-danger-soft { background: var(--red-50); color: var(--red); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--red) 12%, var(--surface)); }

.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }

.data-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--text-2);
  vertical-align: middle;
  white-space: nowrap;
}

/* Appointments: cell text wraps so the table fits its container instead of
   overflowing it - this removes the horizontal scrollbar under the table. */
#appointmentTable td { white-space: normal; }

.data-table tbody tr { transition: background 0.15s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.person-cell { display: flex; align-items: center; gap: 12px; }
.person-name { font-weight: 600; color: var(--text); font-size: 14px; }
.person-meta { font-size: 12px; color: var(--text-3); }
/* Avatar boxes are removed app-wide - rule lives after the base .avatar
   definition (same specificity; last rule wins). */

.avatar {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--brand-50);
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.avatar-lg { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
.avatar-xl { width: 84px; height: 84px; border-radius: 16px; font-size: 28px; }

/* No initials/avatar boxes anywhere in the app - tables, detail modals,
   pickers, birthday cards, sidebar chip and the employee panel all show
   plain text instead. Placed AFTER the base rules above on purpose. */
.avatar { display: none; }
.admin-avatar { display: none; }

.icon-action {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.icon-action svg { width: 16px; height: 16px; }
.icon-action:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }
.icon-action.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-50); }

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-green { background: var(--green-50); color: var(--green); }
.badge-amber { background: var(--amber-50); color: var(--amber); }
.badge-red { background: var(--red-50); color: var(--red); }
.badge-sky { background: var(--surface-2); color: var(--text-2); }
.badge-violet { background: var(--surface-2); color: var(--text-2); }
.badge-gray { background: var(--surface-2); color: var(--text-2); }
.badge-brand { background: var(--surface-2); color: var(--text-2); }

/* ============ Chips ============ */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============ Switch tabs (segmented control) ============
   Visible tab switcher used to split a list between two audiences
   (e.g. Birthdays & Anniversaries → All / Employees / Customers). */
.switch-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 14px;
}
.switch-tab {
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.switch-tab:hover { color: var(--text); }
.switch-tab.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ============ Empty state ============ */
.empty-state {
  padding: 56px 24px;
  text-align: center;
}
.empty-state.panel { margin-top: 0; }
.empty-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.empty-text { color: var(--text-3); font-size: 13px; }
.empty-inline { padding: 32px 16px; }

/* ============ Modal ============ */
.modal-root { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.modal-root.open { pointer-events: auto; }

/* A detail/edit popup is open - freeze everything behind it (html, body and
   the app's scrolling .content) so the background page cannot scroll.
   Only the .modal-body inside the popup keeps scrolling. */
html.modal-open,
html.modal-open body,
html.modal-open .content {
  overflow: hidden !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 37, 59, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.4s ease;
}

.modal {
  position: relative;
  margin: auto 0 0;
  width: 100%;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.modal-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; }
.modal-head p { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 500; }

.modal-close {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--brand-50);
  border-color: var(--brand-50);
  color: var(--brand);
}

.modal-body { padding: 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
/* Premium footer: full-width action pair (project-wide, every popup) */
.modal-foot .btn {
  flex: 1;
  justify-content: center;
  height: 44px;
  font-weight: 600;
  border-radius: 12px;
  /* A longer label (e.g. "Send on WhatsApp") stays on ONE line - when the row
     cannot fit, the .modal-foot wrap moves whole buttons to the next line
     instead of breaking the label. */
  white-space: nowrap;
}
/* Icon-only footer buttons (Employee Details) - square, never stretch */
.modal-foot .btn.btn-icon-only {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
}
.modal-foot:has(.btn-icon-only) { justify-content: center; gap: 16px; }
/* Payment detail's Share Bill action keeps its natural width beside the
   icon-only Close button instead of stretching across the footer. */
.modal-foot #paymentShareWa { flex: 0 0 auto; }

/* ============ Right-side detail drawer ============
   Slides in from the right over a dimmed page (same freeze/scroll rules as
   the popup layer). Used for the employee profile opened from an
   attendance card. */
.drawer-root { position: fixed; inset: 0; z-index: 210; pointer-events: none; }
.drawer-root.open { pointer-events: auto; }

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 37, 59, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.4s ease;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(470px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: drawerIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
@keyframes drawerIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.drawer-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.4px; }
.drawer-head p { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
/* The strip / calendar / grids keep their own margins inside the drawer */
.drawer-body .panel-summary-strip { margin-top: 0; }

@media (max-width: 639px) {
  .drawer { width: 100%; border-left: 0; }
}

/* ============ Forms ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Three fields sharing ONE row (e.g. Appointment Date · Time · Status):
   full-width inside .form-grid, then split into three equal columns. */
.field-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  grid-column: 1 / -1;
}
@media (min-width: 640px) {
  .field-row-3 { grid-template-columns: repeat(3, 1fr); }
}

.field { display: flex; flex-direction: column; gap: 8px; }
/* Author `display:flex` above would otherwise beat the UA [hidden] rule and
   keep a hidden field on screen - the employee form's Role toggle relies on
   this (same pattern as .hero-chip[hidden], .linked-record[hidden], ...). */
.field[hidden] { display: none; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0;
}
.field label .req { color: var(--red); margin-left: 2px; }
/* Two bare .field blocks stacked as DIRECT children of .modal-body (the
   WhatsApp wish sheet and the appointment thank-you sheet) have no
   .form-grid gap between them - without this the second label lands
   flush on the control above it. Forms wrap their fields in .form-grid
   (never a direct .modal-body child), so this only touches the sheets. */
.modal-body > .field + .field { margin-top: 16px; }

.field input,
.field select,
.field textarea {
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  outline: none;
  font-weight: 500;
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field textarea { height: auto; min-height: 84px; padding: 12px 12px; resize: vertical; line-height: 1.55; }

/* Focus ring: --brand-50 on white is ~1.1:1 (invisible), so ring the control
   with a translucent brand tint instead - readable and still subtle. */
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
}

/* The base `outline: none` above outranks the global :focus-visible rule,
   so keyboard users got no outline at all - restore it, keyboard only. */
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.field input::placeholder, .field textarea::placeholder { color: var(--text-3); font-weight: 400; }

.field .hint { font-size: 12px; color: var(--text-3); }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A5476' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Hover feedback for selects in modal fields (text inputs keep the default
   arrow). --border-strong is a visibly darker neutral than --border. */
.field select:hover {
  cursor: pointer;
  border-color: var(--border-strong);
}

/* Selects that sit outside a .field (filters in panel heads - leave
   employee, attendance month/status) get the same project look: custom
   chevron, bordered pill, brand focus ring. */
.panel-head select {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  padding: 0 34px 0 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A5476' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* --brand-100 is within ~1 value of --border, so the old hover read as no
   change at all; --border-strong is a visibly stronger neutral. */
.panel-head select:hover { border-color: var(--border-strong); }
.panel-head select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
  color: var(--text);
}

.field.disabled input, .field.disabled select { background: var(--surface-2); color: var(--text-3); }

/* Element-level disabled (e.g. js sets roleSel.disabled = true) - the
   wrapper class above never matches in that case. background-color (not the
   `background` shorthand) so the chevron SVG survives. */
.field input:disabled,
.field select:disabled {
  background-color: var(--surface-2);
  border-color: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}

.auto-id-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 12px 12px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0;
}
.auto-id-box span:first-child { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: 0; }

/* ============ Detail card (profile) ============ */
.profile-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 24px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 16px;
}
/* Premium top accent bar - project colour only (brand) */
.profile-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--brand);
}
.profile-hero .avatar-xl { box-shadow: var(--shadow-md); }
.profile-hero-info h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.5px; word-break: break-word; }
.profile-hero-info .role { font-size: 13px; color: var(--text-2); font-weight: 600; margin-top: 4px; word-break: break-word; }
.profile-hero-info .badges { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }

/* Customer Details - compact hero card (smaller box + smaller type) */
.profile-hero.profile-hero-compact { gap: 10px; padding: 14px 16px; margin-bottom: 14px; }
.profile-hero.profile-hero-compact::before { height: 3px; }
.profile-hero.profile-hero-compact .avatar-xl { width: 44px; height: 44px; font-size: 15px; }
.profile-hero.profile-hero-compact h2 { font-size: 16px; letter-spacing: -0.3px; }
.profile-hero.profile-hero-compact .role { font-size: 12px; margin-top: 2px; }
.profile-hero.profile-hero-compact .badges { margin-top: 8px; gap: 6px; }

/* Three detail cards sharing ONE row (e.g. Due Amount · Method · Status) */
.detail-row-3 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .detail-row-3 { grid-template-columns: repeat(3, 1fr); }
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.detail-item .label {
  font-size: 11px;
  letter-spacing: 0;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.detail-item .value { font-weight: 600; font-size: 14px; color: var(--text); word-break: break-word; }

/* Section title with the vertical accent bar (premium popup pattern -
   used in every detail modal and profile section, project colours only) */
.detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text-2);
  font-weight: 600;
  margin: 24px 0 12px;
}
.detail-section-title::before {
  content: '';
  width: 4px;
  height: 15px;
  border-radius: 4px;
  background: var(--brand);
  flex-shrink: 0;
}

/* ============ Birthdays ============ */
.birthday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.birthday-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.birthday-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.birthday-info { flex: 1; min-width: 0; }
.birthday-info h4 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.birthday-info .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.birthday-info .date { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 8px; }

.days-pill {
  text-align: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--brand);
  min-width: 64px;
}
.days-pill .num { font-size: 20px; font-weight: 600; line-height: 1; letter-spacing: -0.5px; }
.days-pill .lbl { font-size: 11px; font-weight: 600; letter-spacing: 0; margin-top: 4px; }
.days-pill.today { background: var(--champagne-50); color: var(--amber); }
.days-pill.soon { background: var(--brand-50); color: var(--brand); }
.days-pill.later { background: var(--surface-2); color: var(--text-2); }

.birthday-month-head {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
  margin: 8px 0 -4px;
  padding-left: 2px;
}

/* Admin list card - occasion badge on top, send action in a footer row. */
.birthday-card { flex-direction: column; align-items: stretch; gap: 12px; }
.bc-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.bc-main .birthday-info { flex: 1; min-width: 0; }
.birthday-info .badge { margin-bottom: 6px; }
.bc-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Receptionist Celebrations table: month divider + compact days pill. */
.cel-table .cel-month-row { cursor: default; }
.cel-table .cel-month-row td {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
}
.cel-table .days-pill { display: inline-flex; flex-direction: column; min-width: 58px; padding: 5px 9px; }
.cel-table .days-pill .num { font-size: 15px; }
.cel-table .days-pill .lbl { font-size: 10px; margin-top: 2px; }

/* ============ Celebrations - premium occasion switcher (admin) ============
   Primary Birthday | Anniversary tabs: select which occasion the upcoming
   list below shows. The composer's occasion cards were removed. */
.cel-kind-tabs {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.cel-kind-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.cel-kind-tab .ck-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  flex-shrink: 0;
  transition: inherit;
}
.cel-kind-tab .ck-ic svg { width: 19px; height: 19px; }
.cel-kind-tab .ck-txt { display: block; min-width: 0; }
.cel-kind-tab .ck-txt strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text);
}
.cel-kind-tab .ck-txt small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cel-kind-tab:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.cel-kind-tab.active {
  background: var(--brand);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.cel-kind-tab.active .ck-txt strong,
.cel-kind-tab.active .ck-txt small { color: #fff; }
.cel-kind-tab.active .ck-txt small { opacity: 0.85; }
.cel-kind-tab.active .ck-ic {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
@media (max-width: 480px) {
  .cel-kind-tabs { flex-direction: column; }
}

/* Section heading above the upcoming list (title + count chip) */
.cel-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.cel-list-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; color: var(--text); }
.cel-list-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-50);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ============ Services ============ */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.service-card:hover { box-shadow: var(--shadow-md); }

.service-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.service-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--violet-50);
  color: var(--violet);
  display: grid;
  place-items: center;
}
.service-card { position: relative; }
/* Category + status badges share the top row */
.service-card-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
/* Keep long category badges clear of the pinned delete button */
.service-card > div:nth-of-type(2) { padding-right: 48px; }
.service-card h4 { font-size: 15px; font-weight: 600; letter-spacing: 0; margin-top: 12px; }
.service-card .desc { font-size: 13px; color: var(--text-2); line-height: 1.55; }

.service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.service-price { font-weight: 600; font-size: 15px; letter-spacing: 0; }
.service-price small { font-weight: 600; font-size: 11px; color: var(--text-3); }

/* ============ Dashboard list rows ============ */
.mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.mini-row:hover { background: var(--surface-2); }
.mini-row .info { flex: 1; min-width: 0; }
.mini-row .info .t { font-weight: 600; font-size: 13px; }
.mini-row .info .s { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 14px;
  right: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: none;
}
.toast.success::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.toast.error::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ============ Confirm dialog ============ */
.confirm-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.confirm-text strong { color: var(--text); }

/* ============ Responsive - mobile-first enhancements ============ */

/* Large phones / small tablets */
@media (min-width: 480px) {
  .toast-wrap { left: auto; right: 20px; max-width: 380px; }
  .toast { max-width: 340px; }
}

/* Tablets / large phones landscape */
@media (min-width: 640px) {
  .modal-root { display: flex; align-items: center; justify-content: center; }
  .modal-root > div { width: 100%; }
  .content { padding: 24px 24px 40px; }
  .topbar { padding: 16px 24px; gap: 16px; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-title p { font-size: 13px; }

  .section-toolbar { flex-direction: row; align-items: center; gap: 12px; }
  .search-box { height: 40px; min-width: 220px; max-width: 380px; width: auto; flex: 1; }
  .section-toolbar .btn { width: auto; flex-shrink: 0; }

  .form-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .form-grid .span-2 { grid-column: span 2; }
  .field input, .field select, .field textarea { height: 42px; font-size: 14px; }
  .field textarea { height: auto; }

  .detail-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .detail-item.span-2 { grid-column: span 2; }

  /* LEFTOVER CARD -> full width. When an odd card ends a row it would sit
     half-empty, so stretch it across the whole grid. Covers both a card that
     is last in the grid and one that is only followed by full-width cards
     (Address / Notes / a detail-row-3). Applies to EVERY detail modal,
     drawer and profile section (#empApp grids use the same classes). */
  .detail-grid > .detail-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  /* Kept in separate rules: an unsupported :has() would void the whole rule. */
  .detail-grid > .detail-item:nth-child(odd):has(+ .detail-item.span-2) {
    grid-column: 1 / -1;
  }
  .detail-grid > .detail-item:nth-child(odd):has(+ .detail-row-3) {
    grid-column: 1 / -1;
  }

  .profile-hero {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 20px;
    padding: 24px;
  }
  .profile-hero-info .badges { justify-content: flex-start; }

  .modal {
    margin: 5vh auto;
    width: min(720px, calc(100% - 32px));
    max-height: 88vh;
    border-radius: 16px;
  }
  .modal.modal-sm { width: min(460px, calc(100% - 32px)); }
  .modal.modal-lg { width: min(820px, calc(100% - 32px)); }
  .modal-head { padding: 20px 24px; }
  .modal-body { padding: 24px 24px; }
  .modal-foot { padding: 16px 24px; justify-content: stretch; }
  .modal-foot .btn { flex: 1; }

  .stat-grid { gap: 16px; margin-bottom: 24px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-label { font-size: 13px; }
  .stat-sub { font-size: 12px; margin-top: 8px; }

  .btn { height: 40px; }
  .btn-sm { height: 32px; padding: 0 12px; }
}

/* Laptop & desktop - sidebar always docked (below 1024px it is an off-canvas
   drawer so tablets keep the full width for content) */
@media (min-width: 1024px) {
  .sidebar {
    width: var(--sidebar-w);
    transform: none;
    z-index: 50;
  }
  .sidebar-backdrop { display: none; }
  .main { margin-left: var(--sidebar-w); }
  #menuToggle, #empMenuToggle { display: none; }
  .today-chip { display: inline-flex; }
  .nav-item { padding: 8px 12px; }

  .content { padding: 24px 28px 40px; }
  .topbar { padding: 20px 28px; }
  .icon-action { width: 32px; height: 32px; }

  .panel-grid { gap: 20px; }
}

/* Tablets / small laptops */
@media (min-width: 768px) {
  .panel-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Wide desktop */
@media (min-width: 1024px) {
  .panel-grid { grid-template-columns: 1fr 1fr; }
  /* PC: 4 stat cards per row. A partial final row keeps NORMAL card size -
     only the mobile full-width orphan rule is neutralised here. */
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-grid > .stat-card:last-child:nth-child(odd) { grid-column: auto; }
}

/* ============================================================
   New sections · Redesigned popup · Mobile-first cards
   ============================================================ */

/* ============ Modal hero (custom popup header) ============ */
.modal-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.modal-hero-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.modal-hero-icon svg { width: 18px; height: 18px; }

/* Coloured icon chips are removed app-wide (same rule as the stat-card icon
   and the avatar boxes): every popup hero shows its title/subtitle only.
   The markup stays so a chip can be brought back in one line. */
.modal-hero-icon { display: none; }

.modal-hero-info { min-width: 0; }
.modal-hero-info h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.modal-hero-info p { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.modal-hero-id {
  margin-left: auto;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============ Form section titles ============ */
.form-section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.form-section-title.first { border-top: none; margin-top: 0; padding-top: 0; }

.form-section-title .num {
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--brand-50);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}

/* ============ Payment method radio cards ============ */
.pay-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.pay-method { position: relative; }
.pay-method input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.pay-method span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  padding: 0 8px;
}
.pay-method span::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.pay-method input:checked + span {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.pay-method input:checked + span::before {
  background: var(--brand);
  border-color: var(--brand);
}
.pay-method input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--brand-50);
}

@media (min-width: 640px) {
  .pay-methods { grid-template-columns: repeat(4, 1fr); }
}

/* ============ Toolbar date / select fields ============ */
.toolbar-date,
.toolbar-select {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 44px;
}
.toolbar-date label,
.toolbar-select label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
  white-space: nowrap;
}
.toolbar-date input,
.toolbar-select select {
  border: none;
  outline: none;
  background: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
  width: 100%;
}
.toolbar-select select { cursor: pointer; }
@media (min-width: 640px) {
  .toolbar-date,
  .toolbar-select { height: 40px; flex-shrink: 0; }
  .toolbar-date input,
  .toolbar-select select { width: auto; }
}

/* ============ Attendance status segments ============
   Heads the live status controls the attendance sections share: the
   segmented Present / Late / Absent / Half Day group (.seg-group) that the
   attendance day page renders inside its status group for BOTH roles (the
   admin trio directly, the receptionist trio wrapped in .att-day-actions),
   with the saved status's button carrying the on-* highlight. The card grid
   it once described is gone - the lists are tables now - but the segment
   control itself is what this block styles. */

.seg-group {
  display: inline-flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  flex-wrap: wrap;
}
.seg-group button {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.seg-group button:hover { color: var(--text-2); }
.seg-group button.on-present { background: var(--green-50); color: var(--green); }
.seg-group button.on-late { background: var(--amber-50); color: var(--amber); }
.seg-group button.on-absent { background: var(--red-50); color: var(--red); }
.seg-group button.on-half { background: var(--sky-50); color: var(--sky); }

/* Inside the page the segmented status group stays COMPACT (content-sized,
   never stretched across the block); below 640px it keeps its shrink-to-fit
   width. The remove-record action lives in the detail page's modal footer. */
.seg-group { flex: 0 0 auto; }
.seg-group button { flex: 0 0 auto; padding: 6px 10px; }

@media (max-width: 639px) {
  .seg-group { width: auto; }
}

/* ============ Attendance: data tables + punch-pair editor ============
   Two additions for the Attendance rework, kept together on purpose:
   (1) the admin/receptionist card grids became #attendanceTable and
   #empAttTable - the admin copy keeps all nine columns, the receptionist
   copy eight (its Actions column was removed when Check out / Break moved
   onto the attendance day page) - both wider than the app's other tables -
   so
   they get their own min-width floor plus first/last-column rules the
   generic .data-table does not provide; (2) the per-employee detail modal
   gained a MULTI-punch editor whose .punch-* markup is styled here as one
   unit. The editor's time inputs deliberately copy the
   #attDayDetail .value input[type="time"] look (defined further down, in
   the Attendance DATE DETAIL PAGE block) so the new controls read as
   native to this app. */

/* --- Tables (#attendanceTable admin · #empAttTable receptionist) ---
   Both sit inside a .table-wrap (overflow-x: auto). Everything here is
   scoped to >=640px because below that the shared "tables become cards"
   block restacks .data-table (min-width: 0, td text-align: left,
   white-space: normal): an ID selector would out-specify those class
   rules at EVERY width, so an unscoped min-width would widen the card
   layout into the wrap's overflow-x: hidden and clip the cards. The
   tiered column-hiding lists (Responsive: priority columns) do NOT name
   these two ids, so none of their columns is ever dropped by THAT
   block: #attendanceTable keeps all nine and simply scrolls sideways
   inside .table-wrap between 640-1279px, while #empAttTable now drops its
   four bookkeeping columns itself below 768px - see the tier block right
   after this one. */
@media (min-width: 640px) {
  /* Eight columns of content + 12px/16px cell padding needs more room than
     the generic 640px floor, or headers like "Total Worked" crush. */
  #attendanceTable,
  #empAttTable { min-width: 960px; }

  /* Employee cell (reuses the .person-cell / .person-name / .person-meta
     helpers): keep the name on one line - at 640-1279px the generic
     re-flow rule lets every cell wrap, which broke the name mid-row. */
  #attendanceTable td:first-child,
  #empAttTable td:first-child { white-space: nowrap; }

  /* Final Actions column (ADMIN table only - the receptionist copy has no
     Actions column any more): right-aligned, shrink-to-content
     (width: 1%) and never wrapped, so the slack goes to the data columns -
     above all the Employee one - instead of the button row stretching. */
  #attendanceTable th:last-child,
  #attendanceTable td:last-child {
    text-align: right;
    white-space: nowrap;
    width: 1%;
  }
}

/* --- Receptionist attendance floors (#empAttTable ONLY) ---
   This copy now has just four key columns (Employee / Status / Check-in /
   Check-out): the four bookkeeping columns and their .col-* classes were
   removed from BOTH the static <th>s and the row template, so the old
   below-768px hiding rule was retired with them. The admin #attendanceTable
   is untouched and still scrolls sideways inside .table-wrap. */
@media (max-width: 767px) {
  /* The 960px floor in the block above was sized for the old eight columns.
     Keep the floor contract but drop it below the tablet seam so the four
     remaining columns do not scroll sideways for nothing between 640-767px;
     .table-wrap's overflow-x:auto stays as the fallback (below 640px the
     card stack already sets min-width: 0 itself). */
  #empAttTable { min-width: 0; }
}

/* --- Attendance row editors (.att-status-seg / .att-time-*) ---
    Both attendance tables now use the same four columns - Employee | Status
    | In Time | Out Time - and the same editors: js/app.js emits a four-way
    status segment (P/A/H/L, the saved status carrying .active +
    aria-pressed="true") and an hh / mm / AM-PM group per punch side. Every
    rule is scoped to #attendanceTable and #empAttTable so the other
    .data-tables (and controls with neighbouring class names such as
    .seg-group) keep their own styling.
    Metrics reuse the in-table control language already in this file:
    .table-status-select's 30px height + hairline border set the row
    rhythm (so the restructure does not make rows jump), .chip's 8px
    radius and hover, .chip.active's brand fill for the selected letter,
    and .seg-group's 4px segment gap / 12px-600 label size. */

/* The four letters as one tight row. BLOCK-level flex, not inline-flex:
   an inline box baseline-aligns into the cell's line box and can add a
   few px of descender space, whereas this makes the cell's content box
   exactly the 30px buttons - the row-rhythm guarantee above. flex-wrap
   is the narrow-cell guard: <=639px restacks this td into a card and the
   row folds rather than pushing the card wider than the screen (the same
   wrap .seg-group already uses). 4px gap mirrors .seg-group. */
#attendanceTable .att-status-seg,
#empAttTable .att-status-seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

/* One P / A / H / L tile. background + border are declared explicitly so
   the global `button { border: none; background: none }` reset cannot
   leak native chrome through; cursor is restated for the same reason
   (and :disabled below takes it away again). 30px tall x 28px min-width
   = the square-ish tile in the reference; 12px/600 is the label size
   .table-status-select and .seg-group use. font-family is NOT set - the
   global `button, input, select { font-family: inherit }` already hands
   down the table's font. */
#attendanceTable .att-seg-btn,
#empAttTable .att-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease,
              border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover deepens the hairline only - the .chip:hover move. Declared
   BEFORE .att-seg-btn.active on purpose: equal specificity, so the
   selected tile keeps its dark fill under the pointer instead of ending
   up with --text ink on a --text ground (invisible text). */
#attendanceTable .att-seg-btn:hover,
#empAttTable .att-seg-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* Selected tile = .chip.active's treatment (brand ground, light ink,
   matching border), with #fff as the ink on the brand fill. Sits after
   :hover so the fill always wins; flipping .active / aria-pressed is js's
   job, this only paints it. */
#attendanceTable .att-seg-btn.active,
#empAttTable .att-seg-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Keyboard focus: brand hairline + the brand-50 halo .table-status-select:focus
   and .toolbar-select:focus-within already use. Deliberately LAST - it
   must outrank .active's border-color - and it sets no `outline`, so the
   global :focus-visible rule still draws its ring on top for keyboard
   users. */
#attendanceTable .att-seg-btn:focus-visible,
#empAttTable .att-seg-btn:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}

/* One punch side's controls: hh + mm + AM/PM. Same block-flex + wrap
   reasoning as .att-status-seg above; 6px gap per the reference, and
   .data-table td > * already grants min-width: 0 in the card stack so
   the folded rows can shrink with the card. */
#attendanceTable .att-time-group,
#empAttTable .att-time-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* hh / mm - 50px wide (the reference's 44-52px band), 30px tall so the
   row rhythm matches .table-status-select exactly. text-align: center
   parks "hh"/"mm" and the digits mid-box. Native spinners stay VISIBLE:
   no appearance:none and no ::-webkit-inner-spin-button hiding (the
   screenshot shows them, and no other input in this file strips them).
   Radius is --radius-sm (8px) - the radius every input in this file uses
   (.field, .punch-row, #attDayDetail); a 999px pill would round the
   corner out from under the spinner. font-size/weight mirror
   .data-table td (14px/500); font-family stays inherited, never
   redeclared. */
#attendanceTable .att-time-hh,
#attendanceTable .att-time-mm,
#empAttTable .att-time-hh,
#empAttTable .att-time-mm {
  width: 50px;
  height: 30px;
  padding: 0 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* AM/PM - the same 30px / hairline / 8px skin as the two inputs so the
   trio reads as one control; 60px fits the label plus the native arrow,
   which stays native on purpose: the custom chevron every other select
   wears hard-codes a stroke colour inside a data-URI, and this block may
   only use :root tokens. */
#attendanceTable .att-time-mer,
#empAttTable .att-time-mer {
  width: 60px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Pointer + keyboard feedback for the trio, copied from controls this
   file already ships: --border-strong on hover (.chip:hover, .field
   select:hover), brand border + brand-50 halo on focus
   (.table-status-select:focus). Uses :focus, not :focus-visible, so a
   click-to-type shows the halo too; no `outline` is suppressed here, so
   the global :focus-visible rule still rings keyboard users. */
#attendanceTable .att-time-hh:hover,
#attendanceTable .att-time-mm:hover,
#attendanceTable .att-time-mer:hover,
#empAttTable .att-time-hh:hover,
#empAttTable .att-time-mm:hover,
#empAttTable .att-time-mer:hover {
  border-color: var(--border-strong);
}

#attendanceTable .att-time-hh:focus,
#attendanceTable .att-time-mm:focus,
#attendanceTable .att-time-mer:focus,
#empAttTable .att-time-hh:focus,
#empAttTable .att-time-mm:focus,
#empAttTable .att-time-mer:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}

/* Empty "hh"/"mm" hints in the muted ink .field's placeholders use, so an
   unfilled control reads as a hint rather than as a value. */
#attendanceTable .att-time-hh::placeholder,
#attendanceTable .att-time-mm::placeholder,
#empAttTable .att-time-hh::placeholder,
#empAttTable .att-time-mm::placeholder {
  color: var(--text-3);
}

/* js flips these to :disabled while a status/time save is in flight - the
   same contract .table-status-select:disabled documents. Without it the
   explicit background/border/colour above would keep a locked control
   looking live. Uses opacity, not a colour, so no new hex enters. */
#attendanceTable .att-seg-btn:disabled,
#attendanceTable .att-time-hh:disabled,
#attendanceTable .att-time-mm:disabled,
#attendanceTable .att-time-mer:disabled,
#empAttTable .att-seg-btn:disabled,
#empAttTable .att-time-hh:disabled,
#empAttTable .att-time-mm:disabled,
#empAttTable .att-time-mer:disabled {
  opacity: 0.55;
  cursor: default;
}

/* --- Punch-pair editor (.punch-* class contract) ---
   One .punch-list per day holds N .punch-row in/out pairs (two time
   inputs and a remove button), an ordinal .punch-pair-label above each
   row, and the full-width ghost action under the list -
   .punch-checkout ("Check out", receptionist, rendered only while a
   session is still open) and .punch-add (used by FINAL DAY OUT). */

/* Vertical stack; the 8px gap matches the .detail-grid gap rhythm. */
.punch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* One in/out pair. Same surface as .detail-item (surface-2 ground,
   hairline border, 12px radius) so the rows read as part of the detail
   modal's field language; vertical padding tightened to 12px because
   several rows stack here instead of one boxed value. */
.punch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* "Pair 1" / "Session 1" - same metrics as .detail-item .label. Written
   to sit ABOVE its row (the 6px bottom margin groups it with the row,
   while the list gap then separates the pairs); harmless as an in-row
   flex child too. */
.punch-pair-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--text-3);
}

/* The in/out inputs: same look as the existing
   #attDayDetail .value input[type="time"] (surface ground, hairline
   border, 8px radius, 40px tall, 14px/600 ink, same focus ring below) so
   the new controls match the app's other time fields - the only
   difference is flex: 1 1 0 instead of width: 100%, because here the
   inputs share one flex row with the remove button. font-size also feeds
   the iOS no-auto-zoom exception in the mobile block further down. */
.punch-row input[type="time"] {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Focus ring copied from the #attDayDetail time inputs: --brand-50 is
   ~1.1:1 (invisible) on white, so the translucent brand tint instead.
   Base outline stays on, so the global :focus-visible rule covers the
   keyboard case. */
.punch-row input[type="time"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
}

/* Remove ONE pair: icon-sized ghost at rest that turns danger-soft on
   hover - .btn-ghost's surface/border language at a compact 36px square
   (.btn-icon-only is the 44px modal-foot sibling of this idea), tinted
   with the .btn-danger-soft red only on interaction so a list of rows
   does not read as a wall of red. Icon svg sized like .btn svg. */
.punch-del,
.punch-add-row {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-3);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.punch-del:hover {
  background: var(--red-50);
  color: var(--red);
}
.punch-add-row:hover {
  background: var(--brand-50);
  color: var(--brand);
}

/* The full-width ghost action under the list: the receptionist's
   "Check out" (.punch-checkout) and FINAL DAY OUT (.punch-add) share ONE
   skin - same 40px as the time
   inputs so the stack ends evenly either way. font-family/cursor come
   from the global button reset. */
.punch-add,
.punch-checkout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.punch-add:hover,
.punch-checkout:hover { background: var(--surface-2); color: var(--text); }
.punch-add svg,
.punch-del svg,
.punch-add-row svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* Optional per-day "worked" readout - deliberately just type: subtle
   12px meta ink and no wrap, so it reads the same whether it sits on a
   row or under the list. */
.punch-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

@media (max-width: 639px) {
  /* iOS Safari auto-zooms on focus when field font-size < 16px - the
     same exception the .field inputs and #attDayDetail's time inputs
     get in the mobile block above. */
  .punch-row input[type="time"] { font-size: 16px; }
}

/* ============ Amount / summary helpers ============ */
.amount-green { color: var(--green); font-weight: 600; }
.amount-red { color: var(--red); font-weight: 600; }

/* ============ Mobile-first: tables become cards ============ */
/* Shared card style for EVERY section: label stacked above the value,
   compact spacing, delete icon pinned to the card's top-right corner.
   Desktop (>=640px) is unaffected - this lives only in the mobile block. */
@media (max-width: 639px) {
  .modal-root { display: flex; align-items: flex-end; justify-content: center; }
  .modal-root > div { width: 100%; }
  /* iOS Safari auto-zooms on focus when field font-size < 16px */
  .field input, .field select, .field textarea,
  .search-box input,
  .login-field input,
  #attDayDetail .value input[type="time"] { font-size: 16px; }

  .panel .table-wrap { overflow-x: hidden; }
  .data-table { min-width: 0; width: 100%; }

  .data-table thead { display: none; }
  .data-table tbody { display: block; padding: 8px; }

  .data-table tbody tr {
    display: block;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    padding: 2px 8px;
    background: var(--surface);
  }
  .data-table tbody tr:last-child { margin-bottom: 4px; }

  .data-table td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    border: none;
    padding: 4px 12px;
    white-space: normal;
    text-align: left;
  }
  .data-table td::before {
    content: attr(data-label);
    font-size: 11.5px;
    letter-spacing: 0;
    color: var(--text-3);
    font-weight: 600;
    text-align: left;
  }
  .data-table td:empty { display: none; }

  .data-table td .person-cell { justify-content: flex-start; text-align: left; }
  .data-table td > * { min-width: 0; }
  .data-table td .person-cell > div { min-width: 0; overflow: hidden; }
}

/* ============ Responsive: priority columns ============ */
/* Phones (<640px) become cards above. Between phone width and full desktop
   the table keeps its grid but overflows the panel with a horizontal
   scrollbar - so less important columns are dropped instead of scrolling.
   Columns are keyed by a semantic .col-optional class worn by BOTH the <th>
   and the <td>; nth-child selectors silently hit the wrong column whenever a
   table loses a column, so none are used for these rules any more.
   Tier A (<=1279px): secondary columns hidden.
   Tier B (<=1000px): tertiary columns hidden too - only key data remains. */
@media (min-width: 640px) and (max-width: 1279px) {
  .data-table { min-width: 0; }

  /* Tier A - Staff Role (admin employees) */
  #employeeTable .col-optional { display: none; }
}

@media (min-width: 640px) and (max-width: 1000px) {
  /* Tier B - Service (admin customers) and Date (receptionist visits);
     Assigned To (admin visits) keeps its own semantic class too. */
  #customerTable .col-optional,
  #visitTable .col-optional,
  #empVisitsTable .col-optional { display: none; }
}

/* ============ Billing tool (New Bill) ============ */
/* The tool sits between the stat grid / hero and the list below in both
   Payments sections - it needs its own bottom gap (the .panel + .panel rule
   only covers panel-to-panel siblings, and the admin copy is followed by a
   toolbar instead). */
.bill-tool { margin-bottom: 16px; }
/* The receptionist New Bill panel starts collapsed - shown only after the
   hero's New Bill button is clicked. Explicit rule mirrors the codebase's
   other [hidden] overrides (.field[hidden], .hero-chip[hidden], ...) so no
   future .panel display rule can ever beat the UA [hidden] rule. */
.bill-tool[hidden] { display: none; }
.bill-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--brand-50);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
}
.bill-total .amount { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--brand); }
/* SUBTOTAL line closing the service list inside the New Bill tool - same
   shape as .bill-total but neutral, so the brand-tinted Amount due row
   below stays the one highlighted figure. */
.bt-subtotal {
  margin-top: 8px;
  background: var(--surface-2);
}
.bt-subtotal .amount { color: var(--text); font-size: 15px; }
/* Owner number + Save share one compact row inside the tool panel. */
.bt-owner-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bt-owner-row input { flex: 1; min-width: 0; }
.bt-owner-row .btn { flex-shrink: 0; }
/* #empApp ellipsizes .eli-t everywhere else - inside the tool the service
   name should WRAP like the admin copy does, so both panels read alike. */
#empApp #billToolEmp .eli-t { white-space: normal; overflow: visible; text-overflow: clip; }
.bill-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
/* The two send buttons start disabled (no appointment picked yet) - without
   this they'd render at full colour and look clickable. */
.bill-actions .btn:disabled { opacity: 0.55; cursor: not-allowed; }
.bill-actions .wa-btn:disabled:hover { background: var(--green); color: #fff; }
.wa-btn {
  background: var(--green);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.wa-btn:hover { background: var(--green-600); color: #fff; }
.wa-btn svg { width: 16px; height: 16px; }

/* Payments card (mobile): Customer full width, then Amount + Status.
   Method / Date / Notes are no longer columns - they live in the Payment
   Details modal. PC table untouched. */
@media (max-width: 639px) {
  #paymentTable tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }
  #paymentTable td[data-label="Customer"] { order: 1; grid-column: 1 / -1; }
  #paymentTable td[data-label="Amount"]   { order: 2; }
  #paymentTable td[data-label="Status"]   { order: 3; }
  #paymentTable td { align-items: center; text-align: center; }
  #paymentTable td::before { text-align: center; }
  #paymentTable td .person-cell { justify-content: center; text-align: center; }
}

/* Appointments card (mobile): Customer full width, then Date & Time +
   Status. Service / Assigned To moved to the Appointment Details modal.
   PC table untouched. */
@media (max-width: 639px) {
  #appointmentTable tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }
  #appointmentTable td[data-label="Customer"]    { order: 1; grid-column: 1 / -1; }
  #appointmentTable td[data-label="Date & Time"] { order: 2; }
  #appointmentTable td[data-label="Status"]      { order: 3; }
  #appointmentTable td { align-items: center; text-align: center; }
  #appointmentTable td::before { text-align: center; }
  #appointmentTable td .person-cell { justify-content: center; text-align: center; }
}

/* Expenses card (mobile): Title full width, then Amount + Date.
   Category / Method are no longer columns - both remain in the edit form.
   PC table untouched. */
@media (max-width: 639px) {
  #expenseTable tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 12px;
  }
  #expenseTable td[data-label="Title"]  { order: 1; grid-column: 1 / -1; }
  #expenseTable td[data-label="Amount"] { order: 2; }
  #expenseTable td[data-label="Date"]   { order: 3; }
  #expenseTable td { align-items: center; text-align: center; }
  #expenseTable td::before { text-align: center; }
}

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

/* ============================================================
   Autocomplete · Linked record · Auto price (Appointments)
   ============================================================ */

.autocomplete { position: relative; }
/* Editing an existing record: the person field is fixed - no dropdown. */
.autocomplete input[readonly] {
  background: var(--surface-2);
  color: var(--text-2);
  cursor: default;
}
.autocomplete input[readonly]:focus { border-color: var(--border); box-shadow: none; }

.ac-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-height: 264px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* wheel scrolling stays inside the dropdown - never chains to the page */
  overscroll-behavior: contain;
  display: none;
}
.autocomplete.open .ac-list { display: block; }

.ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 48px;
}
.ac-item:hover, .ac-item.active { background: var(--brand-50); }
.ac-item + .ac-item { border-top: 1px solid var(--border); }

.ac-item .avatar { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
.ac-item .ac-info { flex: 1; min-width: 0; }
.ac-item .ac-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item .ac-meta {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item .ac-price {
  margin-left: auto;
  font-weight: 600;
  font-size: 13px;
  color: var(--brand);
  white-space: nowrap;
  flex-shrink: 0;
}
.ac-item .ac-badge { flex-shrink: 0; }

.ac-empty {
  padding: 16px 16px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
}

.ac-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
  transition: background 0.15s;
  min-height: 48px;
}
.ac-add:hover, .ac-add:active { background: var(--brand-50); }
.ac-add svg { width: 16px; height: 16px; }

@media (min-width: 640px) {
  .ac-list { max-height: 300px; }
}

/* ============ Linked record preview ============ */
.linked-record {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  animation: fadeIn 0.4s ease;
}
.linked-record[hidden] { display: none; }

.linked-record .lr-info { flex: 1; min-width: 0; }
.linked-record .lr-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.linked-record .lr-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.linked-record .lr-id {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-50);
  padding: 2px 8px;
  border-radius: 8px;
  margin-top: 4px;
}

.linked-clear {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.linked-clear:hover { background: var(--red-50); color: var(--red); }
.linked-clear svg { width: 16px; height: 16px; }

/* ============ Auto price box ============ */
.auto-price-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--green-50);
  border: 1px solid var(--brand-100);
  color: var(--green);
  border-radius: 8px;
  padding: 0 12px;
  height: 46px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0;
}
.auto-price-box .price-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  opacity: 0.8;
  letter-spacing: 0;
}
.auto-price-box.empty {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
}
@media (min-width: 640px) {
  .auto-price-box { height: 42px; }
}

/* ============================================================
   Employee Panel - picker, toolbar, scoped dashboards
   ============================================================ */

.panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-bar .spacer { flex: 1; }
.panel-bar .btn-sm svg { width: 16px; height: 16px; }

.emp-pick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.emp-pick-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.emp-pick-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.emp-pick-card.selected {
  border-color: var(--brand);
  background: var(--brand-50);
}

.emp-pick-info { flex: 1; min-width: 0; }
.emp-pick-info h4 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-pick-info p {
  font-size: 12px;
  color: var(--text-3);
  margin: 2px 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-pick-arrow {
  color: var(--text-3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.emp-pick-arrow svg { width: 18px; height: 18px; }
.emp-pick-card:hover .emp-pick-arrow { color: var(--brand); }

@media (min-width: 480px) {
  .emp-pick-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .emp-pick-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

#panelView .profile-hero { margin-bottom: 16px; }
#panelProfile { margin-bottom: 4px; }

/* ============================================================
   Ease-of-use: bottom nav, badges, checklist
   ============================================================ */

/* ============ Setup checklist ============ */
.setup-checklist {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.setup-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.setup-head strong { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.setup-head span { font-size: 12px; color: var(--text-3); }

.setup-steps { display: grid; gap: 8px; }
.setup-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 12px;
}
.setup-step .num {
  width: 24px; height: 24px;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand);
  font-weight: 600;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.setup-step .lbl { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; }
.setup-step .lbl small { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); margin-top: 1px; }

@media (min-width: 640px) {
  .setup-steps { grid-template-columns: repeat(3, 1fr); }
}

/* ============ Clickable stat cards ============ */
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* ============ Empty-state CTA ============ */
.empty-cta { margin-top: 16px; }
.empty-cta .btn { min-width: 180px; }

/* Touch targets on phones & tablets (anything without the docked sidebar) */
@media (max-width: 1023px) {
  .seg-group button { min-height: 40px; }
  .link-btn { min-height: 40px; display: inline-flex; align-items: center; }
}

/* ============================================================
   Employee dashboard (employee-side)
   ============================================================ */

.emp-login-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.emp-login-hero .modal-hero-icon { width: 52px; height: 52px; border-radius: 16px; }
.emp-login-hero .modal-hero-icon svg { width: 18px; height: 18px; }
.emp-login-info h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.4px; }
.emp-login-info p { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.emp-dash-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.emp-dash-head .edh-info { flex: 1; min-width: 0; }
.emp-dash-head .edh-name { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.emp-dash-head .edh-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.emp-dash-head .edh-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.emp-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--surface);
}
.emp-list-item:last-child { margin-bottom: 0; }
.emp-list-item .eli-info { flex: 1; min-width: 0; }
.emp-list-item .eli-t { font-weight: 600; font-size: 13px; letter-spacing: 0; }
.emp-list-item .eli-s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.emp-list-item .eli-right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.emp-list-item .eli-amount { font-weight: 600; font-size: 14px; }

/* ============================================================
   Role-based login + Employee Dashboard shell
   ============================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-start;
  align-items: safe center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.login-screen[hidden] { display: none; }

.login-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-head { text-align: center; margin-bottom: 24px; }
.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
}
.login-logo svg { width: 28px; height: 28px; }
.login-company {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.7px;
  color: var(--text);
}
.login-sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-3);
}

.login-field { margin-bottom: 20px; }
.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-2);
  margin-bottom: 8px;
}
.login-field input {
  width: 100%;
  height: 50px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 16px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.login-pass { position: relative; }
.login-pass input { padding-right: 64px; }
.login-show {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
}
.login-submit {
  width: 100%;
  height: 50px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  border: 0;
  color: #fff;
}

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.6;
}
.login-hint strong { color: var(--text-2); }

/* ---------- Login error popup ----------
   Sits on its own layer above .login-screen (z-index 400).
   The shared .modal-root (z-index 200) sits below .login-screen, so it
   cannot be used here. */
.login-popup {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.login-popup[hidden] { display: none; }

.login-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 37, 59, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.4s ease;
}

.login-popup-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-popup-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--red-50);
  border: 1px solid rgba(200, 85, 109, 0.35);
  color: var(--red);
}
.login-popup-icon svg { width: 28px; height: 28px; }

.login-popup-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.login-popup-msg {
  margin: 0 0 24px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.login-popup-btn { width: 100%; }

.login-field input.input-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 85, 109, 0.18);
}

/* Employee sidebar footer */
.emp-user-chip { display: flex; align-items: center; gap: 12px; }
.emp-user-chip .info { flex: 1; min-width: 0; }
.emp-user-chip .info .t {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-user-chip .info .s { color: var(--text-3); font-size: 12px; }
.emp-signout-btn {
  width: 100%;
  margin-top: 12px;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.emp-signout-btn:hover { background: var(--red-50); color: var(--red); border-color: var(--red-50); }

/* Progress card - employee "My Shift" summary */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.progress-card .pg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.progress-card .pg-title { font-size: 12px; font-weight: 600; color: var(--text-2); }
.progress-card .pg-val { font-size: 13px; font-weight: 600; color: var(--brand); }

@media (min-width: 640px) {
  .login-card { padding: 32px 28px; }
}

.app[hidden] { display: none; }

/* ============================================================
   Employee Dashboard - Layout & Alignment Fixes
   ============================================================ */

/* Dashboard head: keep sign-out button on its own line on narrow screens */
#empApp .emp-dash-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
#empApp .emp-dash-head .edh-info {
  width: 100%;
}
#empApp .emp-dash-head #empSignOutBtn {
  align-self: flex-start;
  width: auto;
}

/* Mobile: stat cards single column, two columns from 640px */
#empApp .stat-grid {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  #empApp .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
  #empApp .stat-grid { grid-template-columns: repeat(3, 1fr); }
  #empApp .panel-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  /* PC: four stat cards in one row in the receptionist interface too. */
  #empApp .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Panel grid: single column on mobile, two columns on desktop */
#empApp .panel-grid {
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1024px) {
  #empApp .panel-grid { grid-template-columns: 1fr 1fr; }
}

/* Content padding accounts for bottom nav on mobile */
@media (max-width: 1023px) {
  #empApp .content { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* Laptop & desktop: sidebar always visible, main shifted, hide hamburger */
@media (min-width: 1024px) {
  #empApp .sidebar {
    width: var(--sidebar-w);
    transform: none;
    z-index: 50;
    position: fixed;
    inset: 0 auto 0 0;
  }
  #empApp .sidebar-backdrop { display: none; }
  #empApp .main { margin-left: var(--sidebar-w); }
  #empApp .today-chip { display: inline-flex; }
}

/* Ensure empApp sections fill height and don't overlap sidebar */
#empApp .main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
#empApp .content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* Emp list items: prevent text overflow */
#empApp .eli-info { min-width: 0; }
#empApp .eli-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#empApp .eli-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Empty states centered */
#empApp .empty-state { text-align: center; padding: 24px 16px; color: var(--text-3); }
#empApp .empty-inline { text-align: left; padding: 16px 0; }

/* Detail grid responsive */
#empApp .detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  #empApp .detail-grid { grid-template-columns: 1fr 1fr; }
  #empApp .detail-item.span-2 { grid-column: span 2; }
}

/* My Profile > Login Credentials: own username + Change Password action */
.emp-creds {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
}
.emp-creds .cred-info { min-width: 0; }
.emp-creds .cred-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}
.emp-creds .cred-value {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emp-creds .btn { flex-shrink: 0; }

/* Emp dashboard stat card value sizing */
#empApp .stat-value { font-size: 20px; }
@media (min-width: 640px) {
  #empApp .stat-value { font-size: 24px; }
}

/* ================= New Employee Sections ================= */

/* Detail section title */
#empApp .detail-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
  margin: 20px 0 12px;
}

/* Notifications list item accent */
#empApp #empNotificationsList .emp-list-item { border-left: 3px solid var(--border); }
#empApp #empNotificationsList .emp-list-item .eli-right .badge-approved { background: var(--green-50); color: var(--green); }
#empApp #empNotificationsList .emp-list-item .eli-right .badge-rejected { background: var(--red-50); color: var(--red); }
#empApp #empNotificationsList .emp-list-item .eli-right .badge-pending { background: var(--amber-50); color: var(--amber); }
#empApp #empNotificationsList .emp-list-item .eli-right .badge-reminder { background: var(--surface-2); color: var(--text-2); }

/* Schedule: highlight upcoming appointment cards */
#empApp #empScheduleUpcoming .emp-list-item { border-left: 3px solid var(--border); }

/* Badge color utilities for notification types */
.badge-approved { background: var(--green-50); color: var(--green); }
.badge-rejected { background: var(--red-50); color: var(--red); }
.badge-pending { background: var(--amber-50); color: var(--amber); }
.badge-reminder { background: var(--surface-2); color: var(--text-2); }

/* ============================================================
   NexGravision - theme refinements
   ============================================================ */

html { color-scheme: light; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

::selection { background: var(--brand-100); color: var(--text); }

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

/* ---------- Sidebar (Midnight Navy) ---------- */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text-2);
  border-right: 1px solid var(--sidebar-border);
}
.sidebar.open { box-shadow: var(--shadow-lg); }
.sidebar-backdrop { background: rgba(5, 37, 59, 0.52); }

.brand-mark {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-name { color: var(--sidebar-text); }
.brand-sub { color: var(--sidebar-text-3); }

.nav-label { color: var(--sidebar-text-3); }
.nav-item { color: var(--sidebar-text-2); }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active svg { color: #fff; opacity: 1; }

.nav-logout { color: var(--sidebar-text-3); }
.nav-item.active .nav-logout svg { color: inherit; opacity: 0.85; }
.nav-logout:hover { background: var(--sidebar-hover); color: var(--sidebar-danger); }
.nav-logout:hover svg { opacity: 1; color: var(--sidebar-danger); }

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  background: var(--sidebar-raised);
}
.admin-avatar {
  background: rgba(31, 169, 210, 0.20);
  color: var(--sidebar-text);
  border: 1px solid rgba(31, 169, 210, 0.42);
}
.admin-name { color: var(--sidebar-text); }
.admin-role { color: var(--sidebar-text-3); }

.emp-user-chip .info .t { color: var(--sidebar-text); }
.emp-user-chip .info .s { color: var(--sidebar-text-3); }
.emp-signout-btn {
  background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-border);
  color: var(--sidebar-text-2);
}
.emp-signout-btn:hover {
  background: rgba(200, 85, 109, 0.18);
  border-color: rgba(200, 85, 109, 0.42);
  color: var(--sidebar-danger);
}

/* ---------- Topbar ---------- */
.topbar {
  background: rgba(242, 250, 254, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.topbar-title h1 { color: var(--text); }
.topbar-title p { color: var(--text-3); }
.today-chip { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.icon-btn { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Cards, panels & lists ---------- */
.panel,
.stat-card,
.birthday-card,
.service-card,
.progress-card {
  background: var(--surface);
  border-color: var(--border);
}

.stat-card { box-shadow: var(--shadow-sm); }
.stat-card.clickable:hover,
.birthday-card:hover,
.service-card:hover {
  border-color: var(--champagne);
  box-shadow: var(--shadow-md);
}

.stat-value { color: var(--text); }
.stat-label { color: var(--text-3); }
.stat-sub { color: var(--text-2); }

.panel-head { border-bottom-color: var(--border); background: var(--surface); }
.panel-head h3 { color: var(--text); }
.panel-body { background: var(--surface); }

.link-btn { color: var(--brand); }
.link-btn:hover { background: var(--brand-50); }
.mini-row:hover { background: var(--surface-2); }

.detail-item { background: var(--surface-2); border-color: var(--border); }
.detail-item .value { color: var(--text); }
.detail-section-title { color: var(--text-3); }

.profile-hero {
  background: var(--surface);
  border-color: var(--border);
}

.birthday-card.today-card {
  border-color: var(--champagne);
  background: var(--champagne-50);
}
.birthday-card.soon-card { border-color: var(--brand-100); }
.days-pill { background: var(--brand-50); color: var(--brand); }
.days-pill.soon { background: var(--brand-50); color: var(--brand); }
.days-pill.today { background: var(--champagne-50); color: var(--amber); }
.days-pill.later { background: var(--surface-2); color: var(--text-2); }

.service-icon { background: var(--violet-50); color: var(--violet); }

/* ---------- Tables ---------- */
.data-table th {
  background: var(--surface-2);
  color: var(--text-3);
  border-bottom-color: var(--border);
}
.data-table td { color: var(--text-2); border-bottom-color: var(--border); }
.data-table tbody tr:hover { background: var(--surface-2); }
.person-name { color: var(--text); }

.avatar {
  background: var(--brand-50);
  color: var(--brand);
  border-color: var(--brand-100);
}

/* ---------- Buttons, chips & badges ---------- */
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-danger-soft { background: var(--red-50); color: var(--red); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--red) 12%, var(--surface)); }

.chip { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.chip:hover { border-color: var(--champagne); color: var(--text); }
.chip.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.badge-gray { background: var(--surface-2); color: var(--text-2); }
.badge-brand { background: var(--surface-2); color: var(--text-2); }

.icon-action { background: var(--surface); border-color: var(--border); color: var(--text-3); }
.icon-action:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

.pay-method span { background: var(--surface); border-color: var(--border); }
.pay-method input:checked + span {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand-600);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.pay-method input:checked + span::before { background: var(--brand); border-color: var(--brand); }

.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
/* Same visible focus ring as the base .field rule - kept in sync. */
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
}

.form-section-title .num,
.setup-step .num {
  background: var(--brand-50);
  color: var(--brand);
}

/* ---------- Modal ---------- */
.modal-backdrop { background: rgba(5, 37, 59, 0.55); }
.modal { background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-head { border-bottom-color: var(--border); }
.modal-head h2 { color: var(--text); }
.modal-foot { background: var(--surface-2); border-top-color: var(--border); }

.modal-hero {
  border-color: var(--border);
}
.modal-hero-icon {
  background: var(--brand);
  box-shadow: var(--shadow-sm);
  color: #fff;
}

.auto-id-box { background: var(--surface-2); border-color: var(--border-strong); color: var(--brand); }

.setup-checklist {
  border-color: var(--border);
}
.setup-step { background: var(--surface); border-color: var(--border); }

/* ---------- Toast ---------- */
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }

/* ---------- Employee shell ---------- */
.emp-login-hero {
  border-color: var(--border);
}
.emp-dash-head { background: var(--surface); border-color: var(--border); }
.emp-dash-head .edh-name { color: var(--text); }
.emp-list-item { background: var(--surface); border-color: var(--border); }
.progress-card .pg-val { color: var(--brand); }

/* ---------- Login (NexGravision) ---------- */
.login-screen {
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.login-logo {
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}
.login-company { color: var(--text); }
.login-sub { color: var(--text-3); }
.login-field label { color: var(--text-2); }
.login-field input {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.login-field input:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.login-show { color: var(--brand); }
.login-submit {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.login-submit:hover { background: var(--brand-600); filter: none; }
.login-hint { color: var(--text-3); }
.login-hint strong { color: var(--text-2); }

/* ---------- Accent helpers ---------- */
.amount-green { color: var(--green); }
.amount-red { color: var(--red); }


/* ---------- Visits toolbar: inline filters ---------- */
.visits-toolbar { flex-wrap: wrap; }
.visits-toolbar .search-box { flex: 1 1 220px; }
.toolbar-chips {
  margin-bottom: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.toolbar-chips::-webkit-scrollbar { display: none; }
.clear-filter-btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 639px) {
  .toolbar-chips { width: 100%; }
  /* Search + Clear share ONE row: the search keeps its compact width (the
     wrap is capped at 380px) whether or not Clear is on screen, Clear sizes
     to its own content; the date picker and any other toolbar control (e.g.
     the primary action button) take their own full-width rows. */
  .section-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
  }
  .section-toolbar > .visit-search-wrap { grid-column: 1; min-width: 0; }
  .section-toolbar > .clear-filter-btn { grid-column: 2; min-width: 0; height: 44px; }
  .section-toolbar > .toolbar-date,
  .section-toolbar > .toolbar-select { grid-column: 1 / -1; }
  .section-toolbar > .btn:not(.clear-filter-btn) { grid-column: 1 / -1; }
}

/* Desktop: the Clear button matches the search box height exactly
   (search-box is 40px at >=640; .btn-sm alone would be 32px). */
@media (min-width: 640px) {
  .section-toolbar > .clear-filter-btn { height: 40px; }
}

/* Clear-button visibility alone is driven from JS: syncClearButtons() in
   js/app.js treats the chip that is active at boot as the default filter.
   The search box no longer changes width with it - the wrap/search cap
   (380px) keeps the same compact size whether Clear is on screen or not. */

/* My Visits (receptionist): a real table at every width >=640px - the old
   two-cards-per-row grid is gone. Cells wrap so the rows always fit the
   screen (no horizontal scrollbar) and the Date column drops away on
   narrower screens (Tier B above) so only key data stays visible. Below 640px
   it falls back to the app-wide "table → cards" rule - every cell carries a
   data-label. Birthdays/Anniversaries are cards now, so their old table
   rules were retired along with that table. */
#empVisitsList .table-wrap { overflow-x: hidden; }
#empVisitsTable { min-width: 0; }
#empVisitsTable th,
#empVisitsTable td {
  white-space: normal;
  overflow-wrap: anywhere;
}
#empVisitsTable .person-meta { margin-top: 2px; }

/* ---------- Plain radio options (no card styling) ---------- */
.pay-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  grid-template-columns: none;
}
.pay-method {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.pay-method input {
  position: static;
  opacity: 1;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  pointer-events: auto;
  accent-color: var(--brand);
  cursor: pointer;
}
.pay-method span {
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-2);
  text-align: left;
  transition: color 0.15s ease;
}
.pay-method span::before { content: none; display: none; }
.pay-method input:checked + span {
  border: 0;
  background: transparent;
  color: var(--brand);
  box-shadow: none;
}
.pay-method input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Employee topbar actions ---------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-width: 0; }

/* ---------- Visits search filter dropdown ---------- */
.visit-search-wrap {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  /* The wrapper is what actually caps the width below 640px (the toolbar is
     a grid there and the box sits in a 1fr column) - same 380px the desktop
     rule gives, so the search keeps ONE compact width at every viewport and
     in every state, with or without the Clear button beside it. */
  max-width: 380px;
}
.visit-search-wrap .search-box { width: 100%; }
.filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 90;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.filter-dropdown[hidden] { display: none; }
.filter-dropdown .filter-chips {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  margin-bottom: 0;
  overflow: visible;
}
.filter-dropdown .chip {
  width: 100%;
  padding: 12px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.filter-dropdown .chip:hover {
  background: var(--surface-2);
  color: var(--text);
}
.filter-dropdown .chip.active {
  background: var(--brand-50);
  color: var(--brand);
}
@media (min-width: 640px) {
  .visits-toolbar .visit-search-wrap { flex: 1 1 220px; max-width: 380px; }
}
@media (min-width: 640px) {
  .emp-apt-toolbar .visit-search-wrap { flex: 1 1 220px; max-width: 380px; }
  .section-toolbar > .visit-search-wrap { flex: 1 1 220px; max-width: 380px; }
}

/* ---------- Admin sidebar sign out (icon only) ---------- */
.admin-signout {
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-signout svg { width: 16px; height: 16px; }
.admin-signout:hover {
  color: var(--sidebar-danger);
  background: rgba(200, 85, 109, 0.18);
  border-color: rgba(200, 85, 109, 0.45);
}

/* ---------- Employee section hero (Leaves / Salary) ----------
   "Welcome back, X" + big page title (+ optional subtitle) with an optional
   chip on the right - same structure as the reference design. */
.section-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.section-hero-main { min-width: 0; }
.section-hero-kicker { font-size: 13px; font-weight: 500; color: var(--text-3); }
.section-hero-title {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.7px;
  line-height: 1.15;
  margin-top: 2px;
}
.section-hero-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.hero-chip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
}
.hero-chip[hidden] { display: none; }

/* Pill moved out of the section hero and onto its first stat card. */
.stat-card .stat-chip {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}

/* Panel heading with a supporting line (records count) */
.panel-head-text { min-width: 0; }
.panel-head-text h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.panel-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* Inline "Request Leave" form: labelled fields in one row + centred submit */
.emp-inline-form { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 16px; }
.emp-inline-form .field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
}
.inline-form-actions { display: flex; justify-content: center; margin-top: 16px; }

/* Leaves toolbar: Search box + status dropdown in the panel head */
#empLeaveSearchWrap { width: 260px; max-width: 100%; }
@media (max-width: 640px) { #empLeaveSearchWrap { width: 100%; } }

/* Employee record tables: wrap long cells instead of scrolling sideways */
#empLeaveTable { min-width: 0; }
#empLeaveTable td { white-space: normal; }
#empLeaveTable .person-name { white-space: normal; }
#empLeaveTable tbody tr { cursor: default; }

/* Payments: New Bill button shares the All Payments heading row */
#empNewBillBtn { flex: 0 0 auto; }

/* ---------- Payments: running total under the filtered list ---------- */
.total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.total-bar[hidden] { display: none; }
.total-bar-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.total-bar-value { font-size: 16px; font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---------- Attendance month calendar card ---------- */
.calendar { max-width: 360px; margin: 0 auto; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cal-title { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.cal-nav {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-nav:hover { background: var(--surface-2); color: var(--text); }
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-week span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-day:hover { background: var(--surface-2); color: var(--text); }
.cal-day.empty { visibility: hidden; pointer-events: none; }
.cal-day.today { border-color: var(--brand); color: var(--brand); }
.cal-day.selected { background: var(--brand); border-color: var(--brand); color: #fff; }
.cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.cal-hint { font-size: 12px; color: var(--text-3); text-align: right; }

/* Per-employee attendance calendar (modal) */
.cal-day.is-present { background: var(--green); border-color: var(--green); color: #fff; }
.cal-day.is-absent { background: var(--red-50); border-color: transparent; color: var(--red); }
.cal-day.is-other { background: var(--amber-50); border-color: transparent; color: var(--amber); }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--brand); }

/* Date-detail modal: FUTURE days read as "not yet" - muted --text-3 ink,
   transparent ground and a default cursor, so they stay clearly apart from
   both the invisible .empty lead/trailing cells (visibility:hidden) and an
   ordinary unmarked PAST day (which keeps --text-2 ink plus the surface-2
   hover). ONE rule does all of it: it sits after every .cal-day modifier
   above, so at equal specificity source order wins - the declared background
   cancels the shared .cal-day:hover tint and the ink overrides any status
   colour ("this day hasn't happened yet"), which means no separate hover rule
   and no affordance at all on a disabled cell. Tokens only. */
.cal-day.is-future { color: var(--text-3); background: transparent; cursor: default; }

.cal-legend {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
.cal-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.cal-dot.present { background: var(--green); }
.cal-dot.absent { background: var(--red); }
.cal-dot.other { background: var(--amber); }
.cal-note {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 12px;
}

/* ---------- Attendance · DATE DETAIL PAGE ----------
   The modal body's root (opened from the toolbar's Date field in both the
   admin and receptionist Attendance sections, and from a receptionist team
   card) stacks its five children - the employee profile heading, stat
   strip, month calendar, day detail and hint - on a steady 16px rhythm
   instead of relying on each component's own margins. Three of those
   children carry a vertical margin of their own (the profile heading's 14px
   bottom, the stat strip's 16px bottom and the hint's 12px top), so those
   separations come out a little wider; deliberately left alone rather than
   overriding an existing component rule for this one page. */
.att-day-page { display: flex; flex-direction: column; gap: 16px; }

/* The calendar must keep the width it has as a plain block: inside the flex
   stack above it carries auto cross-axis margins (its own margin:0 auto),
   and the flexbox algorithm then refuses to stretch it - the used cross size
   falls back to fit-content, so it would shrink-wrap to its widest child (the
   legend) instead of filling up to its own 360px max. A definite width gives
   it back exactly the used width a block-context calendar gets, and the
   existing auto margins still centre it. In block context (every other
   calendar in the app, e.g. the drawer's, which lives in .drawer-body)
   width:100% resolves to the same used width as width:auto, so nothing else
   moves; scoped to the modal body because that is where this page's calendar
   sits. */
.modal-body .calendar { width: 100%; }

/* The day block written into the detail slot (a bare <h3>, then the field
   grid, then the status pill) is its own 12px stack: the global * reset
   strips the heading's default margins and the pill is inline-level, so
   neither would get any spacing from normal flow. */
#attDayDetail { display: flex; flex-direction: column; gap: 12px; }

/* Day heading, matched to the app's panel headings - the .panel-head h3
   metrics (15px / 600 / --text / letter-spacing 0) - rather than the 12px
   .detail-section-title label, because this is a heading for the block below
   it, not a section divider, and the markup's class-less <h3> asks for no
   accent bar. The head font family already arrives from the global h1..h6
   rule; spacing comes from the wrapper's gap, so no margins here. */
#attDayDetail h3 { font-size: 15px; font-weight: 600; letter-spacing: 0; color: var(--text); }

/* Flex items are blockified, so the inline-flex status pill would stretch
   full width inside the stack above; align-self keeps it content-sized, the
   same "never stretched across the card" behaviour the cards get from their
   own flex-basis rule. No other property of the pill is touched. */
#attDayDetail .seg-group { align-self: flex-start; }

/* The day-detail ACTION row: the status pill group - and, on a locked past
   day, the single Edit button - sits on its own line under the field grid;
   the day's In/Out times are inputs INSIDE that grid's .value cells, so
   they are deliberately not part of this row. space-between pins the row's
   contents to the block's edges (the #attDayDetail column stretches this
   row full width), align-items centres them on the cross axis - which
   matters because below 1024px the pill (40px min-height buttons + 4px pad
   + 1px border per side = 50px) is TALLER than the .btn (44px under 640px,
   40px above) - and flex-wrap lets the contents fall onto two lines inside
   the narrow modal instead of overflowing. The 12px gap matches
   #attDayDetail's own stack gap so the row reads as part of the same
   block.

   Deliberately NOT adding an override for #attDayDetail .seg-group above:
   that rule is a DESCENDANT selector, so it still matches the pill nested
   in this row and its align-self: flex-start does beat this row's
   align-items: center. Cascade checked at every breakpoint and it is a
   no-op there: below 1024px the pill is the tallest item, so it defines
   the row height and there is no free cross-axis space for align-self to
   distribute, and at >=1024px the pill and the .btn are both exactly 40px
   (12px x 1.5 line-height + 6px+6px padding = 30px buttons + 4px+4px pad
   + 1px+1px border). The rule also still guards the pill's OLD home as a
   direct child of the #attDayDetail column stack, where it is what stops
   a full-width stretch, so touching it would risk that shape. */
.att-day-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* The day's In/Out times are <input type="time"> inside the field grid's
   .value cells on an editable day (a locked past day and the admin page
   keep plain text). There is NO global input styling outside .field, so a
   bare <input> would render as browser chrome: this gives it the app's
   input language - surface background, hairline border, 8px radius, the
   .field input focus treatment - at the .value's own 14px, scoped to this
   page so no other detail modal is affected. Tokens only (--surface,
   --border, --text, --brand) rather than literal colours, so it keeps
   working if the theme tokens are ever re-pointed. */
#attDayDetail .value input[type="time"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Focus ring copied from .field input:focus - a --brand-50 ring would be
   ~1.1:1 (invisible) on white, so the translucent brand tint instead.
   Base outline stays on (unlike .field input's outline:none), so the
   global :focus-visible rule already covers the keyboard case. */
#attDayDetail .value input[type="time"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
}

/* Attendance drawer: "Remove record" action (moved here from the card) */
.drawer-rec-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.drawer-rec-actions .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Expenses: monthly bar chart ---------- */
.chart-panel { margin-bottom: 16px; }
.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 8px 2px 2px;
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bar-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  white-space: normal;
  text-align: center;
}
.bar-track {
  width: 100%;
  max-width: 44px;
  height: 132px;
  display: flex;
  align-items: flex-end;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.bar-fill {
  width: 100%;
  background: var(--brand);
  border-radius: 8px 8px 0 0;
}
.bar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-3);
}

/* ============ Large screens: text and cards scale up ============
   Above 1280px the type and card padding grow with the viewport so the
   UI never reads as small/dense on desktop monitors. */
@media (min-width: 1280px) {
  body { font-size: 15px; }

  /* Page + section headings */
  .topbar-title h1 { font-size: 26px; }
  .section-hero-title { font-size: 30px; letter-spacing: -0.5px; }
  .section-hero-sub { font-size: 14px; }
  .panel-head h3 { font-size: 17px; }

  /* Figures - the moments carry the size */
  .stat-value { font-size: 32px; }
  #empApp .stat-value { font-size: 28px; }
  .bill-total .amount { font-size: 22px; }

  /* List + table text */
  .person-name { font-size: 15px; }
  .emp-list-item .eli-t { font-size: 15px; }
  .data-table td { font-size: 14px; }
  .detail-item .value { font-size: 15px; }
  .detail-item .label { font-size: 12px; }

  /* Cards breathe */
  .stat-card { padding: 24px; }
  .panel-head { padding: 20px 24px; }
  .detail-item { padding: 16px 20px; }
  .emp-list-item { padding: 16px 20px; }
  .panel-body { padding: 12px; }
  .modal-body { padding: 28px; }
}

/* ============================================================
   RESPONSIVE LAYOUT LAYER · 320px → 1920px+
   XS   320-479   small phone
   SM   480-639   large phone
   MD   640-1023  tablet (sidebar = off-canvas drawer)
   LG  1024-1439  laptop (sidebar docked)
   XL  1440-1919  desktop
   2XL 1920+      wide desktop
   Components RE-FLOW at each tier (columns are added/removed, toolbars
   wrap, tables change shape) - nothing is zoomed or scaled down.
   ============================================================ */

/* ---------- 0 · Overflow guards ----------
   Every flex/grid child may shrink below its content width and every
   long value breaks instead of pushing the page sideways. Together with
   body{overflow-x:hidden} this removes horizontal scrolling and the
   cut-off content it causes. */
.app,
.main,
.content,
.section,
.panel,
.stat-card,
.detail-item,
.field,
.section-toolbar > *,
.panel-grid > *,
.stat-grid > *,
.form-grid > *,
.detail-grid > *,
.birthday-grid > *,
.service-grid > * { min-width: 0; }

img, canvas, video { max-width: 100%; height: auto; }
.table-wrap, .chart-panel, .bar-chart, .panel-body { max-width: 100%; }

.stat-label, .stat-sub, .stat-value,
.person-name, .person-meta,
.detail-item .value, .panel-head h3, .panel-head-text,
.section-hero-title, .section-hero-sub,
.birthday-info h4, .service-card h4, .service-card .desc,
.emp-list-item .eli-t, .emp-list-item .eli-s,
.total-bar-value, .bill-total .amount, .login-company,
.empty-title, .empty-text, .modal-head h2 {
  overflow-wrap: break-word;
}

/* ---------- XS · 320-479px small phones ---------- */
@media (max-width: 479px) {
  .content { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
  .topbar { padding: 12px; gap: 10px; }
  .topbar-title h1 { font-size: 16px; letter-spacing: -0.3px; }
  .topbar-title p { font-size: 11.5px; }
  .icon-btn { width: 38px; height: 38px; }

  /* Stat cards: readable single-column stack on the narrowest phones */
  .stat-grid { gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px; border-radius: 14px; }
  .stat-value { font-size: 20px; letter-spacing: -0.6px; }
  .stat-label { font-size: 11.5px; margin-top: 6px; }
  .stat-sub { font-size: 11px; margin-top: 6px; }

  .panel-head { padding: 14px; gap: 8px; flex-wrap: wrap; }
  .panel-head h3 { font-size: 14px; }
  .panel-body { padding: 6px; }
  .panel-grid { gap: 12px; }
  .section > .panel + .panel { margin-top: 12px; }

  .section-hero { padding: 16px; gap: 8px 12px; }
  .section-hero-title { font-size: 20px; letter-spacing: -0.5px; }
  .section-hero-kicker { font-size: 12px; }
  .section-hero-sub { font-size: 12px; }
  .hero-chip { font-size: 12px; padding: 6px 12px; }

  .form-grid { gap: 12px; }
  .field-row-3, .detail-row-3 { gap: 12px; }
  .field input, .field select, .field textarea { height: 44px; }
  .field textarea { min-height: 76px; }

  /* Popups: full-width sheet, buttons wrap their labels instead of
     overflowing the sheet (no cut-off action buttons). */
  .modal-head { padding: 14px 16px; }
  .modal-head h2 { font-size: 16px; }
  .modal-body { padding: 16px; }
  .modal-hero { flex-wrap: wrap; padding: 14px; gap: 8px 12px; }
  .modal-hero-id { margin-left: 0; }
  .modal-foot { gap: 10px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn {
    min-width: 0;
    white-space: normal;
    height: auto;
    min-height: 44px;
    padding: 8px 10px;
    line-height: 1.3;
    font-size: 13px;
  }

  .drawer-head { padding: 16px; }
  .drawer-body { padding: 16px; }

  .cel-kind-tabs { padding: 8px; gap: 8px; }
  .cel-kind-tab { padding: 10px 12px; gap: 10px; }
  .cel-kind-tab .ck-ic { width: 36px; height: 36px; }
  .cel-kind-tab .ck-txt strong { font-size: 14px; }
  .cel-kind-tab .ck-txt small { white-space: normal; }
  .cel-list-head { flex-wrap: wrap; }

  .birthday-grid, .service-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .birthday-card { padding: 14px; gap: 12px; }
  .bc-main { gap: 12px; }
  .service-card { padding: 14px; }

  /* Tabs / segmented controls fit one row without overflowing */
  .switch-tabs { display: flex; width: 100%; }
  .switch-tab { flex: 1; min-width: 0; padding: 8px 8px; font-size: 12.5px; }

  .empty-state { padding: 40px 16px; }
  .setup-checklist { padding: 14px; }
  .setup-step { padding: 10px; gap: 10px; }

  .emp-list-item { padding: 14px; gap: 10px; }
  .emp-creds { padding: 14px; }
  .emp-creds .cred-value { font-size: 15px; }

  .login-card { padding: 24px 20px; }
  .login-company { font-size: 24px; letter-spacing: -0.5px; }

  .toast-wrap { left: 10px; right: 10px; }
  .toast { font-size: 12.5px; padding: 11px 14px; }

  /* Bar chart keeps all six columns inside the panel */
  .bar-chart { gap: 4px; padding: 8px 0 2px; }
  .bar-val, .bar-label { font-size: 10px; }
  .bar-track { max-width: 32px; height: 104px; }

  .calendar { max-width: 100%; }
  .cal-day { font-size: 12px; border-radius: 6px; }
  .cal-week span { font-size: 10.5px; }

  .bill-actions .btn, .inline-form-actions .btn { width: 100%; }
  .total-bar { flex-wrap: wrap; gap: 6px 12px; padding: 12px; }
}

/* Below 360px (iPhone SE / 320px class devices): one stat card per row so
   the figures and labels stay legible instead of being squeezed. */
@media (max-width: 359px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- MD · 640-1023px tablets ---------- */
@media (min-width: 640px) {
  /* Toolbars WRAP rather than overflow: search + filters on the first row,
     actions and date/select controls flow to the next row when needed. */
  .section-toolbar { flex-wrap: wrap; }
  .section-toolbar > .visit-search-wrap { flex: 1 1 240px; max-width: 380px; min-width: 0; }
  .toolbar-date, .toolbar-select { min-width: 0; max-width: 100%; }
  .toolbar-date input, .toolbar-select select { max-width: 100%; }
  .panel-head { flex-wrap: wrap; row-gap: 8px; }
  .panel-head-text { min-width: 0; }
}

/* Panel-head selects (employee / month filters) may shrink to the panel
   width instead of being clipped by .panel's overflow:hidden - and below
   640px they take their own full-width row under the heading. */
.panel-head select,
.panel-head-text { min-width: 0; max-width: 100%; }
@media (max-width: 639px) {
  .panel-head { flex-wrap: wrap; row-gap: 10px; }
  .panel-head select { width: 100%; }
}

@media (min-width: 640px) and (max-width: 1279px) {
  /* Tables re-flow instead of scrolling sideways: cells wrap, and the
     column tiers above hide the least important columns. */
  .data-table th, .data-table td {
    white-space: normal;
    overflow-wrap: break-word;
    vertical-align: top;
  }
  .data-table td .person-cell { align-items: flex-start; }
  .data-table th { vertical-align: bottom; }
}

/* ---------- XL / 2XL · 1440px+ desktop & wide screens ---------- */
@media (min-width: 1440px) {
  /* Comfortable rhythm on large monitors (type already scales at 1280+). */
  .content { padding: 28px 32px 48px; }
  .topbar { padding: 20px 32px; }
  .section-toolbar { gap: 14px; }
  .panel-grid { gap: 24px; }
  .stat-grid { gap: 20px; }
}

@media (min-width: 1920px) {
  .content { max-width: 1560px; padding: 32px 40px 56px; }
  .topbar { padding: 22px 40px; }
}

/* ============================================================
   Receptionist Dashboard (#emp-dash) - NEW, additive only.
   Light ivory / white / forest-green cards. Everything is scoped to
   #emp-dash (or .rec-*) so the Admin Dashboard is untouched.
   ============================================================ */

/* ---- 1 · Welcome hero ------------------------------------------
   .section-hero is already a flex row (justify-content: space-between,
   align-items: flex-start) - here it stacks on phones and picks up a
   soft green tint keeping the panel language consistent. */
#emp-dash .rec-hero {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
  background: var(--brand-50);
}
#emp-dash .rec-hero-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* "View Queue" scrollIntoView target clears the sticky topbar. */
#recQueuePanel { scroll-margin-top: 84px; }

/* ---- 2 · Summary cards -----------------------------------------
   Exactly three cards: 1 column on phones, 3 from 640px (they fit in a
   single row from there up). The generic odd-last-card full-row span is
   neutralised for this grid so a three-card row is never stretched. */
/* #empApp #recStatGrid (2 IDs) is required: the pre-existing
   `#empApp .stat-grid` rules are (1,1,0) and would otherwise win over a
   bare #recStatGrid (1,0,0) and force three columns on desktop. */
#empApp #recStatGrid {
  grid-template-columns: 1fr;
  gap: 12px;
}
#empApp #recStatGrid > .stat-card:last-child:nth-child(odd) {
  grid-column: auto;
}
/* Small forest-green accent bar across the top of each card. */
#recStatGrid .stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand);
}

/* ---- 3 · Two-up panel rows ------------------------------------- */
#emp-dash .rec-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
#emp-dash .rec-cols > * { min-width: 0; }
#emp-dash .rec-panel { margin-bottom: 20px; }
#emp-dash .rec-cols > .rec-panel { margin-bottom: 0; }

/* ---- 4 · Panel bodies ------------------------------------------
   .panel-body already carries 8px padding - the queue list keeps a
   modest scroll ceiling so an unusually long queue scrolls instead of
   stretching the page (6 rows fit comfortably under it). */
#emp-dash .rec-body { min-width: 0; }
#recQueueList {
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---- 5 · Upcoming appointment rows ------------------------------ */
#emp-dash .rec-ap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}
#emp-dash .rec-ap-row:last-child { border-bottom: 0; }
#emp-dash .rec-ap-row:hover,
#emp-dash .rec-ap-row:focus-visible {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
#emp-dash .rec-ap-row:active { background: var(--brand-50); }
#emp-dash .rec-ap-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
#emp-dash .rec-ap-time {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}
#emp-dash .rec-ap-cus {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#emp-dash .rec-ap-row .badge { flex: 0 0 auto; }

/* ---- 6 · Today's queue rows (numbered) -------------------------- */
#emp-dash .rec-q-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
#emp-dash .rec-q-row:last-child { border-bottom: 0; }
#emp-dash .rec-q-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
#emp-dash .rec-q-info { flex: 1; min-width: 0; }
#emp-dash .rec-q-name { font-weight: 600; font-size: 13.5px; }
#emp-dash .rec-q-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#emp-dash .rec-q-row .badge { flex-shrink: 0; }
#emp-dash .rec-q-more {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
  text-align: center;
}

/* ---- 7 · Celebrations (birthdays / anniversaries) ---------------
   Two sub-cards side by side from 640px, stacked below. */
#emp-dash .rec-cel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
#emp-dash .rec-cel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
#emp-dash .rec-cel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
#emp-dash .rec-cel-ic {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand-50);
  color: var(--brand);
  flex-shrink: 0;
}
#emp-dash .rec-cel-ic svg { width: 15px; height: 15px; }
#emp-dash .rec-cel-anni .rec-cel-ic {
  background: var(--red-50);
  color: var(--red);
}
#emp-dash .rec-cel-title { font-size: 13px; font-weight: 600; }
#emp-dash .rec-cel-person {
  display: flex;
  align-items: center;
  gap: 10px;
}
#emp-dash .rec-cel-info { flex: 1; min-width: 0; }
#emp-dash .rec-cel-name {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#emp-dash .rec-cel-date {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
#emp-dash .rec-cel-empty { font-size: 12.5px; color: var(--text-3); }
#emp-dash .rec-cel-person .rec-wa-btn { flex-shrink: 0; }

/* The app-wide `.avatar { display: none }` (0,1,0) is lifted for this
   card only - these two selectors (0,3,0) win, everything else stays
   avatar-less. The JS emits .avatar.avatar-sm, sized round here. */
#emp-dash .rec-cel-person .avatar { display: grid; }
#emp-dash .rec-cel-person .avatar.avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 13px;
}

/* ---- 8 · Compact WhatsApp action ------------------------------- */
#emp-dash .rec-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: auto;
  min-height: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green);
}
#emp-dash .rec-wa-btn:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
#emp-dash .rec-wa-btn svg { width: 13px; height: 13px; }

/* ============================================================
   Responsive refinements (same breakpoints as the rest of the file)
   ============================================================ */

/* SM + XS · phones */
@media (max-width: 639px) {
  #emp-dash .rec-hero-side {
    width: 100%;
    justify-content: flex-start;
  }
}

/* XS · keep the compact rows scroll-free down to 320px: tighten the
   gaps, shrink the appointment time, and let the celebration person row
   wrap its WhatsApp button onto a second line instead of overflowing. */
@media (max-width: 399px) {
  #emp-dash .rec-ap-row { gap: 8px; }
  #emp-dash .rec-ap-time { font-size: 11.5px; white-space: normal; }
  #emp-dash .rec-q-row { gap: 8px; }
  #emp-dash .rec-cel-person { flex-wrap: wrap; }
  #emp-dash .rec-cel-person .rec-wa-btn { padding: 4px 9px; }
}

/* MD+ · hero back to a row, two-up panels, three summary columns,
   two celebration sub-cards side by side */
@media (min-width: 640px) {
  #emp-dash .rec-hero {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }
  #empApp #recStatGrid { grid-template-columns: repeat(3, 1fr); }
  #emp-dash .rec-cel-grid { grid-template-columns: 1fr 1fr; }
}

/* LG+ · asymmetric two-up panel row */
@media (min-width: 1024px) {
  #emp-dash .rec-cols { grid-template-columns: 1.15fr 1fr; }
  /* Four summary cards in one row on the receptionist dashboard too. */
  #empApp #recStatGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================================
   Custom select dropdown · replaces the native <select> popup
   ============================================================
   Rendered by js/dropdown.js: the real <select> stays in the DOM (form
   validation / FormData keep working), its native popup is suppressed and a
   floating list is appended straight to <body>. It is positioned with inline
   left/top/width from select.getBoundingClientRect(), so never hardcode those
   here - only the open state (.cs-open on the list root) is styled.
   Visually mirrors .ac-list / .ac-item and the .field select tokens. */
.cs-list {
  position: fixed;
  /* sits above .modal-root (200) and .drawer-root (210) */
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  max-height: 264px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* wheel scrolling stays inside the dropdown - never chains to the page */
  overscroll-behavior: contain;
  /* small inner gutter so the rows' 8px hover radius looks right */
  padding: 4px;
  display: none;
}
.cs-list.cs-open { display: block; }

.cs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  /* long option labels truncate instead of stretching the popup */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-item:hover, .cs-item.cs-active { background: var(--brand-50); }
/* selected must read clearly stronger than hover/active (which stay on
   --brand-50): deeper green fill + brand-600 text */
.cs-item.cs-selected { color: var(--brand-600); background: var(--brand-100); }
/* first "Select employee" / empty-value row */
.cs-item.cs-placeholder { color: var(--text-3); font-weight: 500; }

/* optional inline SVG tick rendered on the selected row */
.cs-item .cs-check {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--brand);
}

/* js/dropdown.js wraps each option label in this span: .cs-item is a flex
   container, so only a real element can ellipsize (anonymous flex text
   cannot) and long labels must never push .cs-check out of the clipped row */
.cs-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .cs-list { max-height: 220px; }
}

/* ============ In-table status select (.table-status-select) ============
   The Status cell of the ADMIN appointments table (#appointmentTable)
   renders a native <select> next to the status badge; the receptionist
   #empAptList stopped using it and renders the icon action buttons from the
   block below instead. js/dropdown.js only styles the OPEN popup (.cs-list),
   so the closed
   control is styled here: the project chevron (same data-URI as .field and
   .panel-head selects) on a compact status CHIP that reads as part of the
   row instead of as browser chrome.
   NOTE: this block REPLACED an earlier duplicate that sat next to the
   .field select rules (~line 827) - it had different metrics (32px/8px vs
   30px/999px) so whichever came last in the file won, and the control
   rendered inconsistently. There must be exactly ONE .table-status-select
   base rule in this file; merge future tweaks here, not into a new copy.
   Metrics follow the status-chip brief: 30px tall, 999px pill (the badge
   beside it is a pill too) and a 12px/600 label - deliberately NOT the 8px
   field radius, so it reads as a chip rather than as a mini input. */
.table-status-select {
  appearance: none;
  -webkit-appearance: none;
  height: 30px;
  max-width: 100%;
  /* chevron is 16px wide at right:6px, so it occupies ~22px from the right
     edge; 28px of right padding keeps the label clear of it at any width. */
  padding: 0 28px 0 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A5476' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  /* no `outline: none` here, so the global :focus-visible outline still
     applies for keyboard users on this control (border + ring cover mouse). */
  /* js/app.js emits badge and select with NO whitespace between them
     (`${badge}${select}`) and .badge has no right margin, so the control
     needs its own gap to separate the two inline boxes - and vertical-align
     to centre it on the badge instead of dropping it to the baseline. */
  margin-left: 6px;
  vertical-align: middle;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* Hover / focus use the tokens the brief specifies for this control -
   .panel-head select's focus ring is the same brand-50 halo. */
.table-status-select:hover { border-color: var(--brand-100, var(--border)); }
.table-status-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
  color: var(--text);
}
/* js/app.js flips the control to disabled while the status save is in flight. */
.table-status-select:disabled {
  background-color: var(--surface-2);
  color: var(--text-3);
  cursor: default;
}
/* Below 640px the tables restack into cards and .data-table td becomes a flex
   column (label above value): the control drops the badge's inline gap and
   grows past its 30px height to a comfortable tap target. */
@media (max-width: 640px) {
  .table-status-select {
    min-height: 36px;
    margin-left: 0;
  }
}

/* ============ Inline appointment actions (.apt-actions / .apt-action) ============
   WHY this exists: the RECEPTIONIST appointments table (#empAptList) stopped
   rendering the status <select> - js/app.js now emits inline action buttons
   (Confirm / Complete / Cancel) inside the Status cell, right after the status
   badge, and flips them to :disabled while the status save is in flight. The
   ADMIN table (#appointmentTable) still renders .table-status-select above, so
   the two controls coexist: that block owns the <select>, this one owns ONLY
   the button markup the receptionist table emits (base chip + three tone
   variants + focus/disabled states).
   Each button is now ICON-ONLY: one inline SVG (check / calendar-check / X)
   and NO text node, emitted with viewBox + stroke="currentColor" and NO
   width/height - so the chip lays out as a centred flex box and the icon is
   sized here (.apt-action svg) instead of by attributes. The accessible name
   and tooltip come from aria-label / title on the button.
   Metrics mirror the status-chip brief so the row never jumps in height when
   the control changes: a 28x28 square chip (inside the select's 30px band),
   999px radius so it reads as a circle rather than a box. js/app.js
   concatenates badge and actions with NO whitespace
   (`${badge}${actions}`) - exactly like .table-status-select - so the group
   carries its own 6px gap and vertical-align to sit on the badge's centre. */
.apt-actions {
  display: inline-flex;
  /* narrow Status cells: chips wrap instead of blowing the row wide */
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-left: 6px;
  vertical-align: middle;
}

.apt-action {
  /* Icon-only chip: the SVG is the only child, centred on both axes so it
     can never sit on a baseline or drift off-centre. min-width matches the
     height so the chip is a 28x28 square (999px radius -> circle) whichever
     tone icon it holds: 14px icon + 12px padding (2 x 6) + 2px border =
     28px, so the border-box width lands exactly on min-width and height,
     which is what makes the 999px radius render a true circle rather than a
     32x28 pill. No icon/label `gap` any more - there is no label to
     separate from. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--text-2);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  /* colour/shadow only - hover must never resize the chip (row height). */
  transition: color 0.15s ease, background-color 0.15s ease,
              border-color 0.15s ease, box-shadow 0.15s ease;
}

/* The icon SVGs ship without width/height, so this rule IS their size.
   14px sits comfortably inside the 28px chip; flex:0 0 auto (rather than the
   global svg rule's flex-shrink:0 alone) stops the icon being squeezed when
   .apt-actions wraps in a narrow cell. No `color` here on purpose -
   stroke="currentColor" inherits the chip's colour, so the icon follows
   hover/tone/focus/disabled for free. */
.apt-action svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.apt-action:hover {
  color: var(--text);
  background-color: var(--surface-2);
  border-color: var(--border-strong);
}

/* Tone variants - the same token pairs the status badges use (tinted
   background + matching colour) so the three read apart inside a dense row
   without shouting; a 1px tone border keeps them in the status-chip family. */
.apt-action--confirm  { color: var(--sky);   background-color: var(--sky-50);   border-color: var(--sky); }
.apt-action--complete { color: var(--green); background-color: var(--green-50); border-color: var(--green); }
.apt-action--cancel   { color: var(--red);   background-color: var(--red-50);   border-color: var(--red); }

/* Hover deepens the tint. The accent tokens have no "-100" step, so the
   stronger shade is mixed FROM the token itself (the declaration drops out
   harmlessly where color-mix is unsupported - the rest state remains).
   Colour/border are restated because the base .apt-action:hover above would
   otherwise win on equal specificity and flatten the tone back to neutral. */
.apt-action--confirm:hover {
  color: var(--sky);
  background-color: color-mix(in srgb, var(--sky) 16%, var(--sky-50));
  border-color: var(--sky);
}
.apt-action--complete:hover {
  color: var(--green);
  background-color: color-mix(in srgb, var(--green) 16%, var(--green-50));
  border-color: var(--green);
}
.apt-action--cancel:hover {
  color: var(--red);
  background-color: color-mix(in srgb, var(--red) 16%, var(--red-50));
  border-color: var(--red);
}

/* Brand-50 focus halo - same pattern as .table-status-select:focus and
   .search-box:focus-within. No `outline: none` here, so the global
   :focus-visible outline still applies on top of it for keyboard users. */
.apt-action:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}

/* js/app.js disables the buttons while a status save is in flight. Declared
   LAST of the state rules so it outranks the variant :hover rules above on
   equal specificity (a disabled chip must not tint under the pointer). */
.apt-action:disabled {
  background-color: var(--surface-2);
  color: var(--text-3);
  border-color: var(--border);
  cursor: default;
}

/* Below 640px the tables restack into cards and .data-table td becomes a flex
   column (label above value): same treatment as .table-status-select - drop
   the badge's inline gap and grow into a proper touch target. The chips keep
   wrapping (flex-wrap above), so a stacked Status cell can never force the
   card wider than the screen. */
@media (max-width: 640px) {
  .apt-actions {
    margin-left: 0;
    gap: 8px;
  }
  /* Icon-only chip: min-width joins min-height so a 36px tap target stays a
     square/circle (not a 36x28 sliver) - padding stays tight since there is
     no label to fit any more. Hover only repaints (see .apt-action:hover), so
     the touch size never shifts under the finger. */
  .apt-action {
    min-height: 36px;
    min-width: 36px;
    padding: 0 8px;
  }
  /* Tap target grew to 36px, so the icon nudges up with it - stays subtle
     (16px matches .btn svg). */
  .apt-action svg {
    width: 16px;
    height: 16px;
  }
}

/* Service was removed from the receptionist appointments table entirely
   (it is shown in the appointment detail page), so its old <=900px hiding
   tier was retired along with it. */

/* ============ Toolbar filter select (.toolbar-select) ============
   The pill (label + <select>) already carries the border and background, but
   the select inside it still showed the native OS arrow (no appearance:none)
   and had no focus ring at all - its outline:none outranks the global
   :focus-visible rule. Same project chevron as the other selects outside a
   .field, and the brand ring on the pill while it has focus, following the
   .search-box:focus-within pattern. */
.toolbar-select select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231A5476' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.toolbar-select:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}

/* ==========================================================================
   Attendance list pages — compact reference layout (admin + receptionist).
   EVERYTHING is scoped to #section-attendance / #emp-attendance and
   #attendanceStats / #empAttStats / #attendanceTable / #empAttTable so the
   shared day-detail modal and all other tables keep their existing styling.
   Declared last so it outranks the generic rules. */

/* -- Statistics: label above a coloured figure, four even cards ---------- */
#attendanceStats.att-stat-grid,
#empAttStats.att-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
/* Neutralise the generic "odd trailing card spans the row" rule: this grid
   always has four cards, and an odd count must not break the even columns. */
#attendanceStats > .stat-card:last-child:nth-child(odd),
#empAttStats > .stat-card:last-child:nth-child(odd) { grid-column: auto; }
#attendanceStats .stat-card,
#empAttStats .stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
#attendanceStats .stat-card .stat-top,
#attendanceStats .stat-card .stat-icon,
#attendanceStats .stat-card .stat-sub,
#empAttStats .stat-card .stat-top,
#empAttStats .stat-card .stat-icon,
#empAttStats .stat-card .stat-sub { display: none; }
#attendanceStats .stat-label,
#empAttStats .stat-label {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1.2;
}
#attendanceStats .stat-value,
#empAttStats .stat-value {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.4px;
  color: var(--att-stat-accent, var(--text));
}

/* -- Toolbar: view switch + date navigation + Save in one row -------- */
#section-attendance .att-toolbar,
#emp-attendance .att-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
#section-attendance .att-toolbar-left,
#section-attendance .att-toolbar-right,
#emp-attendance .att-toolbar-left,
#emp-attendance .att-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
#section-attendance .att-view-switch,
#emp-attendance .att-view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}
#section-attendance .att-view-btn,
#emp-attendance .att-view-btn {
  min-height: 28px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
#section-attendance .att-view-btn:hover,
#emp-attendance .att-view-btn:hover { color: var(--text-2); }
#section-attendance .att-view-btn.active,
#emp-attendance .att-view-btn.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
#section-attendance .att-date-nav,
#emp-attendance .att-date-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#section-attendance .att-date-nav-btn,
#emp-attendance .att-date-nav-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1;
}
#section-attendance .att-date-nav-btn:hover,
#emp-attendance .att-date-nav-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
#section-attendance .att-date-field,
#emp-attendance .att-date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}
/* The native input stays focusable and keeps its change handler, but a text
   span shows the reference's dd-mm-yyyy format (native date inputs render in
   the browser locale). Clicking anywhere on the field still reaches the
   input, whose handler opens the month page. */
#section-attendance .att-date-field input[type="date"],
#emp-attendance .att-date-field input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
#section-attendance .att-date-field input[type="date"]:focus-visible,
#emp-attendance .att-date-field input[type="date"]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 7px;
}
#section-attendance .att-date-text,
#emp-attendance .att-date-text {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
#section-attendance .att-date-field svg,
#emp-attendance .att-date-field svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
}
#section-attendance .att-save,
#emp-attendance .att-save {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
#section-attendance .att-save:hover,
#emp-attendance .att-save:hover { background: var(--brand-600); color: #fff; }
/* The reference toolbar only shows the view / date / save actions. The
   legacy filters remain in the DOM with their handlers intact. */
#section-attendance .att-legacy-filters,
#emp-attendance .att-legacy-filters { display: none; }

/* -- Table: compact, consistent columns, nothing stacked ------------------ */
#section-attendance .panel,
#emp-attendance .panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
#attendanceTable,
#empAttTable {
  table-layout: fixed;
  min-width: 720px;
}
#attendanceTable .att-col-employee,
#empAttTable .att-col-employee { width: 28%; }
#attendanceTable .att-col-status,
#empAttTable .att-col-status { width: 20%; }
#attendanceTable .att-col-in,
#empAttTable .att-col-in { width: 26%; }
#attendanceTable .att-col-out,
#empAttTable .att-col-out { width: 26%; }
#attendanceTable th,
#empAttTable th {
  padding: 11px 16px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
/* Overrides the stale "last column = Actions" rule that squeezed Out Time
   into a 1% column and forced its three controls to stack vertically. */
#attendanceTable th:last-child,
#attendanceTable td:last-child,
#empAttTable th:last-child,
#empAttTable td:last-child {
  width: auto;
  text-align: left;
  white-space: nowrap;
}
#attendanceTable td,
#empAttTable td {
  height: 54px;
  padding: 8px 16px;
  vertical-align: middle;
}
#attendanceTable .person-cell,
#empAttTable .person-cell { gap: 10px; }
#attendanceTable .person-cell .avatar,
#empAttTable .person-cell .avatar {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
#attendanceTable .person-name,
#empAttTable .person-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}
#attendanceTable .person-meta,
#empAttTable .person-meta {
  font-size: 11px;
  line-height: 1.3;
}
#attendanceTable .att-status-seg,
#empAttTable .att-status-seg { flex-wrap: nowrap; gap: 4px; }
#attendanceTable .att-seg-btn,
#empAttTable .att-seg-btn {
  min-width: 22px;
  height: 24px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 11px;
}
#attendanceTable .att-time-group,
#empAttTable .att-time-group { flex-wrap: nowrap; gap: 5px; }
#attendanceTable .att-time-hh,
#attendanceTable .att-time-mm,
#empAttTable .att-time-hh,
#empAttTable .att-time-mm {
  width: 46px;
  height: 28px;
  border-radius: 6px;
  font-size: 12px;
}
#attendanceTable .att-time-mer,
#empAttTable .att-time-mer {
  width: 54px;
  height: 28px;
  padding: 0 4px;
  border-radius: 6px;
  font-size: 12px;
}

/* -- Responsive ------------------------------------------------------------ */
@media (max-width: 1023px) {
  #attendanceStats.att-stat-grid,
  #empAttStats.att-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Keep all four status tiles and the full hh / mm / AM trio inside their
     cells at tablet widths without growing the rows. */
  #attendanceTable .att-seg-btn,
  #empAttTable .att-seg-btn { min-width: 20px; padding: 0 4px; }
  #attendanceTable .att-time-hh,
  #attendanceTable .att-time-mm,
  #empAttTable .att-time-hh,
  #empAttTable .att-time-mm { width: 42px; }
  #attendanceTable .att-time-mer,
  #empAttTable .att-time-mer { width: 50px; }
}
@media (max-width: 639px) {
  #section-attendance .att-toolbar,
  #emp-attendance .att-toolbar { padding: 10px 12px; gap: 10px; }
  #section-attendance .att-toolbar-right,
  #emp-attendance .att-toolbar-right { margin-left: auto; }
  #attendanceTable,
  #empAttTable { min-width: 0; }
  #attendanceTable td,
  #empAttTable td { height: auto; padding: 6px 10px; }
  #attendanceTable .att-time-group,
  #empAttTable .att-time-group { flex-wrap: nowrap; }
  #attendanceTable .person-cell .avatar,
  #empAttTable .person-cell .avatar { width: 28px; height: 28px; }
}
@media (max-width: 359px) {
  #attendanceStats.att-stat-grid,
  #empAttStats.att-stat-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ============ Stat values sized to THEIR OWN CARD ============
   Long amounts (e.g. ₹40,07,180.18) used to wrap mid-number inside a
   4-column desktop card. Each card is a size container, so the value
   font scales with the card's content width: short numbers stay large
   on wide phones, while a four-up desktop row shrinks just enough to
   keep every value on one line. `nowrap` is safe because the clamp
   actually reduces the font (it never just clips wrapped text). */
.stat-card { container-type: inline-size; }
.stat-value {
  font-size: 22px; /* fallback for engines without container units */
  font-size: clamp(16px, 14cqi, 28px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#empApp .stat-value {
  font-size: 20px;
  font-size: clamp(16px, 14cqi, 28px);
}
/* Attendance tiles have their own deliberately compact typography. */
#attendanceStats .stat-value,
#empAttStats .stat-value {
  font-size: 20px;
  white-space: normal;
}


/* ==========================================================================
   NEXGRAVISION — REFERENCE-MATCHED DESIGN SYSTEM (applied to every page)

   Deep navy → dark teal sidebar, bright cyan → sky-blue → ice-white page,
   light-aqua cards, dark teal gradient panels and primary actions.
   Cormorant Garamond for headings, Manrope for all data and UI text.
   This layer is intentionally last so it wins over the earlier rules while
   leaving every selector, component and interaction untouched.
   ========================================================================== */

/* ---------------------------------------------------------------- Typography */
body {
  font-family: var(--font);
  background: var(--grad-page);
  background-attachment: fixed;
  color: var(--text);
}

h1, h2, h3, h4, h5, h6,
.brand-name, .topbar-title h1, .panel-head h3, .panel-head-text h3,
.modal-head h2, .drawer-head h2, .empty-title, .birthday-info h4,
.service-card h4, .setup-head strong, .login-company, .profile-hero-info h2,
.section-hero-title, .emp-login-info h2, .edh-name, .emp-pick-info h4,
.cel-list-head h3, .modal-hero-info h3, .login-popup-title,
.detail-section-title, .form-section-title, .cal-title, .birthday-month-head,
.cs-label {
  font-family: var(--font-head);
  letter-spacing: -0.01em;
}

/* Main headings 700 · section headings 600 */
h1, .topbar-title h1, .section-hero-title, .login-company,
.modal-head h2, .drawer-head h2, .profile-hero-info h2, .login-popup-title {
  font-weight: 700;
}
h2, h3, h4, h5, h6, .panel-head h3, .panel-head-text h3,
.empty-title, .birthday-info h4, .service-card h4, .setup-head strong {
  font-weight: 600;
}

.topbar-title h1 { font-size: 20px; color: var(--ink); }
.section-hero-title { font-size: 26px; line-height: 1.2; color: var(--ink); }
.panel-head h3, .panel-head-text h3 { font-size: 17px; color: var(--ink); }
.modal-head h2, .drawer-head h2, .emp-login-info h2 { font-size: 20px; color: var(--ink); }
.login-company { font-size: 30px; color: var(--ink); }
.empty-title, .birthday-info h4, .service-card h4 { color: var(--ink); }

/* Figures, tables, controls and navigation stay in Manrope */
.stat-value, .person-name, .person-meta, .data-table th, .data-table td,
.btn, .chip, .badge, .nav-item, input, select, textarea,
.stat-label, .stat-sub, .bill-total .amount, .total-bar-value,
.bar-val, .bar-label, .today-chip, .days-pill .num, .hero-chip,
.login-field label, .field label, .toolbar-date, .toolbar-select,
.detail-item .value, .emp-list-item .eli-t, .emp-list-item .eli-s {
  font-family: var(--font);
  letter-spacing: 0;
}
.stat-value, .bill-total .amount, .total-bar-value { font-weight: 700; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
  background:
    radial-gradient(circle at 98% 12%, rgba(41, 184, 230, 0.20) 0%, rgba(41, 184, 230, 0) 38%),
    radial-gradient(circle at 0% 96%, rgba(23, 140, 192, 0.38) 0%, rgba(23, 140, 192, 0) 46%),
    radial-gradient(circle at 100% 72%, rgba(5, 37, 59, 0.45) 0%, rgba(5, 37, 59, 0) 40%),
    var(--grad-sidebar);
  border-right: 1px solid rgba(143, 217, 238, 0.18);
  color: var(--sidebar-text-2);
}
.sidebar.open { box-shadow: 0 20px 50px rgba(5, 37, 59, 0.35); }
.sidebar-backdrop { background: rgba(5, 37, 59, 0.52); }

.brand { padding-bottom: 26px; }
.brand-mark {
  background: linear-gradient(135deg, #29B8E6 0%, #1179AC 100%);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(5, 37, 59, 0.35);
}
.brand-name { color: #F4FBFE; font-size: 19px; font-weight: 700; letter-spacing: 0; }
.brand-sub { color: var(--sidebar-text-3); font-size: 11px; letter-spacing: 0.01em; }

.nav-label {
  color: var(--sidebar-text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 18px;
}
.nav-item {
  border-radius: 999px;
  color: var(--sidebar-text-2);
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; transform: translateX(2px); }
.nav-item.active {
  background: var(--grad-active);
  color: var(--navy-900);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(5, 37, 59, 0.30);
}
.nav-item.active svg { color: var(--navy-900); opacity: 1; }
.nav-item.active:hover { background: var(--grad-active); color: var(--navy-900); }
.nav-item.active .nav-logout svg { color: inherit; }

.sidebar-footer { background: rgba(5, 37, 59, 0.28); }
.admin-name, .emp-user-chip .info .t { color: #F4FBFE; font-weight: 600; }
.admin-role, .emp-user-chip .info .s { color: var(--sidebar-text-3); }
.admin-signout, .emp-signout-btn {
  color: var(--sidebar-text-2);
  background: var(--sidebar-hover);
  border-color: var(--sidebar-border);
}
.admin-signout:hover, .emp-signout-btn:hover {
  background: var(--red-50);
  border-color: rgba(200, 85, 109, 0.45);
  color: var(--red);
}

/* ---------------------------------------------------------------- Topbar */
.topbar {
  background: rgba(242, 250, 254, 0.82);
  border-bottom: 1px solid rgba(143, 217, 238, 0.55);
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 12px rgba(10, 96, 140, 0.06);
}
.icon-btn, .today-chip {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--ice-300);
  color: var(--ink-2);
  border-radius: 12px;
}
.icon-btn:hover { background: var(--ice-200); border-color: var(--aqua-300); color: var(--ink); }

/* ---------------------------------------------------------- Cards & panels */
.panel, .stat-card, .birthday-card, .service-card, .progress-card,
.emp-dash-head, .emp-list-item, .setup-step, .setup-checklist,
.login-card, .modal, .drawer, .toast, .profile-hero, .section-hero {
  background: var(--grad-light);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.panel, .stat-card, .birthday-card, .service-card, .progress-card,
.emp-dash-head, .emp-list-item, .setup-step, .login-card, .modal,
.drawer, .profile-hero, .section-hero {
  border-radius: var(--radius);
}
.section-hero { border: 1px solid var(--border); }
.stat-card { background: var(--grad-stat); }
.stat-card.clickable:hover, .birthday-card:hover, .service-card:hover {
  border-color: var(--aqua-300);
  box-shadow: var(--shadow-md);
}
.panel-head { background: rgba(228, 244, 251, 0.55); border-bottom-color: var(--ice-300); }
.panel-body { background: transparent; }
.hero-chip, .stat-card .stat-chip {
  background: var(--ice-200);
  border-color: var(--ice-300);
  color: var(--ink-2);
}
.detail-item { background: var(--ice-100); border-color: var(--ice-300); }
.detail-item .value { color: var(--ink); }
.detail-section-title { color: var(--muted); }
.profile-hero::before { background: linear-gradient(90deg, #29B8E6 0%, #1179AC 100%); }
.birthday-card.today-card { border-color: var(--aqua-300); background: var(--ice-200); }
.birthday-card.soon-card { border-color: var(--ice-300); }
.days-pill { background: var(--ice-200); color: var(--teal-600); }
.days-pill.soon { background: var(--ice-200); color: var(--teal-600); }
.days-pill.today { background: #E3F5F8; color: #1E8FA6; }
.days-pill.later { background: var(--ice-100); color: var(--ink-2); }
.service-icon {
  background: linear-gradient(135deg, #0A304E 0%, #1179AC 100%);
  color: #fff;
}
.stat-icon { background: var(--ice-200); color: var(--teal-600); }

/* ----------------------------------------------------------------- Tables */
.data-table th {
  background: linear-gradient(180deg, #E4F4FB 0%, #D9EFF8 100%);
  color: var(--ink);
  border-bottom-color: var(--ice-300);
  font-weight: 700;
}
.data-table td { color: var(--ink-2); border-bottom-color: #DCEFF7; }
.data-table tbody tr:hover { background: #EAF7FC; }
.person-name { color: var(--ink); }
.person-meta { color: var(--muted); }

/* ------------------------------------------------ Buttons, chips and links */
.btn-primary, .login-submit {
  background: var(--grad-dark);
  border: 1px solid var(--navy-800);
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 96, 140, 0.22);
}
.btn-primary:hover, .login-submit:hover {
  background: linear-gradient(135deg, #0C3B5B 0%, #1179AC 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(10, 96, 140, 0.28);
}
.btn-ghost, .chip {
  background: var(--ice-100);
  border-color: var(--ice-300);
  color: var(--ink-2);
}
.btn-ghost:hover, .chip:hover {
  background: var(--ice-200);
  border-color: var(--aqua-300);
  color: var(--ink);
}
.chip.active {
  background: linear-gradient(90deg, #1FA9D2 0%, #1179AC 100%);
  border-color: #1179AC;
  color: #fff;
}
.link-btn { color: var(--teal-600); font-weight: 600; }
.link-btn:hover { background: var(--ice-200); color: var(--ink); }
.icon-action {
  background: var(--ice-100);
  border-color: var(--ice-300);
  color: var(--teal-600);
  border-radius: 10px;
}
.icon-action:hover { background: var(--ice-200); border-color: var(--aqua-300); color: var(--ink); }
.icon-action.danger:hover { background: var(--red-50); border-color: var(--red); color: var(--red); }
.switch-tabs { background: var(--ice-200); border-color: var(--ice-300); }
.switch-tab.active { background: var(--white); border-color: var(--ice-300); color: var(--ink); }
.pay-method input:checked + span {
  border-color: var(--teal-500);
  background: var(--ice-200);
  color: var(--teal-700);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
}

/* ---------------------------------------------------------- Fields & search */
.search-box {
  background: var(--ice-100);
  border: 1px solid var(--ice-300);
  border-radius: 999px;
}
.search-box svg { color: var(--teal-600); }
.search-box input { color: var(--ink); }
.search-box input::placeholder { color: var(--muted); }
.search-box:focus-within { border-color: var(--cyan-400); box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18); }

.field input, .field select, .field textarea,
.login-field input, .toolbar-date input, .toolbar-select select,
.panel-head select, .autocomplete input, .bt-owner-row input,
.ac-add input, .punch-row input[type="time"],
#attendanceTable .att-time-hh, #attendanceTable .att-time-mm, #attendanceTable .att-time-mer,
#empAttTable .att-time-hh, #empAttTable .att-time-mm, #empAttTable .att-time-mer {
  background: var(--ice-100);
  border: 1px solid var(--ice-300);
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus,
.login-field input:focus, .toolbar-date input:focus, .toolbar-select select:focus,
.panel-head select:focus, .punch-row input[type="time"]:focus,
#attendanceTable .att-time-hh:focus, #attendanceTable .att-time-mm:focus,
#attendanceTable .att-time-mer:focus,
#empAttTable .att-time-hh:focus, #empAttTable .att-time-mm:focus,
#empAttTable .att-time-mer:focus {
  border-color: var(--cyan-400);
  box-shadow: 0 0 0 3px rgba(41, 184, 230, 0.18);
  outline: none;
}
:focus-visible { outline: 2px solid var(--cyan-400); outline-offset: 2px; }
::selection { background: var(--ice-300); color: var(--ink); }
.auto-id-box { background: var(--ice-200); border-color: var(--ice-300); color: var(--teal-600); }
.form-section-title .num, .setup-step .num { background: var(--ice-200); color: var(--teal-600); }

/* -------------------------------------------------------- Badges & status */
.badge { font-family: var(--font); }
.badge-green, .badge-approved { background: #E3F5F8; color: #1E8FA6; }
.badge-amber, .badge-pending { background: #E7F5FB; color: #177E9E; }
.badge-red, .badge-rejected { background: #FBECEF; color: var(--red); }
.badge-sky, .badge-violet, .badge-gray, .badge-brand, .badge-reminder {
  background: var(--ice-200);
  color: var(--ink-2);
}
.seg-group button.on-present { background: #E3F5F8; color: #1E8FA6; }
.seg-group button.on-late { background: #E7F5FB; color: #177E9E; }
.cal-day.is-present { background: var(--green); border-color: var(--green); color: #fff; }
.cal-day.is-absent { background: var(--red-50); border-color: transparent; color: var(--red); }
.cal-day.is-other { background: var(--amber-50); border-color: transparent; color: var(--amber); }
.cal-dot.present { background: var(--green); }
.cal-dot.absent { background: var(--red); }
.cal-dot.other { background: var(--amber); }

/* ---------------------------------------------------- Charts & indicators */
.bar-track { background: var(--ice-200); border-color: var(--ice-300); }
.bar-fill { background: linear-gradient(180deg, #29B8E6 0%, #1179AC 100%); }
.progress-card .pg-val { color: var(--teal-600); }
.cal-day.today { border-color: var(--teal-500); color: var(--teal-600); }
.cal-day.selected {
  background: var(--teal-500);
  border-color: var(--teal-500);
  color: #fff;
  box-shadow: inset 0 0 0 2px var(--teal-500);
}
.emp-pick-card.selected { background: var(--ice-200); border-color: var(--teal-500); }
.cs-item.cs-selected { color: var(--teal-700); background: var(--ice-200); }

/* ------------------------------------------------------- Modals & drawers */
.modal-backdrop, .drawer-backdrop { background: rgba(5, 37, 59, 0.55); backdrop-filter: blur(3px); }
.modal-head { background: var(--ice-200); border-bottom-color: var(--ice-300); }
.modal-foot { background: var(--ice-100); border-top-color: var(--ice-300); }
.modal-hero-icon { background: linear-gradient(135deg, #0A304E 0%, #1179AC 100%); color: #fff; }
.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }

/* ------------------------------------------------------------- Login page */
.login-screen { background: var(--grad-page); background-attachment: fixed; }
.login-card { border-radius: 22px; box-shadow: var(--shadow-lg); }
.login-logo {
  background: linear-gradient(135deg, #29B8E6 0%, #1179AC 100%);
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(10, 96, 140, 0.25);
}
.login-sub { color: var(--muted); }
.login-field label { color: var(--ink-2); }
.login-show { color: var(--teal-600); }
.login-submit { border-radius: 12px; }
.login-hint { color: var(--muted); }
.login-hint strong { color: var(--ink-2); }

/* ------------------------------------------------------------ Fine details */
.amount-green { color: var(--green); }
.amount-red { color: var(--red); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ice-100); }
::-webkit-scrollbar-thumb { background: var(--aqua-300); border-radius: 999px; border: 2px solid var(--ice-100); }
::-webkit-scrollbar-thumb:hover { background: var(--cyan-500); }

/* ==========================================================================
   RESPONSIVE HARDENING · 320px → 1920px+
   Additive only: keeps the redesign intact and fixes the last layout edges -
   safe-area insets, tablet/laptop attendance table fit, and ≥40px tap targets
   on touch devices. Declared last so it wins over the equal-specificity rules
   above without replacing any of them.
   ========================================================================== */

/* ---------- Safe-area edges (the page opts into viewport-fit=cover) ------- */
.login-screen, .login-popup {
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
}
.topbar { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
@media (max-width: 479px) {
  .topbar { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 1024px) {
  .topbar { padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 1920px) {
  .topbar { padding-top: calc(22px + env(safe-area-inset-top, 0px)); }
}
/* Bottom sheets / drawers follow the browser chrome instead of a hard vh. */
.modal { max-height: 92dvh; }
.drawer { max-width: 100vw; }
#recQueuePanel { scroll-margin-top: calc(84px + env(safe-area-inset-top, 0px)); }
/* Long unbroken values (phone numbers, IDs, pasted text) never push a sheet
   or a toast wider than the viewport. */
.modal-body, .drawer-body, .toast, .confirm-text, .ac-empty,
.bill-total, .total-bar-label { overflow-wrap: anywhere; }

/* ---------- Attendance tables: fit their panel at tablet + laptop --------
   The four-column attendance tables need a 720px floor at full desktop, but
   that floor made a 28–140px horizontal scroll inside .table-wrap between
   640px and 1279px. Below 1280px the table now sizes to its panel; the cells
   tighten only where the room is genuinely needed (640–1023px). Phones are
   unaffected: the shared "table → cards" block still owns <640px. */
@media (min-width: 640px) and (max-width: 1279px) {
  #attendanceTable, #empAttTable { min-width: 0; }
  /* Content-sized columns expand past the panel when a value is unusually
     long (pasted names, IDs). Fixed columns + wrapping keep every table
     inside its panel; phones already restack as cards. */
  .data-table { table-layout: fixed; }
  .data-table th, .data-table td { overflow-wrap: anywhere; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  #attendanceTable th, #empAttTable th { padding: 8px 6px; font-size: 9.5px; letter-spacing: 0.04em; }
  #attendanceTable td, #empAttTable td { height: 48px; padding: 6px 6px; }
  #attendanceTable .att-status-seg, #empAttTable .att-status-seg { flex-wrap: wrap; }
  #attendanceTable .att-time-group, #empAttTable .att-time-group { flex-wrap: wrap; gap: 4px; }
  #attendanceTable .att-time-hh, #attendanceTable .att-time-mm,
  #empAttTable .att-time-hh, #empAttTable .att-time-mm {
    width: auto; min-width: 34px; padding: 0 3px;
  }
  #attendanceTable .att-time-mer, #empAttTable .att-time-mer {
    width: auto; min-width: 42px; padding: 0 3px;
  }
  #attendanceTable .person-name, #empAttTable .person-name { overflow-wrap: anywhere; }
}

/* ---------- Mobile table cards: text stays inside its card --------------
   In card mode each cell is a column flex with align-items:flex-start, so a
   wide child (person row, badge group, long value) can grow to its max-content
   width instead of shrinking to the card. Cap the children to the cell. */
@media (max-width: 639px) {
  .data-table td > * { max-width: 100%; }
  .data-table td .person-cell { width: 100%; }
  .data-table td .person-name, .data-table td .person-meta { overflow-wrap: anywhere; }
}

/* ---------- Touch targets: ≥40px where fingers actually land ------------
   Width rule covers phones/tablets; pointer rule also catches touch laptops
   and hybrid devices that report a desktop-sized viewport. Mouse-only
   desktops keep their denser reference metrics. */
@media (max-width: 1023px) {
  .btn-sm { height: 40px; min-height: 40px; }
  .chip, .switch-tab { min-height: 40px; }
  .nav-item { min-height: 44px; }
  .nav-logout, .admin-signout, .linked-clear, .icon-action,
  .modal-close, .drawer-close, .punch-del, .punch-add-row,
  .att-date-nav-btn, .cal-nav, .apt-action { min-width: 40px; min-height: 40px; }
  .table-status-select { min-height: 40px; }
  /* Attendance controls are declared with ID-scoped selectors in the
     reference layout, so the touch bump has to match that specificity. */
  #section-attendance .att-view-btn, #emp-attendance .att-view-btn,
  #section-attendance .att-date-field, #emp-attendance .att-date-field,
  #section-attendance .att-save, #emp-attendance .att-save,
  #attendanceTable .att-seg-btn, #empAttTable .att-seg-btn,
  #attendanceTable .att-time-hh, #attendanceTable .att-time-mm, #attendanceTable .att-time-mer,
  #empAttTable .att-time-hh, #empAttTable .att-time-mm, #empAttTable .att-time-mer {
    min-height: 40px;
  }
  #section-attendance .att-date-nav-btn, #emp-attendance .att-date-nav-btn {
    min-width: 40px; min-height: 40px;
  }
  .login-show { min-width: 44px; min-height: 40px; }
  .pay-method, .pay-method span { min-height: 40px; }
  .pay-method input { width: 18px; height: 18px; }
}
@media (hover: none), (pointer: coarse) {
  .btn, .btn-sm, .chip, .switch-tab, .icon-action, .nav-item, .nav-logout,
  .admin-signout, .linked-clear, .modal-close, .drawer-close,
  .punch-del, .punch-add-row, .table-status-select, .apt-action,
  .att-view-btn, .att-date-nav-btn, .att-date-field, .att-save, .att-seg-btn,
  .cal-nav, .login-show { min-height: 40px; }
  .nav-item { min-height: 44px; }
  .icon-action, .nav-logout, .admin-signout, .linked-clear, .modal-close,
  .drawer-close, .punch-del, .punch-add-row, .att-date-nav-btn,
  .cal-nav, .apt-action { min-width: 40px; }
  #attendanceTable .att-time-hh, #attendanceTable .att-time-mm, #attendanceTable .att-time-mer,
  #empAttTable .att-time-hh, #empAttTable .att-time-mm, #empAttTable .att-time-mer,
  .table-status-select { min-height: 40px; }
  #section-attendance .att-view-btn, #emp-attendance .att-view-btn,
  #section-attendance .att-date-nav-btn, #emp-attendance .att-date-nav-btn,
  #section-attendance .att-date-field, #emp-attendance .att-date-field,
  #section-attendance .att-save, #emp-attendance .att-save,
  #attendanceTable .att-seg-btn, #empAttTable .att-seg-btn { min-height: 40px; }
  #section-attendance .att-date-nav-btn, #emp-attendance .att-date-nav-btn { min-width: 40px; }
  .pay-method, .pay-method span { min-height: 40px; }
  .pay-method input { width: 18px; height: 18px; }

  /* iOS Safari zooms the page on focus when a field is under 16px. Touch
     devices get 16px for every date/time/select field at every breakpoint. */
  .field input[type="date"], .field input[type="time"], .field input[type="datetime-local"],
  .field select, .login-field input[type="date"], .login-field input[type="time"],
  .toolbar-date input[type="date"], .autocomplete input[type="date"],
  .autocomplete input[type="time"], .punch-row input[type="time"],
  #attDayDetail .value input[type="time"],
  #attendanceTable .att-time-hh, #attendanceTable .att-time-mm, #attendanceTable .att-time-mer,
  #empAttTable .att-time-hh, #empAttTable .att-time-mm, #empAttTable .att-time-mer {
    font-size: 16px;
  }
}
