@import url("fonts/fonts.css");

:root {
  /* Apple iOS system-like palette */
  --bg: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --brand: #007aff;
  --brand-2: #0a84ff;
  --brand-rgb: 0, 122, 255;
  --brand-2-rgb: 10, 132, 255;
  --brand-soft: rgba(0, 122, 255, 0.12);
  --brand-soft-2: rgba(0, 122, 255, 0.2);
  --theme-glow: rgba(0, 122, 255, 0.22);
  --theme-glow-2: rgba(10, 132, 255, 0.18);
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.18);
  --ok: #1f8a3d;
  --ok-bg: rgba(52, 199, 89, 0.16);
  --err: #ff3b30;
  --err-bg: rgba(255, 59, 48, 0.12);
  --warn-bg: rgba(255, 149, 0, 0.14);
  --danger: #ff3b30;
  --accent: #ff3b30;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.05);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-dark: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.55);
  --blur: blur(22px) saturate(180%);
  --nav-h: 72px;
  --top-h: 64px;
  --sidebar-w: 260px;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Noto Sans Myanmar", "Pyidaungsu", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
body {
  background:
    radial-gradient(900px 520px at 12% -10%, var(--theme-glow-2), transparent 55%),
    radial-gradient(800px 480px at 92% 8%, var(--theme-glow), transparent 50%),
    radial-gradient(700px 420px at 70% 100%, rgba(var(--brand-rgb), 0.08), transparent 45%),
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, #eef3fb) 0%, var(--bg) 48%, #ebebf0 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 1.5rem;
  font-size: 15px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
@media (min-width: 720px) {
  body { font-size: 16px; line-height: 1.4; }
}
body.theme-solid .glass,
body.theme-solid .card,
body.theme-solid .media-card,
body.theme-solid .list-item,
body.theme-solid .stat,
body.theme-solid .soft-search,
body.theme-solid .patient-hero,
body.theme-solid .settings-panel,
body.theme-solid .topbar,
body.theme-solid .bottomnav,
body.theme-solid .appside,
body.theme-solid .history-sidebar,
body.theme-solid .sticky-actions {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #ffffff;
}
body.theme-solid .topbar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 10%, #ffffff) 0%, #ffffff 100%);
  border-bottom-color: color-mix(in srgb, var(--brand) 18%, var(--line));
}
body.theme-solid .appside {
  background: #f8f8fa;
  border-right: 1px solid var(--line-strong);
}
body.theme-solid {
  background: var(--bg);
}
body.has-bottomnav {
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-soft);
}

/* —— App shell + system sidebar —— */
.app-frame {
  min-width: 0;
  width: 100%;
}
.side-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.side-backdrop[hidden] { display: none !important; }
.appside {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2300;
  width: min(var(--sidebar-w), 88vw);
  height: 100vh;
  height: 100dvh;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.12);
  /* Closed drawer must not steal taps from header selects / page controls */
  pointer-events: none;
}
.appside.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.appside-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 0.9rem 0.85rem;
  border-bottom: 1px solid var(--line);
}
.appside-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #5ac8fa, var(--brand));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 122, 255, 0.28);
  overflow: hidden;
}
.appside-brand-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.appside-brand-copy strong {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appside-brand-copy span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.appside-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.16);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.appside-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 0.65rem;
  overflow: auto;
  flex: 1;
}
.appside-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
}
.appside-nav a svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.9;
}
.appside-nav a:hover { background: rgba(120, 120, 128, 0.12); }
.appside-nav a.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.appside-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.appside-nav a.active .appside-badge {
  background: var(--brand);
  color: #fff;
}
.appside-foot {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}
.appside-foot-user {
  color: var(--muted);
  word-break: break-all;
  text-decoration: none;
}
.appside-foot-user:hover { color: var(--text); }
.appside-foot-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 60, 40, 0.28);
  background: rgba(255, 236, 230, 0.75);
  color: #9b2c1a;
  font-weight: 700;
  text-decoration: none;
}
.appside-foot-logout:hover {
  background: rgba(255, 220, 210, 0.95);
  color: #7a1f12;
}
.profile-page {
  gap: 0.85rem;
}
.profile-clinic-link {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.profile-clinic-link:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.05rem;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(90, 200, 250, 0.22), transparent 55%),
    radial-gradient(90% 80% at 100% 20%, rgba(0, 122, 255, 0.12), transparent 50%),
    var(--glass);
}
.profile-hero-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
}
.profile-hero h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.profile-avatar {
  width: 4rem;
  height: 4rem;
  font-size: 1.15rem;
  flex: 0 0 auto;
  box-shadow: 0 8px 22px rgba(0, 90, 180, 0.22);
}
.profile-sheet {
  gap: 0.85rem;
  padding: 1.05rem 1rem 1.1rem;
  border-radius: 22px;
}
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 0.85rem;
}
@media (min-width: 640px) {
  .profile-form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .profile-span-2 {
    grid-column: 1 / -1;
  }
}
.profile-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.profile-fields-panel {
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(90, 200, 250, 0.14), transparent 50%),
    var(--glass);
}
.profile-fields-panel > summary {
  letter-spacing: -0.02em;
}
.profile-fields-panel .settings-body {
  gap: 0.75rem;
}
.profile-field-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.profile-field-empty {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.35);
  font-size: 0.9rem;
}
.profile-field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.profile-field-row:hover {
  border-color: rgba(0, 122, 255, 0.28);
  background: rgba(255, 255, 255, 0.72);
}
.profile-field-row-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.profile-field-row-text strong {
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.profile-field-row-new {
  grid-template-columns: 1fr;
}
.profile-field-row-edit {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
@media (min-width: 640px) {
  .profile-field-row-new {
    grid-template-columns: 1fr auto auto;
    align-items: end;
  }
  .profile-field-row-edit {
    grid-template-columns: 1.4fr 0.9fr;
  }
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-bottom: 0.35rem;
}
.activity-page .activity-list {
  gap: 0.55rem;
}
.activity-item {
  align-items: flex-start;
}
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.activity-table th,
.activity-table td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.activity-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.activity-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.activity-pager-meta {
  margin: 0.15rem 0 0;
}
.activity-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0 0.75rem;
}
.activity-pager .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}
.activity-pager-gap {
  color: var(--muted);
  padding: 0 0.2rem;
}
body.sidebar-open { overflow: hidden; }

@media (max-width: 959px) {
  .appside-close { display: inline-flex; align-items: center; justify-content: center; }
}
@media (min-width: 960px) {
  body.has-appnav.has-bottomnav {
    padding-bottom: 1.5rem;
  }
  .app-frame {
    margin-left: var(--sidebar-w);
    width: auto;
    min-height: 100vh;
  }
  .appside {
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    border-right: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.55);
  }
  .side-backdrop { display: none !important; }
  .side-open-btn { display: none !important; }
  .bottomnav { display: none !important; }
  .appside-close { display: none !important; }
}

a { color: var(--brand); text-decoration: none; }
h1, h2 { margin: 0 0 0.35rem; letter-spacing: -0.03em; font-weight: 800; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.12rem; }

/* —— Top bar (welcome + bell) —— follows Appearance brand —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  /* Solid-enough bar: backdrop-filter on ancestors breaks native <select> on iOS/WebKit */
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--brand) 14%, #ffffff) 0%,
      color-mix(in srgb, var(--brand) 5%, rgba(255, 255, 255, 0.96)) 100%
    );
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 8%, transparent);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.28);
  overflow: hidden;
}
.avatar-photo {
  padding: 0;
  background: #d1d1d6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.appside-logo.avatar-photo {
  padding: 0;
}
.profile-photo-pick {
  display: grid;
  gap: 0.35rem;
}
.profile-photo-pick input[type="file"] {
  font-size: 0.92rem;
}
.doctor-photo-frame,
.doctor-photo-frame .patient-photo-preview,
.doctor-photo-frame .patient-photo-placeholder {
  border-radius: 50%;
}
.doctor-photo-row .patient-photo-meta .actions {
  margin-top: 0.15rem;
}
.doctor-photo-row .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.clinic-photo-frame,
.clinic-photo-frame .patient-photo-preview,
.clinic-photo-frame .patient-photo-placeholder {
  border-radius: 18px;
}
.clinics-page .clinics-hero h1 {
  margin: 0.15rem 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}
.clinics-page .soft-back {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.15rem;
}
.clinic-media-avatar {
  object-fit: cover;
  padding: 0;
  background: #dfe7f0;
  box-shadow: none;
}
.clinic-sheet {
  gap: 0.85rem;
  padding: 1.05rem 1rem 1.15rem;
  border-radius: 24px;
}
.clinic-sheet-photo {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.clinic-sheet-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.clinic-delete-wrap {
  margin: 0;
}
.clinics-fields-panel {
  margin-top: 0.25rem;
}
.clinic-list-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.clinic-list-body {
  flex: 1;
  min-width: 0;
}
.clinic-list-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(0, 122, 255, 0.16);
  background: #eef3f8;
}
.clinic-list-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--brand, #007aff);
  background: linear-gradient(160deg, rgba(0, 122, 255, 0.12), rgba(255, 255, 255, 0.95));
}
.topbar-copy { min-width: 0; }
.topbar-hello {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--brand) 55%, var(--muted));
  font-weight: 700;
  line-height: 1.2;
}
.topbar-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand {
  font-weight: 800;
  color: var(--brand);
  font-size: 1.05rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--glass-border));
  background: color-mix(in srgb, var(--brand) 8%, rgba(255, 255, 255, 0.72));
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn.has-noti {
  border-color: color-mix(in srgb, var(--brand) 35%, #fecaca);
  background: color-mix(in srgb, var(--brand) 12%, #fff7f7);
  color: var(--brand);
}
.icon-btn .dot-badge,
.icon-btn .noti-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.main {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0.75rem 0.8rem 1.25rem;
}
.main:has(.visit-layout.has-history-sidebar) {
  width: min(1180px, 100%);
}
@media (min-width: 960px) {
  .main {
    width: min(880px, 100%);
    padding: 1.25rem 1.25rem 2rem;
  }
  .main:has(.visit-layout.has-history-sidebar) {
    width: min(1180px, 100%);
  }
}

/* —— Visit form + history sidebar —— */
.visit-layout {
  display: block;
  max-width: 100%;
  min-width: 0;
}
.visit-main {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

/* —— Medical chart theme (visit_form) —— */
.visit-chart {
  --visit-rail: color-mix(in srgb, var(--brand) 72%, #0f766e);
  --visit-soft: color-mix(in srgb, var(--brand) 10%, #f4fbf9);
  --visit-ink: #14302c;
  gap: 0.75rem;
}
.visit-chart-form {
  gap: 0.75rem;
}
.visit-chart-sticky {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 8%, #fff) 0%, rgba(255, 255, 255, 0.96) 100%);
  border-bottom-color: color-mix(in srgb, var(--brand) 18%, var(--line));
}
.visit-sticky-title {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  flex: 1 1 auto;
}
.visit-sticky-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}
.visit-chart .sticky-title {
  font-size: 1.05rem;
  color: var(--visit-ink, var(--ink));
}
@media (max-width: 720px) {
  .visit-chart .sticky-actions-inner {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.45rem 0.5rem;
  }
  .visit-chart .visit-sticky-title {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
  .visit-chart .visit-sticky-title .sticky-title {
    flex: none;
    max-width: none;
    font-size: 1.02rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.25;
  }
  .visit-chart .visit-sticky-kicker {
    font-size: 0.72rem;
  }
  .visit-chart .sticky-actions .actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.35rem;
  }
  .visit-chart .sticky-actions .actions > .btn,
  .visit-chart .sticky-actions .actions > a.btn,
  .visit-chart .sticky-actions .actions > button {
    min-height: 36px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
  }
}

.visit-patient-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border-color: color-mix(in srgb, var(--brand) 22%, var(--glass-border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, transparent), transparent 55%),
    var(--glass);
}
.visit-patient-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1 1 12rem;
}
.visit-patient-badge {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 28%, transparent);
}
.visit-patient-text {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}
.visit-patient-name {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--visit-ink, var(--ink));
  text-decoration: none;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visit-patient-name:hover { color: var(--brand); }
.visit-patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.visit-meta-chip {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}
.visit-date-field {
  display: grid;
  gap: 0.25rem;
  min-width: 9.5rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.visit-date-field input {
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  background: #fff;
  color: var(--ink);
}

.visit-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}
.visit-flow-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 16%, transparent);
  text-decoration: none;
}
.visit-flow-chip:hover {
  background: var(--brand-soft-2);
}

