:root {
  color-scheme: light;
  --paper: #efe6d4;
  --sheet: #fbf7ee;
  --ink: #1c1915;
  --muted: #5e574c;
  --line: #ddcfb4;
  --spruce: #234237;
  --spruce-deep: #163028;
  --brass: #8a5e2a;
  --warn: #80600D;
  --warn-bg: #F9EDCC;
  --notice: #92501D;
  --notice-bg: #FBE5D2;
  --alert: #7d2e24;
  --alert-bg: #f6e0d6;
  --cream: #f3ecdf;
  --gold: #e0b46c;
}

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

/* Leave room for the sticky save bar when the browser scrolls a field into view. */
html {
  scroll-padding-bottom: 6rem;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Liberation Sans", "Nimbus Sans", "DejaVu Sans", sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

h1,
h2,
.brand strong,
.auth-card h1 {
  font-family: "Liberation Serif", "Nimbus Roman", "DejaVu Serif", Palatino, Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 1.4rem;
}

h3 {
  margin: 0;
  font-family: "Liberation Sans", "Nimbus Sans", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

p {
  margin: 0;
}

a {
  color: var(--spruce);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: white;
  padding: 0.4rem 0.6rem;
  z-index: 6;
}

.skip:focus {
  left: 0.5rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.25rem 0.8rem 1.7rem;
  background: var(--spruce-deep);
  color: var(--cream);
}

.topbar a {
  color: inherit;
  text-decoration: none;
}

.topbar a:hover {
  text-decoration: underline;
}

/* Module tabs run the full height of the bar; the current one is marked by
   a gold rule along the bar's bottom edge. */
.modules {
  display: flex;
  align-self: stretch;
  gap: 0.25rem;
  margin: -0.8rem 0;
}

.topbar .module-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.95rem;
  color: rgba(243, 236, 223, 0.72);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}

.module-link .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.topbar .module-link:hover {
  color: var(--cream);
  background: rgba(243, 236, 223, 0.07);
  text-decoration: none;
}

.topbar .module-link[aria-current="page"] {
  color: var(--cream);
  background: rgba(243, 236, 223, 0.1);
}

.module-link::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  transition: background-color 0.15s;
}

.module-link:hover::after {
  background: rgba(224, 180, 108, 0.45);
}

.module-link[aria-current="page"]::after {
  background: var(--gold);
}

.topbar a:focus-visible,
.app-menu summary:focus-visible {
  outline-color: var(--gold);
}

.topbar .module-link:focus-visible {
  outline-offset: -4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand strong {
  display: block;
}

.mark {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
}

.brand:hover {
  text-decoration: none;
}

.brand:hover strong {
  text-decoration: underline;
}

.app-menu {
  position: relative;
}

.app-menu details {
  position: relative;
}

.app-menu summary {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  list-style: none;
  color: var(--cream);
  border: 1px solid rgba(243, 236, 223, 0.45);
  border-radius: 0.45rem;
  cursor: pointer;
}

.app-menu summary::-webkit-details-marker,
.app-menu summary::marker {
  display: none;
  content: "";
}

.app-menu summary:hover,
.app-menu details[open] summary {
  background: rgba(243, 236, 223, 0.14);
}

.menu-icon {
  display: block;
  width: 1.05rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 4;
  min-width: 12.5rem;
  padding: 0.85rem 0.9rem 0.55rem;
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 10px 28px rgba(22, 48, 40, 0.18);
}

.menu-panel .identity {
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.menu-panel .identity span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.topbar form {
  margin: 0;
}

button.lang {
  display: flex;
  justify-content: center;
}
.lang-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  overflow: hidden;
}

.lang-switch button {
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 0.35rem 0.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.lang-switch button + button {
  border-left: 1px solid var(--line);
}

.lang-switch button:hover {
  background: var(--cream);
}

.lang-switch button[aria-pressed="true"],
.lang-switch button[aria-pressed="true"]:hover {
  background: var(--spruce);
  color: var(--cream);
}

a.menu-item {
  display: block;
  margin-top: 0.55rem;
  padding: 0.6rem 0.1rem 0.25rem;
  color: var(--ink);
  border-top: 1px solid var(--line);
  text-decoration: none;
}

a.menu-item:hover {
  text-decoration: underline;
}

button.menu-item {
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.6rem 0.1rem 0.25rem;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

button.menu-item:hover {
  background: transparent;
  text-decoration: underline;
}

main {
  width: min(112rem, calc(100% - 2.5rem));
  max-width: 967px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.eyebrow {
  margin: 0;
  color: var(--brass);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede,
.quiet,
.signed,
.by,
.who span {
  color: var(--muted);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 1rem;
}

.calendar {
  margin-top: 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--sheet);
}

.cal-head,
.cal-body {
  display: grid;
  grid-template-columns: 3.6rem repeat(var(--cols, 7), minmax(7.5rem, 1fr));
  min-width: calc(3.6rem + var(--cols, 7) * 7.5rem);
}

.cal-head .cal-day {
  color: var(--ink);
  text-decoration: none;
}

.cal-head .cal-day:hover {
  background: #f3eee2;
}

.cal-head .cal-day,
.cal-head h2 {
  margin: 0;
  padding: 0.55rem 0.4rem 0.45rem;
  font-family: "Liberation Sans", "Nimbus Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  line-height: 1.25;
  color: var(--ink);
  border-left: 1px solid var(--line);
}

.cal-head .cal-day.today,
.cal-head h2.today {
  box-shadow: inset 0 3px 0 var(--spruce);
  background: #f3f8f5;
}

.cal-hours,
.cal-col {
  display: grid;
  grid-template-rows: repeat(var(--rows), 2.15rem);
}

.cal-hour {
  padding-right: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
  line-height: 1;
}

.cal-col {
  position: relative;
  border-left: 1px solid var(--line);
}

.cal-col.today {
  background: #f3f8f5;
}

.cal-cell {
  border-top: 1px solid #efe6d4;
}

.cal-cell.hour {
  border-top-color: var(--line);
}

.cal-cell.off {
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(94, 87, 76, 0.06) 6px 7px);
}

.cal-cell:hover {
  position: relative;
  background: #eef4ef;
}

.cal-cell:hover::after {
  content: "+ " attr(data-when);
  position: absolute;
  top: 0.3rem;
  left: 0.4rem;
  color: var(--spruce);
  font-size: 0.72rem;
  font-weight: 700;
}

.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 0;
  border-top: 2px solid var(--alert);
  pointer-events: none;
}

.cal-now::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert);
}

