/* ============================================================================
   Orchid Medical — M3 Components + Legacy Alias Layer (m3-components.css)
   ============================================================================
   Two halves:
   1. m3-* component classes (buttons, fields, chips, cards, dialogs, snackbar,
      tabs, tables, progress...) — the new M3 vocabulary.
   2. Legacy alias layer: every class the existing pages use (.btn, .card,
      .badge, .alert, .auth-*, .stat-*, .modal-*, .data-table, .sidebar-*, ...)
      is re-skinned onto M3 tokens/shapes/state layers so the whole app
      re-skins without touching page markup. style.css still loads FIRST;
      this file overrides its visual layer only.

   Version stamp: bump ?v= in every <head> that links this file when changed.
   ========================================================================== */

/* ============================================================================
   Section 1 — M3 Components
   ========================================================================== */

/* ---- Buttons ---- */
.m3-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 24px;
  border: none; border-radius: var(--md-shape-small);
  font: 500 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .1px;
  cursor: pointer; user-select: none; text-decoration: none;
  position: relative; overflow: hidden;
  transition: box-shadow var(--md-duration-short4) var(--md-ease-standard),
              background-color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-btn:disabled { opacity: .38; pointer-events: none; }
.m3-btn--filled { background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--md-elevation-1); }
.m3-btn--filled:hover { box-shadow: var(--md-elevation-2); }
.m3-btn--filled::before { background: var(--md-on-primary); } /* state layer color */
.m3-btn--tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.m3-btn--tonal::before { background: var(--md-on-secondary-container); }
.m3-btn--elevated { background: var(--md-surface); color: var(--md-primary); box-shadow: var(--md-elevation-1); }
.m3-btn--elevated:hover { box-shadow: var(--md-elevation-2); }
.m3-btn--elevated::before { background: var(--md-primary); }
.m3-btn--outlined {
  background: transparent; color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-outline);
}
.m3-btn--outlined::before { background: var(--md-primary); }
.m3-btn--text { background: transparent; color: var(--md-primary); padding: 0 12px; }
.m3-btn--text::before { background: var(--md-primary); }
.m3-btn--error { background: var(--md-error); color: var(--md-on-error); }
.m3-btn--error::before { background: var(--md-on-error); }
.m3-btn--small { min-height: 32px; padding: 0 16px; font-size: 13px; }

/* State layer for buttons */
.m3-btn::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  opacity: 0; transition: opacity var(--md-duration-short3) var(--md-ease-standard);
}
.m3-btn:hover::before { opacity: var(--md-state-hover); }
.m3-btn:focus-visible::before { opacity: var(--md-state-focus); }
.m3-btn:active::before { opacity: var(--md-state-pressed); }

/* ---- Icon button ---- */
.m3-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 40px;
  border: none; border-radius: var(--md-shape-small);
  background: transparent; color: var(--md-on-surface-variant);
  cursor: pointer; position: relative; overflow: hidden;
  transition: background-color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-icon-btn:hover { background: rgba(29,27,32,var(--md-state-hover)); }
[data-theme="dark"] .m3-icon-btn:hover { background: rgba(230,224,233,var(--md-state-hover)); }
.m3-icon-btn:active { background: rgba(29,27,32,var(--md-state-pressed)); }
[data-theme="dark"] .m3-icon-btn:active { background: rgba(230,224,233,var(--md-state-pressed)); }
.m3-icon-btn:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.m3-icon-btn svg { width: 22px; height: 22px; }

/* ---- FAB ---- */
.m3-fab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 56px; height: 56px;
  border: none; border-radius: var(--md-shape-large);
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  box-shadow: var(--md-elevation-3);
  font: 500 14px/20px "Roboto", system-ui, sans-serif;
  cursor: pointer; position: relative; overflow: hidden; text-decoration: none;
  transition: box-shadow var(--md-duration-short4) var(--md-ease-standard);
}
.m3-fab:hover { box-shadow: var(--md-elevation-4); }
.m3-fab svg { width: 24px; height: 24px; }

/* ---- Cards ---- */
.m3-card {
  background: var(--md-surface); color: var(--md-on-surface);
  border-radius: var(--md-shape-medium);
  box-shadow: var(--md-elevation-1);
  position: relative; overflow: hidden;
}
.m3-card--outlined { box-shadow: none; box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.m3-card--filled { background: var(--md-surface-variant); color: var(--md-on-surface-variant); box-shadow: none; }
.m3-card--elevated { box-shadow: var(--md-elevation-1); }
.m3-card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; }
.m3-card__title { font: 500 16px/24px "Roboto", system-ui, sans-serif; letter-spacing: .15px; color: var(--md-on-surface); }
.m3-card__body { padding: 24px; }
.m3-card__actions { display: flex; align-items: center; gap: 8px; padding: 0 24px 24px; }