.visit-section {
  position: relative;
  border-color: color-mix(in srgb, var(--brand) 16%, var(--glass-border));
  box-shadow: 0 8px 22px rgba(15, 48, 44, 0.05);
}
.visit-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.visit-section-head strong {
  display: block;
  font-size: 0.98rem;
  color: var(--visit-ink, var(--ink));
}
.visit-section-num {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--brand) 30%, transparent);
}
.visit-section-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.1rem;
}
.visit-field-block textarea {
  min-height: 3.2rem;
  font-size: 0.95rem;
  line-height: 1.45;
  border-radius: 12px;
  border-color: color-mix(in srgb, var(--brand) 14%, var(--line));
  background: #fff;
}
.visit-field-block textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.visit-chart .vitals-card {
  background:
    linear-gradient(160deg, var(--visit-soft), transparent 48%),
    var(--glass);
}
.visit-chart .vitals-summary {
  gap: 0.4rem;
}
.visit-chart .vitals-summary strong {
  font-size: 0.98rem;
  color: var(--visit-ink, var(--ink));
}
.visit-chart .vital-unit {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: color-mix(in srgb, var(--muted) 80%, var(--brand));
  opacity: 0.9;
}
.visit-chart .vitals-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}
.visit-chart .vitals-grid.compact label {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--brand) 12%, var(--line));
  border-radius: 12px;
  padding: 0.4rem 0.45rem 0.5rem;
  gap: 0.28rem;
}
.visit-chart .vitals-grid.compact input {
  border: 0;
  background: transparent;
  padding: 0.2rem 0.1rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--visit-ink, var(--ink));
}
.visit-chart .vitals-grid.compact input:focus {
  outline: none;
}
.visit-chart .vitals-grid.compact input.vital-ok {
  background: transparent;
  color: #166534;
}
.visit-chart .vitals-grid.compact input.vital-bad {
  background: transparent;
  color: #991b1b;
  box-shadow: none;
}
.visit-chart .vitals-grid.compact label:has(input.vital-ok) {
  background: #eefaf1;
  border-color: #86efac;
}
.visit-chart .vitals-grid.compact label:has(input.vital-bad) {
  background: #fef2f2;
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.12);
}
.visit-chart .vitals-grid.compact input[readonly] {
  color: var(--brand);
}

.visit-chart .visit-assist-card {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--brand) 7%, transparent), transparent 40%),
    var(--glass);
}
.visit-chart .icd-field {
  padding: 0.65rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--line));
  background: color-mix(in srgb, var(--brand) 4%, #fff);
}
.visit-chart .icd-search {
  border-radius: 12px;
  min-height: 2.5rem;
  font-size: 0.95rem;
}
.visit-chart .rx-pad {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent 38%),
    var(--glass);
}
.visit-chart .rx-pad-title {
  align-items: center;
  gap: 0.45rem;
}
.visit-chart .rx-add-btn {
  border-radius: 999px;
  font-weight: 800;
}

@media (max-width: 719px) {
  .visit-patient-strip {
    padding: 0.75rem 0.8rem;
  }
  .visit-patient-name {
    font-size: 1rem;
    white-space: normal;
  }
  .visit-date-field {
    width: 100%;
  }
  .visit-chart .vitals-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .visit-flow {
    position: sticky;
    top: calc(var(--top-h) + 3.35rem);
    z-index: 20;
    padding: 0.25rem 0;
    background: color-mix(in srgb, #fff 88%, transparent);
    backdrop-filter: blur(8px);
  }
}
.history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1900;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.history-backdrop[hidden] { display: none !important; }
.history-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1950;
  width: min(400px, 92vw);
  height: 100vh;
  height: 100dvh;
  background: var(--glass-strong);
  border-left: 1px solid var(--glass-border);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.14);
  transform: translateX(105%);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  pointer-events: none;
}
.history-sidebar.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.history-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  padding: 0.9rem 0.85rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}
.history-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  flex-shrink: 0;
}
.history-sidebar-head h2 {
  margin: 0;
  font-size: 1.08rem;
}
.history-sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex-shrink: 0;
}
.history-sidebar-hint {
  margin: 0;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.history-sidebar-list {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding-right: 0.15rem;
  -webkit-overflow-scrolling: touch;
}
body.history-drawer-open { overflow: hidden; }

@media (min-width: 960px) {
  .visit-layout.has-history-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 1rem;
    align-items: start;
  }
  .history-backdrop { display: none !important; }
  .history-sidebar {
    position: sticky;
    top: calc(var(--top-h) + 0.5rem);
    right: auto;
    z-index: 5;
    pointer-events: auto;
    width: auto;
    height: auto;
    max-height: calc(100vh - var(--top-h) - var(--nav-h) - 1.25rem);
    transform: none;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    background: var(--glass);
  }
  .history-sidebar-inner {
    padding: 0.85rem 0.8rem;
  }
  .history-drawer-only { display: none !important; }
  .history-sidebar-list {
    max-height: calc(100vh - var(--top-h) - var(--nav-h) - 11rem);
  }
}

.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.card.warn { background: var(--warn-bg); border-color: rgba(255, 149, 0, 0.25); }

.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }

.hero-line h1 { margin-bottom: 0.15rem; }
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
}

.sticky-actions {
  position: sticky;
  top: var(--top-h);
  z-index: 25;
  /* Match .main horizontal padding so bar never spills past the frame */
  margin: -0.25rem -0.8rem 0.25rem;
  padding: 0.55rem 0.8rem;
  max-width: 100vw;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.sticky-actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  width: min(720px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
}
.sticky-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-actions .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}
.sticky-actions .btn {
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  max-width: 100%;
}
@media (min-width: 960px) {
  .sticky-actions {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}
@media (max-width: 720px) {
  .sticky-actions-inner {
    flex-wrap: nowrap;
    gap: 0.35rem;
  }
  .sticky-title {
    flex: 0 1 auto;
    max-width: 28%;
    font-size: 0.82rem;
  }
  .sticky-actions .actions {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 0.28rem;
    justify-content: flex-end;
    min-width: 0;
  }
  .sticky-actions .actions > .btn,
  .sticky-actions .actions > a.btn,
  .sticky-actions .actions > button {
    min-height: 32px;
    padding: 0.28rem 0.45rem;
    font-size: 0.72rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .sticky-actions .noti-btn {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    gap: 0.22rem;
  }
  .sticky-actions .noti-label {
    font-size: 0.7rem;
  }
  .sticky-actions .noti-badge {
    min-width: 1.05rem;
    height: 1.05rem;
    line-height: 1.05rem;
    font-size: 0.62rem;
    padding: 0 0.25rem;
  }
}
.muted { color: var(--muted); }
.section-title {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}
input, select, textarea, button, .btn { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.84rem;
  line-height: 1.35;
  font-weight: 550;
  background: rgba(118, 118, 128, 0.08);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
textarea { resize: vertical; min-height: 68px; }
select {
  min-height: 40px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.18);
  background: rgba(255, 255, 255, 0.92);
}

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 46px;
  padding: 0.65rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn.primary, button.btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.28);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.btn.primary:hover, button.btn.primary:hover {
  background: var(--brand-2);
}
.btn.danger, button.btn.danger {
  background: #fff;
  border-color: #f0c2c2;
  color: var(--danger);
  box-shadow: none;
}
.btn.sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.88rem; }

