:root {
  --accent: #2f5d4e;
  --accent-hover: #28503f;
  --accent-tint: #eaf1ed;
  --accent-border: #bfd2c9;
  --bg: #f7f6f3;
  --surface: #fcfbf9;
  --surface-pure: #ffffff;
  --border: #e5e2dc;
  --border-strong: #d8d4cc;
  --grid-line: #eceae4;
  --text: #22211e;
  --text-secondary: #6b6862;
  --text-tertiary: #97938b;
  --attention: #9a6b22;
  --attention-tint: #f6eedf;
  --negative: #9c4a3c;
  --negative-tint: #f3e5e1;
  --radius: 7px;
  --radius-small: 4px;
  --font-sans: "Sohne", "Neue Haas Grotesk Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Sohne Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-width: 320px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

td {
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
}

td:first-child {
  color: var(--text);
  font-weight: 600;
}

.mono,
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.num {
  text-align: right;
}

.clinic-app {
  display: flex;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  background: var(--bg);
}

.app-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.topnav {
  display: flex;
  flex: 0 0 52px;
  align-items: center;
  gap: 0;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-right: 22px;
  font-size: 15px;
  font-weight: 600;
}

.brand-diamond {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}

.chevron,
.brand-switch .chevron,
.select-button span,
.date-label span {
  color: var(--text-tertiary);
  font-size: 10px;
}

.section-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
}

.section-tabs button {
  position: relative;
  height: 100%;
  padding: 0 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.section-tabs button:hover {
  color: var(--text);
}

.section-tabs button.active {
  color: var(--text);
  font-weight: 600;
}

.section-tabs button.active::after {
  position: absolute;
  right: 11px;
  bottom: -1px;
  left: 11px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.nav-fill,
.toolbar-fill {
  flex: 1;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius-small);
  color: var(--text-secondary);
}

.icon-button:hover {
  background: var(--bg);
  color: var(--text);
}

.action-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
}

.hairline {
  width: 1px;
  height: 20px;
  margin: 0 8px;
  background: var(--border);
}

.account-button {
  display: grid;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface-pure);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 80ms ease, border-color 80ms ease, transform 80ms ease;
}

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

.button:active {
  transform: translateY(1px);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.button.quiet:hover {
  background: var(--bg);
  color: var(--text);
}

.button.secondary {
  background: var(--surface-pure);
}

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

.toolbar,
.page-toolbar {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.date-stepper {
  display: flex;
  height: 30px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-pure);
}

.date-stepper button {
  width: 30px;
  color: var(--text-secondary);
}

.date-stepper button:nth-child(2) {
  width: auto;
  padding: 0 11px;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}

.date-label,
.select-button {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  white-space: nowrap;
}

.date-label {
  padding: 0 10px;
  color: var(--text);
}

.select-button {
  border: 1px solid var(--border-strong);
  padding: 0 11px;
  background: var(--surface-pure);
}

.select-button strong {
  color: var(--text);
  font-weight: 600;
}

.date-label:hover,
.select-button:hover {
  background: var(--bg);
}

.segmented {
  display: inline-flex;
  height: 30px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-pure);
}

.segmented button {
  min-width: 64px;
  padding: 0 12px;
  color: var(--text-secondary);
}

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

.segmented button.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.segmented.wide {
  width: 100%;
  overflow-x: auto;
}

.mobile-new-button {
  display: none;
}

