/* Shared components (audit §2.2). Text colours use *-text tokens. Animations: opacity/transform only. */

/* ---------- keyframes (compositor-friendly) ---------- */
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes skel {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes rec-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.35); }
}
@keyframes caret { 50% { opacity: 0; } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- app header ---------- */
.app-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sp-3);
  height: var(--header-h);
  padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top);
  background: rgb(var(--c-primary));
  color: rgb(var(--c-on-primary));
  flex: none;
  z-index: 20;
}
.app-header a, .app-header .brand { color: rgb(var(--c-on-primary)); }
.brand-mono { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; background: rgb(255 255 255 / .14); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .22); color: rgb(var(--c-on-primary)); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.brand-mono[hidden] { display: none; }
.app-header :focus-visible { outline-color: rgb(var(--c-on-primary)); }
.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-logo { object-fit: contain; flex: none; width: 32px; height: 32px; border-radius: 8px; background: #fff; padding: 2px; }
.brand-logo[hidden] { display: none; }
.page-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  margin: 0 0 var(--sp-3);
}
.app-header-search {
  width: 100%; max-width: 480px; justify-self: center;
  min-height: var(--hit); padding: 0 var(--sp-3);
  border: 0; border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.14); color: rgb(var(--c-on-primary));
}
.app-header-search::placeholder { color: rgb(255 255 255 / 0.7); }

/* legacy topbar glass (untouched screens) */
.glass-bar {
  background: rgb(255 255 255 / 0.7);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border-bottom: 1px solid rgb(var(--c-ink) / 0.08);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-bar { background: rgb(255 255 255 / 0.94); }
}

/* ---------- side nav ---------- */
.side-nav {
  width: var(--nav-w);
  background: rgb(var(--c-surface));
  border-right: 1px solid rgb(var(--c-line));
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 8px;
  overflow-y: auto;
}
.side-nav-group {
  padding: 14px 12px 6px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: none;
  color: rgb(var(--c-ink-3));
}
.side-nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px;
  border: 0; border-radius: var(--radius); border-left: 0;
  background: transparent; text-align: left; text-decoration: none;
  font-size: var(--fs-md); font-weight: 550; color: rgb(var(--c-ink)); cursor: pointer;
}
.side-nav-item:hover { background: rgb(var(--c-primary) / 0.06); }
.side-nav-item.is-active {
  background: rgb(var(--c-vet-tint));
  color: rgb(var(--c-primary));
  font-weight: 700;
}
@media (min-width: 768px) and (max-width: 1023px) {
  .side-nav { width: 64px; padding-left: var(--sp-1); padding-right: var(--sp-1); }
  .side-nav-group, .side-nav-item > span { display: none; }
  .side-nav-item { justify-content: center; padding: 0; border-left-width: 0; }
  .side-nav-item.is-active { background: rgb(var(--c-vet-tint)); }
}

/* ---------- record tabs ---------- */
.record-tabs {
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; flex: none;
  background: rgb(var(--c-surface-2));
  border-bottom: 1px solid rgb(var(--c-line));
}
.record-tabs [role="tab"], .record-tabs > button {
  flex: none; min-height: 48px; padding: 0 16px;
  border: 0; border-top: 0; border-bottom: 1px solid transparent;
  background: transparent; margin-bottom: -1px; position: relative;
  font-size: var(--fs-md); font-weight: 650; color: rgb(var(--c-mute)); cursor: pointer; white-space: nowrap;
}
.record-tabs [role="tab"][aria-selected="true"],
.record-tabs > button[aria-selected="true"],
.record-tabs > button.is-active {
  background: rgb(var(--c-surface));
  color: rgb(var(--c-ink));
  border-bottom-color: rgb(var(--c-surface));
}
.record-tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: rgb(var(--c-primary)); }

/* ---------- patient banner + flags ---------- */
.patient-banner {
  position: sticky; top: 0; z-index: 15;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  min-height: var(--banner-h); padding: var(--sp-2) var(--sp-4);
  background: rgb(var(--c-surface));
  border-bottom: 1px solid rgb(var(--c-line));
}
.patient-banner-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgb(var(--c-primary) / 0.1); color: rgb(var(--c-primary)); font-size: var(--fs-lg);
}
.patient-banner-name { margin: 0; font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; color: rgb(var(--c-ink)); }
.patient-banner-meta { font-size: var(--fs-sm); color: rgb(var(--c-mute)); }
.patient-banner-flags { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-left: auto; }