.flash {
  margin: 0.75rem 1rem 0;
  width: min(720px - 2rem, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.flash-ok, .flash.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error, .flash.flash-error { background: var(--err-bg); color: var(--err); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stat-row.three { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 0.95rem 0.85rem;
  box-shadow: var(--shadow-soft);
  text-align: center;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.stat-n { display: block; font-size: 1.55rem; font-weight: 800; color: var(--brand); letter-spacing: -0.03em; }
.stat-l { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.vitals-card {
  padding: 0.65rem 0.75rem 0.75rem;
}
.vitals-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-height: 1.6rem;
  user-select: none;
}
.vitals-summary::-webkit-details-marker { display: none; }
.vitals-summary::after {
  content: "";
  margin-left: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.vitals-card[open] > .vitals-summary::after {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}
.vitals-hint { font-size: 0.75rem; font-weight: 600; }
.vitals-pp-chip {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.vitals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.vitals-grid.compact {
  margin-top: 0.65rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem 0.45rem;
}
.vitals-grid.compact label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 0.2rem;
}
.vitals-grid.compact input {
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  background: #fff;
}
.vitals-grid .full { grid-column: 1 / -1; }
.vitals-grid input[readonly],
.vitals-grid.compact input[readonly] {
  background: var(--brand-soft);
  color: var(--ink);
  border-color: transparent;
}
@media (max-width: 420px) {
  .vitals-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.vitals-alert {
  margin-top: 0.55rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}
.vitals-alert.is-bad {
  background: #fdeceb;
  color: #8b1e1e;
  border: 1px solid #f0c2c2;
}
.vitals-grid.compact input.vital-ok {
  background: #e7f6ec;
  border-color: #86efac;
  color: #166534;
}
.vitals-grid.compact input.vital-bad {
  background: #fdeceb;
  border-color: #f87171;
  color: #991b1b;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
}

body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 40, 32, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-sheet {
  width: min(560px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: 22px 22px 16px 16px;
  box-shadow: 0 20px 50px rgba(20, 53, 44, 0.28);
  padding: 1rem 1rem 1.1rem;
  animation: modal-up 0.18s ease-out;
}
@keyframes modal-up {
  from { transform: translateY(18px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.modal-list { max-height: 52vh; overflow: auto; }
.history-item.is-current {
  border-color: #86efac;
  background: #f0fdf4;
}
.history-item > summary {
  list-style: none;
  cursor: pointer;
}
.history-item > summary::-webkit-details-marker { display: none; }
.history-summary { display: block; }
.history-body {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.history-group { margin-bottom: 0.65rem; }
.history-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.history-field {
  background: #f8fbf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.4rem;
}
.history-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.history-field-value {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}
.history-copy-tip {
  margin: 0 0 0.65rem;
  width: auto;
}
#visitForm .history-filled,
#visitForm .history-filled:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  background: #eef8f1;
  transition: background 0.2s ease, outline-color 0.2s ease;
}
.history-payload-json {
  display: none !important;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet { border-radius: 18px; }
}
.readonly-value {
  margin-top: 0.25rem;
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--brand);
}
.clinic-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.92rem;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
details.card > summary::-webkit-details-marker { display: none; }

.noti-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem 0.45rem 0.7rem;
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
  border-radius: 999px;
  box-shadow: none;
}
.noti-btn:hover { background: var(--brand-soft-2); }
.noti-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.noti-label { font-weight: 800; font-size: 0.88rem; }
.noti-badge {
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.3rem;
  text-align: center;
}
.noti-badge.inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.searchbar input,
.searchbar select {
  background: #fff;
  border-radius: 999px;
  padding-left: 1rem;
  box-shadow: var(--shadow-soft);
}
.searchbar.clinic-filter { grid-template-columns: 1fr; }

/* —— Home clinical dashboard —— */
.home-dash {
  gap: 0.85rem;
}
.home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  padding: 1rem 1.05rem;
  border-color: color-mix(in srgb, var(--brand) 20%, var(--glass-border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, transparent), transparent 58%),
    var(--glass);
}
.home-greet {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}
.home-hero-name {
  margin: 0.15rem 0 0.2rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.home-hero-meta {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
}
.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.home-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
.home-kpi-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.7rem;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--glass-border));
  background: var(--glass);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}
.home-kpi-card.is-accent {
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}
.home-kpi-card.is-warn {
  background: #fff7ed;
  border-color: #fdba74;
}
.home-kpi-n {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand);
  line-height: 1.1;
}
.home-kpi-card.is-warn .home-kpi-n { color: #c2410c; }
.home-kpi-l {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.home-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.home-quick-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 12%, var(--line));
  background: #fff;
  color: inherit;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}
.home-quick-item em {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--accent, #ff3b30);
  color: #fff;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-quick-ico {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  flex-shrink: 0;
}
.home-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.35rem;
}
.chip-warn {
  background: #ffedd5;
  color: #9a3412;
}
.media-card.needs-note {
  border-color: color-mix(in srgb, #f97316 35%, var(--glass-border));
}
.home-queue-card .media-card-avatar.soft {
  font-size: 0.85rem;
  font-weight: 800;
}

@media (max-width: 719px) {
  .home-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-hero-name {
    font-size: 1.2rem;
  }
}

/* Soft medical home / list cards (collage-inspired) */
.soft-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.4rem 0.35rem 0.85rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.soft-search-ico {
  color: var(--muted);
  display: inline-flex;
  flex-shrink: 0;
}
.soft-search input[type="search"] {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0.45rem 0.25rem;
  min-width: 0;
  flex: 1;
  font-size: 0.84rem;
}
.soft-search input[type="search"]:focus {
  outline: none;
  box-shadow: none;
  background: transparent;
}
.soft-search-filter {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
}
.soft-search-filter:hover { background: var(--brand-2); }

.cat-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.25rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-align: center;
  background: transparent;
}
.cat-item.is-hot .cat-ico {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}
.cat-ico {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: var(--shadow-soft);
}
.cat-ico.cat-a { background: rgba(0, 122, 255, 0.14); color: #007aff; }
.cat-ico.cat-b { background: rgba(255, 59, 48, 0.12); color: #ff3b30; }
.cat-ico.cat-c { background: rgba(255, 149, 0, 0.14); color: #ff9500; }
.cat-ico.cat-d { background: rgba(52, 199, 89, 0.14); color: #34c759; }
.cat-label { font-size: 0.78rem; font-weight: 700; color: var(--ink); }
.cat-meta { font-size: 0.7rem; font-weight: 700; color: var(--muted); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.section-head .section-title { margin: 0; }
.link-more {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}
.soft-caption { margin: 0; font-size: 0.85rem; }
.soft-stats .stat { border-radius: 20px; }

.empty-card {
  background: var(--glass);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.15rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.empty-card .muted { margin: 0; }

.media-list { gap: 0.75rem; }
.media-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-soft);
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
a.media-card:active { transform: scale(0.99); }
.media-card.static { cursor: default; }
.media-card-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.media-card-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.media-card-sub {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}
.media-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, #5ac8fa, var(--brand));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.22);
}
.media-card-avatar.soft {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.14);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
}
.chip-accent {
  background: var(--brand-soft);
  color: var(--brand);
}

.patient-hero {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.patient-hero-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.patient-hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.allergy-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(196, 60, 40, 0.35);
  background: linear-gradient(135deg, rgba(255, 236, 230, 0.95), rgba(255, 220, 210, 0.88));
  color: #6b1d12;
  box-shadow: 0 8px 20px rgba(180, 50, 30, 0.12);
}
.allergy-alert-ico {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: #d9480f;
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.allergy-alert-body {
  min-width: 0;
  flex: 1;
}
.allergy-alert-body strong {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.allergy-alert-body div {
  font-weight: 650;
  white-space: pre-wrap;
}
.patient-action-row {
  align-items: stretch;
}
.patient-action-row .btn {
  flex: 1;
  text-align: center;
}
.visit-timeline-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.7rem 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
}
.visit-timeline-card .media-card-main {
  flex: 1;
  min-width: 0;
  display: block;
  text-decoration: none;
  color: inherit;
}
.visit-timeline-card .media-card-body {
  flex: 1;
  padding-right: 0.25rem;
}
.media-card-trail {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  align-self: center;
}
.visit-print-ico {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}
.visit-print-ico svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.visit-timeline-card .media-card-avatar.soft {
  width: 40px;
  height: 40px;
  margin: 0;
  font-size: 1rem;
  text-decoration: none;
}
.patient-photo-row {
  display: flex;
  gap: 0.95rem;
  align-items: center;
}
.patient-photo-pick {
  position: relative;
  display: block;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
.patient-photo-pick input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.patient-photo-frame {
  position: relative;
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 22px;
  overflow: hidden;
  border: 1.5px solid rgba(0, 122, 255, 0.22);
  background: linear-gradient(160deg, rgba(0, 122, 255, 0.08), rgba(255, 255, 255, 0.9));
  box-shadow: 0 10px 24px rgba(18, 40, 70, 0.08);
}
.patient-photo-preview,
.patient-photo-placeholder {
  width: 112px;
  height: 112px;
  border-radius: 22px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(18, 40, 70, 0.06);
}
.patient-photo-placeholder {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: #5b6b7c;
  font-size: 0.78rem;
  font-weight: 700;
}
.patient-photo-plus {
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 400;
  color: var(--brand, #007aff);
}
.patient-photo-badge {
  position: absolute;
  left: 50%;
  bottom: 0.4rem;
  transform: translateX(-50%);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}
.patient-photo-meta {
  flex: 1;
  min-width: 0;
  gap: 0.4rem;
}
.allergy-alert.is-hidden,
.patient-photo-preview.is-hidden,
.patient-photo-placeholder.is-hidden {
  display: none !important;
}
.patient-hero-photo {
  object-fit: cover;
  padding: 0;
  background: #dfe7f0;
}
input[type="file"].is-compressing {
  opacity: 0.55;
}
.patient-hero-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5ac8fa, var(--brand));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.28);
}
.patient-hero-copy { min-width: 0; flex: 1; }
.patient-hero-copy h1 { margin: 0 0 0.15rem; font-size: 1.35rem; }
.patient-hero-copy .muted { margin: 0 0 0.45rem; }
.patient-hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.5rem;
}
.metric-tile {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 0.65rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.metric-tile strong { font-size: 1.05rem; font-weight: 800; color: var(--brand); }
.vital-overview {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 0.75rem;
}
.vital-overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.vital-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.vital-pill {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 0.45rem 0.65rem;
  min-width: 96px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.vital-pill-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}
.vital-pill-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}
.btn-block {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
}

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.list-item {
  display: block;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-soft);
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
a.list-item:active { transform: scale(0.99); }
.list-item.static { cursor: default; }
.list-item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.list-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.list-body { min-width: 0; flex: 1; }
.list-main { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.list-sub { margin-top: 0.2rem; color: var(--muted); font-size: 0.9rem; }

.meta { display: grid; gap: 0.45rem; }
.login-card { margin-top: 2rem; }

/* —— Auth / login stage —— */
body:has(.auth-stage) {
  --auth-ink: #122033;
  --auth-muted: #5a6a7c;
  --auth-line: rgba(18, 36, 64, 0.12);
  --auth-brand: #0a6fd8;
  --auth-deep: #0a4f8c;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--auth-ink);
  background:
    radial-gradient(980px 560px at 8% 0%, rgba(74, 168, 255, 0.2), transparent 58%),
    radial-gradient(720px 460px at 96% 8%, rgba(42, 150, 118, 0.11), transparent 52%),
    linear-gradient(165deg, #d7e7f6 0%, #eef3f7 42%, #e8f1eb 100%);
  min-height: 100vh;
}
body:has(.auth-stage) .topbar,
body:has(.auth-stage) .app-frame > .flash {
  display: none;
}
body:has(.auth-stage) .app-frame {
  min-height: 100vh;
}
body:has(.auth-stage) .main {
  max-width: none;
  padding: 0;
  margin: 0;
  min-height: 100vh;
}
.auth-stage {
  display: grid;
  grid-template-columns: minmax(24rem, 1.2fr) minmax(360px, 0.8fr);
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: stretch;
  overflow: visible;
}
.auth-panel {
  position: relative;
  overflow: hidden;
}
.auth-panel.auth-panel-brand {
  /* Do not crop Fraunces “DocNote” glyphs / title */
  overflow: visible;
  min-width: min(100%, 22rem);
}
.auth-panel-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.25rem, 5.5vw, 4.5rem) clamp(2.25rem, 6vw, 5.5rem);
  color: #fff;
  background:
    linear-gradient(160deg, rgba(7, 48, 96, 0.5) 0%, rgba(10, 88, 164, 0.2) 48%, rgba(9, 108, 78, 0.32) 100%),
    linear-gradient(128deg, #0a6fd8 0%, #0a4f8c 52%, #0b6e4f 118%);
  min-height: 100vh;
}
.auth-brand-glow {
  position: absolute;
  width: 58%;
  height: 58%;
  right: -10%;
  top: -12%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent 70%);
  animation: authGlow 9s ease-in-out infinite alternate;
  pointer-events: none;
}
.auth-brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 72%);
  pointer-events: none;
}
.auth-brand-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20%;
  height: 132px;
  color: rgba(255, 255, 255, 0.5);
  opacity: 0.75;
  pointer-events: none;
  animation: authWave 1s ease-out both;
}
.auth-brand-wave svg {
  width: 100%;
  height: 100%;
  display: block;
}
.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: min(40rem, 100%);
  width: 100%;
  overflow: visible;
  animation: authRise 0.65s ease-out both;
}
.auth-brand-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}
.auth-brand-mark {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.9rem, 5.4vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 1.15rem;
  padding: 0.12em 0.06em 0.18em 0;
  max-width: 100%;
  overflow: visible;
  white-space: nowrap;
  text-shadow: 0 10px 40px rgba(0, 30, 70, 0.25);
}
.auth-brand-tag {
  margin: 0;
  max-width: 26rem;
  font-size: 1.14rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}
