/**
 * Acedo Dental Clinic Appointment & QR Queue Management System
 * Pure CSS3 Design System - Modern, Clean, Minimalist & Flat UI
 * STRICT RULE COMPLIANCE: 0 box-shadows, 0 gradients, 1px solid #E5E7EB borders, rounded components
 */

/* Self-hosted fonts: no external font requests or CSP changes required. */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-ExtraBold.ttf') format('truetype');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/poppins/Poppins-Black.ttf') format('truetype');
}

:root {
  --bg-main: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-subtle: #F3F4F6;
  --border-color: #E5E7EB;
  --border-dark: #D1D5DB;
  --text-main: #111827;
  --text-muted: #4B5563;
  --text-subtle: #6B7280;
  
  --primary: #111827;
  --primary-hover: #1F2937;
  --primary-text: #FFFFFF;
  
  --brand-gold: #D97706;
  --brand-gold-hover: #B45309;
  --brand-gold-light: #FEF3C7;
  --brand-gold-text: #92400E;

  --success-bg: #D1FAE5;
  --success-text: #065F46;
  --success-border: #A7F3D0;

  --warning-bg: #FEF3C7;
  --warning-text: #92400E;
  --warning-border: #FDE68A;

  --danger-bg: #FEE2E2;
  --danger-text: #991B1B;
  --danger-border: #FECACA;

  --info-bg: #DBEAFE;
  --info-text: #1E40AF;
  --info-border: #BFDBFE;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --font-family: 'Poppins', Arial, sans-serif;
  --sidebar-width: 260px;
  --header-height: 64px;
}

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

body {
  font-family: var(--font-family);
  background-color: #FFFFFF;
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea, code, pre, kbd, samp {
  font-family: var(--font-family);
}

/* Normalize legacy inline font declarations, including JS-generated queue modals. */
[style*="font-family:Arial"],
[style*="font-family: Arial"] {
  font-family: var(--font-family) !important;
}

/* -------------------------------------------------------------
   Typography & Links
------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1.00rem; }

p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-gold);
}

/* -------------------------------------------------------------
   Layout Structure
------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.main-content {
  flex: 1;
  padding: 2rem 0;
}

/* Admin / Dashboard Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

.app-topbar {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-body {
  padding: 1.75rem;
  flex: 1;
}

/* Public Header */
.site-header {
  background-color: var(--bg-card);
  border-bottom: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}

.brand-logo img {
  height: 38px;
  width: auto;
  display: block;
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 2px solid transparent;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  border-bottom-color: var(--brand-gold);
}

/* -------------------------------------------------------------
   Cards & Containers (Strictly 0 Shadows)
------------------------------------------------------------- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.card-footer {
  padding-top: 1rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.stat-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: outline-color 0.15s ease;
}

.stat-card-link:hover,
.stat-card-link:focus-visible,
.dashboard-status-grid > .stat-card:hover,
.dashboard-status-grid > .stat-card:focus-visible {
  color: inherit;
  text-decoration: none;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Hero Banner & Today's Live Capacity Widget */
.hero-banner-card {
  padding: 2.5rem 2rem;
}

.hero-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.hero-banner-text {
  flex: 1 1 320px;
  max-width: 640px;
}

.today-capacity-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

.capacity-slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.capacity-slot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.15rem;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1rem;
  min-width: 0;
  box-sizing: border-box;
}

.capacity-slot-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.capacity-slot-label strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.capacity-slot-label .slot-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.capacity-slot-badge {
  width: 144px;
  min-width: 144px;
  max-width: 144px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.capacity-slot-badge .badge {
  box-sizing: border-box;
  width: 144px;
  min-width: 144px;
  max-width: 144px;
  flex: 0 0 144px;
  justify-content: center;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
}

/* Responsive-ready hero typography & actions (scale down on phones) */
.hero-title {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  line-height: 1.15;
  overflow-wrap: break-word;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Two-column info grid that collapses to a single column on phones */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* -------------------------------------------------------------
   Buttons & Controls (Strictly 0 Shadows, 0 Gradients)
------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  text-decoration: none;
  line-height: 1;
}

.btn:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-text) !important;
  border-color: var(--primary);
}

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

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main) !important;
  border-color: var(--border-dark);
}

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