.flag {
  display: inline-flex; align-items: center; gap: 6px;
  height: auto; min-height: 30px; padding: 0 13px; border-radius: var(--radius-pill);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; white-space: nowrap;
  border: 1px solid rgb(var(--c-line)); background: rgb(var(--c-bg)); color: rgb(var(--c-mute));
}
.flag-ok { background: rgb(var(--c-ok-tint)); color: rgb(var(--c-ok-ink)); border-color: rgb(var(--c-ok-ink) / .22); }
.flag-warn { background: rgb(var(--c-warn-tint)); color: rgb(var(--c-warn-ink)); border-color: rgb(var(--c-warn-ink) / .22); }
.flag-danger { background: rgb(var(--c-danger-tint)); color: rgb(var(--c-danger-ink)); border-color: rgb(var(--c-danger-ink) / .22); }
.flag-info { background: rgb(var(--c-info-tint)); color: rgb(var(--c-info-ink)); border-color: rgb(var(--c-info-ink) / .18); }
.flag .ico, .badge .ico { width: 16px; height: 16px; }

/* ---------- section card ---------- */
.section, .card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line) / .6);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  padding: 0;
  margin-bottom: var(--sp-4);
}
.card { padding: var(--sp-4); }
.section-header, .panel-heading {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-4);
  background: rgb(var(--c-surface));
  border-bottom: 1px solid rgb(var(--c-line));
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  font-size: var(--fs-lg); font-weight: 700; letter-spacing: 0; text-transform: none;
  color: rgb(var(--c-ink));
}
.panel-heading {
  background: transparent; border: 0; border-radius: 0; padding: 0 0 var(--sp-2); min-height: 0;
}
.section-body { padding: var(--sp-3) var(--sp-4); }
.section-header .grow, .section-header-actions { margin-left: auto; display: flex; gap: var(--sp-2); }