.auth-brand-points {
  display: none;
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  gap: 0.65rem;
}
.auth-brand-points li {
  position: relative;
  margin: 0;
  padding: 0.7rem 0.95rem 0.7rem 2.35rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.95);
}
.auth-brand-points li::before {
  content: "";
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #7dd3b0;
  box-shadow: 0 0 0 4px rgba(125, 211, 176, 0.22);
}
.auth-panel-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    radial-gradient(520px 360px at 80% 12%, rgba(10, 111, 216, 0.08), transparent 60%),
    radial-gradient(420px 300px at 10% 90%, rgba(11, 110, 79, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.16));
}
.auth-form-shell {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 0.85rem;
  justify-items: stretch;
}
.auth-form-card {
  width: 100%;
  max-width: 440px;
  padding: 2rem 1.75rem 1.65rem;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(18, 36, 64, 0.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 40px rgba(18, 40, 70, 0.1);
  animation: authRise 0.7s 0.06s ease-out both;
}
.auth-form-foot {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--auth-muted);
  opacity: 0.85;
}
.auth-form-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.auth-form-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(10, 111, 216, 0.18);
}
.auth-form-card h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  color: var(--auth-ink);
  line-height: 1.12;
}
.auth-form-sub {
  margin: 0.25rem 0 0;
  color: var(--auth-muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.auth-error {
  margin-bottom: 0.9rem;
}
.auth-form {
  gap: 1rem;
}
.auth-field {
  display: grid;
  gap: 0.42rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--auth-muted);
}
.auth-field input {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 12px;
  border: 1px solid var(--auth-line);
  background: #f8fafc;
  padding: 0.75rem 0.95rem;
  color: var(--auth-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-field input::placeholder {
  color: #97a6b6;
  font-weight: 500;
}
.auth-field input:hover {
  background: #fff;
}
.auth-field input:focus {
  outline: none;
  background: #fff;
  border-color: rgba(10, 111, 216, 0.55);
  box-shadow: 0 0 0 4px rgba(10, 111, 216, 0.12);
}
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-ink);
  box-shadow: 0 0 0 1000px #f8fafc inset;
  transition: background-color 9999s ease-out;
}
.auth-submit {
  margin-top: 0.4rem;
  min-height: 50px;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #0a6fd8, #0a4f8c);
  border: 0;
  color: #fff;
  box-shadow: 0 12px 26px rgba(10, 111, 216, 0.26);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.auth-submit-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.auth-submit-with-icon .auth-provider-icon {
  color: #fff;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(10, 111, 216, 0.32);
}
.auth-submit:active {
  transform: translateY(0);
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin-top: 1.25rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--auth-line);
  font-size: 0.9rem;
  font-weight: 700;
}
.auth-links a {
  color: var(--auth-brand);
  text-decoration: none;
}
.auth-links a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.auth-links-sep {
  color: #b0bbc8;
}
@keyframes authRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes authGlow {
  from { transform: scale(1); opacity: 0.82; }
  to { transform: scale(1.07); opacity: 1; }
}
@keyframes authWave {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 0.75; transform: translateY(0); }
}
@media (min-width: 901px) {
  .auth-brand-points {
    display: grid;
  }
  .auth-brand-wave {
    bottom: 12%;
    height: 160px;
    opacity: 0.55;
  }
  .auth-form-card {
    padding: 2.35rem 2.1rem 1.9rem;
    border-radius: 24px;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.95) inset,
      0 24px 56px rgba(18, 40, 70, 0.12),
      0 2px 6px rgba(18, 40, 70, 0.04);
  }
  .auth-form-card h1 {
    font-size: 1.85rem;
  }
  .auth-form-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .auth-provider-btn {
    min-height: 52px;
  }
}
@media (min-width: 1200px) {
  .auth-stage {
    grid-template-columns: minmax(32rem, 1.3fr) minmax(420px, 0.7fr);
  }
  .auth-panel-brand {
    padding-left: clamp(3rem, 8vw, 7rem);
    padding-right: clamp(2rem, 5vw, 4rem);
  }
  .auth-brand-inner {
    max-width: min(44rem, 100%);
  }
  .auth-brand-mark {
    font-size: clamp(3.8rem, 4.6vw, 5.25rem);
    line-height: 1.1;
  }
  .auth-brand-tag {
    font-size: 1.22rem;
    max-width: 28rem;
  }
  .auth-brand-points {
    max-width: 22rem;
  }
  .auth-panel-form {
    padding: 3.5rem 3rem;
  }
  .auth-form-shell,
  .auth-form-card {
    max-width: 460px;
  }
}
@media (min-width: 1600px) {
  .auth-stage {
    grid-template-columns: minmax(36rem, 1.4fr) minmax(480px, 0.6fr);
  }
  .auth-brand-inner {
    max-width: min(48rem, 100%);
  }
  .auth-brand-mark {
    font-size: clamp(4.4rem, 4.2vw, 5.6rem);
  }
  .auth-form-shell,
  .auth-form-card {
    max-width: 480px;
  }
}
@media (max-width: 900px) {
  .auth-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .auth-panel.auth-panel-brand {
    min-width: 0;
    overflow: hidden;
  }
  .auth-panel-brand {
    min-height: 38vh;
    justify-content: flex-end;
    padding: 1.85rem 1.35rem 1.55rem;
  }
  .auth-brand-mark {
    font-size: clamp(2.55rem, 11vw, 3.3rem);
    white-space: normal;
    line-height: 1.05;
  }
  .auth-brand-tag {
    font-size: 0.98rem;
    max-width: none;
  }
  .auth-brand-points {
    display: none;
  }
  .auth-brand-wave {
    bottom: 30%;
    height: 72px;
  }
  .auth-panel-form {
    padding: 1.15rem 1rem 2.25rem;
  }
  .auth-form-foot {
    display: none;
  }
  .auth-form-card {
    max-width: none;
    padding: 1.55rem 1.25rem 1.35rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth-brand-glow,
  .auth-brand-inner,
  .auth-form-card,
  .auth-brand-wave {
    animation: none;
  }
}
.keybox {
  display: block;
  margin-top: 0.6rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 12px;
  word-break: break-all;
  font-size: 0.85rem;
}
.key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.55rem;
}
.key-row .keybox {
  flex: 1 1 12rem;
  margin-top: 0;
}
.inline-form { margin-top: 0.55rem; }
.list-item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
.list-item .actions .inline-form { margin-top: 0; }
.danger-zone { margin-top: 1.5rem; }

.field-toggles { display: grid; gap: 0.45rem; }
label.toggle,
.field-toggles .toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
label.toggle input,
.field-toggles .toggle input {
  width: auto;
  margin: 0;
}
.field-toggles .toggle.always {
  opacity: 0.75;
  background: var(--brand-soft);
}
.field-toggles .toggle em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.85rem;
}

.settings-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.settings-panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.settings-panel > summary {
  list-style: none;
  cursor: pointer;
  min-height: 52px;
  padding: 0.9rem 1rem;
  font-weight: 800;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.settings-panel > summary::-webkit-details-marker { display: none; }
.settings-panel > summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.settings-panel[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft);
}
.settings-panel[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 0.25rem;
}
.settings-body { padding: 0.9rem 1rem 1rem; }

/* —— Bottom nav (soft medical) —— */
.bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 100%;
  max-width: 100vw;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0.15rem 0.4rem env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: 1fr 1fr 64px 1fr 1fr;
  align-items: end;
  background: var(--glass-strong);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  min-height: 54px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.bottomnav a .nav-ico {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.bottomnav a.active { color: var(--brand); }
.bottomnav a.active .nav-ico { transform: translateY(-1px); }
.bottomnav .nav-fab {
  position: relative;
  top: -18px;
  width: 56px;
  height: 56px;
  min-height: 56px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--brand);
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(0, 122, 255, 0.4);
  border: 4px solid rgba(242, 242, 247, 0.9);
}
.bottomnav .nav-fab .nav-ico {
  width: 24px;
  height: 24px;
  fill: #fff;
}
.bottomnav .nav-fab span { display: none; }

@media (min-width: 720px) {
  .main { padding-top: 1.25rem; }
}

/* —— Reports / Analysis (mobile-first) —— */
.report-page { gap: 0.85rem; }
.report-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.report-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}
.report-hero h1 { margin: 0; font-size: 1.7rem; }
.report-hero-actions {
  display: flex;
  flex-shrink: 0;
  gap: 0.4rem;
}
.report-icon-btn { background: rgba(255, 255, 255, 0.7); }

.report-filter-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem 0.9rem 1rem;
  border-radius: 22px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.report-filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.report-filter-head strong { font-size: 1rem; }
.report-filter-head .muted { font-size: 0.78rem; margin: 0; }
.report-quick {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
  scrollbar-width: none;
}
.report-quick::-webkit-scrollbar { display: none; }
.report-quick-chip {
  flex: 0 0 auto;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.12);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  border: 1px solid transparent;
}
.report-quick-chip.is-active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 14px rgba(var(--brand-rgb), 0.28);
}
.report-date-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: end;
}
.report-date-field,
.report-clinic-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.report-date-field input,
.report-clinic-field select {
  min-height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0.45rem 0.65rem;
}
.report-date-sep {
  padding-bottom: 0.85rem;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
}
.report-filter-actions { margin-top: 0.15rem; }
.report-filter-actions .btn-block { min-height: 48px; border-radius: 16px; }

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}
.report-kpi {
  position: relative;
  overflow: hidden;
  padding: 0.95rem 0.9rem 0.85rem;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-height: 96px;
}
.report-kpi.is-accent {
  background: linear-gradient(145deg, rgba(var(--brand-rgb), 0.95), rgba(var(--brand-2-rgb), 0.88));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(var(--brand-rgb), 0.28);
}
.report-kpi.is-accent .report-kpi-label,
.report-kpi.is-accent .report-kpi-hint { color: rgba(255, 255, 255, 0.82); }
.report-kpi-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.report-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.report-kpi-hint {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}
.report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.55rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.report-strip-item {
  text-align: center;
  padding: 0.45rem 0.25rem;
}
.report-strip-item em {
  display: block;
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.report-strip-item span {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.report-panel {
  padding: 0.95rem 0.9rem 1rem;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.report-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.report-panel-head .section-title { margin: 0; font-size: 1.02rem; }
.report-empty { margin: 0; font-size: 0.9rem; }

.report-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 900px) {
  .report-grid { grid-template-columns: 1fr 1fr; }
  .report-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .report-date-pair { gap: 0.65rem; }
}
.report-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 280px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.report-bars li {
  display: grid;
  grid-template-columns: 52px 1fr 28px;
  gap: 0.45rem;
  align-items: center;
}
.report-bar-label {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-bar-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.14);
  overflow: hidden;
}
.report-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(var(--brand-2-rgb), 0.85), var(--brand));
  min-width: 2px;
}
.report-bar-n {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
  text-align: right;
}
.report-table-wrap {
  padding: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 18px;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 480px;
}
.report-table th,
.report-table td {
  padding: 0.75rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.report-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
  position: sticky;
  top: 0;
}
.report-table tr:last-child td { border-bottom: 0; }
.report-table a { font-weight: 700; }

body.theme-solid .report-filter-sheet,
body.theme-solid .report-kpi,
body.theme-solid .report-panel,
body.theme-solid .report-kpi-strip {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #fff;
}
body.theme-solid .report-kpi.is-accent {
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
}

/* —— Treatment analysis filter —— */
.analysis-filter { gap: 0.85rem; }
.analysis-reset {
  font-size: 0.82rem;
  font-weight: 750;
  color: var(--brand);
}
.analysis-filter-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.analysis-filter-row,
.report-filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}
.analysis-filter-row .report-date-field,
.report-filter-row .report-date-field {
  flex: 1 1 0;
  min-width: 0;
}
.analysis-filter-row .analysis-clinic-inline,
.report-filter-row .analysis-clinic-inline {
  flex: 1.15 1 0;
  min-width: 0;
}
.analysis-filter-row .report-date-sep,
.report-filter-row .report-date-sep {
  flex: 0 0 auto;
  padding-bottom: 0.7rem;
}
.analysis-filter-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.analysis-q-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.analysis-q-wrap {
  position: relative;
  display: block;
}
.analysis-q-ico {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
  pointer-events: none;
}
.analysis-q-wrap input {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  font-size: 0.84rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  padding: 0.55rem 0.75rem 0.55rem 2.3rem;
}
.analysis-q-wrap input:focus {
  outline: none;
  border-color: rgba(var(--brand-rgb), 0.55);
  box-shadow: 0 0 0 4px var(--brand-soft);
  background: #fff;
}
.analysis-field-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.28rem;
  border-radius: 14px;
  background: rgba(120, 120, 128, 0.1);
}
.analysis-seg {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 40px;
  padding: 0.35rem 0.25rem;
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--ink);
  text-align: center;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.analysis-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.analysis-seg.is-active,