.cal-block.status-confirmed {
  border-left: 4px solid #1d7a45;
}

.cal-block.status-attended {
  background: #eceae4;
  border-color: #8f877a;
  color: var(--muted);
}

.cal-block.status-no_show {
  background: var(--notice-bg);
  border-color: var(--notice);
}

.cal-block.clash {
  border-color: var(--alert);
  box-shadow: inset 0 0 0 1px var(--alert);
}

.cal-block {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0.12rem 0.3rem;
  background: #e7f0ea;
  border: 1px solid var(--spruce);
  border-radius: 0.3rem;
  color: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
  text-decoration: none;
}

.cal-block:hover {
  background: #d7eadf;
  text-decoration: none;
}

.cal-block time,
.cal-block strong,
.cal-block span {
  display: block;
}

.cal-block time,
.cal-block span {
  color: var(--muted);
  font-weight: 400;
}

/* Agenda: month view, a week to a row as in a wall calendar. */
.month {
  margin-top: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--sheet);
  overflow: hidden;
}

.month-head,
.month-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-head span {
  padding: 0.45rem 0.5rem 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.month-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 0;
  min-height: 6.6rem;
  padding: 0.3rem 0.3rem 0.4rem;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.month-cell:nth-child(7n + 1) {
  border-left: 0;
}

.month-cell.closed {
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(94, 87, 76, 0.06) 6px 7px);
}

.month-cell.outside {
  background-color: rgba(239, 230, 212, 0.55);
}

.month-cell.outside .month-day {
  color: var(--muted);
  font-weight: 400;
}