.btn-accent {
  background-color: var(--brand-gold);
  color: #FFFFFF !important;
  border-color: var(--brand-gold);
}

.btn-accent:hover {
  background-color: var(--brand-gold-hover);
  border-color: var(--brand-gold-hover);
}

.btn-danger {
  background-color: #DC2626;
  color: #FFFFFF !important;
  border-color: #DC2626;
}

.btn-danger:hover {
  background-color: #B91C1C;
  border-color: #B91C1C;
}

.btn-success {
  background-color: #059669;
  color: #FFFFFF !important;
  border-color: #059669;
}

.btn-success:hover {
  background-color: #047857;
  border-color: #047857;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  min-height: 36px;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #FFFFFF;
  animation: btn-spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
  box-sizing: border-box;
}

.btn-secondary .btn-spinner {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--text-main);
}

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

.btn.is-loading,
.btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.report-preset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main) !important;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  min-height: 28px;
  cursor: pointer;
}

.report-preset-btn:hover {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #FFFFFF !important;
}

.report-preset-btn.active {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #FFFFFF !important;
}

.report-preset-btn.active:hover {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  color: #FFFFFF !important;
}

/* -------------------------------------------------------------
   Forms & Inputs
------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.email-delivery-filter {
  display: grid;
  grid-template-columns: minmax(0, 240px) max-content;
  align-items: end;
  gap: 0.75rem;
  max-width: 100%;
}

.email-delivery-filter > div { min-width: 0; }
.email-delivery-filter .btn { min-height: 44px; }

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-control, .form-select, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  min-height: 44px;
  transition: border-color 0.15s ease;
}

.registration-form input.form-control,
.registration-form select.form-select {
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
}

.date-example-field {
  position: relative;
}

.date-example-placeholder {
  display: none;
  position: absolute;
  left: 0.85rem;
  right: 2.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.date-example-field[data-empty="true"]:not(:focus-within) .date-example-placeholder {
  display: block;
}

.date-example-field[data-empty="true"]:not(:focus-within) input {
  color: transparent;
}

.date-example-field[data-empty="true"]:not(:focus-within) input::-webkit-datetime-edit {
  color: transparent;
}

.registration-address {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.registration-address .address-search {
  margin-bottom: 0;
  padding-right: 3rem;
  border-radius: 999px;
}

.registration-address .address-search-wrapper {
  position: relative;
  min-width: 0;
  margin-bottom: 0.4rem;
}

.registration-address .address-search-icon {
  position: absolute;
  right: 0.9rem;
  bottom: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.registration-address .address-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.registration-address .address-suggestions[hidden] {
  display: none;
}

.registration-address .address-suggestion {
  padding: 0.7rem 0.85rem;
  min-height: 44px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.registration-address .address-suggestion:hover,
.registration-address .address-suggestion[aria-selected="true"] {
  background: var(--bg-subtle);
  color: var(--primary);
}

.registration-address .address-no-results {
  margin: 0;
  padding: 0.7rem 0.85rem;
  color: var(--text-muted);
}

.registration-address #address_lookup_retry {
  margin-bottom: 0.75rem;
}

.registration-address #address_lookup_retry[hidden] {
  display: none;
}

@media screen and (min-width: 641px) {
  .registration-address #address_lookup_retry {
    margin-bottom: 0.85rem;
  }
}

.registration-address .address-preview {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow-wrap: anywhere;
}

.registration-address .address-preview p {
  margin: 0.3rem 0 0;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.form-control:focus, .form-select:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.25rem;
}

/* Shared clinic footer: scoped so cards, modals and the live monitor are unaffected. */
.clinic-footer {
  margin-top: auto;
  padding: 2rem 0 1rem;
  border-top: none;
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-family);
}

.public-site .clinic-footer .footer-layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}