.analysis-seg:has(input:checked) {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.analysis-date-quick { margin-bottom: 0.15rem; }
.analysis-active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.analysis-filter-actions { margin-top: 0.1rem; }
.analysis-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: var(--brand-soft);
  border: 1px solid rgba(var(--brand-rgb), 0.18);
}
.analysis-export-bar .muted { margin: 0.15rem 0 0; }
.analysis-case-line {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}
.analysis-case-line span {
  display: inline-block;
  min-width: 2.6rem;
  color: var(--muted);
  font-weight: 750;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.analysis-dx-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: stretch;
  grid-template-columns: none;
}
.analysis-dx-link {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 1.4fr 28px;
  gap: 0.45rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.analysis-dx-meta {
  font-size: 0.72rem;
  font-weight: 650;
  padding-left: 0.1rem;
}
.analysis-insights {
  gap: 0.55rem;
}
.analysis-insight-list {
  margin: 0;
  padding: 0 0 0.15rem 1.1rem;
  display: grid;
  gap: 0.4rem;
}
.analysis-insight-list li {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

/* —— Visit form: stepwise AI treatment analysis —— */
.visit-assist-card {
  border-color: color-mix(in srgb, var(--accent, #0d7a6f) 28%, var(--line, #d7dde5));
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--accent, #0d7a6f) 7%, transparent), transparent 42%),
    var(--card, #fff);
}
.visit-assist-step.is-loading {
  opacity: 0.65;
}
.visit-assist-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}
.visit-assist-summary-text {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.visit-assist-hint {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}
.visit-assist-step {
  display: grid;
  gap: 0.4rem;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent, #0d7a6f) 35%, var(--line, #d7dde5));
  background: color-mix(in srgb, var(--accent, #0d7a6f) 5%, transparent);
}
.visit-assist-step[hidden],
.visit-assist-toolbar[hidden] {
  display: none !important;
}
.visit-assist-step.is-ready {
  border-style: solid;
  background: color-mix(in srgb, var(--accent, #0d7a6f) 8%, var(--card, #fff));
}
.visit-assist-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.visit-assist-step-title {
  font-size: 0.9rem;
}
.visit-assist-step-meta {
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}
.visit-assist-step-insight {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
}
.visit-assist-actions {
  display: grid;
  gap: 0.4rem;
}
.visit-assist-action {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line, #d7dde5);
  background: var(--card, #fff);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.visit-assist-action:hover {
  border-color: color-mix(in srgb, var(--accent, #0d7a6f) 45%, var(--line, #d7dde5));
}
.visit-assist-action.is-applied {
  border-color: var(--accent, #0d7a6f);
  background: color-mix(in srgb, var(--accent, #0d7a6f) 14%, var(--card, #fff));
  transform: scale(0.99);
}
.visit-assist-action-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.visit-assist-action-label {
  font-size: 0.84rem;
  font-weight: 700;
}
.visit-assist-action-meta {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent, #0d7a6f);
  white-space: nowrap;
}
.visit-assist-action-hint {
  font-size: 0.75rem;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.visit-assist-jump {
  min-width: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

@media (max-width: 719px) {
  .sticky-actions .visit-assist-jump {
    padding-inline: 0.55rem;
  }
}

/* —— Analysis / Reports: native phone density —— */
@media (max-width: 719px) {
  h1 { font-size: 1.28rem; }
  h2 { font-size: 1rem; }

  .report-page,
  .analysis-page {
    gap: 0.6rem;
    max-width: 100%;
    overflow-x: clip;
  }

  .report-hero {
    gap: 0.5rem;
    align-items: center;
  }
  .report-hero h1 {
    font-size: 1.2rem;
    line-height: 1.15;
    letter-spacing: -0.025em;
  }
  .report-kicker {
    font-size: 0.62rem;
    margin-bottom: 0.05rem;
  }
  .report-hero .soft-caption,
  .analysis-page .soft-caption {
    font-size: 0.74rem;
    line-height: 1.3;
  }
  .report-hero-actions .btn.sm {
    min-height: 32px;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
  }

  .report-filter-sheet,
  .analysis-filter {
    padding: 0.7rem 0.75rem 0.75rem;
    border-radius: 16px;
    gap: 0.55rem;
  }
  .report-filter-head strong {
    font-size: 0.88rem;
  }
  .analysis-reset {
    font-size: 0.74rem;
  }
  .analysis-filter-label {
    font-size: 0.64rem;
  }
  .analysis-filter-block {
    gap: 0.35rem;
  }

  /* Compact field text (viewport max-scale=1 → safe under 16px) */
  input, select, textarea {
    font-size: 0.8rem;
    padding: 0.48rem 0.62rem;
  }
  .analysis-q-wrap input,
  .report-date-field input,
  .report-clinic-field select {
    font-size: 0.8rem;
    min-height: 38px;
    border-radius: 11px;
    padding: 0.42rem 0.6rem;
  }
  .analysis-q-wrap input {
    min-height: 40px;
    padding: 0.45rem 0.65rem 0.45rem 2.15rem;
  }
  .soft-search input[type="search"] {
    font-size: 0.8rem;
  }
  .vitals-grid.compact input {
    font-size: 0.76rem;
  }
  .card input,
  .card select,
  .card textarea,
  .report-filter-sheet input,
  .report-filter-sheet select,
  .report-filter-sheet textarea,
  .settings-body input,
  .settings-body select,
  .settings-body textarea {
    font-size: 0.8rem;
  }
  .analysis-q-ico {
    left: 0.7rem;
  }
  .analysis-q-ico svg {
    width: 16px;
    height: 16px;
  }

  .analysis-field-chips {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 12px;
  }
  .analysis-seg {
    min-height: 34px;
    min-width: 0;
    padding: 0.25rem 0.12rem;
    font-size: 0.65rem;
    line-height: 1.15;
    border-radius: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .analysis-seg span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .report-quick-chip {
    padding: 0.34rem 0.7rem;
    font-size: 0.74rem;
  }
  .report-date-pair {
    gap: 0.3rem;
  }
  .analysis-filter-row,
  .report-filter-row {
    gap: 0.28rem;
  }
  .analysis-filter-row .report-date-sep,
  .report-filter-row .report-date-sep {
    font-size: 0.75rem;
    padding-bottom: 0.55rem;
  }
  .analysis-filter-row .report-date-field input,
  .analysis-filter-row .report-clinic-field select,
  .report-filter-row .report-date-field input,
  .report-filter-row .report-clinic-field select {
    min-height: 36px;
    padding: 0.32rem 0.4rem;
    font-size: 0.72rem;
  }
  .report-date-sep {
    font-size: 0.8rem;
    padding-bottom: 0.65rem;
  }
  .report-date-field,
  .report-clinic-field {
    font-size: 0.7rem;
  }

  .analysis-active-pills .chip,
  .analysis-page .chip {
    font-size: 0.68rem;
    padding: 0.22rem 0.5rem;
  }

  .analysis-filter-actions {
    position: sticky;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 6px);
    z-index: 12;
    margin: 0.15rem -0.2rem 0;
    padding: 0.4rem 0.2rem 0.15rem;
    background: linear-gradient(180deg, transparent 0%, rgba(242, 242, 247, 0.92) 28%, var(--bg) 100%);
  }
  .analysis-filter-actions .btn-block,
  .report-filter-actions .btn-block {
    min-height: 44px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 750;
  }

  .report-kpi-grid {
    gap: 0.45rem;
  }
  .report-kpi {
    min-height: 74px;
    padding: 0.65rem 0.7rem 0.6rem;
    border-radius: 14px;
    gap: 0.05rem;
  }
  .report-kpi-label {
    font-size: 0.6rem;
  }
  .report-kpi-value {
    font-size: 1.28rem;
  }
  .report-kpi-hint {
    font-size: 0.68rem;
  }

  .analysis-export-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
  }
  .analysis-export-bar strong {
    font-size: 0.88rem;
  }
  .analysis-export-bar .soft-caption {
    font-size: 0.72rem;
  }
  .analysis-export-bar .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  .analysis-export-bar .actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    font-size: 0.82rem;
  }

  .report-panel {
    padding: 0.7rem 0.75rem 0.8rem;
    border-radius: 14px;
  }
  .report-panel-head .section-title,
  .analysis-page .section-title {
    font-size: 0.92rem;
  }
  .section-head {
    gap: 0.4rem;
  }

  .report-bars {
    gap: 0.4rem;
    max-height: 240px;
  }
  .report-bars li {
    grid-template-columns: minmax(0, 64px) 1fr 24px;
    gap: 0.35rem;
  }
  .report-bar-label {
    font-size: 0.68rem;
  }
  .report-bar-n {
    font-size: 0.72rem;
  }
  .report-bar-track {
    height: 9px;
  }

  .analysis-dx-link {
    grid-template-columns: minmax(0, 1.15fr) minmax(48px, 1fr) 24px;
    gap: 0.35rem;
  }
  .analysis-dx-meta {
    font-size: 0.64rem;
  }

  .analysis-page .media-card {
    padding: 0.7rem 0.75rem;
    gap: 0.55rem;
  }
  .analysis-page .media-card-title {
    font-size: 0.9rem;
    line-height: 1.25;
  }
  .analysis-page .media-card-sub {
    font-size: 0.74rem;
  }
  .analysis-page .media-card-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }
  .analysis-case-line {
    font-size: 0.74rem;
  }
  .analysis-case-line span {
    font-size: 0.64rem;
    min-width: 2.2rem;
  }

  .analysis-page .empty-card {
    padding: 0.85rem 0.9rem;
  }
  .analysis-page .empty-card strong {
    font-size: 0.92rem;
  }
}

/* —— Language picker (Settings → Language) —— */
.lang-swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (min-width: 520px) {
  .lang-swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.lang-swatch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  min-width: 0;
}
.lang-swatch.is-active,
.lang-swatch:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--brand-soft);
}
.lang-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.lang-swatch-code {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(120, 120, 128, 0.14);
  color: var(--ink);
}
.lang-swatch:has(input:checked) .lang-swatch-code {
  background: var(--brand);
  color: #fff;
}
.lang-swatch-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.lang-swatch-copy strong {
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.2;
}
.lang-swatch-copy .muted {
  font-size: 0.7rem;
  font-weight: 600;
}
body.lang-my,
body.lang-zh,
body.lang-ja,
body.lang-ko,
body.lang-th,
body.lang-hi {
  word-break: keep-all;
}
body.lang-my .bottomnav span,
body.lang-my .appside-nav span {
  font-size: 0.78em;
  letter-spacing: 0;
}

/* —— Theme picker (Settings → Appearance) —— */
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
@media (min-width: 520px) {
  .theme-swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.theme-swatch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
}
.theme-swatch:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--brand-soft);
}
.theme-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.theme-swatch-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65), 0 2px 8px rgba(0, 0, 0, 0.12);
}
.theme-swatch-label { min-width: 0; }
.theme-custom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.theme-custom-row input[type="color"] {
  padding: 0.25rem;
  height: 44px;
  cursor: pointer;
}
.theme-preview {
  border-style: dashed;
}

/* —— ICD-10 diagnosis picker (visit form) —— */
.icd-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.icd-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
}
.icd-selected {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  min-height: 2.6rem;
}
.icd-selected.is-empty {
  border-style: dashed;
  color: var(--muted);
}
.icd-code-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  font-weight: 750;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.icd-name-text {
  flex: 1 1 140px;
  min-width: 0;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}
.icd-search-wrap {
  position: relative;
}
.icd-search {
  width: 100%;
  font-size: 0.84rem;
  padding: 0.5rem 0.7rem;
  min-height: 40px;
}
.icd-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: min(280px, 45vh);
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
.icd-results li { margin: 0; }
.icd-result-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.icd-result-btn:hover,
.icd-result-btn:focus-visible {
  background: var(--brand-soft);
  outline: none;
}
.icd-empty {
  padding: 0.65rem 0.7rem;
}
.icd-hint {
  margin: 0;
  font-size: 0.78rem;
}

/* —— Treatment body diagram (visit form) —— */
.body-map {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--line);
}
.body-map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}
.body-map-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}
.body-map-tools .btn {
  max-width: 100%;
}
.body-map-view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  padding: 0.22rem;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.12);
}
.body-map-view-tab {
  margin: 0;
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}
.body-map-view-tab.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.body-map-regions-label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.body-map-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-height: 120px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.body-map-region {
  margin: 0;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.body-map-region:hover,
.body-map-region:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  outline: none;
}
.body-map-side-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  background: rgba(120, 120, 128, 0.14);
  font-size: 0.65rem;
  font-weight: 750;
  color: var(--muted);
}
.body-map-head .muted {
  display: block;
  font-size: 0.8rem;
  margin-top: 0.15rem;
}
.body-map-stage {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 720px) {
  .body-map-stage {
    grid-template-columns: minmax(180px, 240px) 1fr;
    align-items: start;
  }
}
.body-map-mode-tabs,
.body-map-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
/* Class display rules must not override the HTML hidden attribute */
.body-map-view-tabs[hidden],
.body-map-3d[hidden],
.body-map-wrap[hidden],
#bodyMapResetView[hidden] {
  display: none !important;
}
.body-map-mode-tab,
.body-map-view-tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  color: var(--text);
}
.body-map-mode-tab.is-active,
.body-map-view-tab.is-active {
  background: var(--brand, #0f4c5c);
  border-color: transparent;
  color: #fff;
}
.body-map-hint-inline {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.15rem;
}
.body-map-viewport {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}
.body-map-3d {
  width: 100%;
  height: min(52vh, 420px);
  min-height: 300px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #f2f4f7;
  touch-action: none;
  position: relative;
}
.body-map-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
/* Photo turntable when WebGL is unavailable */
.body-map-3d.is-fallback-360,
.body-map-fallback {
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: grab;
  touch-action: none;
}
.body-map-fallback:active {
  cursor: grabbing;
}
.body-map-fallback-frame {
  position: relative;
  width: min(72%, 220px);
  aspect-ratio: 1 / 2.15;
  transform-style: preserve-3d;
  transition: transform 0.05s linear;
}
.body-map-fallback-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  background: #fff;
  border-radius: 8px;
}
.body-map-fallback-pins {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.body-map-fallback-pins .body-map-pin {
  pointer-events: auto;
}
.body-map-fallback-hint {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  text-align: center;
  padding: 0 0.75rem;
}
.body3d-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 280px;
  padding: 1rem;
}
.body3d-progress {
  width: min(70%, 200px);
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.body3d-progress > span {
  display: block;
  height: 100%;
  background: var(--brand, #007aff);
  border-radius: inherit;
  transition: width 0.15s linear;
}
.body3d-orbit-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45rem;
  margin: 0;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  text-align: center;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
}
.body-map-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f7f7f8;
  overflow: hidden;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.body-map-img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  pointer-events: none;
  object-fit: contain;
  background: #fff;
}
.body-map-pin {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 2px 8px rgba(0, 229, 255, 0.55);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
}
.body-map-pin:hover,
.body-map-pin:focus-visible {
  outline: none;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.3), 0 2px 8px rgba(0, 229, 255, 0.55);
}
.body-map-side {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.body-map-note-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 650;
  font-size: 0.8rem;
}
.body-map-note-label textarea {
  font-size: 0.84rem;
  min-height: 64px;
}
.body-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 180px;
  overflow: auto;
}
.body-map-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.86rem;
}
.body-map-pin-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.18);
  color: #0090a8;
  font-weight: 750;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.body-map-hint {
  margin: 0;
  font-size: 0.78rem;
}
.body-map-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  max-width: min(360px, calc(100vw - 2rem));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
.body-map-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.body-map-dialog .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* User guide */
.guide-page { gap: 0.85rem; }
.guide-hero h1 { margin: 0 0 0.25rem; font-size: 1.45rem; }
.guide-hero .muted { margin: 0; }
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.guide-toc a {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 650;
}
.guide-section h2 {
  margin: 0;
  font-size: 1.05rem;
}
.guide-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.guide-list li { padding-left: 0.1rem; }
.guide-foot { margin: 0.4rem 0 1.2rem; font-size: 0.85rem; }