/* ---- Chips ---- */
.m3-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 32px; padding: 0 16px;
  border-radius: var(--md-shape-small);
  font: 500 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .1px;
  cursor: pointer; position: relative; overflow: hidden;
  background: transparent; color: var(--md-on-surface-variant);
  box-shadow: inset 0 0 0 1px var(--md-outline);
  transition: background-color var(--md-duration-short4) var(--md-ease-standard),
              box-shadow var(--md-duration-short4) var(--md-ease-standard);
}
.m3-chip:hover { background: rgba(29,27,32,.08); }
[data-theme="dark"] .m3-chip:hover { background: rgba(230,224,233,.08); }
.m3-chip--selected { background: var(--md-secondary-container); color: var(--md-on-secondary-container); box-shadow: none; }
.m3-chip svg { width: 18px; height: 18px; }
.m3-chip--filter { padding: 0 8px 0 16px; }

/* ---- Text field (filled) ---- */
.m3-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.m3-field__label { font: 500 12px/16px "Roboto", system-ui, sans-serif; letter-spacing: .5px; color: var(--md-on-surface-variant); }
.m3-field__input {
  min-height: 56px; padding: 16px 16px 8px;
  background: var(--md-surface-variant); color: var(--md-on-surface);
  border: none; border-radius: var(--md-shape-extra-small) var(--md-shape-extra-small) 0 0;
  border-bottom: 1px solid var(--md-outline);
  font: 400 16px/24px "Roboto", system-ui, sans-serif;
  outline: none; transition: border-color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-field__input:focus { border-bottom: 2px solid var(--md-primary); }
.m3-field__input:hover:not(:focus) { border-bottom-color: var(--md-on-surface); }
.m3-field__input::placeholder { color: var(--md-on-surface-variant); }
.m3-field__error { font: 400 12px/16px "Roboto", system-ui, sans-serif; color: var(--md-error); min-height: 16px; }
.m3-field--error .m3-field__input { border-bottom-color: var(--md-error); background: var(--md-error-container); }
select.m3-field__input { appearance: none; padding: 12px 16px; border-radius: var(--md-shape-extra-small); border-bottom-width: 1px; }
.m3-field__input[type="date"],
.m3-field__input[type="time"] { padding-top: 12px; }

/* ---- Checkbox / radio ---- */
.m3-check, .m3-radio {
  display: inline-flex; align-items: center; gap: 12px;
  font: 400 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .25px;
  color: var(--md-on-surface); cursor: pointer; min-height: 48px;
}
.m3-check input, .m3-radio input {
  width: 18px; height: 18px; min-width: 18px; flex-shrink: 0;
  accent-color: var(--md-primary); cursor: pointer;
}
.m3-radio input { border-radius: 50%; }

/* ---- Switch ---- */
.m3-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; min-height: 32px; }
.m3-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.m3-switch__track {
  width: 52px; height: 32px; border-radius: var(--md-shape-full);
  background: var(--md-surface-variant);
  box-shadow: inset 0 0 0 2px var(--md-outline);
  transition: background-color var(--md-duration-short4) var(--md-ease-standard), box-shadow var(--md-duration-short4) var(--md-ease-standard);
}
.m3-switch__thumb {
  position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--md-outline);
  transition: transform var(--md-duration-short4) var(--md-ease-standard), background-color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-switch input:checked + .m3-switch__track { background: var(--md-primary); box-shadow: inset 0 0 0 2px var(--md-primary); }
.m3-switch input:checked ~ .m3-switch__thumb { transform: translateX(20px); background: var(--md-on-primary); }

/* ---- Dialog ---- */
.m3-dialog { display: none; }
.m3-dialog.open { display: flex; }
.m3-scrim {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.32);
  align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.m3-dialog__container {
  background: var(--md-surface); color: var(--md-on-surface);
  border-radius: var(--md-shape-extra-large) var(--md-shape-extra-large) var(--md-shape-large) var(--md-shape-large);
  box-shadow: var(--md-elevation-3);
  max-width: 560px; width: 100%; margin-top: 8vh;
  animation: m3-dialog-in var(--md-duration-short4) var(--md-ease-emphasized-decelerate);
}
@keyframes m3-dialog-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.m3-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 24px 8px; }
.m3-dialog__title { font: 400 24px/32px "Roboto", system-ui, sans-serif; color: var(--md-on-surface); }
.m3-dialog__body { padding: 8px 24px 24px; color: var(--md-on-surface-variant); font: 400 14px/20px "Roboto", system-ui, sans-serif; }
.m3-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 24px 24px; }

/* ---- Snackbar ---- */
.m3-snackbar-layer {
  position: fixed; bottom: 24px; left: 0; right: 0; z-index: 1000;
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
}
.m3-snackbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--md-inverse-surface); color: var(--md-inverse-on-surface);
  border-radius: var(--md-shape-extra-small);
  box-shadow: var(--md-elevation-3);
  padding: 14px 16px; max-width: 640px; width: 100%;
  font: 400 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .25px;
  pointer-events: auto;
}
.m3-snackbar__action { background: none; border: none; color: var(--md-inverse-primary); font: 500 14px/20px "Roboto", system-ui, sans-serif; cursor: pointer; padding: 0 8px; min-height: 36px; }

