:root {
  color-scheme: light;
  --bg: #f7fbfb;
  --surface: #ffffff;
  --ink: #12302d;
  --muted: #526864;
  --line: #dbe9e6;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --accent: #f59e0b;
  --danger: #b42318;
  --info: #235f91;
  --info-surface: #f2f7fc;
  --warm-surface: #fff8e8;
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, .08);
  font-family: Tahoma, sans-serif;
}
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scrollbar-color: #93b9b4 var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
::selection { background: #ccebe7; color: #0a4540; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
input::placeholder, textarea::placeholder { color: #657a76; opacity: 1; }
a { color: inherit; text-decoration: none; }
.app-shell {
  max-width: 760px;
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid rgba(219, 233, 230, .7);
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(247, 251, 251, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .045);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img {
  width: 46px;
  height: 46px;
  border: 1px solid #25302e;
  border-radius: 12px;
  background: #111;
  object-fit: cover;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .primary, .secondary, .action-list button, .action-list a, .tab {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  cursor: pointer;
}
.icon-button, .secondary {
  padding: 0 14px;
  background: #e5f4f2;
  color: var(--brand);
  font-weight: 700;
}
.icon-button, .primary, .secondary, .action-list button, .action-list a, .tab, .contact-actions a, .content-card > a, .aftercare-review {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #76b8b1;
  outline-offset: 2px;
}
main { padding: 18px 16px 96px; }
.hero {
  display: grid;
  grid-template-columns: 1.5fr .9fr;
  gap: 14px;
  align-items: stretch;
  padding: 20px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #0b4f4a);
  box-shadow: var(--shadow-soft);
}
.hero-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: #111;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
.hero h1 { margin: 0; font-size: 28px; line-height: 1.55; letter-spacing: 0; }
.hero p { margin-bottom: 0; line-height: 1.9; }
.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 8px;
  background: rgba(0, 0, 0, .14);
}
.hero-card strong { font-size: 22px; }
.auth-panel, .profile-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.view { margin-top: 16px; }
.auth-panel { position: relative; }
.auth-close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eef7f6;
  color: var(--brand);
  font-size: 22px;
  cursor: pointer;
}
.auth-panel .section-heading { padding-left: 38px; }
.guest-access {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #b8d8d3;
  border-radius: 8px;
  background: #edf8f6;
}
.guest-access strong { color: #145f58; }
.guest-access p { margin: 5px 0 0; color: var(--muted); line-height: 1.8; }
.guest-access .primary { min-height: 44px; white-space: nowrap; }
.section-heading h2 { margin: 0 0 6px; font-size: 20px; }
.section-heading p, .hint { margin: 0 0 14px; color: var(--muted); line-height: 1.8; }
.form-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
label { display: grid; gap: 7px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
}
input:hover, select:hover, textarea:hover { border-color: #abcac6; }
.primary {
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.primary:disabled { opacity: .62; cursor: wait; }
.secondary:disabled { opacity: .62; cursor: default; }
.otp-resend { min-height: 44px; white-space: nowrap; }
.otp-autofill-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.auth-method-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid #d8e5e2;
  border-radius: 8px;
  background: #f4f8f7;
}
.auth-method-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.auth-method-switch button.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .12);
}
.wide { grid-column: 1 / -1; }
.profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.availability-note { margin: -2px 0 0; color: var(--muted); line-height: 1.8; font-size: 13px; }
.consultation-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #c8e2dd;
  border-radius: 8px;
  background: #eef8f5;
  color: #315a52;
  font-size: 13px;
  line-height: 1.9;
}
.login-connections {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #dce9e6;
}
.login-connections h3 { margin: 0 0 5px; font-size: 16px; }
.login-connections > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.connection-list { display: grid; gap: 7px; margin-bottom: 12px; }
.connection-list span {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #d7e7e3;
  border-radius: 7px;
  background: #f7faf9;
  color: #355b53;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.schedule-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #cce1dd;
  border-radius: 8px;
  background: #f2f9f8;
}
.schedule-guide div { display: grid; gap: 4px; }
.schedule-guide strong { color: #145f58; font-size: 14px; }
.schedule-guide span { color: var(--muted); font-size: 13px; line-height: 1.8; }
.schedule-guide small { grid-column: 1 / -1; padding-top: 6px; border-top: 1px solid #d7e8e5; color: #9f2d20; line-height: 1.7; }
.tabs {
  position: sticky;
  top: 72px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 16px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 251, 251, .94);
  backdrop-filter: blur(16px);
}
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-inline: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.tab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.is-active { background: var(--brand); color: #fff; }
.view { display: none; }
.view.is-active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric-grid article, .content-grid article, .card-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
}
.metric-grid span, .content-grid span { color: var(--muted); font-size: 13px; }
.metric-grid strong { display: block; margin-top: 8px; font-size: 24px; color: var(--brand); }
.metric-grid article:nth-child(2) { border-color: #edddb8; background: #fffbf2; }
.metric-grid article:nth-child(2) strong { color: #8a5a00; }
.metric-grid article:nth-child(3) { border-color: #cddfee; background: #f5f9fc; }
.metric-grid article:nth-child(3) strong { color: var(--info); }
#dashboardFileNumber { overflow-wrap: anywhere; font-size: 18px; }
.dashboard-shortcuts-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.dashboard-shortcuts-heading h2 { margin: 0; font-size: 18px; }
.dashboard-shortcuts-heading span { color: var(--muted); font-size: 12px; }
.action-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.action-list button, .action-list a {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
}
.action-list button { font-weight: 700; }
.action-list .review-action {
  border-color: #d8ad53;
  background: #fff8e8;
  color: #704d08;
  font-weight: 700;
}
.contact-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.contact-panel h2 { margin: 0 0 12px; font-size: 19px; }
.contact-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.contact-actions a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  background: #fff;
  text-align: center;
}
.contact-panel address { margin-top: 14px; color: var(--muted); font-style: normal; line-height: 2; }
.phone-list { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; direction: ltr; justify-content: flex-end; }
.phone-list a {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 7px 4px;
  color: var(--brand);
  font-weight: 700;
}
.card-list, .content-grid { display: grid; gap: 12px; }
.card-list h3, .content-grid h3 { margin: 0 0 8px; }
.card-list p, .content-grid p { margin: 0; color: var(--muted); line-height: 1.9; }
.aftercare-grid, .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.care-search-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #cddfee;
  border-radius: 8px;
  background: var(--info-surface);
}
.care-search-panel > label {
  display: block;
  margin-bottom: 8px;
  color: #214e72;
  font-size: 14px;
  font-weight: 800;
}
.care-search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.care-search-field input {
  min-height: 48px;
  border-color: #bdd3e4;
  background: #fff;
  font-size: 16px;
}
.care-search-field button {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #bdd3e4;
  border-radius: 8px;
  background: #fff;
  color: var(--info);
  font-weight: 700;
  cursor: pointer;
}
.care-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.care-quick-filters button {
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid #c5d8e7;
  border-radius: 8px;
  background: #fff;
  color: #315f83;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.care-quick-filters button.is-active {
  border-color: var(--info);
  background: var(--info);
  color: #fff;
}
.care-search-status {
  min-height: 21px;
  margin: 9px 0 0;
  color: #3d617d;
  font-size: 12px;
}
.care-empty {
  padding: 24px 16px;
  border: 1px dashed #b9cfdd;
  border-radius: 8px;
  background: #f8fbfd;
  text-align: center;
}
.care-empty strong { display: block; color: #244e6d; }
.care-empty p { margin: 6px 0 14px; color: var(--muted); line-height: 1.8; }
.care-empty button { min-height: 44px; border: 0; cursor: pointer; }
.care-alert {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #efb3ab;
  border-radius: 8px;
  background: #fff7f5;
}
.care-alert strong { color: #9f2d20; }
.care-alert p { margin: 0; color: #6f4a45; line-height: 1.8; }
.care-alert a {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #a83b2e;
  color: #fff;
  font-weight: 700;
}
.content-card { display: flex; flex-direction: column; }
.aftercare-grid .care-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
  color: var(--ink);
  font: inherit;
  text-align: right;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}
.aftercare-grid .care-card:hover {
  border-color: #8cc8c1;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .09);
  transform: translateY(-1px);
}
.aftercare-grid .care-card:active { transform: translateY(0); }
.aftercare-grid .care-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .2);
  outline-offset: 2px;
}
.care-card > span, .content-card > span {
  width: fit-content;
  margin-bottom: 9px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #edf7f5;
  color: #17665e;
  font-size: 12px;
  font-weight: 700;
}
.care-card[data-care="children"] > span { background: #f5f1fa; color: #694d82; }
.care-card[data-care="restoration"] > span,
.care-card[data-care="amalgam"] > span,
.care-card[data-care="veneer"] > span,
.care-card[data-care="laminate"] > span { background: #fff5e6; color: #815100; }
.care-card[data-care="extraction"] > span,
.care-card[data-care="surgery"] > span { background: #fff1ee; color: #923a30; }
.care-card[data-care="implant"] > span,
.care-card[data-care="healing-abutment"] > span,
.care-card[data-care="implant-crown"] > span { background: #eef6fc; color: #235f91; }
.care-card p { margin-bottom: 16px; font-size: 14px; }
.care-card > strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--brand);
  font-size: 14px;
}
.care-card > strong::after {
  content: "";
  width: 8px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}
.content-card > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font-weight: 700;
  text-align: center;
}
.content-card p { margin-bottom: 14px; }
.resource-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.resource-links a {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  color: var(--brand);
}
.resource-links span { color: var(--muted); font-size: 13px; line-height: 1.7; }
.appointment-history { margin-top: 16px; }
.appointment-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.appointment-list-toolbar h3 { margin: 0; font-size: 17px; }
.appointment-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f7;
}
.appointment-mode-switch button {
  min-height: 38px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.appointment-mode-switch button.is-active { background: #fff; color: var(--brand); box-shadow: 0 2px 7px rgba(0, 0, 0, .1); }
.appointment-history article { position: relative; }
.appointment-history article.is-active-appointment { border-color: #b9d9d4; background: #f8fcfb; }
.appointment-history .appointment-meta { padding-inline-end: 86px; }
.appointment-history .appointment-status {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e7f5f2;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}
.appointment-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.appointment-actions button, .appointment-actions a {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.appointment-actions .appointment-cancel-button { border-color: #e7c0bc; color: #9a3c35; }
.appointment-cancel-confirm {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e7c0bc;
  border-radius: 8px;
  background: #fff5f3;
  color: #7f302a;
}
.appointment-cancel-confirm.is-error { border-color: #d88d86; background: #fff0ee; }
.appointment-cancel-confirm p { margin: 0; line-height: 1.8; }
.appointment-cancel-confirm > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.appointment-cancel-confirm button {
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid #d6dfdd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.appointment-cancel-confirm .appointment-cancel-confirm-button { border-color: #b84640; background: #b84640; color: #fff; }
.appointment-cancel-confirm button:disabled { opacity: .65; cursor: wait; }
.appointment-empty {
  margin: 0;
  padding: 18px 14px;
  border: 1px dashed #c8dad7;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  text-align: center;
}
.aftercare-review {
  display: grid;
  place-items: center;
  min-height: 48px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand);
  font-weight: 700;
  text-align: center;
}
.notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #ecfdf3;
  color: #067647;
}
.notice.is-error { background: #fef3f2; color: #b42318; }
.profile-source-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #f1d79a;
  border-radius: 8px;
  background: #fff9e8;
  color: #6f5011;
  line-height: 1.8;
}
.connection-status, .patient-toast {
  position: fixed;
  right: 50%;
  z-index: 160;
  width: min(calc(100% - 28px), 560px);
  padding: 11px 15px;
  border: 1px solid #e7aca7;
  border-radius: 8px;
  background: #fff1ef;
  color: #8f2f29;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  transform: translateX(50%);
}
.connection-status { top: calc(12px + env(safe-area-inset-top)); }
.patient-toast {
  bottom: calc(18px + env(safe-area-inset-bottom));
  border-color: #abd5cd;
  background: #f1fbf8;
  color: var(--brand-strong);
}
.patient-toast.is-error { border-color: #e7aca7; background: #fff1ef; color: #8f2f29; }
.booking-contact-gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0;
  background: #fff8e8;
  color: #704d08;
}
.booking-contact-gate[hidden] { display: none; }
.booking-contact-gate strong { display: block; margin-bottom: 4px; }
.booking-contact-gate p { margin: 0; line-height: 1.8; font-size: 13px; }
.booking-contact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.booking-contact-form[hidden] { display: none; }
.booking-contact-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.booking-contact-form input { background: #fff; }
.booking-contact-form .primary, .booking-contact-form .secondary { min-height: 44px; white-space: nowrap; }
.booking-contact-actions { display: flex; grid-column: 1 / -1; gap: 8px; flex-wrap: wrap; }
.booking-contact-message { padding-top: 8px; border-top: 1px solid #ecdcae; }
.booking-contact-message.is-error { color: #b42318; }
.profile-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.profile-summary span, .profile-summary p { color: var(--muted); }
.profile-summary h2 { margin: 6px 0; }
.connector-list { margin: 16px 0 0; padding: 0 20px 0 0; color: var(--muted); line-height: 2; }
.install-sheet[hidden] { display: none !important; }
.install-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: rgba(9, 24, 22, .58);
  backdrop-filter: blur(5px);
}
.permission-sheet[hidden] { display: none !important; }
.permission-sheet {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(9, 24, 22, .62);
  backdrop-filter: blur(6px);
}
.permission-sheet > div {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}
.permission-sheet img { width: 82px; height: 82px; border-radius: 18px; background: #111; }
.permission-sheet h2 { margin: 14px 0 8px; font-size: 21px; }
.permission-sheet p { margin: 0 0 16px; color: var(--muted); line-height: 1.8; }
.permission-allow { width: 100%; min-height: 46px; }
.permission-later { margin-top: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.care-sheet[hidden] { display: none !important; }
.care-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(9, 24, 22, .66);
  backdrop-filter: blur(6px);
}
body.has-open-care { overflow: hidden; }
.care-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 620px);
  max-height: min(90dvh, 820px);
  overflow: hidden;
  border-radius: 14px 14px 8px 8px;
  background: #fff;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, .24);
}
.care-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.care-dialog-header span { color: var(--brand); font-size: 13px; font-weight: 800; }
.care-dialog-header h2 { margin: 5px 0 0; font-size: 21px; line-height: 1.55; }
.care-dialog-close {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #edf7f5;
  color: var(--brand);
  font: 25px/1 sans-serif;
  cursor: pointer;
}
.care-detail-body { overflow-y: auto; padding: 16px 18px 22px; overscroll-behavior: contain; }
.care-detail-intro {
  margin: 0 0 15px;
  padding: 12px;
  border: 1px solid #c8e2dd;
  border-radius: 6px;
  background: #f3faf8;
  color: #355a55;
  line-height: 1.9;
}
.care-detail-section + .care-detail-section { margin-top: 18px; }
.care-detail-section h3 { margin: 0 0 8px; font-size: 16px; }
.care-detail-section ul { margin: 0; padding: 0 19px 0 0; color: var(--muted); line-height: 1.95; }
.care-detail-section li + li { margin-top: 5px; }
.care-detail-loading { margin: 0; padding: 26px 12px; color: var(--muted); text-align: center; }
.care-detail-article h2, .care-detail-article h3 { margin: 20px 0 8px; font-size: 16px; line-height: 1.7; }
.care-detail-article h2:first-child, .care-detail-article h3:first-child { margin-top: 0; }
.care-detail-article p { margin: 8px 0; color: var(--muted); line-height: 1.95; }
.care-detail-article ul, .care-detail-article ol { margin: 0; padding: 0 20px 0 0; color: var(--muted); line-height: 1.95; }
.care-detail-article li + li { margin-top: 5px; }
.care-detail-article img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 14px auto;
  border-radius: 8px;
}
.care-detail-article a { color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.care-detail-article blockquote {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #c5ddd7;
  border-radius: 6px;
  background: var(--brand-soft);
  color: #355a55;
  line-height: 1.9;
}
.care-detail-article table { width: 100%; margin: 14px 0; border-collapse: collapse; font-size: 13px; }
.care-detail-article th, .care-detail-article td { padding: 10px; border: 1px solid var(--line); text-align: right; }
.care-detail-article th { background: #f2f7f6; color: var(--brand-strong); }
.care-detail-body[data-content-kind="gallery"] .subtitle,
.care-detail-body[data-content-kind="services"] .subtitle { margin: 0 0 16px; color: var(--muted); line-height: 1.9; }
.care-detail-body[data-content-kind="gallery"] .gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.care-detail-body[data-content-kind="gallery"] .gal-item {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}
.care-detail-body[data-content-kind="gallery"] .gal-item img {
  width: 100%;
  max-height: 340px;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
}
.care-detail-body[data-content-kind="gallery"] .gal-caption { padding: 11px 12px; color: var(--ink); line-height: 1.8; }
.care-detail-body[data-content-kind="gallery"] .back-link { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.care-detail-body[data-content-kind="gallery"] .back-link a,
.care-detail-body[data-content-kind="services"] .fresh-guides-grid > a,
.care-detail-body[data-content-kind="services"] .more-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #c9ddd8;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  text-decoration: none;
}
.care-detail-body[data-content-kind="services"] .page-tag { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; color: var(--brand); font-weight: 800; }
.care-detail-body[data-content-kind="services"] .page-tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.care-detail-body[data-content-kind="services"] .intro-strip,
.care-detail-body[data-content-kind="services"] .fresh-guides { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fbfa; }
.care-detail-body[data-content-kind="services"] .intro-points { margin-bottom: 10px; }
.care-detail-body[data-content-kind="services"] .intro-mini { padding: 10px 12px; border-radius: 6px; background: var(--brand-soft); color: #355a55; line-height: 1.85; }
.care-detail-body[data-content-kind="services"] .fresh-guides-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px; }
.care-detail-body[data-content-kind="services"] .fresh-guides-kicker { color: var(--brand); font-size: 13px; font-weight: 800; }
.care-detail-body[data-content-kind="services"] .fresh-guides-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.care-detail-body[data-content-kind="services"] .fresh-guides-grid > a { display: grid; min-width: 0; }
.care-detail-body[data-content-kind="services"] .fresh-guides-grid span,
.care-detail-body[data-content-kind="services"] .fresh-guides-grid small { color: var(--muted); font-size: 12px; font-weight: 400; }
.care-detail-body[data-content-kind="services"] .services-grid { display: grid; gap: 12px; }
.care-detail-body[data-content-kind="services"] .service-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.care-detail-body[data-content-kind="services"] .service-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.care-detail-body[data-content-kind="services"] .service-title-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }
.care-detail-body[data-content-kind="services"] .service-title-wrap h2 { margin: 0; }
.care-detail-body[data-content-kind="services"] .icon-badge { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.care-detail-body[data-content-kind="services"] .icon-badge svg { width: 23px; height: 23px; fill: none; stroke: currentColor; }
.care-detail-body[data-content-kind="services"] .service-tag { flex: 0 0 auto; padding: 5px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
.care-detail-body[data-content-kind="services"] .more-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.care-detail-body[data-content-kind="faq"] .subtitle,
.care-detail-body[data-content-kind="review"] .subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.9;
}
.care-detail-body[data-content-kind="faq"] .faq-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 18px;
}
.care-detail-body[data-content-kind="faq"] .faq-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #c5ddd7;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  text-decoration: none;
}
.care-detail-body[data-content-kind="faq"] .faq-section + .faq-section { margin-top: 24px; }
.care-detail-body[data-content-kind="faq"] .faq-section-title { margin: 0 0 6px; color: var(--brand-strong); font-size: 18px; }
.care-detail-body[data-content-kind="faq"] .faq-section-desc { margin: 0 0 12px; color: var(--muted); line-height: 1.85; }
.care-detail-body[data-content-kind="faq"] .faq-box {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.care-detail-body[data-content-kind="faq"] .faq-item { padding: 14px; }
.care-detail-body[data-content-kind="faq"] .faq-item + .faq-item { border-top: 1px solid var(--line); }
.care-detail-body[data-content-kind="faq"] .faq-q { color: var(--ink); font-weight: 800; line-height: 1.8; }
.care-detail-body[data-content-kind="faq"] .faq-a { margin-top: 7px; color: var(--muted); line-height: 1.95; }
.care-detail-body[data-content-kind="review"] .badge-strip,
.care-detail-body[data-content-kind="review"] .thank-strip {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #e6d29c;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #76530e;
  font-weight: 800;
  text-align: center;
}
.care-detail-body[data-content-kind="review"] .reviews-layout { display: grid; gap: 14px; }
.care-detail-body[data-content-kind="review"] .card,
.care-detail-body[data-content-kind="review"] .side-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.care-detail-body[data-content-kind="review"] .card-title { margin: 0 0 10px; color: var(--brand-strong); font-size: 16px; font-weight: 800; }
.care-detail-body[data-content-kind="review"] .links-grid { display: grid; gap: 9px; }
.care-detail-body[data-content-kind="review"] .link-btn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #c8ddd8;
  border-radius: 8px;
  background: #fbfffe;
  color: var(--brand-strong);
  text-decoration: none;
}
.care-detail-body[data-content-kind="review"] .link-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.care-detail-body[data-content-kind="review"] .icon-img { width: 38px; height: 38px; margin: 0; object-fit: contain; border-radius: 8px; }
.care-detail-body[data-content-kind="review"] .platform-title { display: block; color: var(--ink); font-weight: 800; }
.care-detail-body[data-content-kind="review"] .platform-caption { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.7; }
.care-detail-body[data-content-kind="review"] .mini-stats,
.care-detail-body[data-content-kind="review"] .steps-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.care-detail-body[data-content-kind="review"] .mini-pill,
.care-detail-body[data-content-kind="review"] .step-pill { padding: 6px 9px; border-radius: 6px; background: #f1f6f5; color: var(--muted); font-size: 12px; }
.care-detail-body[data-content-kind="review"] .tips-list { padding-right: 20px; }
.care-detail-warning {
  margin: 18px 0 0;
  padding: 12px;
  border: 1px solid #efb3ab;
  border-radius: 8px;
  background: #fff7f5;
  color: #7d352c;
  line-height: 1.9;
}
.care-detail-review {
  display: grid;
  place-items: center;
  min-height: 48px;
  margin-top: 20px;
  padding: 10px 14px;
  border: 1px solid #d8ad53;
  border-radius: 8px;
  background: #fff8e8;
  color: #704d08;
  font-weight: 800;
  text-align: center;
}
.care-dialog-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}
.care-dialog-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.care-dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.care-dialog-actions a, .care-dialog-actions button {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.care-dialog-actions .care-share-button {
  display: inline-flex;
  gap: 7px;
  border: 1px solid #b9d9d4;
  background: #fff;
  color: var(--brand);
}
.care-share-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.care-share-button:disabled { opacity: .62; cursor: wait; }
.install-dialog {
  width: min(100%, 480px);
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 12px 12px;
  background: #fff;
  box-shadow: 0 -12px 38px rgba(0,0,0,.18);
}
.install-logo {
  display: block;
  width: 86px;
  height: 86px;
  margin: 2px auto 12px;
  border: 1px solid #25302e;
  border-radius: 20px;
  background: #111;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
}
.install-dialog h2 { margin: 0; text-align: center; font-size: 21px; }
.install-intro { margin: 8px auto 16px; color: var(--muted); text-align: center; line-height: 1.8; }
.install-guide { display: grid; gap: 10px; }
.install-step {
  display: grid;
  grid-template-columns: 28px 48px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}
.install-step p { margin: 0; color: #314743; line-height: 1.65; }
.step-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.browser-menu-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #edf5ff;
}
.browser-menu-icon i { width: 5px; height: 5px; border-radius: 50%; background: #1473e6; }
.share-icon, .add-home-icon { width: 44px; height: 44px; color: #1473e6; }
.share-icon { position: relative; display: block; }
.share-icon::before {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 2px;
  width: 28px;
  height: 27px;
  border: 2px solid currentColor;
  border-radius: 7px;
}
.share-icon::after {
  content: "↑";
  position: absolute;
  top: -8px;
  right: 12px;
  width: 20px;
  background: #f8fbfb;
  text-align: center;
  font: 30px/1 sans-serif;
}
.add-home-icon {
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 10px;
  font: 34px/1 sans-serif;
}
.install-native, .install-done {
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.install-native {
  margin-top: 14px;
  background: #0b5d57;
}
.install-native + .install-done { margin-top: 8px; }
.close {
  float: left;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eef7f6;
  color: var(--brand);
  font-size: 22px;
}
.is-hidden { display: none !important; }


@media (min-width: 641px) {
  .install-sheet { place-items: center; padding: 24px; }
  .install-dialog { border-radius: 16px; }
}
@media (max-width: 640px) {
  .app-shell { border-inline: 0; }
  main { padding: 14px 12px calc(112px + env(safe-area-inset-bottom)); }
  .topbar { padding: 10px 12px; }
  .brand img { width: 42px; height: 42px; border-radius: 10px; }
  .hero { grid-template-columns: 1fr; padding: 16px; }
  .hero > div:first-child {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
  }
  .hero-logo { grid-row: 1 / span 2; width: 60px; height: 60px; margin: 0; border-radius: 15px; }
  .hero h1 { font-size: 24px; }
  .hero > div:first-child p { grid-column: 2; margin: 3px 0 0; font-size: 13px; }
  .form-grid, .profile-form, .guest-access, .schedule-guide, .booking-contact-gate, .booking-contact-form { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid article:nth-child(3) { grid-column: 1 / -1; }
  .schedule-guide small { grid-column: 1; }
  .guest-access .primary { width: 100%; }
  .tabs {
    position: fixed;
    top: auto;
    right: 50%;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 40;
    width: min(calc(100% - 16px), 744px);
    margin: 0;
    padding: 6px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    overflow: visible;
    transform: translateX(50%);
    background: rgba(255, 255, 255, .96);
    border: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  }
  .tab { min-width: 0; min-height: 52px; flex-direction: column; gap: 2px; padding: 4px 2px; font-size: 11px; }
  .tab svg { width: 20px; height: 20px; }
  .contact-actions { grid-template-columns: 1fr; }
  .aftercare-grid, .content-grid, .resource-links { grid-template-columns: 1fr; }
  .care-detail-body[data-content-kind="gallery"] .gallery-grid,
  .care-detail-body[data-content-kind="services"] .fresh-guides-grid { grid-template-columns: 1fr; }
  .aftercare-grid .care-card { min-height: 174px; padding: 14px; }
  .care-search-panel { margin-inline: -2px; padding: 12px; }
  .care-quick-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .care-quick-filters button { width: 100%; }
  .care-alert { grid-template-columns: 1fr; }
  .care-alert a { grid-column: 1; grid-row: auto; margin-top: 5px; }
  .care-sheet { padding: 0; }
  .care-dialog { max-height: 94dvh; border-radius: 18px 18px 0 0; }
  .care-dialog-footer { grid-template-columns: 1fr; }
  .care-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .care-dialog-actions a, .care-dialog-actions button { width: 100%; }
  .care-dialog-actions .care-share-button { grid-column: 1 / -1; }
  .appointment-list-toolbar { align-items: stretch; flex-direction: column; }
  .install-sheet { padding: 0; }
  .install-dialog { border-radius: 20px 20px 0 0; }
}

/* Patient-friendly visual system */
:root {
  --bg: #f3f7f6;
  --surface: #ffffff;
  --ink: #183330;
  --muted: #526864;
  --line: #d7e4e1;
  --brand: #0b6b64;
  --brand-strong: #07534e;
  --brand-soft: #e7f4f1;
  --blue: #286a96;
  --blue-soft: #edf5fb;
  --coral: #b84640;
  --coral-soft: #fff0ee;
  --amber: #876000;
  --amber-soft: #fff6df;
  --violet: #69527d;
  --violet-soft: #f5f0f8;
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, .1);
}

html { scrollbar-color: #87aaa5 #edf3f1; }
body { background: #eaf1ef; }
::selection { background: #bfe8e1; color: #073f3b; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #edf3f1; }
::-webkit-scrollbar-thumb { background: #87aaa5; border: 2px solid #edf3f1; border-radius: 8px; }

.app-shell {
  border-color: #d4e1de;
  background: var(--bg);
  box-shadow: 0 0 36px rgba(0, 0, 0, .08);
}
.topbar {
  background: rgba(255, 255, 255, .94);
  border-bottom-color: #d4e1de;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .07);
}
.brand strong { color: var(--brand-strong); font-size: 16px; }
.brand small { color: #60736f; font-size: 12px; }
.brand img { border-color: #c8d8d4; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.icon-button, .secondary { background: var(--brand-soft); color: var(--brand-strong); }
.icon-button:hover, .secondary:hover { background: #d8ebe7; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline-color: #4d9f96;
  box-shadow: none;
}
input, select, textarea {
  min-height: 46px;
  border-color: #cbdad6;
  background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: #5c9e96; }
.primary { background: var(--brand); box-shadow: 0 5px 12px rgba(0, 0, 0, .14); }
.primary:hover { background: var(--brand-strong); transform: translateY(-1px); }
.primary:active { transform: translateY(0); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid #07534e;
  background: #0b625c;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
}
.hero-logo { border-color: rgba(255, 255, 255, .8); box-shadow: none; }
.hero h1 { text-wrap: balance; }
.hero p { color: #e6f5f2; }
.hero-card {
  border-color: #f3e2c1;
  background: #fffaf0;
  color: var(--ink);
  box-shadow: none;
}
.hero-card span { color: #6b6352; font-size: 12px; font-weight: 700; }
.hero-card strong { color: var(--brand-strong); line-height: 1.5; }
.hero-card small { color: #5f6e6b; line-height: 1.75; }

.auth-panel, .profile-panel {
  border-color: #ccddd9;
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.view {
  margin-top: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}
.view[hidden] { display: none !important; }
.view.is-active { display: block; animation: view-enter .24s cubic-bezier(.16, 1, .3, 1); }
@keyframes view-enter {
  from { opacity: .72; transform: translateY(5px); filter: blur(1px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.guest-access {
  border-color: #bdd6e6;
  background: var(--blue-soft);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .06);
}
.guest-access strong { color: #1e577e; }
.guest-access .primary { background: var(--blue); box-shadow: 0 5px 12px rgba(0, 0, 0, .14); }
.section-heading { margin-bottom: 14px; }
.section-heading h2 { color: var(--brand-strong); font-size: 22px; }
.section-heading p { max-width: 68ch; }

.tabs {
  border-color: #d2dfdc;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .09);
}
.tab { --tab-accent: var(--brand); color: #5a6e6a; }
.tab:nth-child(2) { --tab-accent: var(--blue); }
.tab:nth-child(3) { --tab-accent: var(--coral); }
.tab:nth-child(4) { --tab-accent: var(--amber); }
.tab:nth-child(5) { --tab-accent: var(--violet); }
.tab:hover { background: #f0f5f4; color: var(--tab-accent); }
.tab.is-active { background: var(--tab-accent); color: #fff; box-shadow: 0 5px 12px rgba(0, 0, 0, .12); }

.metric-grid article {
  min-height: 112px;
  border-color: #c8dfd9;
  background: var(--brand-soft);
  box-shadow: 0 6px 15px rgba(0, 0, 0, .06);
}
.metric-grid article:nth-child(2) { border-color: #efddb2; background: var(--amber-soft); }
.metric-grid article:nth-child(3) { border-color: #c9ddec; background: var(--blue-soft); }
.metric-grid span { color: #526460; font-weight: 700; }
.metric-grid strong { color: var(--brand-strong); }
.metric-grid article:nth-child(2) strong { color: var(--amber); }
.metric-grid article:nth-child(3) strong { color: var(--blue); }

.dashboard-shortcuts-heading h2, .contact-panel h2 { color: var(--ink); }
.action-list button, .action-list a {
  display: flex;
  min-height: 56px;
  gap: 9px;
  padding: 10px 14px;
  border-color: #c6ddd8;
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .06);
}
.action-list > :nth-child(2) { border-color: #c7dcec; background: var(--blue-soft); color: var(--blue); }
.action-list .review-action { border-color: #ead59f; background: var(--amber-soft); color: var(--amber); }
.action-list .faq-action { border-color: #c9dcd8; background: #f1f8f6; color: #24675f; font-weight: 700; }
.action-list svg {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.action-list button:hover, .action-list a:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0, 0, 0, .1); }

.contact-panel {
  padding: 18px;
  border: 1px solid #d3e0dd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .06);
}
.contact-actions a { border-color: #c9ddd8; background: var(--brand-soft); color: var(--brand-strong); }
.contact-actions a:nth-child(2) { border-color: #e1d2e7; background: var(--violet-soft); color: var(--violet); }
.contact-actions a:nth-child(3) { border-color: #c9ddec; background: var(--blue-soft); color: var(--blue); }
.contact-actions a:nth-child(4) { border-color: #c9dfd8; background: #edf8f3; color: #1e6b4c; }
.contact-actions a:nth-child(5) { border-color: #ead7a6; background: var(--amber-soft); color: var(--amber); }
.contact-panel address { color: #546965; }

#appointments > .profile-form, .schedule-guide, .booking-contact-gate {
  padding: 16px;
  border: 1px solid #d0dfdc;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .06);
}
.schedule-guide { border-color: #c4dae9; background: var(--blue-soft); }
.schedule-guide strong { color: #1e577e; }
.schedule-guide small { border-top-color: #d6c9c5; color: #8f3732; }
.consultation-note { border-color: #c5ddd7; background: var(--brand-soft); color: #315a55; }

.care-search-panel { border-color: #c1d9e9; background: var(--blue-soft); box-shadow: 0 6px 16px rgba(0, 0, 0, .06); }
.care-search-panel > label { color: #1d557c; }
.care-quick-filters button.is-active { border-color: var(--blue); background: var(--blue); }
.care-alert { border-color: #eab6b1; background: var(--coral-soft); }
.care-alert strong { color: #973a35; }
.care-alert a { background: var(--coral); }

.aftercare-grid .care-card, .content-grid article {
  border-color: #d4e1de;
  background: #fff;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .065);
}
.aftercare-grid .care-card[data-care="root-canal"],
.aftercare-grid .care-card[data-care="scaling"] { border-color: #c7ddd8; background: #fbfffe; }
.aftercare-grid .care-card[data-care="children"] { border-color: #ded1e5; background: #fdfbfe; }
.aftercare-grid .care-card[data-care="restoration"],
.aftercare-grid .care-card[data-care="amalgam"],
.aftercare-grid .care-card[data-care="veneer"],
.aftercare-grid .care-card[data-care="laminate"] { border-color: #ecdcb6; background: #fffdf8; }
.aftercare-grid .care-card[data-care="extraction"],
.aftercare-grid .care-card[data-care="surgery"] { border-color: #ebc9c5; background: #fffafa; }
.aftercare-grid .care-card[data-care="implant"],
.aftercare-grid .care-card[data-care="healing-abutment"],
.aftercare-grid .care-card[data-care="implant-crown"] { border-color: #cbddec; background: #fbfdff; }
.aftercare-grid .care-card:hover { border-color: #79b6ae; box-shadow: 0 11px 23px rgba(0, 0, 0, .11); }
.care-card > strong { color: var(--brand-strong); }

.content-grid article:nth-child(2), .content-grid article:nth-child(6) { border-color: #c9ddec; background: #fbfdff; }
.content-grid article:nth-child(3), .content-grid article:nth-child(4) { border-color: #eadbb5; background: #fffdf8; }
.content-grid article:nth-child(5) { border-color: #dfd2e6; background: #fdfbfe; }
.content-card > a { border-color: #c9ddd8; background: var(--brand-soft); color: var(--brand-strong); }
.resource-links a { border-color: #d3e0dd; background: #fff; box-shadow: 0 5px 14px rgba(0, 0, 0, .05); }
.resource-links a:nth-child(2) { color: var(--violet); }
.resource-links a:nth-child(3) { color: var(--blue); }

.appointment-history article { box-shadow: 0 6px 16px rgba(0, 0, 0, .06); }
.appointment-history article.is-active-appointment { border-color: #bcd8d2; background: #fbfffe; }
.aftercare-review { border-color: #d9bd72; background: var(--amber-soft); color: var(--amber); }
.profile-summary {
  padding: 18px;
  border: 1px solid #d8cde0;
  border-radius: 8px;
  background: var(--violet-soft);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .07);
}
.profile-summary h2 { color: #523e64; }
.connector-list {
  padding: 14px 34px 14px 16px;
  border: 1px solid #d7e4e1;
  border-radius: 8px;
  background: #fff;
}

.care-dialog { border: 1px solid #d3e0dd; box-shadow: 0 -18px 48px rgba(0, 0, 0, .22); }
.care-dialog-header { background: var(--brand-soft); }
.care-dialog-close { background: #fff; }
.care-detail-intro { border-color: #c5ddd7; background: var(--brand-soft); }
.care-detail-warning { border-color: #eab6b1; background: var(--coral-soft); }
.care-detail-review { border-color: #e3ca8b; background: var(--amber-soft); color: var(--amber); }

.auth-close, .close, .care-dialog-close { width: 44px; height: 44px; }
.auth-method-switch button, .care-quick-filters button, .appointment-mode-switch button,
.content-card > a, .permission-later { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .view.is-active { animation: none; }
}

@media (max-width: 640px) {
  body { background: var(--bg); }
  .app-shell { box-shadow: none; }
  .hero { padding: 17px; }
  .hero-card { margin-top: 2px; }
  .auth-panel, .profile-panel { padding: 15px; }
  .view { margin-top: 16px; }
  .tabs { border: 1px solid #d4e0dd; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
  .tab.is-active { box-shadow: none; }
  .metric-grid article { min-height: 104px; }
  .action-list button, .action-list a { padding-inline: 10px; }
  .contact-panel { padding: 15px; }
  #appointments > .profile-form, .schedule-guide, .booking-contact-gate { padding: 14px; }
  .profile-summary { align-items: flex-start; padding: 15px; }
  .patient-toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Treatment records */
.treatment-panel { max-width:1100px; margin-inline:auto; }
.treatment-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-block:22px 32px; padding:20px; border:1px solid #d9e7e4; border-radius:18px; background:#f7fbfa; }
.treatment-form h3,.treatment-wide { grid-column:1/-1; }
.treatment-form label,.treatment-panel > label { display:flex; flex-direction:column; gap:7px; font-weight:600; }
.treatment-form input,.treatment-form select,.treatment-form textarea,.treatment-panel > label select { width:100%; min-width:0; box-sizing:border-box; padding:12px; border:1px solid #c9dad6; border-radius:10px; background:white; color:#173e38; font:inherit; }
.treatment-form small { font-weight:400; color:#526b65; }
.treatment-check { flex-direction:row!important; align-items:center; }
.treatment-check input { width:20px; height:20px; }
.treatment-actions { display:flex; gap:10px; flex-wrap:wrap; margin-block:16px; }
.treatment-actions button,.treatment-form button,.treatment-card button { padding:10px 18px; border:0; border-radius:10px; background:#0f766e; color:white; font:inherit; cursor:pointer; }
.treatment-form button:disabled { opacity:.5; }
.treatment-timeline { display:grid; gap:16px; margin-block:20px; }
.treatment-card { border:1px solid #dae7e3; border-inline-start:4px solid #0f766e; border-radius:14px; background:white; padding:20px; overflow-wrap:anywhere; }
.treatment-card h3 { margin-block:10px; }
.treatment-card p { line-height:1.9; margin-block:8px; }
.treatment-description { white-space:pre-wrap; }
.treatment-badge { display:inline-block; background:#e3f2ec; color:#175e4f; border-radius:20px; padding:4px 12px; font-size:.85rem; }
.treatment-meta { color:#58716a; font-size:.9rem; }
.treatment-money { background:#f3f7f5; padding:10px; border-radius:8px; }
.treatment-file { display:inline-block; margin:6px; color:#0b7164; text-decoration:underline; }
#treatmentNotice,#patientTreatmentNotice { white-space:pre-wrap; line-height:1.8; }
#patientTreatmentFilter { padding:10px; border:1px solid #c9dad6; border-radius:10px; font:inherit; background:white; }
@media(max-width:600px) { .treatment-form { grid-template-columns:minmax(0,1fr); padding:14px; } .treatment-card { padding:14px; } }

.treatment-form[hidden],#treatmentWorkspace[hidden] {display:none!important;}
.tooth-picker {border:1px solid #d9e7e4;border-radius:12px;padding:16px;min-width:0;}
.tooth-picker legend {font-weight:700;padding-inline:8px;}
.tooth-picker p {font-size:.9rem;color:#526b65;line-height:1.8;}
.tooth-quadrants {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;}
.tooth-quadrant strong {display:block;margin-bottom:8px;}
.tooth-buttons {display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:5px;}
.tooth-buttons button {padding:10px 0;background:white;color:#175e4f;border:1px solid #bfd4cd;}
.tooth-buttons button[aria-pressed="true"] {background:#0f766e;color:white;border-color:#0f766e;box-shadow:0 0 0 2px #cce7df;}
.treatment-actions .secondary {background:#e4ece9;color:#254d44;}
@media(max-width:600px){.tooth-quadrants {grid-template-columns:1fr;}.tooth-picker {padding:10px;}}

#treatmentSubtypeLabel[hidden],#treatmentDetailLabel[hidden]{display:none!important;}
#treatmentFormNotice{white-space:pre-wrap;line-height:1.8;color:#8a302a;}

#treatmentBatch[hidden]{display:none!important;}
.treatment-queue-row{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #cadad4;border-radius:10px;padding:12px;margin-top:10px;}
#treatmentSuccess{max-width:420px;width:calc(100% - 32px);border:1px solid #c9dad5;border-radius:18px;padding:28px;color:#163d34;text-align:center;}
#treatmentSuccess::backdrop{background:#081d2877;}
#treatmentSuccess button{background:#0f766e;color:white;border:0;border-radius:10px;padding:12px 25px;font:inherit;}
.patient-treatment-row{border:1px solid var(--line,#dbe9e6);border-radius:12px;background:var(--surface,#fff);overflow:hidden;}
.patient-treatment-row summary{display:grid;grid-template-columns:minmax(110px,.8fr) minmax(120px,1fr) minmax(150px,1.5fr);gap:12px;padding:16px;cursor:pointer;align-items:center;list-style:none;font-size:14px;}
.patient-treatment-row summary::after{content:none;}.patient-treatment-row .record-treatment{font-weight:700;}.patient-treatment-detail{padding:0 16px 16px;border-top:1px solid var(--line,#dbe9e6);white-space:pre-wrap;line-height:1.9;}
@media(max-width:600px){.patient-treatment-row summary{grid-template-columns:85px 100px minmax(115px,1fr);gap:8px;padding:12px;font-size:12px;}.patient-treatment-row{overflow:auto;}.treatment-queue-row{align-items:flex-start;flex-direction:column;}}

#treatmentDeleteDialog{max-width:480px;width:calc(100% - 32px);padding:24px;border:1px solid #d9dedc;border-radius:16px;line-height:1.9;}
#treatmentDeleteDialog::backdrop{background:#081d2877;}
.treatment-card .treatment-delete,.treatment-actions .treatment-delete{background:#a83030;margin-inline:6px;}

/* Prevent double-tap zoom while keeping deliberate pinch zoom accessible. */
html,body {touch-action:manipulation;}
button,a,input,select,textarea,summary,[role="tab"] {touch-action:manipulation;}
@media(max-width:700px){input,select,textarea{font-size:16px!important;}}
.patient-treatment-row summary{grid-template-columns:minmax(0,.85fr) minmax(0,1.4fr) minmax(0,1fr);align-items:start;}
.patient-treatment-row summary > span{min-width:0;overflow-wrap:break-word;line-height:1.9;}
.record-tooth-line{display:block;}
@media(max-width:600px){.patient-treatment-row summary{grid-template-columns:minmax(0,.8fr) minmax(0,1.3fr) minmax(0,1fr);gap:8px;font-size:12px;}.patient-treatment-row{overflow:hidden;}}

.patient-treatment-row summary{grid-template-columns:minmax(0,.8fr) minmax(0,1.3fr) minmax(0,1.1fr) minmax(0,1fr);}
.record-doctor{color:inherit;}
@media(max-width:600px){.patient-treatment-row summary{grid-template-columns:minmax(0,.8fr) minmax(0,1.25fr) minmax(0,1.05fr) minmax(0,.9fr);gap:6px;padding:10px;font-size:12px;}}

.tabs { grid-template-columns:repeat(6,minmax(0,1fr)); }
@media(max-width:600px){.tabs .tab {padding-inline:3px;} .tabs .tab span {font-size:10px;} }