/* Visit file attachments */
.visit-files-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.visit-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.visit-file-item {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
}
.visit-file-thumb {
  flex: 0 0 4.2rem;
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 10px;
  overflow: hidden;
  background: #e8eef0;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--brand, #0f4c5c);
  font-weight: 750;
  font-size: 0.75rem;
}
.visit-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.visit-file-thumb.is-pdf {
  border: 1px solid var(--line);
}
.visit-file-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}
.visit-file-meta a {
  color: inherit;
  text-decoration: none;
  word-break: break-word;
}
.visit-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.visit-file-upload {
  display: grid;
  gap: 0.35rem;
}
.visit-file-upload input[type="file"] {
  font-size: 0.85rem;
  max-width: 100%;
}
.visit-file-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 1.05rem 0.9rem 0.95rem;
  border-radius: 16px;
  border: 1.5px dashed rgba(0, 122, 255, 0.35);
  background: linear-gradient(165deg, rgba(0, 122, 255, 0.07), rgba(255, 255, 255, 0.78));
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.visit-file-drop:hover,
.visit-file-drop.is-drag {
  border-color: var(--brand, #007aff);
  background: linear-gradient(165deg, rgba(0, 122, 255, 0.12), rgba(255, 255, 255, 0.9));
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.1);
}
.visit-file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.visit-file-drop-ico {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand, #007aff);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
}
.visit-file-drop-title {
  font-size: 0.95rem;
  pointer-events: none;
}
.visit-file-drop .soft-caption {
  pointer-events: none;
}
.visit-file-pending {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 0.35rem;
  text-align: left;
  pointer-events: none;
}
.visit-file-pending[hidden] {
  display: none !important;
}
.visit-file-pending li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 122, 255, 0.14);
  font-size: 0.82rem;
  font-weight: 650;
}
.visit-file-pending .vf-kind {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand, #007aff);
}
.sub-proof-drop {
  margin-top: 0.15rem;
}
.sub-proof-preview {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  width: 100%;
  pointer-events: none;
}
.sub-proof-preview[hidden] {
  display: none !important;
}
.sub-proof-preview img {
  width: 7.5rem;
  height: 7.5rem;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  background: #fff;
}

/* —— Patient form (mobile-first) —— */
.patient-form-page {
  gap: 0.75rem;
}
.pf-clinic-lock {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}
.pf-clinic-lock .clinic-pill {
  margin-top: 0;
  width: fit-content;
  max-width: 100%;
  font-weight: 800;
}
.pf-clinic-lock .clinic-pill.is-muted {
  background: rgba(142, 142, 147, 0.16);
  color: var(--muted);
}
.patient-form .sticky-copy {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
  flex: 1 1 auto;
}
.patient-form .sticky-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  line-height: 1.2;
}
.patient-form .sticky-sub {
  font-size: 0.72rem;
  font-weight: 600;
}
.pf-section {
  gap: 0.75rem;
  padding: 0.95rem 0.9rem;
  min-width: 0;
}
.pf-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.pf-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 0.65rem;
  min-width: 0;
}
.pf-field {
  margin: 0;
  gap: 0.35rem;
  min-width: 0;
}
.pf-label {
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--ink);
}
.pf-req {
  color: #ff3b30;
  font-style: normal;
  font-weight: 800;
}
.pf-hint {
  display: block;
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 550;
  line-height: 1.35;
}
.patient-form .pf-field input,
.patient-form .pf-field select,
.patient-form .pf-field textarea {
  min-height: 46px;
  font-size: 16px; /* avoid iOS input zoom */
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  max-width: 100%;
}
.patient-form .pf-field textarea {
  min-height: 88px;
  font-size: 16px;
}
.seg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.seg-chip {
  position: relative;
  flex: 1 1 calc(50% - 0.4rem);
  min-width: 4.5rem;
  margin: 0;
  cursor: pointer;
}
.seg-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(118, 118, 128, 0.08);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}
.seg-chip input:checked + span {
  border-color: rgba(0, 122, 255, 0.55);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.14);
}
.blood-row .seg-chip {
  flex: 1 1 calc(33.33% - 0.4rem);
  min-width: 3.2rem;
}
.blood-row .seg-chip span {
  min-height: 40px;
  font-size: 0.82rem;
  padding: 0.3rem 0.35rem;
}
.patient-sticky-bottom {
  display: none;
}
.patient-form-foot-spacer {
  display: none;
  height: 4.5rem;
}