/* ---- Banner ---- */
.m3-banner {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--md-surface); color: var(--md-on-surface);
  border-radius: var(--md-shape-medium);
  box-shadow: var(--md-elevation-1);
  padding: 12px 16px; margin-bottom: 16px;
  font: 400 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .25px;
}
.m3-banner__icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 24px; height: 24px; }
.m3-banner__text { flex: 1; color: var(--md-on-surface-variant); }
.m3-banner--error .m3-banner__icon { color: var(--md-error); }
.m3-banner--success .m3-banner__icon { color: var(--md-success, #2e7d32); }
.m3-banner--warning .m3-banner__icon { color: var(--md-warning, #b26a00); }

/* ---- Tabs (M3 primary) ---- */
.m3-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--md-outline-variant); margin-bottom: 24px; overflow-x: auto; }
.m3-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; min-height: 48px; white-space: nowrap;
  background: none; border: none; cursor: pointer;
  font: 500 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .1px;
  color: var(--md-on-surface-variant);
  transition: color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-tab:hover { color: var(--md-on-surface); }
.m3-tab::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--md-primary);
  transform: scaleX(0); transition: transform var(--md-duration-medium2) var(--md-ease-emphasized-decelerate);
}
.m3-tab.active { color: var(--md-primary); }
.m3-tab.active::after { transform: scaleX(1); }
.m3-tab svg { width: 18px; height: 18px; }

/* ---- List ---- */
.m3-list { display: flex; flex-direction: column; }
.m3-list__item {
  display: flex; align-items: center; gap: 16px;
  min-height: 56px; padding: 8px 16px;
  border-radius: var(--md-shape-extra-small);
  color: var(--md-on-surface); text-decoration: none;
  font: 400 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .25px;
  transition: background-color var(--md-duration-short4) var(--md-ease-standard);
}
.m3-list__item:hover { background: rgba(29,27,32,.08); }
[data-theme="dark"] .m3-list__item:hover { background: rgba(230,224,233,.08); }
.m3-list__item--active, .m3-list__item--selected { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.m3-list__icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--md-on-surface-variant); }
.m3-list__item--active .m3-list__icon { color: var(--md-on-secondary-container); }
.m3-list__support { flex: 1; min-width: 0; }
.m3-list__title { font: 500 14px/20px "Roboto", system-ui, sans-serif; }
.m3-list__sub { font: 400 12px/16px "Roboto", system-ui, sans-serif; color: var(--md-on-surface-variant); }
.m3-list__traling { color: var(--md-on-surface-variant); }

/* ---- Table (M3) ---- */
.m3-table-wrap { overflow-x: auto; border-radius: var(--md-shape-medium); border: 1px solid var(--md-outline-variant); }
.m3-table { width: 100%; border-collapse: collapse; font: 400 14px/20px "Roboto", system-ui, sans-serif; }
.m3-table th {
  background: var(--md-surface-variant); color: var(--md-on-surface-variant);
  text-align: left; padding: 12px 16px;
  font: 500 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .1px;
  position: sticky; top: 0; white-space: nowrap;
}
.m3-table td { padding: 12px 16px; border-bottom: 1px solid var(--md-outline-variant); color: var(--md-on-surface); vertical-align: middle; }
.m3-table tbody tr { transition: background-color var(--md-duration-short3) var(--md-ease-standard); }
.m3-table tbody tr:hover { background: rgba(29,27,32,.06); }
[data-theme="dark"] .m3-table tbody tr:hover { background: rgba(230,224,233,.06); }
.m3-table--numeric td.num, .m3-table--numeric th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Progress ---- */
.m3-linear {
  height: 4px; border-radius: 4px; overflow: hidden; background: var(--md-primary-container);
}
.m3-linear__bar {
  height: 100%; width: 40%; border-radius: 4px; background: var(--md-primary);
  animation: m3-linear-indeterminate 1.4s var(--md-ease-standard) infinite;
}
@keyframes m3-linear-indeterminate {
  0% { transform: translateX(-100%); }
  60% { transform: translateX(150%); }
  100% { transform: translateX(250%); }
}
.m3-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--md-primary-container);
  border-top-color: var(--md-primary);
  animation: m3-spin .8s linear infinite;
}
@keyframes m3-spin { to { transform: rotate(360deg); } }

/* ---- Skeleton ---- */
.m3-skeleton {
  border-radius: var(--md-shape-extra-small);
  background: linear-gradient(90deg, var(--md-surface-variant) 25%, var(--md-outline-variant) 50%, var(--md-surface-variant) 75%);
  background-size: 200% 100%;
  animation: m3-shimmer 1.6s var(--md-ease-standard) infinite;
}
@keyframes m3-shimmer { to { background-position: -200% 0; } }

/* ---- Divider ---- */
.m3-divider { height: 1px; background: var(--md-outline-variant); border: none; margin: 8px 0; }