.clinic-footer .footer-identity {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.footer-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--brand-gold);
}

.public-site .clinic-footer .footer-clinic-name {
  display: block;
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
}

.public-site .clinic-footer .footer-address {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.public-site .clinic-footer .footer-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
  min-width: 0;
}

.public-site .clinic-footer .footer-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  max-width: 100%;
  min-height: 56px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  text-align: left;
  text-decoration: none;
  color: var(--text-main);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.footer-contact-item > svg { flex-shrink: 0; color: var(--brand-gold); }
.footer-contact-item > span { min-width: 0; overflow-wrap: anywhere; }
.footer-contact-item strong { font-size: 0.8rem; font-weight: 600; }
.footer-contact-label { display: block; color: var(--text-muted); font-size: 0.72rem; line-height: 1.6; }
.public-site .clinic-footer .footer-contact-item:hover,
.public-site .clinic-footer .footer-contact-item:active {
  background: var(--brand-gold-light);
  border-color: var(--brand-gold);
  color: var(--brand-gold-text);
  text-decoration: none;
}
.public-site .clinic-footer .footer-contact-item:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 3px;
}

.public-site .clinic-footer .footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  line-height: 1.7;
}

.public-site .clinic-footer .footer-privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--brand-gold);
  font-size: 0.75rem;
  text-decoration: none;
}

.clinic-footer .footer-privacy-link:hover { color: var(--brand-gold-hover); text-decoration: underline; text-underline-offset: 3px; }
.clinic-footer .footer-privacy-link:focus-visible { outline: 2px solid var(--brand-gold); outline-offset: 3px; border-radius: 3px; }

.admin-portal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: auto;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font: 0.75rem/1.6 'Poppins', Arial, sans-serif;
}

.admin-portal-footer strong { font-weight: 600; color: var(--text-main); }
.admin-footer-label { display: inline-flex; align-items: center; gap: 0.4rem; }

@media (max-width: 767px) {
  .public-site .clinic-footer .footer-layout { flex-direction: column; padding-bottom: 1rem; }
  .public-site .clinic-footer .footer-identity { flex-direction: column; text-align: center; }
  .public-site .clinic-footer .footer-contacts { width: 100%; justify-content: center; gap: 0.75rem; }
  .public-site .clinic-footer .footer-contact-item { min-height: 56px; line-height: 1.4; }
  .public-site .clinic-footer .footer-contact-label { line-height: 1.4; }
  .public-site .clinic-footer .footer-contact-item strong { display: block; line-height: 1.4; }
  .public-site .clinic-footer .footer-bottom { flex-direction: column; text-align: center; }
  .admin-portal-footer { padding: 0.85rem 1rem; font-size: 0.7rem; }
}

.footer-contacts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.4rem;
  row-gap: 0;
}

.footer-contact-link {
  color: #1D4ED8;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer-contact-link:hover {
  color: #1E40AF;
  text-decoration-thickness: 2px;
}

.footer-contact-link:focus-visible {
  outline: 2px solid #1D4ED8;
  outline-offset: 3px;
}

.privacy-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.privacy-consent input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.1rem 0 0;
  flex: 0 0 auto;
  accent-color: var(--brand-gold);
  cursor: pointer;
}