@media (max-width: 959px) {
  .patient-form .patient-top-actions {
    display: none;
  }
  .patient-form .patient-sticky-top {
    margin-bottom: 0.15rem;
  }
  .patient-form .sticky-actions-inner {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .patient-form .sticky-copy {
    flex: 1 1 100%;
    max-width: none;
  }
  .patient-form .sticky-copy .sticky-title {
    flex: none;
    max-width: none;
    font-size: 1.08rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.25;
  }
  .patient-sticky-bottom {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    padding: 0.55rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    background: var(--glass-strong);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
  }
  .patient-sticky-bottom .btn {
    min-height: 48px;
    border-radius: 14px;
    font-size: 0.95rem;
  }
  .patient-sticky-bottom .btn-block {
    width: 100%;
  }
  .patient-form-foot-spacer {
    display: block;
    height: calc(4.75rem + env(safe-area-inset-bottom, 0px));
  }
  .pf-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pf-span-2 {
    grid-column: 1 / -1;
  }
  .pf-field[data-field="gender"],
  .pf-field[data-field="blood_group"] {
    grid-column: 1 / -1;
  }
  .patient-form .patient-photo-row {
    align-items: flex-start;
    gap: 0.85rem;
  }
}

/* Narrow phones: one column inputs, easier typing */
@media (max-width: 519px) {
  .patient-form-page {
    gap: 0.65rem;
  }
  .pf-section {
    padding: 0.8rem 0.72rem;
    border-radius: 16px;
  }
  .patient-form .pf-grid {
    grid-template-columns: 1fr;
  }
  .patient-form .pf-demo-body .pf-grid,
  .patient-form .pf-demo-who .pf-grid-who {
    grid-template-columns: 1fr 1fr;
  }
  .patient-form .pf-demo-who .pf-field[data-field="gender"] {
    grid-column: 1 / -1;
  }
  .patient-form .gender-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .patient-form .gender-row .seg-chip span {
    min-height: 52px;
  }
  .patient-form .blood-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .patient-form .patient-photo-row {
    flex-direction: column;
    align-items: stretch;
  }
  .patient-form .patient-photo-pick {
    align-self: center;
  }
  .patient-form .patient-photo-meta {
    text-align: center;
    align-items: center;
  }
  .patient-form .patient-photo-meta .check-row {
    justify-content: center;
  }
  .patient-sticky-bottom {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}

@media (min-width: 960px) {
  .pf-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pf-span-2 {
    grid-column: 1 / -1;
  }
  .patient-form .pf-field input,
  .patient-form .pf-field select,
  .patient-form .pf-field textarea {
    font-size: 0.92rem;
  }
}

/* —— Demographics section polish —— */
.pf-section-head {
  display: grid;
  gap: 0.15rem;
}
.pf-section-sub {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}
.pf-section-demo {
  background:
    linear-gradient(165deg, rgba(0, 122, 255, 0.08) 0%, rgba(255, 255, 255, 0.72) 42%, rgba(255, 255, 255, 0.88) 100%);
  border: 1px solid rgba(0, 122, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 122, 255, 0.06);
}
.pf-section-demo .pf-section-title {
  font-size: 1.05rem;
  background: linear-gradient(90deg, var(--brand), #5ac8fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pf-demo-layout {
  display: grid;
  gap: 0.85rem;
}
.pf-demo-block {
  padding: 0.75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(120, 120, 128, 0.12);
}
.pf-demo-who {
  background: rgba(255, 255, 255, 0.82);
}
.pf-demo-blood {
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.05), rgba(255, 255, 255, 0.85));
}
.pf-demo-body {
  background: linear-gradient(180deg, rgba(52, 199, 89, 0.06), rgba(255, 255, 255, 0.85));
}
.gender-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}
.gender-row .seg-chip {
  flex: none;
  min-width: 0;
}
.gender-row .seg-chip span {
  flex-direction: column;
  gap: 0.08rem;
  min-height: 58px;
  border-radius: 14px;
  line-height: 1.1;
}
.gender-row .seg-chip span strong {
  font-size: 1.05rem;
  font-weight: 800;
}
.gender-row .seg-chip span small {
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
}
.gender-row .seg-chip input:checked + span small {
  color: inherit;
  opacity: 0.85;
}
.gender-male input:checked + span {
  background: rgba(0, 122, 255, 0.14);
  border-color: rgba(0, 122, 255, 0.45);
  color: #0066d6;
}
.gender-female input:checked + span {
  background: rgba(255, 45, 85, 0.12);
  border-color: rgba(255, 45, 85, 0.4);
  color: #d70045;
}
.gender-other input:checked + span {
  background: rgba(175, 82, 222, 0.12);
  border-color: rgba(175, 82, 222, 0.4);
  color: #8944b8;
}
.gender-unknown input:checked + span {
  background: rgba(142, 142, 147, 0.16);
  border-color: rgba(142, 142, 147, 0.35);
  color: #636366;
}
.blood-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}
.blood-row .seg-chip {
  flex: none;
  min-width: 0;
}
.blood-row .seg-chip span {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.blood-row .seg-chip input:checked + span {
  background: rgba(255, 59, 48, 0.12);
  border-color: rgba(255, 59, 48, 0.42);
  color: #d70015;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}
.pf-metric {
  position: relative;
  display: grid;
}
.pf-metric input {
  padding-right: 2.6rem !important;
}
.pf-metric-unit {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  pointer-events: none;
}
.pf-section-demo .pf-field[data-field="gender"],
.pf-section-demo .pf-field[data-field="blood_group"] {
  grid-column: 1 / -1;
}
.pf-section-demo .pf-field[data-field="weight_kg"],
.pf-section-demo .pf-field[data-field="height_cm"] {
  grid-column: auto;
}
.pf-demo-body .pf-grid {
  grid-template-columns: 1fr 1fr;
}
.pf-demo-who .pf-grid-who {
  grid-template-columns: 1fr;
  gap: 0.85rem;
}
.pf-demo-who .pf-field[data-field="gender"] {
  grid-column: 1 / -1;
}
.pf-demo-who .pf-field[data-field="dob"],
.pf-demo-who .pf-field-age {
  max-width: 100%;
}
.pf-demo-who .pf-field-age .pf-hint {
  margin-top: 0.25rem;
}

@media (min-width: 520px) {
  .pf-demo-who .pf-grid-who {
    grid-template-columns: 1.4fr 0.7fr;
    align-items: start;
  }
  .pf-demo-layout {
    grid-template-columns: 1.2fr 1fr;
  }
  .pf-demo-who { grid-column: 1 / -1; }
  .pf-demo-blood { grid-column: 1; }
  .pf-demo-body { grid-column: 2; }
  .pf-demo-work { grid-column: 1 / -1; }
}

/* —— Header working clinic (custom dropdown — avoids native select auto-pick on mousedown) —— */
.topbar-clinic {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  max-width: min(52vw, 13.5rem);
  pointer-events: auto;
}
.topbar-clinic-dd {
  position: relative;
  width: 100%;
}
.topbar-clinic-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0.35rem 0.7rem 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line-strong));
  background: color-mix(in srgb, var(--brand) 7%, #ffffff);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  text-align: left;
}
.topbar-clinic-btn-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-clinic-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  flex-shrink: 0;
}
.topbar-clinic-dd.is-open .topbar-clinic-caret {
  transform: rotate(180deg);
}
.topbar-clinic-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 60;
  min-width: max(100%, 11rem);
  max-width: min(72vw, 16rem);
  max-height: min(50vh, 18rem);
  overflow: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}