.agenda-view,
.table-page,
.messages-page,
.import-page,
.settings-page,
.profile-page {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.agenda-workspace {
  flex: 1;
  min-height: 0;
  background: var(--surface);
}

.calendar-grid {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
  background: var(--surface);
}

.grid-head {
  display: grid;
  min-width: calc(56px + var(--staff-min-width));
  flex: 0 0 38px;
  grid-template-columns: 56px repeat(var(--staff-count), minmax(180px, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.time-head {
  border-right: 1px solid var(--border);
}

.staff-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border-right: 1px solid var(--border);
  font-size: 13px;
}

.staff-head strong {
  font-weight: 600;
}

.staff-head span:last-child {
  color: var(--text-tertiary);
  font-size: 11px;
}

.staff-head.ghost {
  color: var(--text-tertiary);
}

.availability-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.availability-dot.active {
  background: var(--accent);
}

.grid-body {
  display: grid;
  min-width: calc(56px + var(--staff-min-width));
  grid-template-columns: 56px minmax(var(--staff-min-width), 1fr);
}

.time-gutter {
  position: relative;
  width: 56px;
  height: var(--calendar-height);
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.time-gutter span {
  position: absolute;
  right: 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  transform: translateY(-6px);
}

.staff-area {
  position: relative;
  height: var(--calendar-height);
  min-width: 0;
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 43px, var(--grid-line) 43px 44px),
    repeating-linear-gradient(to bottom, transparent 0 87px, #e3e0d9 87px 88px);
}

.working-band {
  position: absolute;
  top: 88px;
  right: 0;
  left: 0;
  height: 792px;
  background: rgba(47, 93, 78, 0.022);
}

.hour-lines,
.column-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hour-lines {
  display: grid;
  grid-template-rows: repeat(11, 88px);
}

.hour-lines span {
  border-top: 1px solid transparent;
}

.column-lines {
  display: grid;
  grid-template-columns: repeat(var(--staff-count), minmax(0, 1fr));
}

.column-lines span {
  border-right: 1px solid var(--border);
}

.column-lines span:last-child {
  border-right: 0;
}

.empty-day {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
  transform: translateY(-50%);
  pointer-events: none;
}

.setup-panel {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 2;
  width: min(440px, calc(100% - 32px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-pure);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  transform: translateX(-50%);
}

.setup-panel h2 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}

.setup-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.setup-row:last-child {
  border-bottom: 0;
}

.setup-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 11px;
}

.setup-row strong {
  font-weight: 500;
}

.setup-row > span:not(.setup-number) {
  color: var(--text-tertiary);
  font-size: 11px;
}

.now-line {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 3;
  height: 0;
  border-top: 1px solid var(--accent);
}

.now-line::before {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.now-line span {
  position: absolute;
  top: -8px;
  right: 8px;
  padding: 0 3px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
}

.appointment-card {
  position: absolute;
  z-index: 2;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 6px 8px 7px 11px;
  background: var(--surface-pure);
  color: var(--text);
  text-align: left;
  transition: border-color 80ms ease, transform 80ms ease;
}

.appointment-card:hover {
  border-color: var(--accent-border);
}

.appointment-card:active {
  transform: translateY(1px);
}

.status-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--accent);
}

.appointment-card.pending .status-bar {
  background: var(--attention);
}

.appointment-card.completed .status-bar {
  background: var(--text-tertiary);
}

.appointment-card.cancelled,
.appointment-card.no-show {
  opacity: 0.6;
}

.appointment-card.cancelled .status-bar,
.appointment-card.no-show .status-bar {
  background: var(--negative);
}

.appointment-card.in-room .status-bar {
  animation: pulse-bar 2s ease-in-out infinite;
}

.appointment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.appointment-top > .mono {
  color: var(--text-secondary);
  font-size: 11px;
}

.state-glyphs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
}

.state-glyphs .complete {
  color: var(--accent);
}

.state-glyphs .partial,
.state-glyphs .pending {
  color: var(--attention);
}

.state-glyphs em {
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.appointment-card strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-card p {
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-card.compact {
  padding-top: 5px;
}

.mobile-agenda {
  display: none;
}

.page-toolbar .search-field {
  display: flex;
  width: 280px;
  height: 30px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--surface-pure);
  color: var(--text-tertiary);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.table-shell {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: var(--bg);
}

.summary-strip {
  display: flex;
  flex: 0 0 46px;
  align-items: center;
  height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.summary-strip > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 18px;
  border-left: 1px solid var(--border);
}

.summary-strip > div:first-child {
  border-left: 0;
  padding-left: 0;
}

.summary-strip span {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-strip strong {
  font-size: 15px;
  font-weight: 600;
}

.summary-strip small {
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
}

.status-tag {
  display: inline-flex;
  height: 18px;
  align-items: center;
  padding: 0 7px;
  border-radius: var(--radius-small);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-tag.green {
  background: var(--accent-tint);
  color: var(--accent);
}

.status-tag.amber {
  background: var(--attention-tint);
  color: var(--attention);
}

.status-tag.neutral {
  background: var(--bg);
  color: var(--text-secondary);
}

.empty-line {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 40px 16px;
  color: var(--text-secondary);
  text-align: center;
}

.empty-line > div {
  display: flex;
  gap: 8px;
}

.messages-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.thread-list {
  flex: 0 0 320px;
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.thread-list header {
  height: 44px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.thread-list article {
  position: relative;
  min-height: 56px;
  padding: 10px 16px 10px 28px;
  border-bottom: 1px solid var(--border);
}

.thread-list article::before {
  position: absolute;
  top: 18px;
  left: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.thread-list strong {
  font-size: 13px;
}

.thread-list p {
  margin: 2px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.thread-list span {
  color: var(--text-tertiary);
  font-size: 11px;
}

.message-detail {
  display: grid;
  flex: 1;
  place-items: center;
  background: var(--bg);
  color: var(--text-tertiary);
  font-size: 13px;
}

.import-page {
  overflow: auto;
  align-items: center;
  padding: 48px 24px;
}

.import-column {
  width: min(560px, 100%);
}

.import-column h1 {
  margin: 0 0 22px;
  font-size: 18px;
  font-weight: 600;
}

.connect-state {
  display: grid;
  justify-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 16px;
  background: var(--surface);
  color: var(--text-secondary);
  text-align: center;
}

.connect-state p {
  max-width: 380px;
  margin: 0;
}

.import-block {
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.import-block header,
.import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.import-block header {
  font-weight: 600;
}

.import-row:last-child {
  border-bottom: 0;
}

.import-row span {
  color: var(--text-secondary);
}

.import-row strong {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}

.import-row strong.ok {
  color: var(--accent);
}

.import-row strong.attention {
  color: var(--attention);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  font-size: 13px;
}

.source-error {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--negative);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
}

.source-error strong {
  font-weight: 600;
}

.source-error p {
  margin: 3px 0 0;
  color: var(--text-secondary);
}

.import-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.import-footer span {
  color: var(--text-tertiary);
  font-size: 12px;
}

.settings-page {
  flex-direction: row;
}

.settings-index {
  flex: 0 0 220px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 0;
}

.settings-index button {
  display: block;
  width: 100%;
  padding: 8px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
}

.settings-index button.active {
  box-shadow: inset 2px 0 0 var(--accent);
  color: var(--text);
  font-weight: 600;
}

.settings-panel {
  flex: 1;
  overflow: auto;
  padding: 28px 32px;
}

.settings-panel h1,
.profile-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.hours-table,
.settings-list {
  max-width: 560px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.hours-table div,
.settings-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.hours-table div:last-child,
.settings-list div:last-child {
  border-bottom: 0;
}

.settings-list h2 {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}

.profile-page {
  background: var(--bg);
}

.profile-head {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 24px 0;
}

.back-button {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}

.profile-identity h1.muted {
  color: var(--text-tertiary);
  font-style: italic;
  font-weight: 500;
}

.profile-identity p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.profile-facts {
  display: flex;
  margin-top: 16px;
}

.profile-fact {
  min-width: 150px;
  padding: 0 18px 14px;
  border-left: 1px solid var(--border);
}

.profile-fact:first-child {
  border-left: 0;
  padding-left: 0;
}

.profile-fact span,
.profile-rail h2 {
  display: block;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-fact strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
}

.profile-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.profile-tabs button {
  margin-bottom: -1px;
  padding: 11px 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
}

.profile-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.profile-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.profile-main {
  flex: 1;
  overflow: auto;
  background: var(--surface);
}

.profile-key {
  width: 210px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.profile-rail {
  flex: 0 0 280px;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.profile-rail section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.profile-rail h2 {
  margin: 0 0 10px;
}

.rail-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.rail-line strong {
  color: var(--text-tertiary);
  font-weight: 500;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  justify-items: end;
  background: rgba(34, 33, 30, 0.08);
}

.drawer {
  display: flex;
  width: min(420px, 90vw);
  height: 100dvh;
  flex-direction: column;
  border-left: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: -12px 0 30px rgba(0, 0, 0, 0.07);
}

.drawer-head {
  display: flex;
  flex: 0 0 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.drawer-form {
  display: grid;
  flex: 1;
  align-content: start;
  overflow: auto;
  padding: 8px 16px 0;
}

.field {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.field > span:first-child {
  color: var(--text-secondary);
  font-size: 12px;
}

.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.control-readonly,
.inline-empty {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--surface-pure);
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(47, 93, 78, 0.2);
  outline-offset: 0;
}

.inline-empty {
  color: var(--accent);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.radio-segment {
  display: inline-flex;
  width: fit-content;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-pure);
}

.radio-segment label {
  display: inline-flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--text-secondary);
}

.radio-segment label + label {
  border-left: 1px solid var(--border);
}

.radio-segment input {
  position: absolute;
  opacity: 0;
}

.radio-segment label:has(input:checked) {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

.radio-segment.small label {
  padding: 0 10px;
  font-size: 12px;
}

.estimate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
}

.estimate-line strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 -16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.drawer-actions.split {
  justify-content: space-between;
}

.selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 0;
}

.selected-files span {
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 5px 8px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 11px;
}

.skeleton-shell {
  display: flex;
  height: 100dvh;
  flex-direction: column;
  background: var(--bg);
}

.skeleton-grid .sk {
  position: absolute;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: #efede8;
}

.skeleton-grid .sk::after,
.skeleton-block::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: #efede8;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes pulse-bar {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .clinic-app {
    min-height: 100dvh;
    padding-bottom: 60px;
  }

  .topnav {
    display: none;
  }

  .app-stage {
    overflow: auto;
  }

  .toolbar {
    height: 50px;
    flex: 0 0 50px;
    padding: 0 14px;
  }

  .date-stepper,
  .toolbar .select-button:nth-of-type(2),
  .toolbar .segmented,
  .toolbar > .icon-button {
    display: none;
  }

  .date-label {
    font-weight: 600;
  }

  .mobile-new-button {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
  }

  .calendar-grid {
    display: none;
  }

  .mobile-agenda {
    display: flex;
    min-height: calc(100dvh - 110px);
    flex-direction: column;
    background: var(--surface);
  }

  .mobile-agenda-head {
    display: none;
  }

  .mobile-time-list {
    flex: 1;
    overflow: auto;
  }

  .mobile-appointment {
    display: grid;
    width: 100%;
    min-height: 64px;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--grid-line);
    border-left: 3px solid var(--accent);
    padding: 8px 12px;
    background: var(--surface);
    text-align: left;
  }

  .mobile-appointment.pending {
    border-left-color: var(--attention);
  }

  .mobile-appointment.cancelled,
  .mobile-appointment.no-show {
    border-left-color: var(--negative);
    opacity: 0.65;
  }

  .mobile-appointment strong {
    font-size: 14px;
  }

  .mobile-appointment p {
    margin: 2px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
  }

  .mobile-empty {
    display: grid;
    height: 50vh;
    place-items: center;
    align-content: center;
    gap: 14px;
    color: var(--text-tertiary);
  }

  .mobile-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: flex;
    height: 60px;
    border-top: 1px solid var(--border);
    background: var(--surface);
  }

  .mobile-tabs button {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-tertiary);
    font-size: 11px;
  }

  .mobile-tabs button span {
    width: 18px;
    height: 18px;
    border: 1.5px solid currentColor;
    border-radius: 4px;
  }

  .mobile-tabs button.active {
    color: var(--accent);
    font-weight: 600;
  }

  .page-toolbar {
    overflow-x: auto;
  }

  .page-toolbar .search-field {
    min-width: 220px;
  }

  .messages-layout,
  .settings-page,
  .profile-body,
  .profile-identity,
  .profile-facts,
  .import-footer {
    flex-direction: column;
  }

  .thread-list,
  .settings-index,
  .profile-rail {
    flex: 0 0 auto;
    width: 100%;
  }

  .settings-index {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .settings-index button {
    width: auto;
    min-width: max-content;
  }

  .settings-panel {
    padding: 20px 16px;
  }

  .profile-actions {
    width: 100%;
    margin-left: 0;
  }

  .profile-actions .button {
    flex: 1;
  }

  .profile-tabs {
    overflow-x: auto;
    padding: 0 14px;
  }

  .profile-tabs button {
    min-width: max-content;
  }

  .profile-fact {
    min-width: 0;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 10px 0;
  }

  .drawer-backdrop {
    align-items: end;
  }

  .drawer {
    width: 100vw;
    height: 90dvh;
    border-top: 1px solid var(--border-strong);
    border-left: 0;
  }
}

@media (min-width: 901px) {
  .mobile-tabs {
    display: none;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid var(--bg);
  border-radius: 8px;
  background: #dcd9d2;
}