.privacy-notice h2 {
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.privacy-notice p {
  margin-bottom: 0.85rem;
  line-height: 1.6;
}

.privacy-notice h2:first-child {
  margin-top: 0;
}

.privacy-notice > :last-child {
  margin-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.google-profile-names {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.google-profile-form .form-group {
  margin-bottom: 0.75rem;
}

/* -------------------------------------------------------------
   Password Input with Show/Hide Toggle Button
------------------------------------------------------------- */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper .form-control {
  padding-right: 44px !important;
  width: 100%;
}

.password-toggle-btn {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 42px;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: color 0.15s ease, background-color 0.15s ease;
  z-index: 2;
  user-select: none;
}

.password-toggle-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  color: var(--text-main);
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

/* -------------------------------------------------------------
   Tables (Clean, Aligned & Responsive)
------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
}

.card .table-responsive {
  border: none;
  border-radius: 0;
}

.table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th, .data-table th {
  background-color: var(--bg-subtle);
  padding: 0.85rem 1.15rem;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td, .data-table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.table tbody tr:hover, .data-table tbody tr:hover {
  background-color: #F9FAFB;
}

/* -------------------------------------------------------------
   Badges (Flat & Subtle) - merged: single definition kept below in Badges & Tags
------------------------------------------------------------- */

/* -------------------------------------------------------------
   Flash Messages & Alerts
------------------------------------------------------------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid;
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-error, .alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.alert-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.alert-info {
  background-color: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

/* Plain flash notice: no border, no background, centered (e.g. logout message) */
.alert-plain {
  background: transparent;
  border: none;
  color: var(--text-muted);
  justify-content: center;
  text-align: center;
  padding: 0.5rem 0;
}

/* -------------------------------------------------------------
   Badges & Tags (Strictly Inline Horizontal, No Word Wrapping)
------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-decoration: none;
}

/* -------------------------------------------------------------
   Sidebar Navigation
------------------------------------------------------------- */
.admin-app .admin-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 1.875rem;
  min-height: 1.75rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid #6B7280;
  border-radius: 6px;
  background: #FFFFFF;
  color: #111827;
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}

.admin-app .sidebar-link .admin-count-badge {
  margin-left: auto;
}

.admin-app .sidebar-count-link {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 0.5rem;
  min-height: 48px;
  overflow: visible;
}

.admin-app .sidebar-count-link .sidebar-link-label {
  min-width: 0;
  line-height: 1.4;
}

.admin-app .sidebar-count-link .admin-nav-count {
  min-width: 1.875rem;
  min-height: 1.875rem;
  border-color: #111827;
  background: #111827;
  color: #FFFFFF;
  font-size: 1rem;
}

.admin-app .admin-message-tabs {
  flex-wrap: wrap;
}

.admin-app .admin-message-tabs > a {
  max-width: 100%;
  min-height: 44px;
}

.admin-app .admin-message-tabs > a > svg {
  flex-shrink: 0;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
  list-style: none;
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem 0.65rem 1rem;
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 0.925rem;
  font-weight: 500;
  min-height: 44px;
  overflow: hidden;
  transition: background-color 0.18s ease-out, color 0.18s ease-out;
}

/* Icons: never squash, glide slightly on hover with a gold tint */
.sidebar-link svg {
  flex-shrink: 0;
  transition: transform 0.18s ease-out, color 0.18s ease-out;
}

.admin-app .sidebar-link .admin-nav-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  object-fit: contain;
}

.admin-app .sidebar-count-link.has-custom-nav-icon {
  grid-template-columns: 22px minmax(0, 1fr) auto;
}

.sidebar-link .badge {
  transition: background-color 0.18s ease-out, color 0.18s ease-out;
}

/* Gold indicator bar (no layout shift — replaces the old 3px border hack) */
.sidebar-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: var(--radius-full);
  background-color: var(--brand-gold);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.18s ease-out;
}