/* ---------- list group (legacy) ---------- */
.list-group {
  overflow: hidden;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.list-group > * + * { border-top: 1px solid rgb(var(--c-line)); }
.list-row {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: var(--row-h); padding: 10px var(--sp-4);
  background: none; border: 0; text-align: left; text-decoration: none;
  font-size: var(--fs-md); color: rgb(var(--c-ink));
  cursor: default;
}
a.list-row, button.list-row { cursor: pointer; }
a.list-row:hover, button.list-row:hover { background: rgb(var(--c-surface-2)); }
a.list-row:active, button.list-row:active { background: rgb(var(--c-primary) / 0.06); }
.list-footnote { padding: 6px var(--sp-4) 0; font-size: var(--fs-xs); line-height: 1.5; color: rgb(var(--c-mute)); }

/* ---------- data table + filter + pager ---------- */
.table-wrap, .table-scroll {
  overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.data-table, .table {
  width: 100%; min-width: 560px; border-collapse: collapse; font-size: var(--fs-sm);
}
.data-table th, .data-table td, .table th, .table td {
  padding: 6px var(--sp-3); text-align: left; vertical-align: middle;
  border-bottom: 1px solid rgb(var(--c-line));
  height: var(--row-h);
}
.data-table thead th, .table thead th {
  position: sticky; top: 0; z-index: 1;
  white-space: nowrap; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.02em; text-transform: none;
  color: rgb(var(--c-mute)); background: rgb(var(--c-surface-2));
}
.data-table-root.is-comfortable .data-table th, .data-table-root.is-comfortable .data-table td { height: 48px; font-size: var(--fs-md); }
.data-table tbody tr.is-clickable:hover { background: rgb(var(--c-surface-2)); }
.data-table tbody tr:hover, .table tbody tr:hover { background: rgb(var(--c-surface-2)); }
.data-table tbody tr.is-selected { background: rgb(var(--c-primary) / 0.06); }
.data-table tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: 0; }

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.filter-bar .filter-count { margin-left: auto; font-size: var(--fs-sm); color: rgb(var(--c-mute)); }

.pager {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) 0; font-size: var(--fs-sm); color: rgb(var(--c-mute));
}
.pager-range { margin-right: auto; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); margin: 0 0 var(--sp-4); }
.page-title { margin: 0; font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; color: rgb(var(--c-ink)); }
.page-subtitle { margin: 4px 0 0; font-size: var(--fs-md); color: rgb(var(--c-mute)); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  background: rgb(var(--c-ink) / 0.07); color: rgb(var(--c-mute));
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.badge-ok { background: rgb(var(--c-ok-tint)); color: rgb(var(--c-ok-ink)); }
.badge-warn { background: rgb(var(--c-warn-tint)); color: rgb(var(--c-warn-ink)); }
.badge-danger { background: rgb(var(--c-danger-tint)); color: rgb(var(--c-danger-ink)); }
.badge-info { background: rgb(var(--c-info-tint)); color: rgb(var(--c-info-ink)); }
.badge-muted { background: rgb(var(--c-ink) / 0.06); color: rgb(var(--c-mute)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--hit); padding: 0 18px;
  border: 0; border-radius: var(--radius-pill);
  font-size: var(--fs-md); font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap;
  background: rgb(var(--c-bg)); color: rgb(var(--c-primary));
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 1; color: rgb(117 129 138); background: rgb(var(--c-surface-2)); border-color: rgb(var(--c-line)); box-shadow: none; cursor: not-allowed; }
.btn-primary { background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary)); box-shadow: 0 1px 2px rgb(var(--c-primary) / 0.25); }
.btn-primary:hover:not(:disabled) { background: rgb(var(--c-primary-hover)); }
.btn-secondary {
  background: rgb(var(--c-surface)); color: rgb(var(--c-primary));
  border: 1px solid rgb(var(--c-line));
}
.btn-secondary:hover:not(:disabled) { background: rgb(var(--c-bg)); border-color: rgb(196 207 216); }
.btn-ghost, .btn-plain {
  background: transparent; color: rgb(var(--c-primary)); border: 0;
  padding-left: 10px; padding-right: 10px;
}
.btn-ghost:hover:not(:disabled), .btn-plain:hover:not(:disabled) { background: rgb(var(--c-primary) / 0.06); }
.btn-danger {
  background: rgb(var(--c-danger-tint)); color: rgb(var(--c-danger-ink));
  border: 1px solid rgb(241 194 194);
}
.btn-danger:hover:not(:disabled) { background: rgb(247 220 220); border-color: rgb(230 170 170); }
.btn-danger-solid { background: rgb(var(--c-danger-ink)); color: #fff; border: 0; }
.btn-danger-solid:hover:not(:disabled) { background: rgb(158 20 20); }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: var(--fs-lg); }
.btn-quiet { min-height: 36px; padding: 0 10px; border: 0; background: transparent; color: rgb(var(--c-mute)); font-size: var(--fs-sm); font-weight: 600; }
@media (pointer: coarse) { .btn-quiet { min-height: 44px; } }
.btn-quiet:hover:not(:disabled) { background: rgb(var(--c-ink) / 0.05); color: rgb(var(--c-ink)); }
.btn-sm { min-height: var(--hit); padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn-icon, .icon-btn {
  display: inline-grid; place-items: center;
  width: var(--hit); min-width: var(--hit); min-height: var(--hit); padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: rgb(var(--c-primary)); cursor: pointer;
  transition: background 0.15s;
}
.btn-icon:hover, .icon-btn:hover { background: rgb(var(--c-primary) / 0.07); }
.icon-btn { border-radius: var(--radius-pill); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.ico-sm { width: 16px; height: 16px; }
.vt-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- segmented ---------- */
.segmented {
  display: flex; gap: 2px; padding: 4px;
  border: 1px solid rgb(var(--c-line)); border-radius: var(--radius-pill); background: rgb(var(--c-bg));
}
.segmented > button {
  flex: 1 1 0; min-height: 42px; padding: 0 16px;
  border: 0; border-radius: var(--radius-pill); background: transparent;
  font-size: var(--fs-md); font-weight: 650; color: rgb(var(--c-mute));
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.segmented > button:hover { color: rgb(var(--c-ink)); }
.segmented > button[aria-pressed="true"],
.segmented > button[aria-checked="true"] {
  background: rgb(var(--c-primary)); color: rgb(var(--c-on-primary));
  box-shadow: 0 1px 2px rgb(var(--c-primary) / 0.25);
}
.segmented .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.swatch-owner { background: rgb(var(--c-owner-dot)); }
.swatch-vet { background: rgb(var(--c-vet-dot)); }

/* ---------- forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}
@media (min-width: 900px) {
  .form-grid { grid-template-columns: 160px 1fr; align-items: start; }
  .form-grid .field-label { padding-top: calc((var(--hit) - 1.2em) / 2); }
  .form-grid .field-hint, .form-grid .field-error { grid-column: 2; }
}
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: var(--fs-sm); font-weight: 650; color: rgb(var(--c-ink)); }
.field-label .req, .field-label .required { color: rgb(var(--c-danger-text)); }
.field-hint { font-size: var(--fs-xs); line-height: 1.45; color: rgb(var(--c-mute)); margin: 0; }
.field-error {
  display: flex; align-items: flex-start; gap: 4px; margin: 0;
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.45; color: rgb(var(--c-danger-ink));
}
.input, .select, .textarea {
  display: block; width: 100%; min-height: var(--hit); padding: 8px 12px;
  border: 1px solid rgb(var(--c-line-input)); border-radius: var(--radius);
  background: #fff; color: rgb(var(--c-ink));
  font-size: var(--fs-lg); box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: rgb(var(--c-mute)); }
.input:focus, .select:focus, .textarea:focus {
  border-color: rgb(var(--c-accent));
  outline: 2px solid rgb(var(--c-accent));
  outline-offset: 0;
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: rgb(var(--c-danger));
  box-shadow: 0 0 0 3px rgb(180 35 24 / .12);
}
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23586476' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.5; }

.switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 40px; height: 22px; margin: 0; border: 0; border-radius: var(--radius-pill);
  background: rgb(var(--c-ink) / 0.16); cursor: pointer; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.2s;
}
.switch:checked { background: rgb(var(--c-ok)); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.4; cursor: not-allowed; }
@media (pointer: coarse) {
  .switch { width: 51px; height: 31px; }
  .switch::after { width: 27px; height: 27px; }
  .switch:checked::after { transform: translateX(20px); }
}
.switch-label { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }

/* ---------- dialog / drawer / sheet ---------- */
dialog.dialog, dialog.sheet, dialog.drawer {
  width: 100%; max-width: none; max-height: 92vh; max-height: 92dvh;
  margin: auto 0 0; padding: 0;
  border: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); box-shadow: var(--shadow-2);
}
dialog.dialog[open], dialog.sheet[open], dialog.drawer[open] {
  display: flex; flex-direction: column;
  animation: sheet-up var(--t-fast) cubic-bezier(0.2, 0.8, 0.2, 1);
}
dialog.dialog::backdrop, dialog.sheet::backdrop, dialog.drawer::backdrop {
  background: rgb(0 0 0 / 0.35);
}
.dialog-header, .sheet > form > h2, dialog.sheet h2 {
  display: flex; align-items: center; gap: var(--sp-2);
  flex: none; min-height: 56px; margin: 0; padding: 0 var(--sp-4);
  font-size: var(--fs-xl); font-weight: 700; line-height: 1.25; color: rgb(var(--c-ink));
  border-bottom: 1px solid rgb(var(--c-line));
}
dialog.sheet .dialog-header h2, .dialog-header h2 { margin: 0; flex: 1 1 auto; min-height: 0; padding: 0; border: 0; font: inherit; color: inherit; }
.dialog-body, .sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-4);
}
.sheet-text {
  margin: 0; padding: var(--sp-3); white-space: pre-wrap; font-size: var(--fs-md); line-height: 1.6;
  border-radius: var(--radius-sm); background: rgb(var(--c-ink) / 0.04);
}
.dialog-actions, .sheet-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2);
  flex: none; padding: var(--sp-3) var(--sp-4); padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
  border-top: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-surface-2));
}
@media (min-width: 768px) {
  dialog.dialog, dialog.sheet {
    width: min(600px, calc(100% - 48px)); margin: auto; border-radius: var(--radius-sheet); box-shadow: var(--shadow-3);
  }
  dialog.dialog.dialog-md { width: min(640px, calc(100% - 48px)); }
  dialog.dialog.dialog-lg { width: min(880px, calc(100% - 48px)); }
  dialog.drawer {
    width: min(480px, calc(100% - 24px)); height: 100%; max-height: 100%;
    margin: 0 0 0 auto; border-radius: var(--radius-sheet) 0 0 var(--radius-sheet);
  }
  .sheet-actions { flex-direction: row; }
  .sheet-actions .btn { flex: 0 0 auto; }
}
/* legacy openSheet form layout */
dialog.sheet > form.stack { padding: var(--sp-4); padding-bottom: max(var(--sp-4), env(safe-area-inset-bottom)); gap: var(--sp-3); }
dialog.sheet > form.stack > h2.panel-heading {
  border: 0; background: transparent; padding: 0; min-height: 0;
  font-size: var(--fs-lg); font-weight: 700; letter-spacing: 0; text-transform: none; color: rgb(var(--c-ink));
}