/* ---- Badge (M3) ---- */
.m3-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--md-shape-small);
  background: var(--md-error); color: var(--md-on-error);
  font: 500 12px/16px "Roboto", system-ui, sans-serif; letter-spacing: .5px;
  white-space: nowrap;
}

/* ---- Menu (M3) ---- */
.m3-menu {
  position: absolute; z-index: 400;
  min-width: 180px; padding: 8px 0;
  background: var(--md-surface); color: var(--md-on-surface);
  border-radius: var(--md-shape-extra-small);
  box-shadow: var(--md-elevation-2);
  display: none;
}
.m3-menu.open { display: block; animation: m3-menu-in var(--md-duration-short3) var(--md-ease-emphasized-decelerate); }
@keyframes m3-menu-in { from { opacity: 0; transform: scale(.95) translateY(-4px); } to { opacity: 1; transform: none; } }
.m3-menu__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 16px; min-height: 40px;
  background: none; border: none; cursor: pointer; text-align: left;
  color: var(--md-on-surface);
  font: 400 14px/20px "Roboto", system-ui, sans-serif; letter-spacing: .25px;
  transition: background-color var(--md-duration-short3) var(--md-ease-standard);
}
.m3-menu__item:hover { background: rgba(29,27,32,.08); }
[data-theme="dark"] .m3-menu__item:hover { background: rgba(230,224,233,.08); }
.m3-menu__item svg { width: 20px; height: 20px; color: var(--md-on-surface-variant); }
.m3-menu__item--danger { color: var(--md-error); }
.m3-menu__item--danger svg { color: var(--md-error); }
.m3-menu__label { padding: 8px 16px 4px; font: 500 12px/16px "Roboto", system-ui, sans-serif; letter-spacing: .5px; color: var(--md-on-surface-variant); }
.m3-menu__sep { height: 1px; background: var(--md-outline-variant); margin: 8px 0; }
.m3-menu-anchor { position: relative; }

/* ---- Ripple (driven by m3.js) ---- */
.m3-ripple-host { position: relative; overflow: hidden; }
.m3-ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .12;
  transform: scale(0);
  animation: m3-ripple-in var(--md-duration-medium2) var(--md-ease-emphasized-decelerate) forwards;
}
@keyframes m3-ripple-in { to { transform: scale(1); opacity: 0; } }

/* ---- Tooltip ---- */
.m3-tooltip { position: relative; }
.m3-tooltip::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--md-inverse-surface); color: var(--md-inverse-on-surface);
  border-radius: var(--md-shape-extra-small); padding: 4px 8px;
  font: 500 11px/16px "Roboto", system-ui, sans-serif; letter-spacing: .5px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity var(--md-duration-short4) var(--md-ease-standard);
  z-index: 500;
}
.m3-tooltip:hover::after { opacity: 1; }

/* ============================================================================
   Section 2 — Legacy Alias Layer (re-skin of existing classes)

   style.css loads BEFORE this file. These rules override its visual layer
   (shape, elevation, state, type) so legacy markup renders as M3 without
   class renames. Structural rules not overridden here keep working.
   ========================================================================== */

/* ---- Buttons: legacy .btn becomes M3 filled/elevated/outlined ---- */
.btn {
  border-radius: var(--md-shape-small);
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 500; letter-spacing: .1px;
  border: none;
  box-shadow: var(--md-elevation-1);
  transition: box-shadow var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}