.sidebar-link:hover {
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.sidebar-link:hover svg {
  color: var(--brand-gold);
  transform: translateX(2px);
}

.sidebar-link.active {
  color: var(--text-main);
  background-color: #ECEEF1;
  font-weight: 600;
}

.sidebar-link.active::before {
  transform: scaleY(1);
}

.sidebar-link.active svg {
  color: var(--brand-gold);
}

.sidebar-link.active:hover {
  background-color: #E5E7EB;
}

.sidebar-link.active:hover svg {
  transform: none;
}

/* Keyboard users get the same cue as hover, plus a visible focus ring */
.sidebar-link:focus-visible {
  color: var(--text-main);
  background-color: var(--bg-subtle);
  outline: 2px solid var(--brand-gold);
  outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-link,
  .sidebar-link svg,
  .sidebar-link .badge,
  .sidebar-link::before {
    transition: none;
  }
  .sidebar-link:hover svg {
    transform: none;
  }
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* -------------------------------------------------------------
   Queue Monitor Board (Clean, High Visibility)
------------------------------------------------------------- */
.monitor-wrapper {
  min-height: 100vh;
  background-color: #FFFFFF;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.monitor-header {
  text-align: center;
  margin-bottom: 2rem;
}

.monitor-header h1 {
  font-size: 2.25rem;
  letter-spacing: 1px;
}

.monitor-header p {
  font-size: 1.1rem;
  color: var(--brand-gold);
  font-weight: 600;
}

.monitor-header-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

@media (max-width: 860px) {
  .monitor-header-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .monitor-header-right {
    justify-content: center !important;
    margin-top: 6px;
  }
}

/* GM65 Scanner Status Indicator (Frameless, Clean) */
.scanner-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 6px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 0.85rem;
  font-weight: 600;
  color: #000000;
  transition: all 0.2s ease;
  user-select: none;
}

.scanner-status-pill:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

.scanner-status-pill .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #9CA3AF;
  display: inline-block;
  flex-shrink: 0;
}

.scanner-status-pill.status-online {
  background: transparent !important;
  border: none !important;
  color: #000000;
}

.scanner-status-pill.status-online .status-dot {
  background-color: #10B981;
  animation: pulse-scanner-dot 1.8s infinite ease-in-out;
}

.scanner-status-pill.status-standby {
  background: transparent !important;
  border: none !important;
  color: #000000;
}

.scanner-status-pill.status-standby .status-dot {
  background-color: #F59E0B;
}

.scanner-status-pill.status-offline {
  background: transparent !important;
  border: none !important;
  color: #000000;
}

.scanner-status-pill.status-offline .status-dot {
  background-color: #EF4444;
}

@keyframes pulse-scanner-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

.now-serving-scan-hint {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px dashed transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.now-serving-scan-hint:hover {
  color: var(--primary);
  background: var(--bg-subtle);
  border-color: var(--border-color);
}


.monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  flex: 1;
}

.now-serving-box {
  background-color: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
}

.now-serving-box.recalling-pulse {
  animation: recallPulse 2.8s ease-out;
  border-color: #F59E0B !important;
}

@keyframes recallPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  20% {
    transform: scale(1.03);
    box-shadow: 0 0 0 16px rgba(245, 158, 11, 0);
  }
  40% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  60% {
    transform: scale(1.02);
    box-shadow: 0 0 0 12px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.now-serving-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--brand-gold);
  margin-bottom: 1rem;
}

.now-serving-number {
  font-size: 5rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 1.5rem;
  font-family: var(--font-family);
}

.now-serving-instructions {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.queue-lists-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.queue-list-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  flex: 1;
}

.queue-tickets-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ticket-pill {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-dark);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}

.ticket-pill.serving {
  background-color: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

/* -------------------------------------------------------------
   QR Code Display Card & Pass Layout (Ultra Responsive)
------------------------------------------------------------- */
.qr-container-outer {
  max-width: 480px;
  width: 100%;
  margin: 1.5rem auto;
  box-sizing: border-box;
}

.qr-card {
  text-align: center;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.75rem;
  box-sizing: border-box;
}

.qr-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 0.65rem;
  width: 100%;
}

.qr-card .qr-pass-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
  box-sizing: border-box;
}

.qr-card .qr-actions-row .btn,
.qr-card .qr-back-link {
  min-height: 44px;
}