/* ---------- menus ---------- */
.vt-menu { position: relative; }
.vt-menu > summary { list-style: none; cursor: pointer; }
.vt-menu > summary::-webkit-details-marker { display: none; }
.vt-menu-list { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); min-width: 240px; max-width: calc(100vw - 24px); padding: 6px;
  background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); border: 1px solid rgb(var(--c-line)); border-radius: 16px; box-shadow: var(--shadow-2); }
.vt-menu-list[data-place="up"] { top: auto; bottom: calc(100% + 8px); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: transparent; color: rgb(var(--c-ink)); font: inherit; font-size: var(--fs-md); font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: rgb(var(--c-surface-2)); }
.menu-item[aria-checked="true"] { background: rgb(var(--c-vet-tint)); color: rgb(var(--c-vet)); }
.menu-label { margin: 4px 4px 6px; font-size: var(--fs-xs); font-weight: 650; color: rgb(var(--c-mute)); }
.menu-sep { height: 1px; margin: 6px 0; background: rgb(var(--c-line)); }

/* ---------- toast stack ---------- */
.toast-stack {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: var(--toast-bottom, max(16px, env(safe-area-inset-bottom)));
  width: min(92vw, 520px); max-height: 45vh; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2);
  pointer-events: none;
}
@media (min-width: 1024px) and (pointer: fine) {
  .toast-stack { top: calc(var(--header-h) + 12px); right: 16px; left: auto; bottom: auto; transform: none; width: min(420px, calc(100vw - 32px)); }
}
.toast-stack > .toast { pointer-events: auto; position: static; transform: none; left: auto; bottom: auto; }
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-2); width: 100%; min-width: 0;
  padding: 12px 16px; border-radius: 16px; background: rgb(var(--c-ink)); color: #fff;
  font-size: var(--fs-md); font-weight: 500; line-height: 1.4; text-align: left; box-shadow: var(--shadow-2);
  animation: toast-in var(--t-fast) var(--ease);
}
.toast-text { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: break-word; word-break: normal; }
.toast-count { flex: none; font-weight: 700; opacity: 0.85; }
.toast-action {
  margin-left: auto; flex: none;
  padding: 4px 12px; min-height: var(--hit);
  border: 1px solid rgb(255 255 255 / 0.6); border-radius: var(--radius-pill);
  background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.toast-dismiss {
  flex: none; margin-left: auto; border: 0; background: transparent; color: inherit;
  font-size: var(--fs-lg); line-height: 1; cursor: pointer; opacity: 0.8; padding: 0 4px;
  min-width: var(--hit); min-height: var(--hit);
}
.toast-ok { background: rgb(var(--c-ok-ink)); }
.toast-error, .toast-danger { background: rgb(var(--c-danger-ink)); }
.toast-warn { background: rgb(var(--c-warn-tint)); color: rgb(var(--c-warn-ink)); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--c-warn-line) / 0.5); }
.toast-warn .toast-action { border-color: rgb(var(--c-warn-ink) / 0.5); }
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  min-height: var(--hit); padding: 4px 12px; border: 0; border-radius: var(--radius-pill);
  /* solid light amber on the navy header: text 6.2:1, pill edge 10.9:1 (was 2.1:1) */
  background: rgb(255 244 219); color: rgb(138 75 8);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
}