.month-add {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.month-add:hover {
  background: #eef4ef;
}

.month-add:hover::after {
  content: "+";
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  color: var(--spruce);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
}

.month-day,
.month-count,
.month-events {
  position: relative;
  z-index: 1;
}

.month-day {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.month-day:hover {
  background: #e6decc;
}

.month-day[aria-current="date"] {
  background: var(--spruce);
  color: var(--cream);
}

.month-count {
  display: none;
}

.month-events {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.month-events li {
  min-width: 0;
}

.month-event,
.month-more {
  display: flex;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.08rem 0.35rem;
  border-radius: 0.25rem;
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.month-event {
  background: #e7f0ea;
  border-left: 3px solid var(--spruce);
}

.month-event:hover,
.month-more:hover {
  background: #d7eadf;
  text-decoration: none;
}

.month-event time {
  flex: none;
  color: var(--muted);
}

.month-event span {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.month-event.status-confirmed {
  border-left-color: #1d7a45;
}

.month-event.status-attended {
  background: #eceae4;
  border-left-color: #8f877a;
  color: var(--muted);
}

.month-event.status-no_show {
  background: var(--notice-bg);
  border-left-color: var(--notice);
}

.month-more {
  color: var(--spruce);
  font-weight: 700;
}

/* Agenda: navigation bar, week strip, day view, appointment form, hours. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hint {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.85rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-left: 4px solid var(--warn);
}

.hint a {
  color: inherit;
  font-weight: 700;
}

.agenda-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.2rem;
}

.agenda-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.nav-arrow,
.nav-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.3rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--sheet);
  color: var(--ink);
  text-decoration: none;
}

.nav-arrow {
  width: 2.3rem;
}

.nav-today {
  padding: 0 0.8rem;
  font-weight: 600;
}

.nav-arrow:hover,
.nav-today:hover {
  background: white;
}

.agenda-title {
  margin: 0 0 0 0.5rem;
  font-size: 1.3rem;
}

.agenda-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.date-jump {
  display: flex;
  gap: 0.35rem;
  margin: 0;
}

.date-jump input {
  width: auto;
  padding: 0.35rem 0.5rem;
}

.dentist-pick {
  display: flex;
  gap: 0.35rem;
  margin: 0;
}

.dentist-pick select {
  width: auto;
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
}

button.ghost,
.button.ghost {
  background: transparent;
  color: var(--spruce);
  border: 1px solid var(--line);
}

button.ghost:hover,
.button.ghost:hover {
  background: white;
}

.view-switch {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 0.2rem;
  gap: 0.15rem;
  background: #e6decc;
  border-radius: 0.6rem;
}

.view-switch a {
  padding: 0.35rem 0.9rem;
  border-radius: 0.45rem;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.view-switch a[aria-current="page"] {
  background: white;
  color: var(--spruce);
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.16);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.strip-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  height: 100%;
  padding: 0.5rem 0.6rem 0.55rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--ink);
  text-decoration: none;
}

.strip-link:hover {
  background: white;
}

.strip-link.today {
  border-color: var(--spruce);
}

.strip-link[aria-current="date"] {
  background: var(--spruce);
  border-color: var(--spruce);
  color: var(--cream);
}

.strip-link.closed:not([aria-current]) {
  background: transparent;
  color: var(--muted);
}

.strip-day span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.strip-day strong {
  font-size: 1.15rem;
}

.strip-load {
  font-size: 0.78rem;
  line-height: 1.25;
  opacity: 0.85;
}

.strip-bar {
  display: block;
  height: 4px;
  margin-top: auto;
  background: rgba(35, 66, 55, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.strip-bar span {
  display: block;
  height: 100%;
  background: var(--brass);
}

.strip-link[aria-current="date"] .strip-bar {
  background: rgba(243, 236, 223, 0.25);
}

.strip-link[aria-current="date"] .strip-bar span {
  background: var(--gold);
}

.day-view {
  margin-top: 1.1rem;
}

.day-summary {
  color: var(--muted);
  font-weight: 600;
}

.day-list {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.day-list > li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.day-time time {
  display: block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.day-time span {
  color: var(--muted);
  font-size: 0.85rem;
}

.day-appt {
  padding: 0.8rem 0.95rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-left: 4px solid var(--spruce);
  border-radius: 0.45rem;
}

.day-appt.status-confirmed {
  border-left-color: #1d7a45;
}

.day-appt.status-attended {
  border-left-color: #8f877a;
}

.day-appt.status-no_show {
  border-left-color: var(--notice);
}

.day-appt.status-cancelled {
  border-left-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.day-appt.status-cancelled .day-patient,
.day-appt.status-cancelled .day-reason {
  text-decoration: line-through;
}

.day-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}

.day-patient {
  font-weight: 700;
  font-size: 1.05rem;
}

.day-reason {
  margin-top: 0.15rem;
}

.status-badge {
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #e7f0ea;
  color: var(--spruce);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-badge.status-confirmed {
  background: #d9efe1;
  color: #1d6a3c;
}

.status-badge.status-attended {
  background: #eceae4;
  color: var(--muted);
}

.status-badge.status-no_show {
  background: var(--notice-bg);
  color: var(--notice);
}

.status-badge.status-cancelled,
.status-badge.clash {
  background: var(--alert-bg);
  color: var(--alert);
}

.day-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin-top: 0.65rem;
}

.day-actions form {
  margin: 0;
}

.button.small {
  padding: 0.3rem 0.7rem;
  font-size: 0.9rem;
}

button.chip-button {
  padding: 0.25rem 0.65rem;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
}

button.chip-button:hover {
  background: #eef4ef;
  border-color: var(--spruce);
}

button.chip-button.danger {
  color: var(--alert);
}

button.chip-button.danger:hover {
  background: var(--alert-bg);
  border-color: var(--alert);
}

.day-free .day-time,
.day-break .day-time {
  padding-top: 0.45rem;
}

.free-book {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border: 1px dashed #b9c9bd;
  border-radius: 0.45rem;
  background: rgba(231, 240, 234, 0.45);
  color: var(--spruce);
  text-decoration: none;
}

.free-book:hover {
  background: #e7f0ea;
  border-style: solid;
}

.day-break > span {
  padding: 0.45rem 0;
  color: var(--muted);
  font-style: italic;
}

.field-label {
  display: block;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.chip {
  position: relative;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip span {
  display: block;
  padding: 0.4rem 0.85rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
}

.chip:hover span {
  border-color: var(--spruce);
}

.chip input:checked + span {
  background: var(--spruce);
  border-color: var(--spruce);
  color: var(--cream);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.chips.small {
  margin: 0;
}

.chips.small .chip span {
  padding: 0.2rem 0.65rem;
  font-size: 0.85rem;
}

.slot-finder {
  margin: 0.2rem 0 1rem;
  padding: 0.85rem 0.95rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.slot-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.slot-head .field-label {
  font-weight: 700;
}

.slot-days {
  display: grid;
  gap: 0.55rem;
}

.slot-day {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: baseline;
}

.slot-day-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.slot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

button.slot-chip {
  padding: 0.25rem 0.65rem;
  background: #eef4ef;
  color: var(--spruce);
  border: 1px solid #c9d8cd;
  border-radius: 0.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

button.slot-chip:hover {
  background: #dfece3;
}

button.slot-chip[aria-pressed="true"] {
  background: var(--spruce);
  border-color: var(--spruce);
  color: var(--cream);
}

.day-preview {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.preview-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.day-preview ul {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.2rem;
  font-size: 0.9rem;
}

.day-preview li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.1rem 0.75rem;
}

.day-preview li .quiet {
  font-size: 0.8rem;
}

.day-preview time {
  font-variant-numeric: tabular-nums;
}

.day-preview li.cancelled {
  color: var(--muted);
  text-decoration: line-through;
}

.overlap {
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  background: var(--alert-bg);
  color: var(--alert);
  border-left: 4px solid var(--alert);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-weight: 700;
  cursor: pointer;
}

.check-line input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.picks-new {
  margin-top: 0.55rem;
}

.hours-row {
  display: grid;
  grid-template-columns: 10rem repeat(4, minmax(0, 1fr));
  gap: 0.4rem 0.8rem;
  align-items: center;
  margin: 0;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.hours-head {
  padding-top: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.hours-row .field-error {
  grid-column: 1 / -1;
  margin: 0;
}

.hours-day {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  cursor: pointer;
}

.hours-day input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.hours-row:has(.hours-day input:not(:checked)) input[type="time"] {
  opacity: 0.45;
}

.hours-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.hours-form > .quiet {
  margin: 0.8rem 0 0.4rem;
}

.feed {
  margin-top: 2rem;
  padding: 1rem 1.05rem 1.1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}

.feed summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--spruce);
}

.feed[open] summary {
  margin-bottom: 0.45rem;
}

.feed p {
  margin-top: 0.45rem;
}

.feed .field {
  margin-top: 0.9rem;
}

.feed + .feed {
  margin-top: 1rem;
}

.feed-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.picks {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.field .picks label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  font-weight: 600;
  cursor: pointer;
}

.picks input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  flex: none;
}

.picks .who {
  display: block;
  min-width: 0;
  padding: 0;
}

.picks .who span {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.field .picks label:has(input:checked) {
  background: #e7f0ea;
  border-color: var(--spruce);
  box-shadow: inset 3px 0 0 var(--spruce);
}

.field .picks label:has(input:focus-visible) {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.upcoming-list {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
}

.upcoming-list li {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.upcoming-list li > a:first-child {
  flex: 1;
  border-bottom: 0;
}

.upcoming-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.upcoming-list time {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.actions form {
  margin: 0;
}

.back {
  margin: 0 0 0.8rem;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--spruce);
  color: var(--cream);
  border: 1px solid var(--spruce);
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--spruce-deep);
}

button.danger {
  background: transparent;
  color: var(--alert);
  border-color: var(--alert);
}

button.danger:hover {
  background: var(--alert-bg);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex: none;
}

.icon path,
.icon circle,
.icon rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-decoration: underline;
}

button.linkish:hover {
  background: none;
}

.search {
  margin-top: 1.25rem;
}

.search-field {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  padding-left: 2.35rem;
}

.field {
  margin-bottom: 0.9rem;
}

.field.yesno {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field.yesno > span {
  margin: 0;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 9.5rem;
  width: 9.5rem;
  padding: 0.2rem;
  gap: 0.15rem;
  background: #e6decc;
  border-radius: 0.65rem;
}

.choice label {
  position: relative;
  display: block;
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 0.45rem;
  cursor: pointer;
}

.choice span {
  display: block;
  padding: 0.35rem 0.55rem;
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.choice label:hover {
  color: var(--ink);
}

.choice label:has(input:checked),
.choice label:has(input:checked):hover {
  background: white;
  color: #1d7a45;
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.16);
}

.choice label:has(input:focus-visible) {
  outline: 2px solid var(--brass);
  outline-offset: -2px;
}

.field.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.field.check input {
  width: auto;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.6rem;
}

.password-field button.reveal {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.password-field button.reveal:hover {
  background: none;
  color: inherit;
}

.password-field button.reveal .eye-closed,
.password-field button.reveal[aria-pressed="true"] .eye-open {
  display: none;
}

.password-field button.reveal[aria-pressed="true"] .eye-closed {
  display: block;
}

.field.check label {
  margin: 0;
}

.field label {
  display: block;
}

input,
textarea,
select {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.55rem 0.65rem;
}

textarea {
  resize: vertical;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--alert);
  box-shadow: inset 0 0 0 1px var(--alert);
}

.req {
  margin-left: 0.2rem;
  color: var(--alert);
  font-weight: 700;
}

.required-hint {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.required-hint .req {
  margin: 0 0.15rem 0 0;
}

.field-hint {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-error {
  margin: 0.3rem 0 0;
  color: var(--alert);
  font-size: 0.92rem;
}

.banner {
  background: var(--alert-bg);
  color: var(--alert);
  padding: 0.7rem 0.85rem;
  margin: 0 0 1rem;
}

.banner.ok {
  background: var(--cream);
  color: var(--spruce);
  border: 1px solid var(--line);
}

.sheet-form,
.auth-card,
.roster,
.chart {
  background: var(--sheet);
  border: 1px solid var(--line);
}

.sheet-form,
.auth-card {
  padding: 1.2rem 1.25rem 1.3rem;
  max-width: 36rem;
}

.auth-page {
  max-width: 36rem;
  margin: 2vh auto 4vh;
}

.auth-card h1 {
  margin: 0.2rem 0 1.5rem;
  font-size: 2.2rem;
}

.auth-card .field {
  margin-bottom: 1.15rem;
}

.auth-card .field > label:first-child {
  margin-bottom: 0.3rem;
}

.auth-card .form-actions {
  margin-top: 1.6rem;
}

.auth-card .form-actions button {
  width: 100%;
  justify-content: center;
  padding: 0.7rem 1rem;
  font-weight: 700;
}

.auth-alt {
  margin: 1.25rem 0 0;
  text-align: center;
}

.auth-note {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.3rem 0.7rem;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--spruce);
  font-weight: 700;
}

.form-actions {
  margin-top: 0.4rem;
}

.sheet-form {
  margin-top: 1rem;
}

.sheet-form.wide {
  max-width: none;
}

/* Keep the save button in reach on long forms. */
.sheet-form > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin: 0.4rem -1.25rem -1.3rem;
  padding: 0.8rem 1.25rem;
  background: var(--sheet);
  border-top: 1px solid var(--line);
}

.form-cancel {
  color: var(--muted);
}

.form-section {
  min-width: 0;
  margin: 0 0 0.6rem;
  padding: 0;
  border: 0;
}

.form-section + .form-section {
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.form-section > legend {
  float: left;
  width: 100%;
  margin: 0 0 0.8rem;
  padding: 0;
  color: var(--brass);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form-section > :not(legend) {
  clear: both;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  column-gap: 1.25rem;
}

.form-grid > * {
  grid-column: span 6;
  min-width: 0;
}

.form-grid > .w-half {
  grid-column: span 3;
}

.form-grid > .w-third {
  grid-column: span 2;
}

.form-grid > .w-two-thirds {
  grid-column: span 4;
}

.form-grid > .yesno {
  margin-bottom: 0.6rem;
}

.form-grid .choice {
  flex-basis: 7.5rem;
  width: 7.5rem;
}

@media (max-width: 900px) {
  .form-grid > .w-third,
  .form-grid > .w-two-thirds {
    grid-column: span 3;
  }
}

.roster {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 1.75rem;
}

.roster li {
  border-bottom: 1px solid var(--line);
}

.roster li:last-child {
  border-bottom: 0;
}

.roster a,
.roster .who {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.roster a {
  color: inherit;
  text-decoration: none;
  padding: 0.9rem 1rem;
}

.roster .who {
  display: block;
  padding: 0.9rem 1rem;
}

.roster a .who {
  padding: 0;
}

.roster a:hover strong {
  text-decoration: underline;
}

.roster-more {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 1rem;
}

.roster-more button {
  background: transparent;
  color: var(--spruce);
  border-color: var(--line);
}

.roster-more button:hover {
  background: var(--cream);
}

.roster-more button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.who span {
  display: block;
}

.empty {
  color: var(--muted);
  padding: 0.4rem 0 0.2rem;
}

.chart {
  padding: 1.3rem 1.35rem 0.6rem;
}

.chart-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 1rem 0 0.25rem;
}

.chart .chart-facts section {
  margin: 0;
}

.chart-facts h3 {
  margin-bottom: 0.45rem;
}

.chart-facts .facts {
  grid-template-columns: 1fr;
  gap: 0.55rem 0;
}

.chart-facts dd {
  overflow-wrap: anywhere;
}

.chart aside,
.form-alert {
  margin-top: 1.1rem;
  border-left: 4px solid var(--brass);
  padding: 0.75rem 0.9rem;
}

.chart aside strong,
.form-alert strong {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart aside.allergy,
.form-alert.allergy {
  background: var(--alert-bg);
  color: var(--alert);
  border-left-color: var(--alert);
}

.chart aside.notes,
.form-alert.notes {
  background: var(--notice-bg);
  color: var(--notice);
  border-left-color: var(--notice);
}

.chart aside.medical,
.form-alert.medical {
  background: var(--warn-bg);
  color: var(--warn);
  border-left-color: var(--warn);
}

.chart aside p,
.form-alert p,
.quiet {
  margin-top: 0.2rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.facts div {
  margin: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
}

.flags .on {
  font-weight: 700;
}

.flags div:has(.on) dt {
  text-decoration: underline;
}

.chart section {
  margin-top: 2.5rem;
}

.upcoming .page-head {
  align-items: center;
  margin-bottom: 0.4rem;
}

.visit-table-wrap {
  overflow-x: auto;
  margin-top: 0.4rem;
}

.visit-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.visit-table th,
.visit-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
}

.visit-table thead th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.visit-table tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.by {
  display: block;
  margin: 0.15rem 0 0;
  font-weight: 400;
  font-size: 0.8rem;
}

.charge-line,
.charge-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem 2.5rem;
  grid-template-areas: "description amount remove";
  column-gap: 0.7rem;
  align-items: end;
}

.charge-head {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.charge-line .field {
  margin-bottom: 0;
}

.charge-description {
  grid-area: description;
}

.charge-amount {
  grid-area: amount;
}

.money-remove {
  grid-area: remove;
}

.account-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.account-preview dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin: 0;
}

.account-preview dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.account-preview dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.account-preview .after dd {
  font-weight: 700;
}

.account .page-head {
  align-items: center;
}

.fold-heading {
  font-size: 1.4rem;
}

button.fold-toggle,
button.fold-toggle:hover {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 0;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.fold-chevron {
  flex: none;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.fold-toggle[aria-expanded="false"] .fold-chevron {
  transform: rotate(-90deg);
}

.visit-table td form {
  margin: 0;
}

.visit-table .num,
.ledger .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ledger-totals .due strong,
.ledger td.due {
  color: var(--alert);
}

.paid-by {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

button.linkish.danger-link {
  color: var(--alert);
}

.money-row {
  margin-bottom: 0.7rem;
}

/* The header row names the columns on wide screens; each row keeps its own
   labels for screen readers and shows them once the columns stack. */
.money-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.currency-input {
  position: relative;
  display: block;
}

.currency {
  position: absolute;
  top: 50%;
  left: 0.65rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.currency-input input {
  padding-left: 1.45rem;
}

button.money-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

button.money-remove:hover {
  background: var(--alert-bg);
  color: var(--alert);
}

.money-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  margin-top: 0.2rem;
}

.money-total {
  margin: 0;
  font-weight: 700;
}

.danger-zone {
  margin-top: 2rem;
}

/* Long notes grow with their text where the browser supports it. */
.sheet-form textarea {
  field-sizing: content;
  min-height: 4.75rem;
  max-height: 70vh;
}

.ledger-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 1.2rem;
}

.ledger-totals p {
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.ledger-totals span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.ledger-wrap {
  overflow-x: auto;
}

.ledger-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}

.period-kinds {
  display: inline-flex;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.period-kinds a {
  padding: 0.35rem 0.9rem;
  color: inherit;
  text-decoration: none;
}

.period-kinds a + a {
  border-left: 1px solid var(--line);
}

.period-kinds a:hover {
  background: var(--cream);
}

.period-kinds a[aria-current="page"] {
  background: var(--spruce);
  color: var(--cream);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: baseline;
  justify-content: center;
  margin-top: 1rem;
  color: var(--muted);
}

.ledger {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  background: var(--sheet);
  border: 1px solid var(--line);
}

.ledger th,
.ledger td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.ledger thead th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text-link {
  color: var(--spruce);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.odontogram {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem 1rem;
  margin: 0.35rem 0 0.2rem;
}

.chart-tools .chart-field {
  margin: 0;
  min-width: 14rem;
}

.chart-tools label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-tools select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chart-tools button[aria-pressed="true"] {
  background: var(--brass);
  border-color: var(--brass);
}

.chart-save-error {
  margin: 0.35rem 0 0;
  color: var(--alert);
}

.odontogram-inner {
  width: fit-content;

  > .arch {
    > .quad:first-child {
      justify-content: right;
    }
  }

}

.arch-labels,
.arch {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  column-gap: 0.7rem;
}

.arch-labels {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.arch-labels span:last-child {
  text-align: right;
}

.arch-name {
  margin: 0.55rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.arch-name-primary {
  margin-top: 1.4rem;
}

.quad {
  display: flex;
}

.midline {
  background: var(--line);
}

.tooth {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.tooth .face-svg {
  width: 56px;
  height: auto;
  aspect-ratio: 400 / 428;
  display: block;
}

.tooth .num {
  font-size: 0.85rem;
  letter-spacing: -0.03em;
  color: var(--muted);
}

.face-svg .region {
  fill: white;
  stroke: var(--ink);
  stroke-width: 1.5px;
  vector-effect: non-scaling-stroke;
}

.face-svg .region.plan,
.swatch.plan {
  fill: #1565c0;
  background: #1565c0;
  stroke: #0d47a1;
  border-color: #0d47a1;
}

.face-svg .region.made,
.swatch.made {
  fill: #c62828;
  background: #c62828;
  stroke: #7f1212;
  border-color: #7f1212;
}

.face-svg [hidden] {
  display: none !important;
}

.face-svg .overlay,
.face-svg .overlay .sym {
  fill: none;
  pointer-events: none;
}

.face-svg .overlay .ink,
.face-svg .overlay .halo,
.face-svg .overlay.prosthesis {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.face-svg .overlay .halo {
  stroke: #fff;
  fill: none;
}

.face-svg .overlay.plan .ink,
.face-svg .overlay.prosthesis.plan {
  stroke: #1565c0;
  fill: none;
}

.face-svg .overlay.made .ink,
.face-svg .overlay.prosthesis.made {
  stroke: #c62828;
  fill: none;
}

.face-svg .overlay.prosthesis {
  stroke-linecap: round;
}

.odontogram.is-editing .face-svg .region {
  cursor: crosshair;
}

.odontogram.is-editing .tooth:hover .region,
.odontogram.is-editing .face-svg .region:hover,
.odontogram.is-editing .face-svg .region:focus-visible {
  stroke: var(--brass);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  list-style: none;
  padding: 0.8rem 0 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  flex: 0 0 1.35rem;
}

.legend-icon polygon,
.legend-icon line,
.legend-icon circle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legend-icon .sample {
  fill: #1565c0;
  stroke: #0d47a1;
}

.swatch {
  width: 0.75rem;
  height: 0.75rem;
  border: 1.5px solid var(--ink);
  background: white;
}

@media (max-width: 640px) {
  .form-grid > .w-half,
  .form-grid > .w-third,
  .form-grid > .w-two-thirds {
    grid-column: span 6;
  }

  .charge-head {
    display: none;
  }

  .agenda-title {
    flex-basis: 100%;
    margin: 0.5rem 0 0;
    font-size: 1.15rem;
  }

  .agenda-nav {
    flex-wrap: wrap;
  }

  .week-strip {
    gap: 0.25rem;
  }

  .month-cell {
    min-height: 4.2rem;
    padding: 0.2rem 0.1rem;
    align-items: center;
  }

  .month-events {
    display: none;
  }

  .month-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--brass);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
  }

  .view-switch a {
    padding: 0.35rem 0.7rem;
  }

  .strip-link {
    padding: 0.4rem 0.2rem 0.45rem;
    text-align: center;
  }

  .strip-day span {
    display: block;
    font-size: 0.7rem;
  }

  .strip-load {
    display: none;
  }

  .day-list > li {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .day-time {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
  }

  .day-free .day-time,
  .day-break .day-time {
    padding-top: 0;
  }

  .slot-day {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .day-preview li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .day-preview li > span:nth-child(2) {
    grid-column: 1 / -1;
    order: 3;
  }

  .hours-row {
    grid-template-columns: 1fr 1fr;
  }

  .hours-head {
    display: none;
  }

  .hours-day {
    grid-column: 1 / -1;
  }

  .hours-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
  }

  .charge-line {
    grid-template-columns: minmax(0, 1fr) 2.5rem;
    grid-template-areas:
      "description remove"
      "amount amount";
    row-gap: 0.5rem;
  }

  .money-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    display: block;
  }

  .topbar {
    flex-wrap: wrap;
  }

  /* On phones the modules become an equal-width row under the brand. */
  .modules {
    order: 3;
    flex-basis: calc(100% + 2.95rem);
    gap: 0;
    margin: 0.7rem -1.25rem -0.8rem -1.7rem;
    border-top: 1px solid rgba(243, 236, 223, 0.14);
  }

  .topbar .module-link {
    flex: 1 1 0;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 0.25rem;
    font-size: 0.95rem;
  }

  .module-link::after {
    left: 0.9rem;
    right: 0.9rem;
  }

  main {
    width: min(112rem, calc(100% - 1.5rem));
  }

  .chart section {
    margin-top: 2rem;
  }

  .chart-facts {
    grid-template-columns: 1fr;
  }

  .ledger-totals {
    grid-template-columns: 1fr;
  }

  /* Responsive Visit Table (No Mobile Horizontal Scroll) */
  .visit-table-wrap {
    overflow-x: visible;
  }

  .visit-table,
  .visit-table thead,
  .visit-table tbody,
  .visit-table th,
  .visit-table td,
  .visit-table tr {
    display: block;
  }

  .visit-table {
    min-width: 0;
    width: 100%;
  }

  .visit-table thead {
    display: none;
  }

  .visit-table tr {
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    overflow: hidden;
  }

  .visit-table tbody th {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.85rem;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
  }

  .visit-table tbody th .by {
    margin: 0;
  }

  .visit-table td {
    border: none;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid #f2ede4;
  }

  .visit-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.15rem;
  }

  .visit-table td:empty::after {
    content: "—";
    color: var(--muted);
    opacity: 0.5;
  }

  .visit-table td.num {
    text-align: left;
  }

  .visit-table td.no-print {
    padding: 0.6rem 0.85rem;
    background: #faf7f2;
    text-align: right;
    border-bottom: none;
  }
}


@media print {
  body {
    background: white;
  }

  .odontogram-inner {
    zoom: 0.6;
  }

  .topbar,
  .no-print {
    display: none !important;
  }

  .fold-body[hidden] {
    display: block !important;
  }

  .fold-chevron {
    display: none;
  }

  .chart,
  .roster,
  .sheet-form {
    border: 0;
  }
}

/* Backoffice */
.status-badge.billing-overdue {
  background: var(--alert-bg);
  color: var(--alert);
}

.status-badge.billing-none {
  background: #eceae4;
  color: var(--muted);
}

.status-badge.billing-suspended {
  background: var(--notice-bg);
  color: var(--notice);
}

.backoffice-table {
  margin-top: 1rem;
}

.backoffice-facts {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.backoffice-section {
  margin-top: 2rem;
}

.backoffice-section h3 {
  margin-top: 1.5rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.inline-form select {
  width: auto;
  min-width: 12rem;
}

.ledger td form {
  margin: 0;
}

.ledger tr.voided td {
  color: var(--muted);
  text-decoration: line-through;
}

.ledger tr.voided td:last-child {
  text-decoration: none;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Users page */
.team-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.team-actions button {
  padding: 0.3rem 0.65rem;
  font-size: 0.9rem;
}

.team-actions .danger-text {
  color: var(--alert);
}

.status-badge.member-invited {
  background: var(--notice-bg);
  color: var(--notice);
}

.status-badge.member-inactive {
  background: #eceae4;
  color: var(--muted);
}

.invite-link {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invite-link p {
  margin: 0 0 0.5rem;
}

.invite-link input {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