.qr-back-row {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.qr-card .qr-back-link {
  gap: 0.4rem;
  max-width: 100%;
  font-size: 0.85rem;
  line-height: 1;
  white-space: nowrap;
}

.qr-clinic-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.qr-clinic-title h1 {
  font-size: 1.3rem;
  margin: 0;
}

.qr-box {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.qr-code-wrapper {
  width: 220px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #FFFFFF;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.qr-code-wrapper canvas,
#qrCanvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

.barcode-code-wrapper {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  background: #FFFFFF;
}

.barcode-code-wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
}

.token-code {
  font-family: var(--font-family);
  font-size: 1.05rem;
  font-weight: 700;
  background-color: var(--bg-subtle);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: inline-block;
  margin-top: 0.5rem;
  max-width: 100%;
  word-break: break-all;
  overflow-wrap: anywhere;
  letter-spacing: 0.5px;
  box-sizing: border-box;
}

.qr-queue-assigned {
  background: #E0E7FF;
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
  box-sizing: border-box;
}

.qr-queue-number-text {
  font-size: 2.2rem;
  font-weight: 800;
  color: #3730A3;
  line-height: 1.2;
  font-family: var(--font-family);
  margin: 0.25rem 0;
}

.qr-instructions {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  text-align: left;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.qr-instructions ol {
  margin: 0.5rem 0 0 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.qr-actions-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

/* -------------------------------------------------------------
   Modal Dialogs (Clean, Accessible & Mobile Responsive)
------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-sizing: border-box;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

.modal-body {
  min-height: 0;
  padding: 1.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  box-sizing: border-box;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* The inquiry body is nested in a form: allow both flex layers to shrink
   so the body scrolls instead of being clipped by the dialog. */
#guestInquiryForm {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#guestInquirySendStatus {
  flex-shrink: 0;
}

.inquiry-form-body {
  padding: 1.5rem;
  overscroll-behavior-y: contain;
}

/* Reserve the same label height so email/mobile inputs share a baseline. */
@media (min-width: 641px) {
  #guestInquiryForm .inquiry-contact-grid .form-label {
    min-height: 3em;
    line-height: 1.5;
  }
}

@media (max-width: 640px) {
  .registration-form .form-grid,
  #guestInquiryForm .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0;
  }

  .registration-form .form-group,
  #guestInquiryForm .form-group {
    margin-bottom: 0.65rem;
  }

  .registration-form .form-label,
  #guestInquiryForm .form-label {
    margin-bottom: 0.2rem;
  }

  .registration-form .form-control,
  .registration-form .form-select,
  #guestInquiryForm .form-control {
    font-size: 1rem;
    padding: 0.5rem 0.7rem;
  }

  .modal-overlay {
    padding: 8px;
  }
  
  .modal-dialog {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 10px;
  }
  
  .modal-header {
    padding: 0.85rem 1rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
  }
}

/* -------------------------------------------------------------
   Chat & Messaging Styles
------------------------------------------------------------- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 480px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-bubble {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
}

.chat-bubble.sent {
  align-self: flex-end;
  background-color: var(--primary);
  color: #FFFFFF;
}

.chat-bubble.received {
  align-self: flex-start;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.chat-time {
  font-size: 0.725rem;
  margin-top: 0.25rem;
  opacity: 0.75;
}

.chat-input-bar {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
}

/* -------------------------------------------------------------
   Responsive Breakpoints
------------------------------------------------------------- */
.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  cursor: pointer;
  min-height: 44px;
}