/* ---------- empty / skeleton / kbd ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-6) var(--sp-4); text-align: center;
}
.empty-icon { font-size: 32px; line-height: 1; opacity: 0.35; }
.empty-title { margin: 0; font-size: var(--fs-lg); font-weight: 650; color: rgb(var(--c-ink)); }
.table-density { margin-left: 4px; }
.empty-help { margin: 0; font-size: var(--fs-sm); color: rgb(var(--c-mute)); max-width: 28rem; }

.skeleton {
  display: block; border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.08);
  animation: skel 1.2s ease-in-out infinite;
  min-height: 1em;
}
.skeleton-row { height: var(--row-h); margin-bottom: var(--sp-2); }

.kbd {
  display: inline-block; padding: 1px 6px;
  border: 1px solid rgb(var(--c-line)); border-bottom-width: 2px; border-radius: 4px;
  background: rgb(var(--c-surface-2));
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--fs-xs); font-weight: 600; color: rgb(var(--c-mute));
  line-height: 1.4;
}

/* rec-pulse ring (used by clinic .rec-btn.is-listening::after when present) */
.rec-pulse-ring, .rec-btn.is-listening::after {
  content: "";
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgb(var(--c-primary) / 0.45);
  animation: rec-pulse 1.8s ease-out infinite;
  pointer-events: none;
}