.btn:hover { box-shadow: var(--md-elevation-2); }
.btn-primary { background: var(--md-primary); color: var(--md-on-primary); }
.btn-primary:hover { background: var(--md-primary); box-shadow: var(--md-elevation-2); }
.btn-secondary {
  background: var(--md-surface); color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-outline);
}
.btn-secondary:hover { background: var(--md-primary); color: var(--md-on-primary); border-color: transparent; }
.btn-danger { background: transparent; color: var(--md-error); box-shadow: inset 0 0 0 1px var(--md-outline); }
.btn-danger:hover { background: var(--md-error); color: var(--md-on-error); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--md-primary); box-shadow: none; min-height: 40px; }
.btn-ghost:hover { background: var(--md-primary-container); }
.btn-accent { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.btn-accent:hover { background: var(--md-tertiary-container); box-shadow: var(--md-elevation-2); }
.btn-whatsapp { background: #25d366; color: #fff; border-color: transparent; }
.btn-whatsapp:hover { background: #1da851; box-shadow: var(--md-elevation-2); }
.btn-email { background: var(--md-surface); color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-outline); }
.btn-email:hover { background: var(--md-primary-container); border-color: transparent; }

/* ---- Cards: legacy .card becomes M3 elevated outlined card ---- */
.card, .card-sm, .card-md, .card-lg, .card-xl {
  background: var(--md-surface-container);
  border-radius: var(--md-shape-medium);
  border: 1px solid var(--md-outline-variant);
  box-shadow: var(--md-elevation-1);
}
.card-accent { border-top: 3px solid var(--md-primary); }
.card-accent-pink { border-top: 3px solid var(--md-tertiary); }
.card-accent-success { border-top: 3px solid var(--md-success, #2e7d32); }
.card-accent-warning { border-top: 3px solid var(--md-warning, #b26a00); }
.card-accent-error { border-top: 3px solid var(--md-error); }
.card-header { border-bottom: 1px solid var(--md-outline-variant); }
.card-body { padding: 24px; }
.card-footer { border-top: 1px solid var(--md-outline-variant); }

/* ---- Alerts -> M3 banner surfaces ---- */
.alert { border-radius: var(--md-shape-medium); border: 1px solid transparent; }
.alert-ok { background: var(--md-success-bg, rgba(46,125,50,.10)); color: var(--md-success, #2e7d32); border-color: var(--md-success-border, rgba(46,125,50,.28)); }
.alert-err { background: var(--md-error-container); color: var(--md-on-error-container); border-color: transparent; }
.alert-warn { background: var(--md-warning-bg, rgba(178,106,0,.10)); color: var(--md-warning, #b26a00); border-color: var(--md-warning-border, rgba(178,106,0,.28)); }
.alert-info { background: var(--md-info-bg, rgba(0,99,155,.10)); color: var(--md-info, #00639b); border-color: var(--md-info-border, rgba(0,99,155,.28)); }

/* ---- Badges -> M3 tonal chips ---- */
.badge, .badge-s, .badge-p, .badge-w, .badge-e, .badge-a, .badge-n,
.appt-status, .fb-pill, .pg-count {
  border-radius: var(--md-shape-small);
  text-transform: none; letter-spacing: .1px;
  font-family: "Roboto", system-ui, sans-serif;
}
.badge-s { background: var(--md-success-bg, rgba(46,125,50,.10)); color: var(--md-success, #2e7d32); border-color: transparent; }
.badge-p { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
.badge-w { background: var(--md-warning-bg, rgba(178,106,0,.10)); color: var(--md-warning, #b26a00); border-color: transparent; }
.badge-e { background: var(--md-error-container); color: var(--md-on-error-container); border-color: transparent; }
.badge-a { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); border-color: transparent; }
.badge-n { background: var(--md-surface-variant); color: var(--md-on-surface-variant); border-color: transparent; }
.sidebar-badge { border-radius: var(--md-shape-small); background: var(--md-primary); }
.slot-badge, .slot-badge-open { border-radius: var(--md-shape-small); text-transform: none; letter-spacing: .1px; }
.slot-badge-open { background: var(--md-success-bg, rgba(46,125,50,.10)); color: var(--md-success, #2e7d32); }
.slot-badge-booked { background: var(--md-surface-variant); color: var(--md-on-surface-variant); }

/* ---- Status pills (appointments) ---- */
.appt-status.requested { background: var(--md-warning-bg, rgba(178,106,0,.10)); color: var(--md-warning, #b26a00); border-color: transparent; }
.appt-status.contacted { background: var(--md-info-bg, rgba(0,99,155,.10)); color: var(--md-info, #00639b); border-color: transparent; }
.appt-status.booked { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
.appt-status.completed { background: var(--md-success-bg, rgba(46,125,50,.10)); color: var(--md-success, #2e7d32); border-color: transparent; }
.appt-status.cancelled { background: var(--md-surface-variant); color: var(--md-on-surface-variant); border-color: transparent; }

/* ---- Forms ---- */
.form-label { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: .1px; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="date"], input[type="time"], input[type="number"], input[type="search"],
select, textarea, .form-input {
  border-radius: var(--md-shape-extra-small) var(--md-shape-extra-small) 0 0;
  border: none;
  border-bottom: 1px solid var(--md-outline);
  background: var(--md-surface-variant);
  color: var(--md-on-surface);
  padding: 14px 16px 10px;
  min-height: 48px;
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 15px; line-height: 20px;
  outline: none;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
input:focus, select:focus, textarea:focus, .form-input:focus {
  border-bottom: 2px solid var(--md-primary);
  padding-bottom: 9px;
  background: var(--md-surface-variant);
}
input::placeholder, textarea::placeholder { color: var(--md-on-surface-variant); }
select { border-radius: var(--md-shape-extra-small); }
textarea { border-radius: var(--md-shape-extra-small); min-height: 96px; }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
.field-error, .input-error { color: var(--md-error); font-size: 12px; font-weight: 400; }
input.has-error, .has-error input, .has-error select, .has-error textarea {
  border-bottom-color: var(--md-error);
  background: var(--md-error-container);
}
.consent-box { border-radius: var(--md-shape-medium); }
.consent-box input[type="checkbox"] { accent-color: var(--md-primary); }

/* ---- Auth screens ---- */
.auth-page, .login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--md-primary-container) 0%, transparent 60%),
    radial-gradient(900px 400px at -10% 110%, var(--md-tertiary-container) 0%, transparent 55%),
    var(--md-background);
}
.auth-card, .login-card {
  margin: auto;
  border-radius: var(--md-shape-extra-large) var(--md-shape-extra-large) var(--md-shape-large) var(--md-shape-large);
  border: none;
  box-shadow: var(--md-elevation-3);
}
.auth-logo { border-radius: var(--md-shape-medium); }
.auth-brand { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; margin: 0; line-height: 1.3; }
.auth-tagline { color: var(--md-on-surface-variant); }
.auth-contact, .auth-footer { color: var(--md-on-surface-variant); }

/* Tall content (booking/lobby) must scroll from the top, not clip:
   margin:auto centers when there is room and pins to top when taller.
   width:100% is REQUIRED — margin:auto in a flex column disables the
   default stretch, so without it the wrap collapses to content width. */
.bk-wrap, .lobby-wrap { margin: 0 auto; width: 100%; max-width: 680px; box-sizing: border-box; }

/* ---- Stat cards -> M3 dashboard cards ---- */
.stats-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: transparent; border: none; box-shadow: none;
}
.stat-card {
  border-radius: var(--md-shape-medium);
  border: 1px solid var(--md-outline-variant);
  background: var(--md-surface);
  box-shadow: var(--md-elevation-1);
  padding: 20px 16px;
}
.stat-card::before { content: none; }
.stat-card .stat-value { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: 0; }
.stat-card .stat-label { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: .1px; text-transform: none; }
/* Color coding moves to the value text (M3-idiomatic, keeps the signal) */
.stat-card.purple .stat-value { color: var(--md-primary); }
.stat-card.pink .stat-value { color: var(--md-tertiary); }
.stat-card.success .stat-value { color: var(--md-success, #2e7d32); }
.stat-card.warning .stat-value { color: var(--md-warning, #b26a00); }
@media (max-width: 1023px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { border-right: none; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 360px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ---- Sidebar / navigation drawer (keeps existing ids, M3 look) ---- */
.admin-sidebar {
  background: var(--md-surface);
  border-right: 1px solid var(--md-outline-variant);
}
.sidebar-nav { padding: 12px; gap: 4px; }
.sidebar-group-label {
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 500; letter-spacing: .1px;
  text-transform: none; font-size: 12px;
  padding: 16px 16px 8px;
}
.sidebar-link, .sidebar-dropdown-toggle {
  border-radius: var(--md-shape-small);
  border-left: none;
  min-height: 48px;
  padding: 12px 16px;
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 500; letter-spacing: .1px;
  color: var(--md-on-surface-variant);
  transition: background-color var(--t-fast), color var(--t-fast);
}
.sidebar-link:hover, .sidebar-dropdown-toggle:hover { background: rgba(29,27,32,.08); color: var(--md-on-surface); }
[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .sidebar-dropdown-toggle:hover { background: rgba(230,224,233,.08); }
.sidebar-link.active, .sidebar-dropdown-toggle.active {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  border-left: none;
}
.sidebar-link.active svg, .sidebar-dropdown-toggle.active svg { color: var(--md-primary); }
.sidebar-dropdown-toggle .chevron { color: var(--md-on-surface-variant); }
.sidebar-dropdown-toggle.active .chevron { color: var(--md-on-secondary-container); }
.sidebar-sub-nav {
  padding-left: 20px;
  margin-left: 12px;
  border-left: 1px solid var(--md-outline-variant);
}
.sidebar-sub-nav .sidebar-link { min-height: 40px; padding: 8px 16px; }
.sidebar-sub-nav .sidebar-link.active { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.sidebar-foot { border-top: 1px solid var(--md-outline-variant); padding: 8px 12px; }
.sidebar-link.danger { color: var(--md-error); }
.sidebar-link.danger:hover { background: var(--md-error-container); color: var(--md-on-error-container); }
.sidebar-brand-box { border-bottom: 1px solid var(--md-outline-variant); }
.admin-sidebar-brand { border-bottom: 1px solid var(--md-outline-variant); }
.admin-sidebar-brand img { border-radius: var(--md-shape-medium); }
.brand-name { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: 0; }
.brand-sub { letter-spacing: .1px !important; }
/* Collapsed rail */
@media (min-width: 901px) {
  html.sidebar-collapsed .sidebar-link,
  html.sidebar-collapsed .sidebar-dropdown-toggle { justify-content: center; }
  html.sidebar-collapsed .sidebar-link[data-hide-collapsed],
  html.sidebar-collapsed .sidebar-dropdown-toggle[data-hide-collapsed] { display: none; }
  html.sidebar-collapsed .sidebar-sub-nav { display: none !important; }
  html.sidebar-collapsed .sidebar-dropdown-toggle span,
  html.sidebar-collapsed .sidebar-dropdown-toggle .chevron { display: none; }
  html.sidebar-collapsed .sidebar-dropdown-toggle { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
}
@media (max-width: 900px) {
  .admin-sidebar.open { box-shadow: var(--md-elevation-4); }
}

/* ---- Topbar ---- */
.content-topbar {
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-variant);
}
.content-topbar .content-title { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: 0; }
.sidebar-toggle, .sidebar-collapse-btn {
  border-radius: var(--md-shape-small);
  border: none;
  background: transparent;
  color: var(--md-on-surface-variant);
}
.sidebar-toggle:hover, .sidebar-collapse-btn:hover { background: rgba(29,27,32,.08); border-color: transparent; }
[data-theme="dark"] .sidebar-toggle:hover,
[data-theme="dark"] .sidebar-collapse-btn:hover { background: rgba(230,224,233,.08); }
.profile-chip { border-radius: var(--md-shape-small); }
.profile-chip .avatar { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.profile-chip .name { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; }
.menu { border-radius: var(--md-shape-extra-small); box-shadow: var(--md-elevation-2); border: none; padding: 8px 0; }
.menu a { min-height: 40px; font-family: "Roboto", system-ui, sans-serif; border-radius: var(--md-shape-extra-small); }
.menu a:hover { background: rgba(29,27,32,.08); }
[data-theme="dark"] .menu a:hover { background: rgba(230,224,233,.08); }
.menu-sep { background: var(--md-outline-variant); }
.theme-toggle { border-radius: var(--md-shape-small); border: none; background: transparent; color: var(--md-on-surface-variant); }
.theme-toggle:hover { background: rgba(29,27,32,.08); }
[data-theme="dark"] .theme-toggle:hover { background: rgba(230,224,233,.08); }

/* ---- Top-bar global search (popup list) ---- */
.topbar-search { position: relative; flex: 1; max-width: 420px; margin-left: var(--space-3); }
.topbar-search input {
  width: 100%; padding: 10px 14px; border-radius: var(--md-shape-medium);
  border: 1px solid var(--md-outline-variant); background: var(--md-surface-container-low);
  font: 500 14px/20px "Roboto", system-ui, sans-serif; color: var(--md-on-surface);
}
.topbar-search input:focus { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.topbar-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 300;
  background: var(--md-surface); border-radius: var(--md-shape-medium);
  box-shadow: var(--md-elevation-3); border: 1px solid var(--md-outline-variant);
  max-height: 420px; overflow-y: auto;
}
.tsr-item { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; text-decoration: none; }
.tsr-item:hover { background: var(--md-surface-container-low); }
.tsr-type { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--md-primary); min-width: 90px; }
.tsr-name { font-weight: 500; color: var(--md-on-surface); }
.tsr-sub { font-size: 12px; color: var(--md-on-surface-variant); }
.tsr-empty { padding: 14px; color: var(--md-on-surface-variant); font-size: 13px; }
@media (max-width: 900px) { .topbar-search { display: none; } }

/* ---- Slot tag picker (15-minute chips) ---- */
.slot-tag-picker {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-small); background: var(--md-surface-container-low);
}
.slot-tag {
  padding: 6px 10px; border-radius: var(--md-shape-small);
  border: 1px solid var(--md-outline-variant); background: var(--md-surface);
  color: var(--md-on-surface-variant); font: 500 12px/16px "Roboto", system-ui, sans-serif;
  cursor: pointer;
}
.slot-tag:hover { background: var(--md-surface-container-high); }
.slot-tag.on { background: var(--md-primary); color: var(--md-on-primary); border-color: var(--md-primary); }

/* ---- Tabs -> M3 primary tabs ---- */
.tab-btn {
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 500; letter-spacing: .1px;
  border-bottom: 3px solid transparent;
  min-height: 48px;
}
.tab-btn.active {
  color: var(--md-primary);
  border-bottom-color: var(--md-primary);
}
.tabs { border-bottom: 1px solid var(--md-outline-variant); gap: 0; }

/* ---- Modals -> M3 dialogs ---- */
.modal-overlay { background: rgba(0,0,0,.32); }
.modal-card {
  border-radius: var(--md-shape-extra-large) var(--md-shape-extra-large) var(--md-shape-large) var(--md-shape-large);
  border: none;
  box-shadow: var(--md-elevation-3);
}
.modal-head { border-bottom: 1px solid var(--md-outline-variant); }
.modal-close { border-radius: var(--md-shape-small); }
.modal-close:hover { background: var(--md-error-container); color: var(--md-on-error-container); }

/* ---- Dropdowns -> M3 menus ---- */
.dropdown-menu {
  border-radius: var(--md-shape-extra-small);
  border: none;
  box-shadow: var(--md-elevation-2);
  padding: 8px 0;
}
.dropdown-menu a, .dropdown-menu button { min-height: 40px; font-family: "Roboto", system-ui, sans-serif; letter-spacing: .25px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: rgba(29,27,32,.08); color: var(--md-on-surface); }
[data-theme="dark"] .dropdown-menu a:hover,
[data-theme="dark"] .dropdown-menu button:hover { background: rgba(230,224,233,.08); }
.dropdown-menu .danger:hover { background: var(--md-error-container); }

/* ---- Tables ---- */
.data-table-wrap { border-radius: var(--md-shape-medium); border: 1px solid var(--md-outline-variant); overflow: hidden; }
.data-table th {
  background: var(--md-surface-variant);
  color: var(--md-on-surface-variant);
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 500; letter-spacing: .1px; text-transform: none;
}
.data-table th, .data-table td { border-bottom: 1px solid var(--md-outline-variant); }
.data-table tr:hover td { background: rgba(29,27,32,.06); }
[data-theme="dark"] .data-table tr:hover td { background: rgba(230,224,233,.06); }

/* ---- Toasts / snackbar ---- */
.toast {
  border-radius: var(--md-shape-extra-small);
  border-left: none;
  background: var(--md-inverse-surface);
  color: var(--md-inverse-on-surface);
  box-shadow: var(--md-elevation-3);
}
.toast-msg { color: var(--md-inverse-on-surface); }
.toast-x { color: var(--md-inverse-on-surface); }
.toast-ic { background: var(--md-primary); }
.toast-err .toast-ic { background: var(--md-error); }
.toast-ok { border-left: none; }

/* ---- Cards & panels used across admin ---- */
.patient-group, .appt-card, .notif-card, .timeline-card, .filter-bar,
.cta-banner, .sa-help, .patient-list-panel, .bk-card, .msg-card,
.info-card, .timeline-preview.pdf, .patient-results, .slot-detail-patient {
  border-radius: var(--md-shape-medium);
  border-color: var(--md-outline-variant);
}
.patient-group.has-open, .appt-card:focus-within { box-shadow: 0 0 0 2px var(--md-primary-container); }
.pg-head { background: var(--md-primary-container); border-bottom: 1px solid var(--md-primary-container); }
.pg-avatar { background: var(--md-primary); }
.pg-name { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: 0; }
.slot-row, .slot-empty { border-radius: var(--md-shape-small); }
.slot-detail-note, .slot-detail-patient { border-radius: var(--md-shape-medium); }
.appt-question { border-radius: var(--md-shape-medium); background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
.cta-banner { background: var(--md-primary-container); color: var(--md-on-primary-container); border-color: transparent; }
.cta-banner .cta-icon { color: var(--md-primary); }
.cta-banner .cta-text strong { color: var(--md-on-primary-container); }
.cta-banner .cta-text span { color: var(--md-on-primary-container); opacity: .8; }

/* ---- Empty states ---- */
.empty-state strong { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; }

/* ---- Upload / file inputs ---- */
.file-input-wrapper { border-radius: var(--md-shape-medium); }
.upload-toggle { border-radius: var(--md-shape-medium); font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: .1px; }

/* ---- Calendar --- */
.cal-tabs { border-radius: var(--md-shape-small); border-color: var(--md-outline-variant); }
.cal-tab { border-radius: var(--md-shape-small); }

/* ---- Tag input ---- */
.tag-input { border-radius: var(--md-shape-extra-small) var(--md-shape-extra-small) 0 0; }
.tag-input-chips { border-radius: var(--md-shape-extra-small); }

/* ---- Page headers ---- */
.page-header h1, .page-header h2 { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; }
.page-sub { color: var(--md-on-surface-variant); }

/* ---- Lobby / patient pages ---- */
.lobby-wrap, .bk-wrap, .patient-wrap { font-family: "Roboto", system-ui, sans-serif; }
.check-row .check-ok { color: var(--md-success, #2e7d32); }
.check-row .check-err { color: var(--md-error); }
.check-row .check-pending { color: var(--md-outline); }
.lobby-video-preview, .audio-meter { border-radius: var(--md-shape-medium); }
.phase { display: none; }
.phase.active { display: block; }

/* ---- Feedback stars (M3 tertiary) ---- */
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: var(--md-tertiary); }

/* ---- Misc legacy bits ---- */
.fb-type { border-radius: var(--md-shape-small); }
.pagination-bar a { color: var(--md-primary); }
.pg-links .pg-cur { color: var(--md-primary); }
.bulk-toolbar { background: var(--md-secondary-container); border: none; border-radius: var(--md-shape-medium); }
.bulk-toolbar .sel-count { color: var(--md-on-secondary-container); }
.custom-box { border-radius: 0 0 var(--md-shape-medium) var(--md-shape-medium); }
.section-label { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: .1px; text-transform: none; }
.info-label { font-family: "Roboto", system-ui, sans-serif; font-weight: 500; letter-spacing: .1px; text-transform: none; }
.skip-link { background: var(--md-primary); color: var(--md-on-primary); border-radius: var(--md-shape-extra-small); }
.loading-overlay { background: color-mix(in srgb, var(--md-background) 92%, transparent); }
.topbar { background: var(--md-primary); color: var(--md-on-primary); }
.topbar h1 { color: var(--md-on-primary); }
.topbar .btn-secondary { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; }
.topbar .btn-secondary:hover { background: rgba(255,255,255,.24); color: #fff; }

/* ===== Flat pass (user request: no shadows) ===== */
.modal, .modal-content, .dropdown-menu, .m3-menu, .m3-dialog, .m3-snackbar {
  box-shadow: none !important;
  border: 1px solid var(--md-outline-variant);
}