@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-menu {
    display: none;
  }
  
  .nav-menu.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    gap: 0.75rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1.15rem;
  }

  .main-content {
    padding: 1.25rem 0;
  }

  .container {
    padding: 0 0.875rem;
  }

  .brand-logo {
    font-size: 1rem;
    gap: 0.5rem;
  }

  .brand-logo img {
    height: 32px;
  }

  .brand-logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 52vw;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }

  .hero-actions .btn {
    flex: 1 1 160px;
    text-align: center;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .table th, .data-table th {
    padding: 0.65rem 0.75rem;
  }

  .table td, .data-table td {
    padding: 0.7rem 0.75rem;
    font-size: 0.82rem;
  }

  .hero-banner-card {
    padding: 1.25rem 1rem !important;
  }

  .today-capacity-box {
    max-width: 100%;
    padding: 1.15rem 0.85rem;
  }

  .capacity-slot-row {
    padding: 0.55rem 0.75rem;
    gap: 0.35rem;
  }

  .capacity-slot-label {
    font-size: 0.82rem;
    gap: 0.25rem;
  }

  .capacity-slot-label .slot-time {
    font-size: 0.75rem;
  }

  .capacity-slot-badge .badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  .now-serving-number {
    font-size: 3.5rem;
  }

  .qr-container-outer {
    margin: 0.75rem auto;
  }

  .qr-card {
    padding: 1.25rem 1rem;
  }

  .qr-clinic-title h1 {
    font-size: 1.15rem;
  }

  .qr-box {
    padding: 1rem 0.5rem;
    margin: 1rem 0;
  }

  .qr-code-wrapper {
    width: 190px;
    max-width: 85%;
    padding: 8px;
  }

  .token-code {
    font-size: 0.92rem;
    padding: 0.4rem 0.65rem;
  }

  .qr-queue-number-text {
    font-size: 1.85rem;
  }

  .qr-instructions {
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
  }

  .qr-instructions ol {
    margin-left: 1rem;
  }

  .qr-actions-row {
    gap: 0.5rem;
  }

  .qr-actions-row .btn {
    flex: 1 1 auto;
    min-width: 80px;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 420px) {
  .hero-title {
    font-size: 1.4rem;
  }

  .hero-banner-card {
    padding: 1rem 0.75rem !important;
  }

  .today-capacity-box {
    padding: 0.85rem 0.65rem;
  }

  .capacity-slot-row {
    padding: 0.5rem 0.6rem;
  }

  .capacity-slot-label {
    font-size: 0.78rem;
  }

  .capacity-slot-label .slot-time {
    font-size: 0.7rem;
  }

  .capacity-slot-badge .badge {
    font-size: 0.72rem;
    padding: 0.18rem 0.4rem;
  }

  .qr-card {
    padding: 1rem 0.75rem;
  }

  .qr-code-wrapper {
    width: 165px;
    padding: 6px;
  }

  .token-code {
    font-size: 0.82rem;
    padding: 0.35rem 0.5rem;
  }

  .qr-queue-number-text {
    font-size: 1.6rem;
  }
}

/* -------------------------------------------------------------
   Interactive QR Scanner Modal & Kiosk Elements
------------------------------------------------------------- */
.qr-scanner-tabs {
  display: flex;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 1.25rem;
}

.qr-scanner-tab-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.qr-scanner-tab-btn:hover {
  color: var(--text-main);
}

.qr-scanner-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--border-color);
}

/* Also applies inside the public-display iframe, using its own viewport width. */
@media (max-width: 600px) {
  #qrScannerModal .qr-scanner-tabs {
    flex-direction: column;
  }

  #qrScannerModal .qr-scanner-tab-btn {
    flex: none;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  #qrScannerModal .qr-scanner-tab-btn svg {
    flex-shrink: 0;
  }
}

.qr-dropzone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background-color: var(--bg-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.qr-dropzone:hover, .qr-dropzone.dragover {
  border-color: var(--brand-gold);
  background-color: var(--brand-gold-light);
}

.qr-dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.qr-dropzone.dragover .qr-dropzone-icon {
  color: var(--brand-gold);
}

.qr-camera-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  background: #111827;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-camera-target-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 150px;
  border: 2px solid #10B981;
  border-radius: var(--radius-md);
  box-sizing: border-box;
  pointer-events: none;
}

.qr-camera-scan-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #10B981;
  animation: qr-laser-sweep 2s infinite ease-in-out alternate;
}

@keyframes qr-laser-sweep {
  0% { top: 4px; }
  100% { top: calc(100% - 6px); }
}

/* -------------------------------------------------------------
   Toast Notification System (Modern & Minimalist)
------------------------------------------------------------- */
#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 400px;
  width: calc(100% - 40px);
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background-color: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  animation: toast-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-item.toast-hiding {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
}

.toast-item.toast-success,
.toast-item.toast-info,
.toast-item.toast-warning,
.toast-item.toast-danger,
.toast-item.toast-error {
  border: 1px solid #E5E7EB;
  background-color: #FFFFFF;
}

.toast-icon {
  display: none !important;
}