.topbar-clinic-option {
  display: block;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.topbar-clinic-option:hover,
.topbar-clinic-option:focus {
  background: rgba(var(--brand-rgb), 0.1);
  outline: none;
}
.topbar-clinic-option.is-active {
  background: rgba(var(--brand-rgb), 0.14);
  color: var(--brand);
  font-weight: 800;
}
@media (max-width: 420px) {
  .topbar-clinic {
    max-width: 44vw;
  }
  .topbar-clinic-btn {
    font-size: 0.72rem;
    padding-left: 0.5rem;
  }
}

/*
 * Native <select> / date pickers fail under backdrop-filter ancestors (iOS Safari / WebKit).
 * Drop blur on surfaces that contain chooses so system-wide dropdowns work.
 */
body.theme-glass :is(.card, .settings-panel, .searchbar, .report-filter-sheet, .clinic-sheet, .soft-search, .profile-inline-actions, .admin-finance-filters, .auth-form-card):has(select),
body.theme-glass :is(.card, .settings-panel, form):has(select) {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(255, 255, 255, 0.97);
}
body.theme-glass select {
  background: #fff;
  -webkit-appearance: menulist;
  appearance: auto;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

/* —— Admin / pricing / subscription —— */
.admin-page .admin-nav,
.pricing-page .admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.admin-stats {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

/* Admin reset — mobile-first tidy */
.admin-reset-page {
  gap: 0.75rem;
  max-width: 100%;
  overflow-x: clip;
}
.admin-reset-hero h1 {
  margin: 0 0 0.25rem;
  font-size: 1.28rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.admin-reset-hero .soft-caption {
  margin: 0;
  line-height: 1.4;
}
.admin-reset-card {
  padding: 0.9rem 0.85rem;
  min-width: 0;
}
.admin-reset-fields {
  display: grid;
  gap: 0.7rem;
}
.admin-reset-fields label {
  min-width: 0;
}
.admin-reset-fields select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.admin-reset-label {
  font-weight: 700;
  color: var(--ink) !important;
  word-break: break-word;
}
.admin-reset-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.admin-reset-stats .stat {
  padding: 0.55rem 0.4rem;
  min-width: 0;
}
.admin-reset-stats .stat-n {
  font-size: 1.15rem;
}
.admin-reset-stats .stat-l {
  font-size: 0.68rem;
  line-height: 1.25;
}
.admin-reset-actions {
  display: grid;
  gap: 0.75rem;
}
.admin-reset-danger {
  padding: 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(180, 40, 40, 0.22);
  background: rgba(180, 40, 40, 0.05);
}
.admin-reset-confirm-hint {
  display: block;
  white-space: nowrap;
  line-height: 1.35;
}
.admin-reset-danger input {
  width: 100%;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-reset-backups {
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.admin-reset-backup {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--glass-border, var(--line));
  background: var(--glass, #fff);
  min-width: 0;
}
.admin-reset-backup-meta {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.admin-reset-backup-file {
  font-size: 0.82rem;
  font-weight: 700;
  word-break: break-all;
  line-height: 1.35;
}
.admin-reset-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.admin-reset-backup-actions form {
  margin: 0;
  display: inline-flex;
}
.admin-reset-page .btn-block {
  width: 100%;
  justify-content: center;
}

@media (min-width: 720px) {
  .admin-reset-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-reset-fields label:first-child {
    grid-column: 1 / -1;
  }
  .admin-reset-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .admin-reset-backup {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .admin-reset-backup-actions {
    justify-content: flex-end;
  }
  .admin-reset-page .btn-block {
    width: auto;
  }
  .admin-reset-actions .btn-block {
    width: auto;
  }
}

@media (max-width: 419px) {
  .admin-reset-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-reset-hero h1 {
    font-size: 1.15rem;
  }
  .admin-reset-page .admin-nav {
    gap: 0.3rem;
  }
  .admin-reset-page .admin-nav a,
  .admin-reset-page .admin-nav .chip {
    font-size: 0.75rem;
    padding: 0.28rem 0.5rem;
  }
}
.admin-doctor-card {
  align-items: flex-start;
}
.admin-finance-filters .pf-grid {
  align-items: end;
}
.admin-month-bars {
  gap: 0.75rem;
}
.admin-month-row {
  display: grid;
  gap: 0.35rem;
}
.admin-month-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  justify-content: space-between;
}
.admin-month-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(18, 40, 70, 0.08);
  overflow: hidden;
}
.admin-month-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a6fd8, #0b6e4f);
}
.admin-finance-amt {
  font-weight: 800;
  white-space: nowrap;
  color: var(--brand, #0a6fd8);
}
.admin-finance-amt.is-muted {
  color: var(--muted, #6b7a8c);
  font-weight: 600;
}
.chip.usage-using { background: rgba(11, 110, 79, 0.14); color: #0b6e4f; }
.chip.usage-idle { background: rgba(200, 140, 20, 0.16); color: #8a5a00; }
.chip.usage-expired { background: rgba(120, 130, 145, 0.16); color: #4d5b6a; }
.chip.usage-off { background: rgba(180, 40, 40, 0.12); color: #a12828; }
.chip.usage-never { background: rgba(10, 111, 216, 0.12); color: #0a4f8c; }
.admin-doctor-actions,
.admin-req-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.35rem;
}
.inline-form {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
}
.media-card.is-highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.18);
}
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.pricing-card {
  position: relative;
}
.pricing-card h2 {
  margin: 0;
  font-size: 1.15rem;
}
.pricing-card-unlimited {
  border-color: rgba(0, 122, 255, 0.35);
  box-shadow: 0 12px 28px rgba(0, 90, 180, 0.12);
}
.pricing-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pricing-price {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--brand);
}
.pricing-limits {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}
.pricing-public {
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem;
}
.sub-proof-thumb {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.35rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  color: inherit;
  max-width: 100%;
}
.sub-proof-thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.sub-proof-thumb span {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--brand);
}
.pay-card-box {
  border-color: rgba(0, 122, 255, 0.22);
  background: linear-gradient(165deg, rgba(0, 122, 255, 0.06), rgba(255, 255, 255, 0.72));
}
.pay-card-box .section-title {
  color: var(--brand, #007aff);
}
.pay-manual-box {
  border-color: rgba(52, 120, 80, 0.22);
  background: linear-gradient(165deg, rgba(52, 120, 80, 0.07), rgba(255, 255, 255, 0.72));
}
.pay-manual-accounts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.pay-manual-accounts li {
  margin: 0;
}
.pay-manual-accounts strong {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #2d6a4f;
  margin-bottom: 0.2rem;
}
.pay-manual-value {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(45, 106, 79, 0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.pay-manual-steps {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text, #1c1c1e);
}
.pay-admin-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  text-decoration: none;
}
.sub-expiry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 980px;
  margin: 0.65rem auto 0;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(180, 120, 20, 0.35);
  background: linear-gradient(135deg, rgba(255, 248, 220, 0.95), rgba(255, 236, 179, 0.88));
  color: #5c4508;
  box-shadow: 0 8px 20px rgba(160, 110, 20, 0.1);
}
.sub-expiry-banner.is-urgent {
  border-color: rgba(196, 60, 40, 0.35);
  background: linear-gradient(135deg, rgba(255, 236, 230, 0.96), rgba(255, 220, 210, 0.9));
  color: #6b1d12;
}
.sub-expiry-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.sub-expiry-copy strong {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sub-expiry-copy span {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}
.sub-expiry-banner .btn {
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .sub-expiry-banner {
    flex-direction: column;
    align-items: stretch;
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }
}

/* Prescription pad — desktop sheet + mobile app cards */
.rx-pad {
  gap: 0.55rem;
  padding: 0.75rem 0.85rem 0.85rem;
}
.rx-pad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
}
.rx-pad-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.rx-pad-title strong {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.rx-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 7px;
  background: #e8f3ee;
  color: #0f4c5c;
  font-size: 0.72rem;
  font-weight: 750;
}
.rx-add-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.15rem;
  padding: 0.3rem 0.75rem 0.3rem 0.4rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #176b5a 0%, #0f4c5c 100%);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(15, 76, 92, 0.22);
}
.rx-add-ico {
  display: inline-flex;
  width: 1.45rem;
  height: 1.45rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.05rem;
  line-height: 1;
}
.rx-add-btn:hover {
  filter: brightness(1.05);
}
.rx-add-btn:active {
  transform: scale(0.97);
}
.rx-favs-wrap {
  display: grid;
  gap: 0.3rem;
}
.rx-favs-label {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7a8796;
}
.rx-favs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
}
.rx-fav {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid rgba(15, 76, 92, 0.14);
  background: #f2f8f6;
  color: #0f4c5c;
  border-radius: 8px;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}
.rx-fav-plus {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(15, 76, 92, 0.12);
  font-size: 0.78rem;
  line-height: 1;
}
.rx-fav:hover {
  background: #e4f2ec;
  border-color: rgba(15, 76, 92, 0.26);
}
.rx-sheet {
  border: 1px solid rgba(18, 36, 64, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}
.rx-sheet-head {
  display: grid;
  grid-template-columns: 2rem minmax(6.5rem, 2.1fr) minmax(3.2rem, 0.65fr) minmax(3.4rem, 0.7fr) minmax(2.6rem, 0.5fr) minmax(3.5rem, 0.95fr) 1.8rem;
  gap: 0.28rem;
  align-items: center;
  padding: 0.28rem 0.4rem;
  background: #edf2f7;
  border-bottom: 1px solid rgba(18, 36, 64, 0.08);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6a7a8c;
}
.rx-rows {
  display: grid;
}
.rx-row {
  display: grid;
  grid-template-columns: 2rem minmax(6.5rem, 2.1fr) minmax(3.2rem, 0.65fr) minmax(3.4rem, 0.7fr) minmax(2.6rem, 0.5fr) minmax(3.5rem, 0.95fr) 1.8rem;
  grid-template-areas: "bar drug dose freq dur note rm";
  gap: 0.28rem;
  align-items: center;
  padding: 0.28rem 0.35rem;
  border-bottom: 1px solid rgba(18, 36, 64, 0.055);
  background: #fff;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.rx-row:last-child {
  border-bottom: 0;
}
.rx-row.rx-flash {
  background: #eefaf4;
  box-shadow: inset 0 0 0 1px rgba(15, 76, 92, 0.18);
}
.rx-row-bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.rx-num {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e8f0f6;
  color: #3d5266;
  font-size: 0.72rem;
  font-weight: 800;
  flex: 0 0 auto;
}
.rx-row-title {
  display: none;
}
.rx-f-drug { grid-area: drug; }
.rx-f-dose { grid-area: dose; }
.rx-f-freq { grid-area: freq; }
.rx-f-dur { grid-area: dur; }
.rx-f-note { grid-area: note; }
.rx-field {
  display: block;
  min-width: 0;
  margin: 0;
}
.rx-lab {
  display: none;
}
.rx-quick {
  display: none;
}
.rx-in {
  width: 100%;
  min-width: 0;
  min-height: 1.9rem;
  height: 1.9rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f3f6f9;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: inherit;
  box-sizing: border-box;
}
.rx-in:hover {
  background: #ebf0f5;
}
.rx-in:focus {
  outline: none;
  background: #fff;
  border-color: rgba(10, 111, 216, 0.42);
  box-shadow: 0 0 0 2px rgba(10, 111, 216, 0.1);
}
.rx-drug {
  font-weight: 700;
}
.rx-remove {
  grid-area: rm;
  justify-self: end;
  width: 1.7rem;
  height: 1.7rem;
  min-height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8a97a8;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.rx-remove-full {
  display: none;
}
.rx-remove-x {
  display: inline;
}
.rx-remove:hover {
  background: #fdecee;
  color: #b42318;
}

@media (max-width: 720px) {
  .rx-pad {
    gap: 0.7rem;
    padding: 0.85rem 0.8rem 0.9rem;
    border-radius: 16px;
  }
  .rx-pad-title strong {
    font-size: 1.05rem;
  }
  .rx-count {
    min-height: 1.5rem;
    font-size: 0.75rem;
  }
  .rx-add-btn {
    min-height: 2.45rem;
    padding: 0.35rem 0.9rem 0.35rem 0.45rem;
    font-size: 0.9rem;
    box-shadow: 0 8px 18px rgba(15, 76, 92, 0.24);
  }
  .rx-add-ico {
    width: 1.6rem;
    height: 1.6rem;
  }
  .rx-favs-label {
    font-size: 0.72rem;
  }
  .rx-favs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.4rem;
    padding: 0.1rem 0.1rem 0.35rem;
    margin: 0 -0.15rem;
  }
  .rx-favs::-webkit-scrollbar {
    display: none;
  }
  .rx-fav {
    flex: 0 0 auto;
    min-height: 2.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 12px;
    font-size: 0.86rem;
    box-shadow: 0 1px 2px rgba(15, 40, 60, 0.04);
  }
  .rx-fav-plus {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 6px;
  }
  .rx-sheet {
    border: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .rx-sheet-head {
    display: none;
  }
  .rx-rows {
    gap: 0.7rem;
  }
  .rx-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 0.95fr);
    grid-template-areas:
      "bar bar rm"
      "drug drug dose"
      "freq dur note";
    gap: 0.5rem 0.35rem;
    padding: 0.85rem 0.85rem 0.95rem;
    border: 1px solid rgba(18, 36, 64, 0.1);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(18, 36, 64, 0.05);
  }
  .rx-row:last-child {
    border-bottom: 1px solid rgba(18, 36, 64, 0.1);
  }
  .rx-row-bar {
    justify-content: flex-start;
    min-height: 2.2rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #eef2f6;
  }
  .rx-num {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 9px;
    background: #0f4c5c;
    color: #fff;
    font-size: 0.8rem;
  }
  .rx-row-title {
    display: inline;
    font-size: 0.86rem;
    font-weight: 750;
    color: #243447;
  }
  .rx-remove {
    width: auto;
    height: auto;
    min-height: 2.2rem;
    padding: 0.35rem 0.7rem 0.55rem;
    border-radius: 10px;
    background: #fff5f5;
    color: #b42318;
    font-size: 0.78rem;
    align-self: stretch;
    justify-self: end;
    border-bottom: 1px solid #eef2f6;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .rx-remove-full {
    display: inline;
  }
  .rx-remove-x {
    display: none;
  }
  .rx-lab {
    display: block;
    margin-bottom: 0.22rem;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a8796;
  }
  .rx-in {
    min-height: 2.55rem;
    height: 2.55rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid #dfe6ee;
    border-radius: 12px;
    background: #f7f9fb;
    font-size: 0.92rem;
  }
  .rx-in:focus {
    border-color: rgba(15, 76, 92, 0.45);
    box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.12);
  }
  .rx-quick {
    display: none;
  }
}

.hidden{display:none!important}

/* Social auth providers */
.auth-social {
  margin: 0 0 0.15rem;
}
.auth-social-label {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b97a8;
}
.auth-social-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.2rem 0 0.95rem;
  color: #8b97a8;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.auth-social-divider-mid {
  margin: 1.15rem 0 1rem;
}
.auth-social-divider::before,
.auth-social-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--auth-line, #e2e8f0), transparent);
}
.auth-social-actions {
  display: grid;
  gap: 0.65rem;
}
.auth-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid #d8e0ea;
  background: #fff;
  color: #1a2332;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.auth-provider-btn:hover {
  text-decoration: none;
  background: #f8fafc;
  border-color: #c5d0de;
  box-shadow: 0 6px 16px rgba(18, 40, 70, 0.07);
  transform: translateY(-1px);
  color: #1a2332;
}
.auth-provider-btn:active {
  transform: translateY(0);
}
.auth-provider-icon {
  flex-shrink: 0;
  display: block;
}
.auth-provider-google {
  border-color: #dadce0;
}
.auth-provider-google:hover {
  border-color: #c6cad1;
  background: #fff;
}
.auth-provider-phone {
  color: #0f4c5c;
  border-color: #c7ddd4;
  background: linear-gradient(180deg, #f7fcf9, #eef8f3);
}
.auth-provider-phone:hover {
  color: #0a3a46;
  border-color: #aecfc2;
  background: linear-gradient(180deg, #fff, #e8f6ef);
}
.auth-form-card .auth-social + .auth-social-divider-mid + .auth-form,
.auth-form-card .auth-social-divider-mid + .auth-form {
  margin-top: 0;
}

/* Queue token board */
.appt-token-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.appt-token-stat {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.7rem;
  border-radius: 14px;
  border: 1px solid rgba(18, 36, 64, 0.1);
  background: #fff;
  text-align: center;
}
.appt-token-lab {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7a8796;
}
.appt-token-big {
  font-size: 1.7rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: #0f4c5c;
  line-height: 1.1;
}
.appt-token-big.is-next {
  color: #0a6fd8;
}
.appt-token-big.is-wait {
  color: #8a5a00;
}
.appt-issued-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f4c5c, #176b5a);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 76, 92, 0.22);
}
.appt-issued-banner span {
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}
.appt-issued-banner strong {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.appt-issue-card {
  gap: 0.7rem;
}
.appt-issue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.appt-issue-preview {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 8px;
  background: #e8f3ee;
  color: #0f4c5c;
  font-size: 0.85rem;
  font-weight: 800;
}
.appt-issue-btn {
  min-height: 2.75rem;
  font-weight: 800;
}
.appt-list .appt-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "tok body"
    "act act";
  gap: 0.55rem 0.7rem;
  align-items: center;
}
.appt-token-badge {
  grid-area: tok;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  min-height: 3.2rem;
  padding: 0.35rem;
  border-radius: 14px;
  background: #0f4c5c;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 18px rgba(15, 76, 92, 0.2);
}
.appt-card .media-card-body {
  grid-area: body;
  min-width: 0;
}
.appt-card .profile-inline-actions {
  grid-area: act;
}
.appt-card.is-serving {
  border-color: rgba(10, 111, 216, 0.35);
  box-shadow: 0 0 0 2px rgba(10, 111, 216, 0.12);
}
.appt-card.is-serving .appt-token-badge {
  background: #0a6fd8;
}
.appt-status-waiting {
  background: #eaf2ff;
  color: #0a5ccc;
}
.appt-status-done {
  background: #e8f7ee;
  color: #0b6e4f;
}
.appt-status-cancelled,
.appt-status-no_show {
  background: #f3f4f6;
  color: #6b7280;
}
@media (max-width: 640px) {
  .appt-token-big {
    font-size: 1.4rem;
  }
  .appt-token-stat {
    padding: 0.65rem 0.45rem;
  }
}

.appt-patient-link {
  gap: 0.4rem;
}
.appt-patient-results {
  display: grid;
  gap: 0.3rem;
  max-height: 14rem;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid rgba(18, 36, 64, 0.1);
  border-radius: 12px;
  background: #f7fafc;
}
.appt-patient-hit {
  appearance: none;
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.appt-patient-hit:hover,
.appt-patient-hit:focus {
  border-color: rgba(15, 76, 92, 0.28);
  background: #eef8f3;
}
.appt-patient-hit strong {
  font-size: 0.92rem;
}
.appt-patient-hit .muted,
.appt-patient-empty {
  font-size: 0.78rem;
}
.appt-patient-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 76, 92, 0.2);
  background: #eef8f3;
}
.appt-patient-chip-main {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.appt-patient-chip-main strong {
  font-size: 0.92rem;
}
.appt-link-dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(26rem, calc(100vw - 1.5rem));
  box-shadow: 0 18px 48px rgba(18, 36, 64, 0.22);
}
.appt-link-dialog::backdrop {
  background: rgba(15, 25, 40, 0.45);
}
.appt-link-dialog-inner {
  padding: 1rem;
  gap: 0.65rem;
}