.toast-content {
  flex: 1;
  line-height: 1.4;
}

.toast-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-subtle);
  font-size: 16px;
  line-height: 1;
  padding: 2px;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(-15px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* -------------------------------------------------------------
   Real-Time Table Row Animations & Badge Pulses
------------------------------------------------------------- */
@keyframes badge-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    opacity: 1;
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    opacity: 0.8;
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    opacity: 1;
  }
}

.row-updated-highlight {
  animation: row-flash-green 2.5s ease-out forwards;
}

@keyframes row-flash-green {
  0% {
    background-color: #D1FAE5 !important;
  }
  50% {
    background-color: #ECFDF5 !important;
  }
  100% {
    background-color: transparent !important;
  }
}

.new-appointment-row {
  animation: new-row-glow 3s ease-out forwards;
}

@keyframes new-row-glow {
  0% {
    background-color: #FEF3C7 !important;
    transform: translateY(-6px);
  }
  30% {
    background-color: #FEF3C7 !important;
    transform: translateY(0);
  }
  100% {
    background-color: transparent !important;
  }
}

.card.patient-appointment-card.status-updated-flash {
  animation: card-flash-green 2s ease-out forwards;
}

@keyframes card-flash-green {
  0% {
    border-color: #10B981 !important;
    background-color: #F0FDF4 !important;
  }
  100% {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
  }
}

/* -------------------------------------------------------------
   Pagination Component Styles
------------------------------------------------------------- */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-nav {
  display: inline-flex;
  align-items: center;
}

.pagination {
  display: inline-flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.page-item {
  margin: 0;
  list-style: none;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  border: 1px solid #D1D5DB;
  background-color: #FFFFFF;
  color: #1F2937;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

.page-link:hover {
  background-color: #F3F4F6;
  border-color: #9CA3AF;
  color: #111827;
}

/* Active page state: High-contrast distinct border and dark background */
.page-item.active .page-link,
.page-link.active {
  background-color: #111827 !important;
  border: 2px solid #111827 !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  cursor: default;
}

.page-item.disabled .page-link,
.page-link[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #F9FAFB;
  color: #9CA3AF;
  border-color: #E5E7EB;
}

.page-link-dots {
  border: none !important;
  background: transparent !important;
  color: #6B7280;
  cursor: default;
  min-width: 20px;
  padding: 0;
}

/* -------------------------------------------------------------
   Print Styles
------------------------------------------------------------- */
@media print {
  body {
    background: #FFFFFF;
    color: #000000;
  }

  .site-header, .app-sidebar, .app-topbar, .btn, .no-print, #toastContainer, .pagination-container, .pagination-nav, .modal-overlay, #scannerHudNotice {
    display: none !important;
  }

  .app-main {
    margin: 0;
    padding: 0;
  }

  .card, .qr-card {
    border: none !important;
    padding: 0 !important;
  }
}

/* -------------------------------------------------------------
   Skeleton Loading Placeholders (flat design pulse — no gradients)
   Shown while live data (queue board, AJAX lists) is still loading.
   They are replaced automatically when real data arrives.
------------------------------------------------------------- */
.skeleton {
  display: inline-block;
  background-color: var(--border-color);
  border-radius: var(--radius-md);
  animation: aceSkeletonPulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes aceSkeletonPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Ticket-pill shaped placeholder for the AM / PM waiting lists */
.skeleton-pill {
  width: 5.5rem;
  height: 2.6rem;
}

/* Large block placeholder for the Now Serving number */
.skeleton-serving {
  width: 2.6em;
  height: 1em;
  border-radius: var(--radius-md);
}

/* Small line / paragraph placeholders (mobile personal queue card, etc.) */
.skeleton-line  { width: 7rem;  height: 1.1rem; }
.skeleton-line-short { width: 4.5rem; height: 0.8rem; border-radius: var(--radius-sm); }
.skeleton-textline   { width: 90%;   height: 0.7rem; border-radius: var(--radius-sm); }

/* Respect users who disable animations */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    opacity: 0.55;
  }
}
