@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');

:root {
  --brand: #5e8c82;
  --brand-700: #48756c;
  --ink: #25322d;
  --muted: #6e7c74;
  --line: #dfe6e0;
  --soft: #f4f8f5;
  --success: #4f9e76;
  --warning: #b58a3f;
  --danger: #c16b5c;
  /* Eucalyptus extended tokens */
  --canvas: #eff3f1;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --body-text: #46544d;
  --accent: #5e8c82;
  --accent-strong: #48756c;
  --accent-2: #8aa39b;
  --tint: #e6efeb;
  --tint-2: #eaf0ee;
  --on-accent: #ffffff;
  --ring: rgba(94, 140, 130, 0.28);

  /* ---- Layout sizing system: one source of truth for spacing + workspace widths ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.1rem;   /* default gap between panels / grid cells */
  --space-6: 1.5rem;
  --space-8: 2rem;
  /* Charting workspace — chart2d and chart3d share these so both modes line up identically */
  --chart-gap: var(--space-5);
  --chart-rail-w: 232px;      /* 3D left rail */
  --chart-side-w: 452px;      /* right panel: notes / plan / tools */
  --chart-rail-w-sm: 210px;   /* < 1500px */
  --chart-side-w-sm: 400px;   /* < 1500px */
  --odontogram-min: 1120px;   /* drawing width before the chart scrolls inside its column */
  --panel-radius: 1.4rem;
  --panel-pad: 1.25rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(94, 140, 130, 0.10), transparent 30rem),
    linear-gradient(180deg, #f4f8f6 0%, #eef3f1 100%);
}

.glass-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  backdrop-filter: blur(12px);
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.38rem;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.468rem;
  padding: 0.72rem 0.85rem;
  background: #fff;
  color: #0f172a;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.textarea { min-height: 6.5rem; resize: vertical; }

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(94, 140, 130, 0.12);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: .4rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.pill-blue { background: #e6efeb; color: #48756c; }
.pill-green { background: #dcfce7; color: #15803d; }
.pill-amber { background: #fef3c7; color: #b45309; }
.pill-red { background: #fee2e2; color: #b91c1c; }
.pill-gray { background: #f1f5f9; color: #475569; }

.progress-track {
  width: 100%;
  height: 0.55rem;
  border-radius: .4rem;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5e8c82, #16a34a);
}

.icon-box {
  display: inline-flex;
  width: 2.55rem;
  height: 2.55rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  background: #eef3f0;
  color: var(--brand);
  font-weight: 900;
}

.sticky-safe {
  position: sticky;
  top: 1rem;
}

.sidebar-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.55rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.sidebar-step.active {
  border-color: rgba(94, 140, 130, 0.35);
  background: #eef3f0;
  color: #48756c;
}

.analysis-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.result-empty {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
}

.print-only { display: none; }

@media print {
  .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .analysis-card, .glass-card { box-shadow: none; border-color: #cbd5e1; }
}


/* Dashboard v2 */
.dashboard-hero {
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(94, 140, 130, 0.13), transparent 24rem),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.dashboard-card {
  position: relative;
  min-height: 17rem;
  overflow: hidden;
  border-width: 1px;
  border-style: solid;
  border-radius: 0.55rem;
  padding: 1.35rem;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dashboard-card:hover {
  transform: translateY(-8px) scale(1.015);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  z-index: 5;
}

.card-glow {
  position: absolute;
  inset: auto -4rem -5rem auto;
  width: 12rem;
  height: 12rem;
  border-radius: .4rem;
  opacity: 0.1;
  filter: blur(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.dashboard-card:hover .card-glow {
  opacity: 0.22;
  transform: scale(1.25);
}

.hover-panel {
  margin-top: 1.2rem;
  transform: translateY(12px);
  opacity: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.85rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
  backdrop-filter: blur(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.dashboard-card:hover .hover-panel {
  transform: translateY(0);
  opacity: 1;
}

.flow-step {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
}

.flow-step span {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.413rem;
  background: #e6efeb;
  color: #48756c;
  font-weight: 900;
}

.flow-step b,
.flow-step small {
  display: block;
}

.flow-step b { margin-top: 0.75rem; }
.flow-step small { margin-top: 0.15rem; color: #64748b; font-weight: 700; }

.finding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.9rem;
}

/* Clinic command-centre UI */
.command-hero {
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(94, 140, 130, 0.12), transparent 24rem),
    radial-gradient(circle at bottom left, rgba(20, 184, 166, 0.10), transparent 22rem),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.metric-card {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.86);
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.attention-item,
.treatment-row,
.room-row,
.patient-card,
.staff-card,
.appointment-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.attention-item:hover,
.treatment-row:hover,
.patient-card:hover,
.staff-card:hover,
.appointment-card:hover {
  transform: translateY(-3px);
  border-color: rgba(94, 140, 130, 0.35);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  background: #f8fafc;
}

.room-row { justify-content: space-between; }


.staff-avatar {
  display: inline-flex;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: #e6efeb;
  color: #48756c;
  font-size: .8rem;
  font-weight: 900;
}


.page-shell {
  max-width: 1500px;
  margin-inline: auto;
  padding: 2rem 1.25rem;
}

.command-nav a {
  color: #475569;
}
.command-nav a:hover,
.command-nav a.active { color: #48756c; }

.case-timeline {
  position: relative;
}
.case-timeline::before {
  content: '';
  position: absolute;
  left: 1.1rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  background: #e2e8f0;
}
.timeline-dot {
  position: absolute;
  left: .45rem;
  top: .25rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #5e8c82;
  border: 4px solid #e6efeb;
}
.tab-chip {
  border: 1px solid #e2e8f0;
  border-radius: .4rem;
  background: #fff;
  padding: .55rem .85rem;
  font-size: .8rem;
  font-weight: 900;
  color: #334155;
}
.tab-chip.active,
.tab-chip:hover {
  border-color: rgba(94, 140, 130, .35);
  background: #eef3f0;
  color: #48756c;
}

/* Command Centre v2 - connected clinic OS */
.command-body {
  background:
    radial-gradient(circle at top left, rgba(94, 140, 130, 0.10), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.08), transparent 28rem),
    #f8fafc;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: 0.55rem;
  padding: 0.8rem 0.9rem;
  color: #475569;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.side-link:hover {
  background: #f1f5f9;
  color: #48756c;
  transform: translateX(3px);
}
.side-link.active {
  background: #e6efeb;
  color: #48756c;
}
.command-hero-v2 {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.96)),
    radial-gradient(circle at top right, rgba(94, 140, 130,0.18), transparent 28rem);
}
.metric-card-v2 {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.85);
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.metric-card-v2 span {
  font-size: 0.75rem;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.attention-item-v2 {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.82);
  padding: 0.95rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.attention-item-v2:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.module-card {
  display: block;
  position: relative;
  overflow: hidden;
  min-height: 13rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.92);
  padding: 1.2rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.module-card:hover {
  transform: translateY(-7px) scale(1.012);
  border-color: rgba(94, 140, 130, 0.38);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  z-index: 3;
}
.module-card h3 {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: 900;
  color: #0f172a;
}
.module-card p {
  margin-top: 0.45rem;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.55;
  color: #64748b;
}
.module-card span {
  display: inline-flex;
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 900;
  color: #48756c;
}
.module-icon {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  font-size: 1.35rem;
}
.flow-logic {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  padding: 0.85rem;
  background: #fff;
}
.flow-logic b {
  display: inline-flex;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 0.385rem;
  background: #e6efeb;
  color: #48756c;
  font-weight: 900;
}
.check-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgb(226 232 240);
  background: white;
  border-radius: 0.55rem;
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: rgb(51 65 85);
}
.check-card input { width: 1rem; height: 1rem; }

/* Dental charting module */
.charting-body {
  background:
    radial-gradient(circle at top left, rgba(94, 140, 130, 0.08), transparent 34rem),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.chart-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.odontogram {
  min-width: var(--odontogram-min);
  display: grid;
  gap: 1rem;
}
.arch-label {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #64748b;
}
.tooth-arch {
  display: grid;
  grid-template-columns: repeat(16, minmax(58px, 1fr));
  gap: 0.45rem;
  align-items: end;
}
.tooth-arch.lower {
  align-items: start;
}
.quadrant-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.quadrant-labels span:last-child { text-align: right; }
.tooth-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.2rem;
  border-radius: 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.tooth-card:hover {
  transform: translateY(-4px);
  border-color: #cdddd7;
  background: #eef3f0;
}
.tooth-card.selected {
  border-color: #5e8c82;
  background: #e6efeb;
}
.root-demo {
  position: relative;
  height: 54px;
  width: 42px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  opacity: 0.94;
}
.root-demo.lower-root {
  align-items: flex-start;
}
.root-line {
  width: 10px;
  height: 46px;
  border-radius: 999px 999px 60% 60%;
  background: linear-gradient(180deg, #f4e8c8, #fdfaf0 72%, #e2d1a8);
  border: 1px solid rgba(202, 176, 121, 0.42);
  transform: rotate(calc((var(--i) - 1) * 7deg));
}
.lower-root .root-line {
  border-radius: 60% 60% 999px 999px;
  background: linear-gradient(180deg, #e2d1a8, #fdfaf0 32%, #f4e8c8);
}
.rct-line::after {
  content: '';
  display: block;
  margin: 0 auto;
  height: 100%;
  width: 3px;
  border-radius: .4rem;
  background: rgba(138, 163, 155, 0.85);
}
.implant-screw {
  display: block;
  width: 18px;
  height: 54px;
  border-radius: .4rem;
  background: repeating-linear-gradient(180deg, #475569 0 4px, #94a3b8 4px 7px);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.22);
}
.tooth-crown {
  position: relative;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 42% 42% 48% 48%;
  background: radial-gradient(circle at 40% 32%, #fff 0 16%, #fffef8 40%, #eee4ca 100%);
  box-shadow: inset 0 -7px 14px rgba(148, 100, 30, 0.08), 0 10px 18px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
.tooth-card.anterior .tooth-crown {
  width: 45px;
  border-radius: 45% 45% 28% 28%;
}
.tooth-card.premolar .tooth-crown {
  width: 49px;
  border-radius: 43% 43% 44% 44%;
}
.tooth-number {
  font-size: 0.8rem;
  font-weight: 900;
  color: #475569;
}
.surface-map {
  position: absolute;
  inset: 4px;
  display: grid;
  grid-template-columns: 1fr 1.28fr 1fr;
  grid-template-rows: 1fr 1.28fr 1fr;
  gap: 2px;
}
.tooth-surface {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.68);
  color: rgba(15, 23, 42, 0.25);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.tooth-surface:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(94, 140, 130, 0.18);
  opacity: 1;
}
.surface-B { grid-column: 2; grid-row: 1; }
.surface-M { grid-column: 1; grid-row: 2; }
.surface-O { grid-column: 2; grid-row: 2; }
.surface-D { grid-column: 3; grid-row: 2; }
.surface-L { grid-column: 2; grid-row: 3; }
.chart-caries { background: rgba(250, 204, 21, 0.78) !important; color: #713f12 !important; }
.chart-restoration { background: rgba(56, 189, 248, 0.62) !important; color: #075985 !important; }
.chart-watch { background: rgba(167, 139, 250, 0.70) !important; color: #3b0764 !important; }
.chart-crown { background: rgba(148, 163, 184, 0.62) !important; color: #334155 !important; }
.chart-rct { background: rgba(138, 163, 155, 0.34) !important; color: #1e3a8a !important; }
.chart-implant { background: rgba(100, 116, 139, 0.54) !important; color: #0f172a !important; }
.chart-missing { background: rgba(248, 250, 252, 0.9) !important; color: #64748b !important; outline: 2px dashed #94a3b8; }
.chart-extraction { background: rgba(248, 113, 113, 0.22) !important; color: #991b1b !important; }
.chart-sound { background: #fff !important; color: #475569 !important; }
.missing-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
  color: #64748b;
  pointer-events: none;
}
.chart-tool {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 900;
  color: #0f172a;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.chart-tool small {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.chart-tool:hover, .chart-tool.active {
  border-color: #93c5fd;
  background: #eef3f0;
  transform: translateY(-1px);
}
.chart-swatch {
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  border-radius: 0.2rem;
  border: 1px solid rgba(15, 23, 42, 0.14);
  flex: 0 0 auto;
}
.surface-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.45rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #fff;
  padding: 0.75rem;
  cursor: pointer;
}
.surface-toggle input { width: 1rem; height: 1rem; }
.surface-toggle small {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
}
.surface-toggle.active {
  border-color: #93c5fd;
  background: #eef3f0;
}
.demo-tooth-panel {
  display: flex;
  gap: 1rem;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  background: #f8fafc;
  padding: 1rem;
}
.demo-tooth-large {
  min-width: 100px;
  transform: scale(1.25);
}
.demo-tooth-large .tooth-card:hover {
  transform: none;
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.chart-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  border-radius: 0.55rem;
  background: #0f172a;
  color: #fff;
  padding: 0.9rem 1rem;
  font-weight: 900;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
@media (max-width: 768px) {
  .odontogram { min-width: 980px; }
  .tooth-arch { grid-template-columns: repeat(16, 54px); }
}

/* Dental AI Copilot v5 — React + SVG full-mouth chart */
.chart-svg-scroll {
  width: 100%;
  overflow-x: auto;
  background:
    radial-gradient(circle at 50% 30%, rgba(94, 140, 130, 0.05), transparent 30rem),
    linear-gradient(180deg, #ffffff, #f8fafc);
}
.dental-svg {
  min-width: 1120px;
  width: 100%;
  height: auto;
  display: block;
}
.svg-tooth { cursor: pointer; outline: none; }
.svg-tooth:hover .svg-hit-ring { fill: rgba(219,234,254,0.7); stroke: #93c5fd; }
.svg-tooth.active .svg-selected-ring { fill: rgba(219,234,254,0.95); stroke: #5e8c82; stroke-width: 2.5; }
.svg-hit-ring, .svg-selected-ring { fill: transparent; stroke: transparent; transition: 160ms ease; }
.svg-crown {
  stroke: rgba(100, 116, 139, 0.42);
  stroke-width: 1.3;
  filter: url(#softShadow);
}
.svg-crown.missing { stroke-dasharray: 5 4; stroke-width: 2; fill: #f1f5f9; }
.svg-root { fill: url(#rootGradient); stroke: rgba(180, 140, 78, 0.42); stroke-width: 1; filter: url(#softShadow); }
.svg-rct-line { stroke: #5e8c82; stroke-width: 4; stroke-linecap: round; opacity: .78; }
.svg-implant { fill: url(#rootGradient); stroke: #475569; stroke-width: 1; filter: url(#softShadow); }
.svg-implant { fill: repeating-linear-gradient(180deg, #475569 0 4px, #94a3b8 4px 7px); }
.svg-surface { transition: 140ms ease; }
.svg-surface:hover { stroke: #5e8c82; stroke-width: 2; filter: brightness(0.98); }
.svg-tooth-number { font-size: 14px; font-weight: 900; fill: #475569; }
.svg-arch-title { font-size: 13px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; fill: #64748b; }
.svg-layer-label { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .18em; fill: #0284c7; }
.svg-layer-label.red { fill: #dc2626; }
.svg-treatment-icon { font-size: 24px; filter: drop-shadow(0 4px 8px rgba(15,23,42,.16)); }
.svg-missing-x { font-size: 38px; font-weight: 900; fill: #64748b; }
.bone-line { stroke: #0ea5e9; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; opacity: .78; }
.gingiva-line { stroke: #ef4444; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.probe-alert { fill: rgba(245, 158, 11, 0.78); }
.bop-dot { fill: #ef4444; stroke: #fff; stroke-width: 2; }
.form-control {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #fff;
  padding: .8rem .9rem;
  font-weight: 750;
  color: #0f172a;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.form-control:focus { border-color: #5e8c82; box-shadow: 0 0 0 4px rgba(94, 140, 130,.12); }
.input-label {
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #64748b;
}
.mobility-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0.495rem;
  padding: .65rem .45rem;
  font-size: .74rem;
  font-weight: 900;
  color: #475569;
}
.mobility-btn.active { border-color: #5e8c82; background: #eef3f0; color: #48756c; }
.probe-input {
  display: grid;
  gap: .35rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: .9rem;
  padding: .6rem;
  font-size: .72rem;
  font-weight: 900;
  color: #64748b;
}
.probe-input input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
  padding: .4rem;
  text-align: center;
  font-weight: 900;
  color: #0f172a;
}
@media (max-width: 900px) {
  .dental-svg { min-width: 1050px; }
}

/* v6 appointment calendar */
.calendar-board {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.85rem;
  min-width: 980px;
}
.calendar-time-axis { color: #64748b; font-size: 0.78rem; font-weight: 900; }
.calendar-time-label { position: absolute; right: 0.5rem; transform: translateY(-50%); }
.calendar-doctor-grid { display: grid; gap: 0.9rem; }
.doctor-column { min-width: 0; }
.doctor-column-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 2px solid #e6efeb;
  border-radius: 0.55rem 0.55rem 0 0;
  background: #ffffff;
  padding: 0.9rem;
}
.doctor-dot,
.doctor-legend i { display: inline-flex; width: 0.8rem; height: 0.8rem; border-radius: 999px; }
.doctor-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: .4rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 900;
  color: #334155;
}
.doctor-day-lane {
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 0.55rem 0.55rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.calendar-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed #e2e8f0;
}
.calendar-event {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-left: 6px solid var(--event-color, #5e8c82);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--event-color, #5e8c82) 8%, white);
  padding: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.calendar-event:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  z-index: 10;
}
.compact-appointment {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
  transition: 150ms ease;
}
.compact-appointment:hover { border-color: #93c5fd; background: #eef3f0; transform: translateY(-2px); }
@media print {
  .calendar-board { min-width: auto; }
  .calendar-event { box-shadow: none; }
}

/* v6 patient medical alerts + prescription */
.condition-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 0.75rem;
  font-weight: 850;
  cursor: pointer;
  transition: 150ms ease;
}
.condition-chip:hover { border-color: #93c5fd; background: #eef3f0; transform: translateY(-1px); }
.condition-chip input { margin-top: 0.25rem; transform: scale(1.1); }
.clinical-alert-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
}
.clinical-alert-card h3 { font-size: 0.95rem; font-weight: 900; color: #0f172a; }
.clinical-alert-card ul { margin-top: 0.65rem; display: grid; gap: 0.45rem; }
.clinical-alert-card li { color: #475569; font-size: 0.84rem; font-weight: 720; line-height: 1.45; }
.rx-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.495rem;
  background: #fff;
  padding: 0.75rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 650;
  outline: none;
}
.rx-input:focus { border-color: #8aa39b; box-shadow: 0 0 0 4px rgba(138, 163, 155, 0.15); }
.rx-label { display: grid; gap: 0.35rem; font-size: 0.78rem; font-weight: 900; color: #475569; }

/* v7 proper dental day schedule grid */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.9));
}

.view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: white;
  padding: 0.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.view-toggle-button {
  border-radius: 0.44rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 900;
  color: #475569;
  transition: 0.15s ease;
}

.view-toggle-button:hover { background: #f1f5f9; }
.view-toggle-button.active { background: #5e8c82; color: white; }

.doctor-legend-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.calendar-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e6efeb;
  border-radius: 0.55rem;
  background: #eef3f0;
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #48756c;
}

.day-grid-scroll {
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  max-height: calc(100vh - 250px);
  min-height: 640px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.day-calendar-grid {
  position: relative;
  display: grid;
  min-width: calc(84px + (var(--provider-count) * 260px));
  isolation: isolate;
}

.day-grid-corner,
.day-grid-provider,
.day-grid-time,
.day-grid-cell {
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  background: white;
}

.day-grid-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #64748b;
  background: #f8fafc;
}

.day-grid-provider {
  position: sticky;
  top: 0;
  z-index: 25;
  border-top: 5px solid #5e8c82;
  background: rgba(255, 255, 255, 0.96);
  padding: 1rem;
  backdrop-filter: blur(8px);
}

.day-grid-time {
  position: sticky;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0.35rem 0.6rem;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 900;
  color: #94a3b8;
}

.day-grid-time.is-hour {
  color: #334155;
  font-size: 0.8rem;
}

.day-grid-time span {
  opacity: 0.42;
}

.day-grid-cell {
  background: white;
  transition: background 0.12s ease;
}

.day-grid-cell.is-hour {
  border-bottom-color: #cbd5e1;
  background: #fcfdff;
}

.day-grid-cell:hover {
  background: #f8fafc;
}

.day-grid-event {
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  margin: 3px 5px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 6px solid var(--doctor-color);
  border-radius: 0.55rem;
  background: linear-gradient(180deg, var(--doctor-soft), #fff 72%);
  padding: 0.55rem 0.7rem;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: 0.16s ease;
}

.day-grid-event:hover {
  transform: translateY(-1px) scale(1.006);
  border-color: var(--doctor-color);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.day-grid-event.selected {
  outline: 3px solid rgba(94, 140, 130, 0.18);
  border-color: var(--doctor-color);
}

.day-grid-event .event-time {
  font-size: 0.68rem;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--doctor-color);
}

.day-grid-event .event-patient {
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.93rem;
  font-weight: 1000;
  color: #0f172a;
}

.day-grid-event .event-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
}

.day-grid-event .event-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.open-patient-link {
  border-radius: .4rem;
  background: #0f172a;
  color: white;
  padding: 0.22rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 1000;
}

.selected-appointment-card {
  border-left: 5px solid var(--doctor-color);
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #f8fafc, white);
  padding: 1rem;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

@media (max-width: 900px) {
  .calendar-toolbar { align-items: flex-start; flex-direction: column; }
  .doctor-legend-strip { justify-content: flex-start; }
  .day-grid-scroll { max-height: 70vh; }
}

@media print {
  .view-toggle, #todayBtn, #printScheduleBtn, .open-patient-link, header { display: none !important; }
  .page-shell { max-width: none !important; padding: 0 !important; }
  .day-grid-scroll { max-height: none; overflow: visible; border: 1px solid #ccc; }
  .day-calendar-grid { min-width: auto; }
  .day-grid-event { box-shadow: none; }
}

/* v8 operations placement rules */
.operation-snapshot-row,
.assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(94, 140, 130, 0.18);
  border-radius: 0.55rem;
  background: rgba(255,255,255,0.86);
  padding: 0.95rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.operation-snapshot-row:hover,
.assignment-row:hover {
  transform: translateY(-3px);
  border-color: rgba(94, 140, 130, 0.45);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.patient-task-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.patient-task-card:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 140, 130, 0.32);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

/* v9 app-mode cleanup */
.app-mode .module-card.compact-module {
  min-height: 8.2rem;
  padding: 1rem;
}
.app-mode .module-card.compact-module h3 {
  margin-top: .75rem;
  font-size: 1rem;
}
.app-mode .module-card.compact-module span {
  margin-top: .55rem;
}
.top-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #fff;
  padding: .65rem .9rem;
  font-size: .85rem;
  font-weight: 900;
  color: #334155;
}
.top-action:hover { background: #f8fafc; color: #48756c; border-color: #93c5fd; }
.app-mode .metric-card-v2 { padding: .9rem; }
.app-mode .metric-card-v2 .text-4xl { font-size: 2rem; line-height: 1; }
.app-mode .operation-snapshot-row { padding: .8rem .9rem; }
.app-mode .analysis-card { box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }

/* Dashboard v10 polish */
.dashboard-v10 {
  background:
    radial-gradient(circle at 10% 0%, rgba(94, 140, 130, .16), transparent 34rem),
    radial-gradient(circle at 92% 14%, rgba(20, 184, 166, .12), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, #f6f8fb 42%, #f8fafc 100%);
}
.app-frame {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid rgba(203, 213, 225, .72);
  background: rgba(255,255,255,.78);
  padding: 1.2rem;
  backdrop-filter: blur(22px);
}
.brand-tile {
  display: flex;
  align-items: center;
  gap: .85rem;
  border-radius: 0.55rem;
  background: #0f172a;
  color: white;
  padding: .95rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.brand-mark {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, #5e8c82, #14b8a6);
  font-size: 1.5rem;
}
.brand-tile b,
.brand-tile small { display: block; }
.brand-tile b { font-size: 1.05rem; font-weight: 900; }
.brand-tile small { margin-top: .08rem; font-size: .72rem; font-weight: 850; color: #cbd5e1; }
.app-nav {
  display: grid;
  gap: .35rem;
  margin-top: .25rem;
  font-size: .88rem;
  font-weight: 900;
}
.app-nav a {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 0.55rem;
  color: #475569;
  padding: .78rem .9rem;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.app-nav a:hover { background: #f1f5f9; color: #48756c; transform: translateX(3px); }
.app-nav a.active { background: #eaf2ff; color: #48756c; }
.app-nav a.active::before {
  content: '';
  width: .42rem;
  height: .42rem;
  border-radius: .4rem;
  background: #5e8c82;
  margin-right: .62rem;
  box-shadow: 0 0 0 6px rgba(94, 140, 130,.12);
}
.sidebar-mini-card {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: rgba(255,255,255,.78);
  padding: .9rem;
}
.sidebar-mini-card b,
.sidebar-mini-card small { display: block; }
.sidebar-mini-card b { font-size: .86rem; font-weight: 900; }
.sidebar-mini-card small { font-size: .72rem; font-weight: 800; color: #64748b; }
.live-dot {
  width: .75rem;
  height: .75rem;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34,197,94,.15);
}
.app-main { min-width: 0; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border-bottom: 1px solid rgba(203, 213, 225, .65);
  background: rgba(248, 250, 252, .76);
  padding: 1rem clamp(1rem, 2.4vw, 2rem);
  backdrop-filter: blur(22px);
}
.eyebrow {
  display: inline-flex;
  color: #5e8c82;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.app-topbar h1 {
  margin-top: .1rem;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -.02em;
  color: #0f172a;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.search-box {
  display: flex;
  min-width: min(32vw, 24rem);
  align-items: center;
  gap: .55rem;
  border: 1px solid #dbe3ef;
  border-radius: 1rem;
  background: rgba(255,255,255,.88);
  padding: .72rem .9rem;
  box-shadow: 0 10px 30px rgba(15,23,42,.035);
}
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: .88rem;
  font-weight: 750;
  color: #0f172a;
}
.search-box span { font-weight: 900; color: #94a3b8; }
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  padding: .78rem 1rem;
  font-size: .86rem;
  font-weight: 900;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn-primary { background: #5e8c82; color: white; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.btn-primary:hover { background: #48756c; transform: translateY(-2px); }
.btn-secondary { border: 1px solid #cbd5e1; background: rgba(255,255,255,.86); color: #334155; }
.btn-secondary:hover { background: white; transform: translateY(-2px); }
.dashboard-content {
  max-width: 1660px;
  margin-inline: auto;
  padding: clamp(1rem, 2.4vw, 2rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
}
.hero-panel,
.work-card {
  border: 1px solid rgba(203, 213, 225, .72);
  border-radius: 0.55rem;
  background: rgba(255,255,255,.86);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  backdrop-filter: blur(16px);
}
.hero-primary {
  position: relative;
  min-height: 19rem;
  overflow: hidden;
  padding: 1.35rem;
  background:
    radial-gradient(circle at 75% 18%, rgba(94, 140, 130,.15), transparent 24rem),
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(248,250,252,.82));
}
.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 34rem;
}
.date-chip {
  display: inline-flex;
  align-items: center;
  border-radius: .4rem;
  background: #dcfce7;
  color: #15803d;
  padding: .35rem .7rem;
  font-size: .74rem;
  font-weight: 900;
}
.hero-copy h2 {
  margin-top: .75rem;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: .98;
  font-weight: 900;
  letter-spacing: -.02em;
  color: #0f172a;
}
.hero-copy p {
  margin-top: .8rem;
  max-width: 29rem;
  color: #64748b;
  font-size: .95rem;
  font-weight: 750;
}
.clinic-svg {
  position: absolute;
  right: 1rem;
  top: .8rem;
  width: min(48%, 33rem);
  opacity: .86;
  pointer-events: none;
}
.clinic-svg svg { width: 100%; height: auto; filter: drop-shadow(0 22px 30px rgba(15,23,42,.08)); }
.hero-metrics {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 2.3rem;
}
.metric-tile {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: .25rem;
  border: 1px solid rgba(203,213,225,.72);
  border-radius: 0.55rem;
  background: rgba(255,255,255,.84);
  padding: .9rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.metric-tile::after {
  content: '';
  position: absolute;
  inset: auto -1rem -1.5rem auto;
  width: 5rem;
  height: 5rem;
  border-radius: .4rem;
  opacity: .14;
  filter: blur(10px);
  background: currentColor;
}
.metric-tile:hover { transform: translateY(-5px); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); border-color: rgba(94, 140, 130,.32); }
.metric-tile small { color: #64748b; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .09em; }
.metric-tile b { color: #0f172a; font-size: 2rem; font-weight: 900; letter-spacing: -.025em; }
.metric-icon { font-size: 1.15rem; }
.metric-tile.blue { color: #5e8c82; }
.metric-tile.amber { color: #d97706; }
.metric-tile.green { color: #16a34a; }
.metric-tile.purple { color: #7c3aed; }
.now-panel { padding: 1.1rem; }
.panel-heading,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.panel-heading h3,
.card-head h3 {
  margin-top: .1rem;
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.035em;
}
.pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border-radius: .4rem;
  background: #dcfce7;
  color: #15803d;
  padding: .35rem .65rem;
  font-size: .72rem;
  font-weight: 900;
}
.pulse-badge i {
  width: .48rem;
  height: .48rem;
  border-radius: .4rem;
  background: #22c55e;
  animation: pulse-dot 1.55s infinite;
}
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: 1rem;
}
.ops-tile {
  display: grid;
  min-height: 5.15rem;
  align-content: space-between;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .85rem;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ops-tile:hover { transform: translateY(-4px); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.ops-tile b { font-size: 1.75rem; font-weight: 900; line-height: 1; }
.ops-tile span { color: #64748b; font-size: .78rem; font-weight: 900; }
.ops-tile.blue b { color: #5e8c82; }
.ops-tile.amber b { color: #d97706; }
.ops-tile.green b { color: #16a34a; }
.ops-tile.red b { color: #dc2626; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1rem;
  margin-top: 1rem;
}
.main-column,
.side-column { display: grid; gap: 1rem; align-content: start; }
.work-card { padding: 1rem; }
.card-head { margin-bottom: .9rem; }
.card-head a { color: #48756c; font-size: .82rem; font-weight: 900; }
.card-head.compact { margin-bottom: .75rem; }
.card-head.compact h3 { font-size: 1.08rem; }
.schedule-rail { overflow: hidden; }
.mini-calendar {
  display: grid;
  grid-template-columns: 3.25rem minmax(0,1fr);
  min-height: calc(var(--track-height) + 2.2rem);
}
.mini-time-axis {
  position: relative;
  height: var(--track-height);
  margin-top: 2.2rem;
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 900;
}
.mini-time-axis span { position: absolute; right: .7rem; }
.mini-doctor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: .7rem;
  overflow-x: auto;
  padding-bottom: .2rem;
}
.doctor-lane header {
  display: flex;
  align-items: center;
  gap: .45rem;
  height: 2.2rem;
  color: #334155;
  font-size: .8rem;
  font-weight: 900;
}
.doctor-lane header span {
  width: .65rem;
  height: .65rem;
  border-radius: .4rem;
  background: var(--doctor);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--doctor), transparent 84%);
}
.doctor-track {
  position: relative;
  height: var(--track-height);
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background:
    repeating-linear-gradient(to bottom, #f8fafc 0 48px, #eef2f7 49px 50px),
    #fff;
  overflow: hidden;
}
.mini-appt {
  position: absolute;
  left: .45rem;
  right: .45rem;
  display: block;
  overflow: hidden;
  border-left: 4px solid var(--doctor);
  border-radius: 0.468rem;
  background: rgba(255,255,255,.92);
  padding: .45rem .55rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform .16s ease, box-shadow .16s ease;
}
.mini-appt:hover { transform: scale(1.018); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); z-index: 2; }
.mini-appt strong,
.mini-appt small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-appt strong { color: #0f172a; font-size: .74rem; font-weight: 900; }
.mini-appt small { margin-top: .1rem; color: #64748b; font-size: .68rem; font-weight: 800; }
.mini-appt.is-green { background: rgba(240,253,244,.96); }
.mini-appt.is-amber { background: rgba(255,251,235,.97); }
.mini-appt.is-red { background: rgba(254,242,242,.97); }
.mini-appt.is-blue { background: rgba(239,246,255,.97); }
.patient-flow-list { display: grid; gap: .65rem; }
.flow-card {
  position: relative;
  display: grid;
  grid-template-columns: 5.2rem minmax(0,1fr) auto auto;
  align-items: center;
  gap: .8rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .82rem .9rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.flow-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: .28rem;
  background: #94a3b8;
}
.flow-card.is-blue::before { background: #5e8c82; }
.flow-card.is-amber::before { background: #f59e0b; }
.flow-card.is-green::before { background: #22c55e; }
.flow-card.is-red::before { background: #ef4444; }
.flow-card:hover { transform: translateY(-3px); border-color: rgba(94, 140, 130,.32); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.flow-time b,
.flow-time small { display: block; }
.flow-time b { font-size: 1.25rem; font-weight: 900; letter-spacing: -.025em; }
.flow-time small { margin-top: .05rem; color: #94a3b8; font-size: .74rem; font-weight: 900; }
.flow-main { min-width: 0; }
.flow-topline { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.flow-topline h4 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0f172a; font-size: .98rem; font-weight: 900; }
.flow-subline,
.flow-team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: .78rem; font-weight: 800; }
.flow-team { margin-top: .12rem; color: #94a3b8; }
.flow-action {
  border-radius: 0.495rem;
  background: #0f172a;
  color: white;
  padding: .55rem .75rem;
  font-size: .76rem;
  font-weight: 900;
}
.flow-next {
  max-width: 11rem;
  text-align: right;
  color: #64748b;
  font-size: .74rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-group-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .55rem .1rem 0;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.flow-group-head:first-child { margin-top: 0; }
.flow-group-head em { font-style: normal; color: #64748b; }
.flow-group-head::after { content: ''; flex: 1; height: 1px; background: #e6ece8; }
.queue-pos {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 .3rem;
  border-radius: 0.303rem;
  background: rgba(245, 158, 11, .14);
  color: #b45309;
  font-size: .7rem;
  font-weight: 900;
}
.flow-card.is-done { opacity: .58; }
.flow-card.is-done:hover { opacity: .9; }
.flow-card.is-cancelled h4 { text-decoration: line-through; }
.queue-summary { display: block; margin-top: .15rem; color: #94a3b8; font-size: .74rem; font-weight: 800; }
.room-stack,
.done-stack { display: grid; gap: .55rem; }
.room-tile,
.done-row {
  display: grid;
  align-items: center;
  gap: .7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .72rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.room-tile { grid-template-columns: auto minmax(0,1fr) auto; }
.done-row { grid-template-columns: auto minmax(0,1fr) auto; }
.room-tile:hover,
.done-row:hover { transform: translateY(-3px); border-color: rgba(94, 140, 130,.32); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.room-dot {
  width: .75rem;
  height: .75rem;
  border-radius: 999px;
  background: #94a3b8;
}
.room-tile.is-blue .room-dot { background: #5e8c82; box-shadow: 0 0 0 6px rgba(94, 140, 130,.12); }
.room-tile.is-amber .room-dot { background: #f59e0b; box-shadow: 0 0 0 6px rgba(245,158,11,.14); }
.room-tile.is-green .room-dot { background: #22c55e; box-shadow: 0 0 0 6px rgba(34,197,94,.13); }
.room-tile b,
.room-tile small,
.done-row b,
.done-row small { display: block; }
.room-tile b,
.done-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; font-weight: 900; }
.room-tile small,
.done-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748b; font-size: .72rem; font-weight: 800; }
.room-tile em { color: #64748b; font-size: .68rem; font-style: normal; font-weight: 900; }
.done-row .done-check {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 0.44rem;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, .16);
  color: #15803d;
  font-size: .82rem;
  font-weight: 900;
}
.done-main { min-width: 0; }
.done-meta { text-align: right; }
.done-meta b {
  display: block;
  font-size: .8rem;
  font-weight: 900;
  color: #0f172a;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.done-meta small {
  display: block;
  margin-top: .1rem;
  color: #94a3b8;
  font-size: .66rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.fade-up {
  animation: fade-up .52s both cubic-bezier(.22, .61, .36, 1);
}
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .10s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .20s; }
.delay-5 { animation-delay: .25s; }
.delay-6 { animation-delay: .30s; }
.delay-7 { animation-delay: .35s; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.32); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@media (max-width: 1240px) {
  .hero-grid,
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clinic-svg { width: 44%; }
}
@media (max-width: 900px) {
  .app-frame { grid-template-columns: 1fr; }
  .app-sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid #e2e8f0; }
  .app-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-mini-card { display: none; }
  .app-topbar { flex-direction: column; align-items: stretch; }
  .topbar-actions { flex-wrap: wrap; }
  .search-box { min-width: 100%; }
  .hero-metrics,
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clinic-svg { display: none; }
  .flow-card { grid-template-columns: 4.8rem minmax(0,1fr); }
  .flow-next,
  .flow-action { display: none; }
}
@media (max-width: 620px) {
  .hero-metrics,
  .side-column { grid-template-columns: 1fr; }
  .mini-calendar { grid-template-columns: 2.8rem minmax(0,1fr); }
}

/* v11 persistent app shell / SPA navigation */
.spa-view {
  min-width: 0;
  animation: spaFadeIn 180ms ease both;
}
.spa-view.spa-leaving {
  opacity: .35;
  transform: translateY(6px) scale(.998);
  transition: opacity 115ms ease, transform 115ms ease;
}
.spa-view.spa-entering {
  animation: spaSlideIn 220ms ease both;
}
@keyframes spaFadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spaSlideIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-sidebar {
  z-index: 50;
}
.app-main {
  min-height: 100vh;
  overflow: clip;
}
.app-main > .spa-view > .page-shell,
.app-main > .spa-view > main.page-shell {
  padding: clamp(1rem, 2.4vw, 2rem);
}
.app-main .page-shell {
  max-width: 1680px;
}
.app-nav a.active {
  box-shadow: inset 0 0 0 1px rgba(94, 140, 130, .08);
}
@media (prefers-reduced-motion: reduce) {
  .spa-view,
  .spa-view.spa-leaving,
  .spa-view.spa-entering {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}


/* v12 performance pass */
.perf-optimized,
.perf-optimized * {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Backdrop blur looks nice but is expensive on low-end PCs. Keep surfaces crisp instead. */
.perf-optimized .glass-card,
.perf-optimized .app-sidebar,
.perf-optimized .app-topbar,
.perf-optimized .sidebar-mini-card,
.perf-optimized .search-box {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.spa-view.is-routing::after {
  content: '';
  position: fixed;
  left: var(--sidebar-w, 282px);
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, #5e8c82, #14b8a6);
  transform-origin: left center;
  animation: routeProgress .42s ease-out both;
  z-index: 100;
}

.app-main.is-routing { cursor: progress; }

@keyframes routeProgress {
  from { transform: scaleX(.12); opacity: .95; }
  to { transform: scaleX(1); opacity: .2; }
}

/* Keep animations subtle and GPU-friendly. */
.spa-view,
.spa-view.spa-leaving,
.spa-view.spa-entering,
.fade-up,
.metric-tile,
.flow-card,
.room-tile,
.done-row,
.mini-appt {
  will-change: opacity, transform;
}

.spa-view.spa-leaving {
  opacity: .72;
  transform: none;
  transition: opacity 90ms ease;
}
.spa-view.spa-entering {
  animation: spaQuickIn 140ms ease both;
}
@keyframes spaQuickIn {
  from { opacity: .84; }
  to { opacity: 1; }
}

/* Reduce expensive shadow animation while preserving the polished look. */
.metric-tile,
.flow-card,
.room-tile,
.done-row,
.mini-appt,
.work-card {
  transition-duration: 120ms !important;
}
.flow-card:hover,
.room-tile:hover,
.done-row:hover,
.mini-appt:hover {
  transform: translateY(-2px);
}

/* Large lists render lazily when off-screen. */
.patient-card,
.flow-card,
.work-card,
.analysis-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 180px;
}

/* Calendar grids are big: isolate layout/paint work. */
.day-calendar-grid,
.mini-calendar,
.patient-flow-list,
.room-stack,
.done-stack {
  contain: layout paint style;
}

@media (max-width: 900px) {
  .spa-view.is-routing::after { left: 0; }
}

/* v13 schedule/appointment cleanup */
.schedule-page-v13 .page-shell,
.schedule-page-v13 {
  min-width: 0;
}
.schedule-layout-v13 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.25rem;
  align-items: start;
}
.schedule-calendar-card-v13 {
  min-width: 0;
}
.schedule-side-v13 {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}
.schedule-grid-v13.day-grid-scroll {
  min-height: 680px;
  max-height: calc(100vh - 215px);
  border-color: #dbe3ef;
  background: #f8fafc;
  scrollbar-gutter: stable;
}
.schedule-grid-v13 .day-calendar-grid {
  min-width: calc(76px + (var(--provider-count) * 235px));
}
.provider-header-v13 {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}
.schedule-grid-v13 .day-grid-provider {
  padding: .85rem .95rem;
  border-right-color: #e2e8f0;
}
.schedule-grid-v13 .day-grid-time {
  padding: .15rem .55rem .2rem 0;
  align-items: flex-start;
  background: #f8fafc;
  color: #334155;
  font-size: .75rem;
}
.schedule-grid-v13 .day-grid-time:not(.is-hour) {
  color: transparent;
}
.schedule-grid-v13 .day-grid-cell {
  background: #fff;
  border-bottom-color: #eef2f7;
  border-right-color: #eef2f7;
}
.schedule-grid-v13 .day-grid-cell.is-half {
  border-bottom-style: dashed;
  border-bottom-color: #dbe3ef;
}
.schedule-grid-v13 .day-grid-cell.is-hour {
  border-bottom-color: #cbd5e1;
  background: linear-gradient(180deg, #fbfdff, #fff);
}
.appointment-block-v13.day-grid-event {
  position: relative;
  display: grid;
  align-content: start;
  gap: .08rem;
  overflow: visible;
  margin: 2px 4px;
  border-left-width: 5px;
  border-radius: 0.451rem;
  background: linear-gradient(180deg, var(--doctor-soft), rgba(255,255,255,.97) 76%);
  padding: .42rem .55rem;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .07);
  min-height: 0;
  container-type: inline-size;
}
.appointment-block-v13.day-grid-event:hover,
.appointment-block-v13.day-grid-event:focus-visible {
  z-index: 120;
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  outline: none;
}
.appt-main-v13,
.appt-line-v13 {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appt-main-v13 {
  color: #0f172a;
  font-size: .87rem;
  font-weight: 1000;
  line-height: 1.1;
}
.appt-line-v13 {
  color: #475569;
  font-size: .67rem;
  font-weight: 850;
  line-height: 1.15;
}
.appointment-block-v13.is-green { background: linear-gradient(180deg, rgba(240,253,244,.98), #fff 72%); }
.appointment-block-v13.is-amber { background: linear-gradient(180deg, rgba(255,251,235,.98), #fff 72%); }
.appointment-block-v13.is-red { background: linear-gradient(180deg, rgba(254,242,242,.98), #fff 72%); }
.appointment-block-v13.is-blue { background: linear-gradient(180deg, rgba(239,246,255,.98), #fff 72%); }
.appointment-popover-v13 {
  pointer-events: none;
  position: absolute;
  left: .35rem;
  right: .35rem;
  top: calc(100% + .45rem);
  z-index: 500;
  display: grid;
  gap: .35rem;
  min-width: 250px;
  max-width: 320px;
  border: 1px solid rgba(15, 23, 42, .10);
  border-radius: 0.55rem;
  background: rgba(255,255,255,.98);
  padding: .8rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  opacity: 0;
  transform: translateY(-4px) scale(.985);
  transition: opacity 110ms ease, transform 110ms ease;
}
.appointment-block-v13:hover .appointment-popover-v13,
.appointment-block-v13:focus-visible .appointment-popover-v13 {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.appointment-popover-v13::before {
  content: '';
  position: absolute;
  left: 1.15rem;
  top: -.42rem;
  width: .8rem;
  height: .8rem;
  transform: rotate(45deg);
  background: white;
  border-left: 1px solid rgba(15,23,42,.10);
  border-top: 1px solid rgba(15,23,42,.10);
}
.appointment-popover-v13 b {
  color: #0f172a;
  font-size: .94rem;
  font-weight: 1000;
  line-height: 1.1;
}
.appointment-popover-v13 span {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  color: #475569;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.25;
}
.appointment-popover-v13 span strong {
  flex: none;
  color: #0f172a;
  font-size: .7rem;
  font-weight: 900;
}
.appointment-popover-v13 em {
  margin-top: .1rem;
  border-top: 1px solid #e2e8f0;
  padding-top: .45rem;
  color: #5e8c82;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}
/* Dashboard mini-schedule now mirrors the appointment card behavior. */
.mini-calendar-v13 .doctor-track {
  overflow: visible;
}
.mini-appt-v13 {
  overflow: visible;
  padding: .38rem .5rem;
  text-decoration: none;
}
.mini-appt-v13 strong,
.mini-appt-v13 small {
  display: block;
  line-height: 1.15;
}
.mini-appt-v13 strong { font-size: .72rem; }
.mini-appt-v13 small { font-size: .63rem; }
.mini-appt-popover-v13 {
  pointer-events: none;
  position: absolute;
  left: .2rem;
  top: calc(100% + .35rem);
  z-index: 80;
  display: grid;
  gap: .18rem;
  width: 230px;
  border: 1px solid #e2e8f0;
  border-radius: 0.495rem;
  background: white;
  padding: .65rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 100ms ease, transform 100ms ease;
}
.mini-appt-v13:hover .mini-appt-popover-v13,
.mini-appt-v13:focus-visible .mini-appt-popover-v13 {
  opacity: 1;
  transform: translateY(0);
}
.mini-appt-popover-v13 b,
.mini-appt-popover-v13 span,
.mini-appt-popover-v13 em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-appt-popover-v13 b { font-size: .78rem; font-weight: 1000; color: #0f172a; }
.mini-appt-popover-v13 span,
.mini-appt-popover-v13 em { font-size: .68rem; font-style: normal; font-weight: 800; color: #64748b; }
@media (max-width: 1280px) {
  .schedule-layout-v13 { grid-template-columns: 1fr; }
  .schedule-side-v13 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .schedule-side-v13 { grid-template-columns: 1fr; }
  .schedule-grid-v13 .day-calendar-grid { min-width: 820px; }
}
@media print {
  .schedule-side-v13,
  .appointment-popover-v13,
  .mini-appt-popover-v13 { display: none !important; }
  .schedule-layout-v13 { display: block; }
}
.schedule-rail { overflow: visible; }

/* v14 Patient Search */
.patient-search-page {
  display: grid;
  gap: 1rem;
}
.patient-search-hero {
  padding: clamp(1rem, 2vw, 1.4rem);
  background:
    radial-gradient(circle at top right, rgba(94, 140, 130,.11), transparent 22rem),
    radial-gradient(circle at bottom left, rgba(14,165,233,.08), transparent 18rem),
    #fff;
}
.patient-search-hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.patient-search-hero h1 {
  margin-top: .15rem;
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -.025em;
}
.patient-search-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .75rem;
  border: 1px solid #dbe3ef;
  border-radius: 1.15rem;
  background: rgba(255,255,255,.93);
  padding: .82rem .9rem;
  box-shadow: 0 16px 40px rgba(15,23,42,.05);
}
.patient-search-bar span {
  color: #94a3b8;
  font-size: 1.15rem;
  font-weight: 900;
}
.patient-search-bar input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font-size: .95rem;
  font-weight: 850;
}
.patient-search-bar button {
  border-radius: .85rem;
  background: #f1f5f9;
  padding: .55rem .75rem;
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
  transition: background .12s ease, color .12s ease;
}
.patient-search-bar button:hover { background: #e2e8f0; color: #0f172a; }
.patient-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-top: .9rem;
}
.patient-filter-grid label > span {
  display: block;
  margin: 0 0 .35rem .1rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.patient-view-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.patient-saved-views {
  padding: 1rem;
  position: sticky;
  top: 1rem;
}
.section-head-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.section-head-compact h2,
.patient-results-top h2 {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -.02em;
}
.saved-view-list {
  display: grid;
  gap: .45rem;
  margin-top: .9rem;
}
.saved-view {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: .6rem;
  border: 1px solid transparent;
  border-radius: 0.522rem;
  padding: .62rem;
  color: #334155;
  text-align: left;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.saved-view:hover,
.saved-view.active {
  transform: translateX(2px);
  border-color: #cdddd7;
  background: #eef3f0;
}
.saved-view span {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.413rem;
  background: #f8fafc;
}
.saved-view b { font-size: .83rem; font-weight: 900; }
.saved-view small {
  border-radius: .4rem;
  background: #fff;
  padding: .18rem .45rem;
  color: #64748b;
  font-size: .7rem;
  font-weight: 900;
}
.recent-patient {
  display: grid;
  grid-template-columns: 2.1rem 1fr;
  gap: .6rem;
  align-items: center;
  border-radius: 0.495rem;
  padding: .5rem;
  transition: background .12s ease, transform .12s ease;
}
.recent-patient:hover { background: #f8fafc; transform: translateX(2px); }
.recent-patient > span {
  display: inline-flex;
  width: 2.1rem;
  height: 2.1rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.44rem;
  background: linear-gradient(135deg, #e6efeb, #eef3f0);
  color: #48756c;
  font-size: .78rem;
  font-weight: 900;
}
.recent-patient b,
.recent-patient small { display: block; }
.recent-patient b { color: #0f172a; font-size: .82rem; font-weight: 900; }
.recent-patient small { margin-top: .12rem; color: #64748b; font-size: .72rem; font-weight: 800; }
.patient-results-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem;
}
.patient-results-top p {
  margin-top: .12rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 900;
}
.patient-sort-wrap {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.patient-sort-wrap > span {
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.patient-sort-wrap .select { min-width: 12rem; padding-block: .6rem; }
.patient-table {
  padding: .45rem;
}
.patient-table-head,
.patient-search-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) minmax(145px, .75fr) minmax(190px, 1fr) minmax(155px, .85fr) minmax(155px, .8fr) 105px;
  align-items: center;
  gap: .8rem;
}
.patient-table-head {
  padding: .7rem 1rem;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.patient-search-row {
  position: relative;
  border: 1px solid transparent;
  border-radius: 1.05rem;
  padding: .82rem 1rem;
  color: inherit;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.patient-search-row:nth-child(even) { background: #fbfdff; }
.patient-search-row:hover {
  z-index: 1;
  transform: translateY(-2px);
  border-color: rgba(94, 140, 130,.3);
  background: #fff;
  box-shadow: 0 18px 42px rgba(15,23,42,.08);
}
.patient-cell-main {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-width: 0;
}
.patient-search-row .staff-avatar {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 1rem;
  flex: none;
  background: linear-gradient(135deg, #5e8c82, #4e9aa8);
  color: #fff;
}
.patient-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: .95rem;
  font-weight: 900;
}
.patient-row-meta,
.patient-row-id {
  margin-top: .14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-size: .76rem;
  font-weight: 800;
}
.patient-row-id { color: #94a3b8; }
.patient-cell {
  min-width: 0;
  color: #0f172a;
  font-size: .82rem;
  font-weight: 900;
}
.patient-cell b,
.patient-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-cell small { margin-top: .18rem; color: #64748b; font-size: .74rem; font-weight: 800; }
.patient-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.patient-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
}
.open-arrow {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.44rem;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 900;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.patient-search-row:hover .open-arrow { background: #5e8c82; color: #fff; transform: translateX(2px); }
.patient-empty-state {
  display: grid;
  place-items: center;
  gap: .35rem;
  min-height: 16rem;
  color: #64748b;
  text-align: center;
}
.patient-empty-state div {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.55rem;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 1.4rem;
  font-weight: 900;
}
.patient-empty-state b { color: #0f172a; font-size: 1rem; font-weight: 900; }
.patient-empty-state span { font-size: .85rem; font-weight: 800; }

@media (max-width: 1260px) {
  .patient-view-grid { grid-template-columns: 1fr; }
  .patient-saved-views { position: static; }
  .saved-view-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .patient-table-head { display: none; }
  .patient-search-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .patient-search-row .patient-cell,
  .patient-search-row .patient-tags { grid-column: 1 / -1; }
  .patient-row-actions { grid-column: 2; grid-row: 1; }
}
@media (max-width: 850px) {
  .patient-filter-grid,
  .saved-view-list { grid-template-columns: 1fr 1fr; }
  .patient-search-hero-main { align-items: stretch; flex-direction: column; }
  .patient-results-top { align-items: stretch; flex-direction: column; }
  .patient-sort-wrap { justify-content: space-between; }
}
@media (max-width: 560px) {
  .patient-filter-grid,
  .saved-view-list { grid-template-columns: 1fr; }
  .patient-search-bar { grid-template-columns: auto 1fr; }
  .patient-search-bar button { grid-column: 1 / -1; }
}

/* v15 staff page refinement */
.staff-page {
  --staff-border: #e2e8f0;
}

.staff-hero {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(360px, 1.45fr);
  gap: 1.25rem;
  padding: 1.15rem;
  background:
    radial-gradient(circle at top right, rgba(94, 140, 130, .12), transparent 22rem),
    radial-gradient(circle at bottom left, rgba(20, 184, 166, .10), transparent 18rem),
    #fff;
}

.staff-hero-copy {
  display: flex;
  min-height: 10rem;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 0.55rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 56%, #5e8c82 100%);
  padding: 1.35rem;
  color: #fff;
  overflow: hidden;
  position: relative;
}

.staff-hero-copy::after {
  content: "";
  position: absolute;
  right: -3.5rem;
  bottom: -3.5rem;
  width: 12rem;
  height: 12rem;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: .4rem;
  box-shadow: inset 0 0 0 1.9rem rgba(255,255,255,.06);
}

.staff-hero-copy h1 {
  margin-top: .45rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: .96;
}

.staff-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  position: relative;
  z-index: 1;
}

.btn-primary,
.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  padding: .72rem 1rem;
  font-size: .82rem;
  font-weight: 900;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.btn-primary {
  background: #5e8c82;
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.btn-soft {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.12);
  color: #fff;
  backdrop-filter: blur(10px);
}

.btn-primary:hover,
.btn-soft:hover {
  transform: translateY(-1px);
}

.staff-search-panel {
  display: grid;
  gap: .95rem;
  align-content: center;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 1.35rem;
  background: rgba(255,255,255,.82);
  padding: 1.1rem;
}

.staff-search-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  border: 1px solid #e6efeb;
  border-radius: 1.15rem;
  background: #fff;
  padding: .75rem .85rem;
  box-shadow: 0 12px 28px rgba(15,23,42,.035);
}

.staff-search-bar span {
  color: #5e8c82;
  font-size: 1.1rem;
  font-weight: 900;
}

.staff-search-bar input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: #0f172a;
  font-size: .96rem;
  font-weight: 850;
}

.staff-search-bar input::placeholder { color: #94a3b8; }

.staff-search-bar button {
  border-radius: .9rem;
  background: #f1f5f9;
  padding: .48rem .8rem;
  color: #475569;
  font-size: .78rem;
  font-weight: 900;
}

.staff-filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
}

.staff-filter-row label {
  display: grid;
  gap: .35rem;
}

.staff-filter-row label > span {
  color: #64748b;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.staff-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-top: 1rem;
}

.staff-metric {
  display: grid;
  gap: .15rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.staff-metric span {
  color: #0f172a;
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
}

.staff-metric b {
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.staff-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.staff-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.1rem;
}

.staff-section-head.compact {
  border-bottom: 0;
  padding: 0 0 .85rem 0;
}

.staff-section-head h2 {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -.02em;
}

.staff-section-head p {
  margin-top: .1rem;
  color: #64748b;
  font-size: .75rem;
  font-weight: 850;
}

.staff-small-link {
  border-radius: 0.468rem;
  background: #eef3f0;
  color: #48756c;
  padding: .48rem .7rem;
  font-size: .72rem;
  font-weight: 900;
}

.staff-directory-list,
.staff-assignment-list,
.staff-coverage-list,
.staff-shift-list {
  display: grid;
  gap: .65rem;
}

.staff-directory-list { padding: 1rem; }

.staff-person-card {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: .9rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .85rem;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.staff-person-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--staff-color), white 62%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  background: #fbfdff;
}

.staff-avatar-modern,
.staff-shift-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 1rem;
  background: color-mix(in srgb, var(--staff-color), white 84%);
  color: var(--staff-color);
  font-weight: 900;
}

.staff-avatar-modern {
  width: 3rem;
  height: 3rem;
  font-size: .84rem;
}

.staff-person-main { min-width: 0; }

.staff-person-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .75rem;
}

.staff-person-title h3 {
  overflow: hidden;
  color: #0f172a;
  font-size: .98rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-person-title p {
  margin-top: .1rem;
  color: #64748b;
  font-size: .77rem;
  font-weight: 850;
}

.staff-status-text {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex: 0 0 auto;
  color: #475569;
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}

.staff-status-text i {
  width: .55rem;
  height: .55rem;
  border-radius: .4rem;
  background: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148,163,184,.12);
}
.staff-status-text i.is-green { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.13); }
.staff-status-text i.is-amber { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
.staff-status-text i.is-red { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,.12); }
.staff-status-text i.is-blue { background: #5e8c82; box-shadow: 0 0 0 4px rgba(94, 140, 130,.13); }

.staff-person-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .55rem;
  margin-top: .65rem;
}

.staff-person-meta div {
  min-width: 0;
  border-radius: 0.468rem;
  background: #f8fafc;
  padding: .58rem .65rem;
}

.staff-person-meta span,
.staff-person-meta b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-person-meta span {
  color: #94a3b8;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.staff-person-meta b {
  margin-top: .1rem;
  color: #334155;
  font-size: .73rem;
  font-weight: 900;
}

.staff-card-action {
  border-radius: 0.495rem;
  background: #0f172a;
  color: #fff;
  padding: .58rem .78rem;
  font-size: .73rem;
  font-weight: 900;
  white-space: nowrap;
}

.staff-side-stack {
  display: grid;
  gap: 1rem;
}

.staff-assignment-row {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .8rem;
}

.staff-room-cell { min-width: 0; }
.staff-room-cell b,
.staff-room-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staff-room-cell b { color: #0f172a; font-size: .84rem; font-weight: 900; }
.staff-room-cell span { margin-top: .12rem; color: #64748b; font-size: .72rem; font-weight: 850; }

.staff-assignment-controls {
  display: grid;
  gap: .45rem;
}

.staff-coverage-row {
  display: grid;
  gap: .45rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .75rem;
}

.staff-coverage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.staff-coverage-top b { color: #0f172a; font-size: .83rem; font-weight: 900; }
.staff-coverage-top span { color: #5e8c82; font-size: .83rem; font-weight: 900; }

.staff-coverage-bar {
  height: .45rem;
  overflow: hidden;
  border-radius: .4rem;
  background: #eef2f7;
}

.staff-coverage-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5e8c82, #06b6d4);
}

.staff-shift-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: .7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .7rem;
}

.staff-shift-avatar {
  width: 2.25rem;
  height: 2.25rem;
  font-size: .68rem;
}

.staff-shift-row b,
.staff-shift-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staff-shift-row b { color: #0f172a; font-size: .8rem; font-weight: 900; }
.staff-shift-row span { margin-top: .12rem; color: #64748b; font-size: .7rem; font-weight: 850; }

.staff-empty-state {
  display: grid;
  place-items: center;
  gap: .35rem;
  min-height: 14rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}
.staff-empty-state b { color: #0f172a; font-size: 1rem; font-weight: 900; }
.staff-empty-state span { font-size: .82rem; font-weight: 850; }

@media (max-width: 1100px) {
  .staff-layout-grid,
  .staff-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .staff-metric-row,
  .staff-filter-row,
  .staff-person-meta {
    grid-template-columns: 1fr 1fr;
  }
  .staff-person-card {
    grid-template-columns: auto minmax(0,1fr);
  }
  .staff-card-action {
    grid-column: 1 / -1;
    text-align: center;
  }
  .staff-assignment-row {
    grid-template-columns: 1fr;
  }
}


/* v16 room board refinement */
.room-board-page {
  --room-blue: #5e8c82;
  --room-teal: #4e9aa8;
  --room-green: #16a34a;
  --room-amber: #f59e0b;
  --room-slate: #64748b;
}

.room-hero {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(420px, .72fr);
  gap: 1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 8% 0%, rgba(94, 140, 130,.12), transparent 30%),
    linear-gradient(135deg, #fff, #f8fbff 70%, #eef6ff);
}

.room-hero-copy {
  display: flex;
  min-height: 13rem;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 0.55rem;
  background: #0f172a;
  color: white;
  padding: 1.35rem;
  position: relative;
  overflow: hidden;
}

.room-hero-copy::after {
  content: "";
  position: absolute;
  right: -3.5rem;
  bottom: -4rem;
  width: 14rem;
  height: 14rem;
  border-radius: .4rem;
  background: radial-gradient(circle, rgba(138, 163, 155,.28), transparent 68%);
  pointer-events: none;
}

.room-hero-copy .eyebrow { color: #cdddd7; }
.room-hero-copy h1 {
  margin-top: .35rem;
  font-size: clamp(2.1rem, 5vw, 4.25rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: .96;
}

.room-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  position: relative;
  z-index: 1;
}

.room-search-panel {
  display: grid;
  align-content: start;
  gap: .85rem;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 1.4rem;
  background: rgba(255,255,255,.9);
  padding: 1rem;
}

.room-search-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  border: 1px solid #dbe5f0;
  border-radius: 1.1rem;
  background: #fff;
  padding: .85rem .95rem;
  box-shadow: 0 12px 26px rgba(15,23,42,.045);
}

.room-search-bar span {
  color: #5e8c82;
  font-size: 1.05rem;
  font-weight: 900;
}

.room-search-bar input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: #0f172a;
  font-size: .95rem;
  font-weight: 850;
}

.room-search-bar input::placeholder { color: #94a3b8; }
.room-search-bar button {
  border-radius: .8rem;
  background: #eef3f0;
  color: #48756c;
  padding: .45rem .65rem;
  font-size: .72rem;
  font-weight: 900;
}

.room-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.room-filter-row label { display: grid; gap: .35rem; }
.room-filter-row label > span {
  color: #64748b;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.room-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-top: 1rem;
}

.room-metric {
  display: grid;
  gap: .15rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.room-metric:hover,
.room-metric.active {
  transform: translateY(-2px);
  border-color: #cdddd7;
  background: linear-gradient(135deg, #fff, #eef3f0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.room-metric span {
  color: #0f172a;
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
}

.room-metric b {
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.room-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.room-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 1.1rem;
}

.room-section-head.compact {
  border-bottom: 0;
  padding: 0 0 .85rem 0;
}

.room-section-head h2 {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -.02em;
}

.room-section-head p {
  margin-top: .1rem;
  color: #64748b;
  font-size: .75rem;
  font-weight: 850;
}

.room-board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
}

.room-board-legend span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.room-board-legend i,
.room-card-top i,
.room-coverage-row > i {
  display: inline-block;
  width: .62rem;
  height: .62rem;
  border-radius: 999px;
  background: #94a3b8;
}
.room-board-legend i.is-blue { background: #5e8c82; box-shadow: 0 0 0 4px rgba(94, 140, 130,.13); }
.room-board-legend i.is-amber { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
.room-board-legend i.is-green { background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,.13); }

.room-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.room-board-card {
  position: relative;
  display: grid;
  gap: .85rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  min-height: 19rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.room-board-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.room-board-card.is-active { border-color: rgba(94, 140, 130,.35); }
.room-board-card.is-ready { border-color: rgba(22,163,74,.36); }

.room-board-card.is-active .room-card-top i,
.room-coverage-row.is-active > i { background: #5e8c82; box-shadow: 0 0 0 5px rgba(94, 140, 130,.12); }
.room-board-card.is-ready .room-card-top i,
.room-coverage-row.is-ready > i { background: #16a34a; box-shadow: 0 0 0 5px rgba(22,163,74,.13); }
.room-board-card.is-neutral .room-card-top i,
.room-coverage-row.is-neutral > i { background: #64748b; box-shadow: 0 0 0 5px rgba(100,116,139,.12); }

.room-card-top,
.room-title-block,
.room-progress-top,
.room-card-actions,
.room-coverage-row,
.room-timeline-row {
  display: flex;
  align-items: center;
}

.room-card-top,
.room-progress-top,
.room-card-actions,
.room-timeline-row { justify-content: space-between; }
.room-title-block { gap: .7rem; min-width: 0; }
.room-title-block h3 {
  overflow: hidden;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-title-block span {
  display: block;
  margin-top: .08rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 850;
}

.room-current-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .85rem;
  transition: background .14s ease, transform .14s ease;
}
.room-current-link:hover { background: #eef3f0; transform: translateY(-1px); }
.room-current-link span,
.room-provider-grid span,
.room-progress-top span,
.room-hover-panel span {
  display: block;
  color: #94a3b8;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.room-current-link b,
.room-provider-grid b,
.room-hover-panel b {
  display: block;
  overflow: hidden;
  margin-top: .1rem;
  color: #0f172a;
  font-size: .9rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-current-link em {
  flex: 0 0 auto;
  border-radius: 0.44rem;
  background: #fff;
  color: #334155;
  padding: .45rem .55rem;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}

.room-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}
.room-provider-grid div {
  min-width: 0;
  border: 1px solid #eef2f7;
  border-radius: 0.495rem;
  background: #fff;
  padding: .65rem;
}
.room-provider-grid b { color: #334155; font-size: .76rem; }

.room-progress-wrap { display: grid; gap: .45rem; }
.room-progress-top b { color: #5e8c82; font-size: .72rem; font-weight: 900; }
.room-progress {
  height: .46rem;
  overflow: hidden;
  border-radius: .4rem;
  background: #eef2f7;
}
.room-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5e8c82, #06b6d4);
}
.room-board-card.is-ready .room-progress i { background: linear-gradient(90deg, #16a34a, #22c55e); }

.room-card-actions { gap: .5rem; }
.room-card-actions a {
  flex: 1 1 0;
  border-radius: 0.495rem;
  background: #0f172a;
  color: #fff;
  padding: .62rem .75rem;
  text-align: center;
  font-size: .73rem;
  font-weight: 900;
}
.room-card-actions a + a { background: #eef3f0; color: #48756c; }

.room-hover-panel {
  position: absolute;
  inset: auto .8rem .8rem .8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  border: 1px solid #e6efeb;
  border-radius: 0.55rem;
  background: rgba(255,255,255,.98);
  padding: .65rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .14s ease, transform .14s ease;
}
.room-board-card:hover .room-hover-panel,
.room-board-card:focus-within .room-hover-panel {
  opacity: 1;
  transform: translateY(0);
}
.room-hover-panel div { min-width: 0; }
.room-hover-panel b { font-size: .72rem; }

.room-side-stack,
.room-coverage-list,
.room-timeline-list { display: grid; gap: .65rem; }
.room-side-stack { gap: 1rem; }

.room-coverage-row,
.room-timeline-row {
  gap: .7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .72rem;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.room-coverage-row:hover,
.room-timeline-row:hover {
  transform: translateY(-1px);
  border-color: #cdddd7;
  background: #fbfdff;
}
.room-coverage-row > div,
.room-timeline-row > div { min-width: 0; flex: 1 1 auto; }
.room-coverage-row b,
.room-coverage-row span,
.room-timeline-row b,
.room-timeline-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-coverage-row b,
.room-timeline-row b { color: #0f172a; font-size: .82rem; font-weight: 900; }
.room-coverage-row span,
.room-timeline-row span { margin-top: .12rem; color: #64748b; font-size: .7rem; font-weight: 850; }
.room-coverage-row em,
.room-timeline-row time {
  flex: 0 0 auto;
  border-radius: 0.413rem;
  background: #f8fafc;
  color: #334155;
  padding: .42rem .5rem;
  font-size: .7rem;
  font-style: normal;
  font-weight: 900;
}
.room-timeline-row time { color: #5e8c82; }

.room-empty-state {
  display: grid;
  place-items: center;
  gap: .35rem;
  min-height: 18rem;
  grid-column: 1 / -1;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}
.room-empty-state b { color: #0f172a; font-size: 1rem; font-weight: 900; }
.room-empty-state span { font-size: .82rem; font-weight: 850; }
.room-empty-small {
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  padding: .85rem;
  text-align: center;
  font-size: .8rem;
  font-weight: 850;
}

@media (max-width: 1180px) {
  .room-hero,
  .room-layout-grid { grid-template-columns: 1fr; }
  .room-board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .room-metric-row,
  .room-board-grid,
  .room-filter-row,
  .room-provider-grid { grid-template-columns: 1fr; }
  .room-hover-panel { position: static; opacity: 1; transform: none; box-shadow: none; pointer-events: auto; }
}

/* v17 room hover cleanup + treatments refinement */
.room-hover-panel { display: none !important; }
.room-board-card { min-height: 16.5rem; }
.room-card-actions { position: relative; z-index: 2; }
.room-board-card:hover .room-card-actions a { box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }

.treatment-page-shell {
  display: grid;
  gap: 1.25rem;
}

.treatment-header,
.treatment-actions,
.treatment-section-head,

.treatment-header {
  justify-content: space-between;
  gap: 1rem;
}

.treatment-header h1 {
  margin-top: .35rem;
  color: #0f172a;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -.025em;
}

.treatment-actions { gap: .65rem; flex-wrap: wrap; }

.treatment-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}

.treatment-stat {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.treatment-stat:hover,
.treatment-stat.active {
  transform: translateY(-2px);
  border-color: rgba(94, 140, 130, .34);
  background: linear-gradient(135deg, #ffffff 0%, #eef3f0 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.treatment-stat span {
  display: block;
  color: #64748b;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.treatment-stat b {
  display: block;
  margin-top: .55rem;
  color: #0f172a;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.treatment-toolbar {
  gap: .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: rgba(255,255,255,.92);
  padding: .8rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.treatment-search {
  display: flex;
  flex: 1 1 22rem;
  align-items: center;
  gap: .65rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #f8fafc;
  padding: .72rem .9rem;
}

.treatment-search span { color: #64748b; font-weight: 900; }
.treatment-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font-size: .88rem;
  font-weight: 800;
}

.treatment-toolbar select,
.treatment-toolbar button {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  color: #334155;
  padding: .72rem .9rem;
  font-size: .82rem;
  font-weight: 900;
}

.treatment-toolbar button:hover,
.treatment-toolbar select:hover { border-color: rgba(94, 140, 130,.32); background: #f8fafc; }

.treatment-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23rem;
  gap: 1rem;
  align-items: start;
}

.treatment-worklog-card {
  border-radius: 0.55rem;
}

.treatment-section-head {
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  padding: 1.05rem 1.1rem;
}

.treatment-section-head h2,

.treatment-section-head span:not(.pill),

.treatment-list {
  display: grid;
  gap: .75rem;
  padding: 1rem;
}

.treatment-log-row {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr) 6rem;
  align-items: center;
  gap: .9rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .85rem;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.treatment-log-row:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 140, 130,.32);
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.treatment-time {
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: #eef3f0;
  padding: .7rem .35rem;
  color: #48756c;
}

.treatment-time b { font-size: .95rem; font-weight: 900; }
.treatment-time span { margin-top: .1rem; font-size: .68rem; font-weight: 900; color: #64748b; }

.treatment-main { min-width: 0; }
.treatment-title-line { justify-content: space-between; gap: .7rem; }
.treatment-title-line h3 {
  overflow: hidden;
  color: #0f172a;
  font-size: .96rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treatment-meta-line,
.treatment-sub-line {
  flex-wrap: wrap;
  gap: .38rem .8rem;
  margin-top: .38rem;
}

.treatment-meta-line span {
  color: #334155;
  font-size: .78rem;
  font-weight: 900;
}

.treatment-sub-line span {
  color: #64748b;
  font-size: .7rem;
  font-weight: 850;
}

.treatment-sub-line span + span::before,
.treatment-meta-line span + span::before {
  content: "";
  display: inline-block;
  width: .28rem;
  height: .28rem;
  margin-right: .55rem;
  vertical-align: middle;
  border-radius: .4rem;
  background: #cbd5e1;
}

.treatment-value {
  text-align: right;
}
.treatment-value b {
  display: block;
  color: #0f172a;
  font-size: .9rem;
  font-weight: 900;
}
.treatment-value span {
  display: block;
  margin-top: .2rem;
  color: #64748b;
  font-size: .68rem;
  font-weight: 900;
}

.treatment-side-stack { display: grid; gap: 1rem; }

.provider-stat-list,

.treatment-stat-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Procedure mix: percentage rows that double as the category filter
 * (they replaced the Restorative / Clinical services tiles). */
.treatment-mix-list { display: grid; gap: .5rem; }
.treatment-mix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.495rem;
  background: #fff;
  padding: .55rem .7rem;
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
.treatment-mix-row:hover { border-color: #cdddd7; background: #fbfdff; transform: translateY(-1px); }
.treatment-mix-row.active {
  border-color: rgba(94, 140, 130, .5);
  background: linear-gradient(135deg, #ffffff 0%, #eef3f0 100%);
}
.treatment-mix-row b { display: block; color: #334155; font-size: .78rem; font-weight: 900; }
.treatment-mix-row div span { display: block; margin-top: .1rem; color: #64748b; font-size: .68rem; font-weight: 850; }
.treatment-mix-row em {
  flex: 0 0 auto;
  color: #5e8c82;
  font-size: 1.05rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: -.02em;
}

.provider-stat-row {
  gap: .7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .72rem;
}
.provider-avatar {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: .85rem;
  background: #eef3f0;
  color: #48756c;
  font-size: .78rem;
  font-weight: 900;
}
.provider-stat-row div:nth-child(2) { min-width: 0; flex: 1; }
.provider-stat-row b { display: block; color: #0f172a; font-size: .82rem; font-weight: 900; }
.provider-stat-row span { display: block; margin-top: .1rem; color: #64748b; font-size: .7rem; font-weight: 850; }
.provider-stat-row em { color: #0f172a; font-size: .76rem; font-style: normal; font-weight: 900; white-space: nowrap; }


.treatment-empty {
  display: grid;
  place-items: center;
  min-height: 9rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
  font-weight: 850;
}
.treatment-empty b { color: #0f172a; }
.treatment-empty span { margin-top: .15rem; font-size: .8rem; }
.treatment-empty.small { min-height: 4.5rem; padding: .85rem; }

@media (max-width: 1180px) {
  .treatment-layout-grid { grid-template-columns: 1fr; }
  .treatment-side-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .treatment-stat-grid,
  .treatment-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .treatment-toolbar { flex-wrap: wrap; }
  .treatment-toolbar select,
  .treatment-toolbar button { flex: 1 1 12rem; }
}

@media (max-width: 680px) {
  .treatment-header { align-items: flex-start; flex-direction: column; }
  .treatment-stat-grid,
  .treatment-side-stack { grid-template-columns: 1fr; }
  .treatment-log-row { grid-template-columns: 1fr; }
  .treatment-time { place-items: start; }
  .treatment-value { text-align: left; }
}

/* v18 unified app polish + New Visit workspace */
.app-workspace-page,
.patient-search-page,
.staff-page,
.room-board-page,
.treatment-page-shell,
.schedule-page-v13 {
  max-width: min(1680px, calc(100vw - 2rem));
}

.spa-view main.page-shell {
  animation: pageSoftIn .2s ease both;
}

@keyframes pageSoftIn {
  from { opacity: .96; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.1rem;
}

.workspace-header h1,
.patient-search-hero h1,
.staff-hero h1,
.room-hero h1,
.treatment-page-header h1 {
  margin-top: .12rem;
  color: #0f172a;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  font-weight: 900;
  letter-spacing: -.02em;
}

.workspace-header p {
  margin-top: .35rem;
  color: #64748b;
  font-size: .92rem;
  font-weight: 800;
}

.workspace-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .65rem;
}

.btn-primary,
.btn-secondary,
.btn-soft {
  display: inline-flex;
  min-height: 2.7rem;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: 0.55rem;
  padding: .78rem 1rem;
  font-size: .84rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}

.btn-primary { border: 1px solid #5e8c82; background: #5e8c82; color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.btn-secondary { border: 1px solid #dbe3ef; background: rgba(255,255,255,.88); color: #334155; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.btn-soft { border: 1px solid #e6efeb; background: #eef3f0; color: #48756c; }
.btn-primary:hover,
.btn-secondary:hover,
.btn-soft:hover { transform: translateY(-2px); }

.input,
.select,
.textarea,
.rx-input {
  min-height: 2.8rem;
  border-radius: 0.55rem;
  font-weight: 800;
}

.analysis-card,

.visit-page {
  --visit-border: #e2e8f0;
  --visit-muted: #64748b;
  padding-bottom: 7rem;
}

.visit-header-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background:
    radial-gradient(circle at 10% 0%, rgba(94, 140, 130,.10), transparent 20rem),
    radial-gradient(circle at 100% 10%, rgba(20,184,166,.12), transparent 18rem),
    rgba(255,255,255,.88);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.visit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: 1.1rem;
}

.visit-kpi {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: rgba(255,255,255,.9);
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.visit-kpi span,
.visit-kpi b { display: block; }
.visit-kpi span { overflow: hidden; color: #0f172a; font-size: 1.4rem; font-weight: 900; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.visit-kpi b { margin-top: .18rem; color: #64748b; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }

.visit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.1rem;
  align-items: start;
}

.visit-main-stack,


.visit-section-head,

.visit-section-head h2,

.visit-section-head > div {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.visit-step {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 0.468rem;
  background: #eef3f0;
  color: #48756c;
  font-size: .74rem;
  font-weight: 900;
}

.visit-mini-link {
  border: 1px solid #e6efeb;
  border-radius: .4rem;
  background: #eef3f0;
  color: #48756c;
  padding: .42rem .72rem;
  font-size: .72rem;
  font-weight: 900;
}

.visit-patient-search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
  border: 1px solid #dbe3ef;
  border-radius: 1.15rem;
  background: #fff;
  padding: .8rem .9rem;
}

.visit-patient-search span { color: #94a3b8; font-size: 1.15rem; font-weight: 900; }
.visit-patient-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: .94rem; font-weight: 850; }
.visit-patient-search button {
  border-radius: .8rem;
  background: #f1f5f9;
  color: #64748b;
  padding: .48rem .7rem;
  font-size: .72rem;
  font-weight: 900;
}


.visit-patient-results {
  display: grid;
  gap: .55rem;
  max-height: 18rem;
  overflow: auto;
  padding-right: .2rem;
}

.visit-patient-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .78rem;
  text-align: left;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.visit-patient-result:hover,
.visit-patient-result.selected { transform: translateY(-1px); border-color: #93c5fd; background: #f8fbff; }
.visit-patient-result em { color: #64748b; font-size: .68rem; font-style: normal; font-weight: 900; }
.visit-avatar {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border-radius: .95rem;
  background: linear-gradient(135deg, #e6efeb, #ccfbf1);
  color: #48756c;
  font-size: .8rem;
  font-weight: 900;
}
.visit-avatar.large { width: 3.1rem; height: 3.1rem; border-radius: 1.1rem; }
.visit-patient-text b,
.visit-patient-text small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-patient-text b { color: #0f172a; font-size: .88rem; font-weight: 900; }
.visit-patient-text small { margin-top: .08rem; color: #64748b; font-size: .72rem; font-weight: 850; }

.visit-selected-top { display: flex; align-items: center; gap: .8rem; }
.visit-selected-top h3 { color: #0f172a; font-size: 1rem; font-weight: 900; }
.visit-selected-top p { color: #64748b; font-size: .76rem; font-weight: 850; }

.visit-new-patient {
  margin-top: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .9rem 1rem;
}
.visit-new-patient summary { cursor: pointer; color: #334155; font-size: .84rem; font-weight: 900; }

.visit-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .85rem;
}
.visit-form-grid-compact { grid-template-columns: repeat(4, minmax(0,1fr)); }
.visit-form-grid label > span {
  display: block;
  margin-bottom: .35rem;
  color: #475569;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.visit-wide { grid-column: 1 / -1; }
.visit-page .textarea { min-height: 6rem; }

.visit-availability-strip {
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .85rem;
}
.visit-availability-list { display: grid; gap: .5rem; max-height: 12rem; overflow: auto; }
.visit-slot {
  display: grid;
  grid-template-columns: 3.8rem minmax(0,1fr) auto;
  align-items: center;
  gap: .65rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.522rem;
  background: white;
  padding: .62rem .7rem;
  color: #334155;
}
.visit-slot b { color: #0f172a; font-size: .8rem; font-weight: 900; }
.visit-slot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 900; }
.visit-slot em { color: #64748b; font-size: .68rem; font-style: normal; font-weight: 900; }


.visit-alerts,
.visit-alert {
  border: 1px solid #fde68a;
  border-radius: 0.55rem;
  background: #fffbeb;
  padding: .75rem;
}
.visit-alert span { display: inline-flex; margin-bottom: .25rem; color: #b45309; font-size: .62rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.visit-alert b { display: block; color: #78350f; font-size: .78rem; font-weight: 900; line-height: 1.35; }
.visit-empty {
  display: grid;
  min-height: 5rem;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  padding: 1rem;
  font-size: .82rem;
  font-weight: 850;
  text-align: center;
}
.visit-empty.compact { min-height: 3.4rem; }
.visit-save-toast {
  position: fixed;
  right: 1.35rem;
  bottom: 1.35rem;
  z-index: 80;
  max-width: min(25rem, calc(100vw - 2rem));
  border: 1px solid #bbf7d0;
  border-radius: 0.55rem;
  background: #f0fdf4;
  color: #166534;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  padding: .9rem 1rem;
  font-size: .86rem;
  font-weight: 850;
  transition: opacity .18s ease, transform .18s ease;
}
.visit-save-toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1280px) {
  .visit-grid,
        .visit-form-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .workspace-header { align-items: stretch; flex-direction: column; }
  .workspace-actions { justify-content: flex-start; }
  .visit-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .visit-patient-search { grid-template-columns: auto 1fr; }
  .visit-patient-search button { grid-column: 1 / -1; }
  .visit-slot { grid-template-columns: 3.2rem minmax(0, 1fr); }
  .visit-slot em { grid-column: 2; }
}

/* v19 page consistency: Staff / Rooms headers + patient-centred New Visit */
.app-page-v19 {
  max-width: 1500px;
}
.app-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1rem;
}
.app-section-header h1 {
  margin-top: .25rem;
  color: #0f172a;
  font-size: clamp(2rem, 4vw, 3.05rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: .98;
}
.app-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
}
.app-toolbar-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, .9fr);
  align-items: end;
  gap: .9rem;
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
}
.app-search-bar-v19 {
  min-height: 3.45rem;
  border-color: #dbe3ef !important;
  box-shadow: none !important;
}
.app-filter-row-v19 {
  align-items: end;
}
.app-filter-row-v19.compact-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.app-metric-row-v19 {
  margin-top: .9rem;
}
.app-metric-v19 {
  cursor: default;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
button.app-metric-v19 { text-align: left; }
.app-metric-v19:hover,
.app-metric-v19.active {
  transform: translateY(-1px);
  border-color: #cdddd7;
  background: #f8fbff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.app-content-grid-v19 {
  margin-top: .9rem;
}
.app-card-head-v19 {
  background: linear-gradient(180deg, rgba(248,250,252,.82), rgba(255,255,255,.95));
}
.app-card-head-v19.compact {
  background: transparent;
}
.staff-toolbar-v19 .staff-filter-row,
.room-toolbar-v19 .room-filter-row {
  margin: 0;
}
.staff-toolbar-v19 .staff-search-bar,
.room-toolbar-v19 .room-search-bar {
  margin: 0;
}
.staff-page .staff-hero,
.room-board-page .room-hero {
  display: none;
}
.staff-page .staff-section-head h2,
.room-board-page .room-section-head h2 {
  letter-spacing: -.025em;
}
.room-board-page .room-board-grid,
.staff-page .staff-directory-list {
  background: #fff;
}

.visit-header-v19 {
  align-items: center;
}
.visit-centred-panel {
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.visit-subsection-title {
  color: #334155;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.visit-page .visit-kpi-grid {
  display: none !important;
}
.visit-page .visit-page .visit-patient-results {
  max-height: 16.5rem;
}

@media (max-width: 1280px) {
  .app-toolbar-card,
  }
@media (max-width: 900px) {
  .app-section-header {
    align-items: stretch;
    flex-direction: column;
  }
  .app-header-actions {
    justify-content: flex-start;
  }
  .app-filter-row-v19,
  .app-filter-row-v19.compact-2,
  }

/* v20 refined individual patient file */
.patient-file-page {
  --patient-blue: #5e8c82;
  --patient-border: #e2e8f0;
  --patient-muted: #64748b;
}
.app-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--patient-border);
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.patient-profile-hero {
  display: grid;
  gap: 1.1rem;
  padding: 1.35rem;
}
.patient-identity-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 1rem;
}
.patient-avatar-xl {
  display: grid;
  flex: 0 0 auto;
  width: 4.6rem;
  height: 4.6rem;
  place-items: center;
  border-radius: 1.45rem;
  background: linear-gradient(135deg, #5e8c82, #06b6d4);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 18px 30px rgba(94, 140, 130, .22);
}
.patient-profile-hero h1 {
  margin-top: .45rem;
  color: #0f172a;
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: .98;
}
.patient-id-line {
  margin-top: .55rem;
  color: #64748b;
  font-size: .86rem;
  font-weight: 850;
}
.patient-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.primary-btn,
.secondary-btn,
.icon-btn,
.mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  font-size: .82rem;
  font-weight: 900;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.primary-btn {
  border: 1px solid #5e8c82;
  background: #5e8c82;
  color: #fff;
  padding: .75rem 1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.secondary-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  padding: .75rem 1rem;
}
.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover,
.mini-action:hover {
  transform: translateY(-1px);
}
.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
}
.mini-action {
  border: 1px solid #cdddd7;
  background: #eef3f0;
  color: #48756c;
  padding: .42rem .65rem;
  font-size: .72rem;
}
.patient-hero-strip {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.patient-quick-fact {
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .85rem .95rem;
}
.patient-quick-fact span,
.case-summary-card span {
  display: block;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.patient-quick-fact b,
.case-summary-card b {
  display: block;
  min-width: 0;
  margin-top: .28rem;
  overflow: hidden;
  color: #0f172a;
  font-size: .83rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-pill {
  display: inline-flex !important;
  width: fit-content;
  border-radius: .4rem;
  padding: .18rem .55rem;
  font-size: .72rem !important;
}
.patient-file-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 1rem;
}
.patient-file-sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
}
.patient-side-card {
  padding: 1.05rem;
}
.side-title-row,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.side-section-title,
.modal-section-title {
  color: #0f172a;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.patient-detail-list {
  display: grid;
  gap: .65rem;
  margin-top: .8rem;
}
.patient-detail-list div {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: .55rem;
}
.patient-detail-list dt {
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 900;
}
.patient-detail-list dd {
  max-width: 55%;
  overflow: hidden;
  color: #0f172a;
  font-size: .78rem;
  font-weight: 900;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.medical-summary-list,
.side-list,
.case-stack,
.notes-list,
.medical-summary-item,
.mini-row {
  display: grid;
  gap: .18rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .78rem;
  text-decoration: none;
}
.medical-summary-item b,
.mini-row b {
  overflow: hidden;
  color: #0f172a;
  font-size: .78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.medical-summary-item span,
.mini-row span {
  overflow: hidden;
  color: #64748b;
  font-size: .7rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-mini,
.empty-state-soft {
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #64748b;
  padding: .9rem;
  font-size: .82rem;
  font-weight: 850;
}
.patient-file-main {
  min-width: 0;
}
.patient-tabs {
  display: flex;
  gap: .35rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .32rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.patient-tab {
  border: 0;
  border-radius: 0.522rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: .68rem .95rem;
  font-size: .82rem;
  font-weight: 900;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.patient-tab.active,
.patient-tab:hover {
  background: #eef3f0;
  color: #48756c;
}
.patient-panel-root {
  margin-top: 1rem;
}
.patient-overview-grid,
.patient-section-card {
  padding: 1.1rem;
}
.section-head h2 {
  color: #0f172a;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: -.02em;
}
.section-head.compact h2 {
  font-size: 1.05rem;
}
.section-eyebrow {
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.case-summary-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}
.case-summary-card,
.workflow-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: .9rem;
}
.workflow-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-radius: 0.468rem;
  background: #fff;
  padding: .62rem .75rem;
  color: #64748b;
  font-size: .8rem;
  font-weight: 850;
}
.workflow-line b {
  color: #0f172a;
  font-size: .78rem;
}
.patient-action-card {
  display: grid;
  gap: .25rem;
  border: 1px solid #e6efeb;
  border-radius: 0.55rem;
  background: #f8fbff;
  padding: .9rem;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.patient-action-card:hover,
.patient-case-row:hover,
.patient-action-card b,
.patient-case-row b,
.patient-action-card span,
.patient-case-row span,
.patient-case-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .78rem;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.patient-case-row.active {
  border-color: #93c5fd;
  background: #eef3f0;
}
.patient-inline-form,
.note-composer {
  display: grid;
  gap: .75rem;
  border: 1px solid #e6efeb;
  border-radius: 0.55rem;
  background: #eef3f0;
  padding: .85rem;
}
.note-composer {
  margin-top: 1rem;
}
.note-pin {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #64748b;
  font-size: .82rem;
  font-weight: 900;
}
.patient-note-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: 1rem;
  transition: transform .15s ease, border-color .15s ease;
}
.patient-note-card.pinned {
  border-color: #fde68a;
  background: #fffbeb;
}
.note-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.note-top small,
.patient-note-card footer {
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 850;
}
.patient-note-card h3 {
  margin-top: .75rem;
  color: #0f172a;
  font-size: .98rem;
  font-weight: 900;
}
.patient-note-card p {
  margin-top: .35rem;
  color: #475569;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
}
.patient-note-card footer {
  margin-top: .75rem;
}
.prescription-grid {
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}
.patient-modal.hidden {
  display: none;
}
.patient-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.patient-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .36);
  backdrop-filter: blur(5px);
}
.patient-modal-panel {
  position: relative;
  display: grid;
  width: min(1120px, 96vw);
  max-height: min(780px, 92vh);
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}
.patient-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255,255,255,.94);
  padding: 1.1rem 1.2rem;
  backdrop-filter: blur(10px);
}
.patient-modal-header h2 {
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 900;
}
.medical-modal-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 360px minmax(0, 1fr);
  padding: 1.1rem;
}
.medical-condition-panel,
.medical-alert-panel,
.medical-note-box {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #f8fafc;
  padding: 1rem;
}
.condition-list {
  display: grid;
  gap: .55rem;
  margin-top: .75rem;
}
.condition-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .7rem;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  cursor: pointer;
  padding: .78rem;
}
.condition-chip:hover {
  border-color: #93c5fd;
}
.condition-chip input {
  width: 1.05rem;
  height: 1.05rem;
}
.condition-chip .block:first-child {
  color: #0f172a;
  font-size: .82rem;
  font-weight: 900;
}
.medical-alert-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: .75rem;
}
.clinical-alert-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .9rem;
}
.clinical-alert-card h3 {
  color: #0f172a;
  font-size: .86rem;
  font-weight: 900;
}
.clinical-alert-card p,
.clinical-alert-card li {
  color: #475569;
  font-size: .77rem;
  font-weight: 750;
  line-height: 1.45;
}
.clinical-alert-card ul {
  display: grid;
  gap: .45rem;
  margin-top: .65rem;
}
.clinical-alert-card li {
  list-style: none;
}
.clinical-alert-card li::before {
  content: '•';
  margin-right: .35rem;
  color: #5e8c82;
  font-weight: 900;
}
.medical-note-box {
  margin: 0 1.1rem 1.1rem;
}
@media (min-width: 980px) {
  .patient-profile-hero {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .patient-hero-strip {
    grid-column: 1 / -1;
  }
}
@media (max-width: 1180px) {
  .patient-file-layout,
  .patient-overview-grid,
    .patient-file-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .patient-hero-strip,
  .case-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 780px) {
  .patient-profile-hero,
  .patient-section-card,
  .patient-side-card {
    border-radius: 0.55rem;
  }
  .patient-identity-block {
    align-items: flex-start;
  }
  .patient-avatar-xl {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.1rem;
  }
  .patient-file-sidebar,
  .patient-hero-strip,
  .case-summary-grid,
  .medical-modal-grid,
  .medical-alert-grid,
  .prescription-grid {
    grid-template-columns: 1fr;
  }
  .patient-hero-actions,
  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
  .patient-modal {
    padding: .45rem;
  }
  .patient-modal-panel {
    max-height: 96vh;
    border-radius: 0.55rem;
  }
}

/* v21 patient file cleanup: no left sidebar, full-page medical record */
.patient-file-v21 .patient-file-main-wide {
  max-width: 100%;
}
.patient-file-v21 .patient-hero-v21 {
  padding: 1.25rem;
}
.patient-file-v21 .patient-profile-hero h1 {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
}
.patient-file-v21 .patient-hero-strip-v21 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.patient-file-v21 .patient-tabs {
  position: sticky;
  top: .75rem;
  z-index: 20;
  margin-inline: auto;
}
.patient-file-v21 .patient-overview-v21 {
  display: grid;
  gap: 1rem;
}
.patient-file-v21 .patient-primary-workspace {
  padding: 1.2rem;
}
.patient-file-v21 .patient-split-v21 {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.patient-file-v21 .case-summary-grid-v21 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.patient-file-v21 .case-stack-v21 {
  max-height: none;
}
.patient-file-v21 .patient-inline-form-v21 {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px minmax(200px, .65fr) auto;
  align-items: center;
}
.patient-file-v21 .patient-file-v21 .notes-list-v21 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.patient-medical-page-v21 {
  display: grid;
  gap: 1rem;
}
.medical-status-grid-v21 {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.medical-metric-v21 {
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  padding: .95rem;
}
.medical-metric-v21 span {
  display: block;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.medical-metric-v21 b {
  margin-top: .45rem;
}
.medical-layout-v21 {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
}
.condition-list-v21 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.condition-chip-v21 {
  min-height: 76px;
}
.medication-form-v21 {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1rem;
  border: 1px solid #e6efeb;
  border-radius: 0.55rem;
  background: #eef3f0;
  padding: .9rem;
}
.medication-list-v21 {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}
.medication-card-v21 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.55rem;
  background: #fff;
  padding: .9rem;
}
.medication-card-v21 h3 {
  color: #0f172a;
  font-size: .95rem;
  font-weight: 900;
}
.medication-card-v21 p,
.medication-card-v21 small,
.medication-card-v21 em {
  display: block;
  margin-top: .18rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.45;
}
.medication-card-v21 em {
  color: #334155;
  font-style: normal;
}
.allergy-form-v21 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  margin-top: 1rem;
}
.allergy-pill-list-v21 {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .8rem;
}
.allergy-pill-list-v21 button {
  margin-left: .35rem;
  font-weight: 900;
}
.medical-alert-grid-v21 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.clinical-alert-card-v21 {
  min-height: 164px;
}
.note-composer-v21 {
  background: #fff;
  border-color: #e2e8f0;
}
@media (max-width: 1180px) {
  .patient-file-v21 .patient-hero-strip-v21,
  .medical-status-grid-v21,
  .patient-file-v21 .case-summary-grid-v21 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .patient-file-v21 .patient-split-v21,
  .patient-file-v21   .patient-file-v21 .patient-inline-form-v21,
  .medication-form-v21 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 760px) {
  .patient-file-v21 .patient-hero-strip-v21,
  .medical-status-grid-v21,
  .condition-list-v21,
  .medical-alert-grid-v21,
  .patient-file-v21 .case-summary-grid-v21,
  .patient-file-v21 .patient-inline-form-v21,
  .medication-form-v21,
  .allergy-form-v21 {
    grid-template-columns: 1fr;
  }
  .patient-file-v21 .patient-tabs {
    width: 100%;
  }
}

/* v22 patient file cleanup */
.patient-overview-v22 {
  display: grid;
  gap: 1rem;
}
.patient-overview-v22 .patient-primary-workspace {
  min-height: 0;
}
.case-summary-grid-v22 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.workflow-card-v22 {
  min-height: 220px;
}
.patient-handoff-v22 {
  margin-top: 0;
}
@media (max-width: 768px) {
  .case-summary-grid-v22 { grid-template-columns: 1fr; }
  .workflow-card-v22 { min-height: auto; }
}

/* ============================================================ *\
   Holistic 3D charting workspace
\* ============================================================ */
.chart3d-root { padding-bottom: 3rem; }
.chart3d-grid {
  display: grid;
  grid-template-columns: var(--chart-rail-w) minmax(0, 1fr) var(--chart-side-w);
  gap: var(--chart-gap);
  align-items: start;
}
@media (max-width: 1500px) {
  .chart3d-grid { grid-template-columns: var(--chart-rail-w-sm) minmax(0, 1fr) var(--chart-side-w-sm); }
}
@media (max-width: 1180px) {
  .chart3d-grid { grid-template-columns: 1fr; }
  .chart3d-rail { display: grid; grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .chart3d-rail { grid-template-columns: 1fr; }
}

.glass3d {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e6ebf3;
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  backdrop-filter: blur(6px);
}
.topbar3d { padding: 1.3rem 1.5rem; }
.stat3d {
  border: 1px solid #eef2f7;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #fbfdff, #f3f7fc);
  padding: 0.75rem 0.9rem;
}

/* buttons */
.btn3d {
  border-radius: 0.55rem; padding: 0.7rem 1rem; font-weight: 900; font-size: 0.86rem;
  border: 1px solid transparent; cursor: pointer; transition: all 140ms ease;
}
.btn3d-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.btn3d-primary:hover { background: var(--brand-700); }
.btn3d-primary:disabled { opacity: 0.55; }
.btn3d-ghost { background: #fff; border-color: #d7dee8; color: #475569; }
.btn3d-ghost:hover { background: #f5f8fc; }
.btn3d-danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.btn3d-danger:hover { background: #fee2e2; }
.btn3d-soft { background: #eef4ff; border-color: #d6e4ff; color: #48756c; }
.btn3d-soft:hover { background: #e0ecff; }

/* left rail */
.chart3d-rail { display: grid; gap: var(--chart-gap); align-content: start; min-width: 0; }
.rail-title { font-size: 0.78rem; font-weight: 900; letter-spacing: 0.05em; color: #0f172a; }
.rail-help { margin-top: 0.35rem; font-size: 0.72rem; font-weight: 650; line-height: 1.25rem; color: #94a3b8; }
.view-btn {
  border: 1px solid #e2e8f0; background: #fff; border-radius: 0.44rem; padding: 0.55rem 0.3rem;
  font-size: 0.74rem; font-weight: 900; color: #475569; transition: all 130ms ease; cursor: pointer;
}
.view-btn:hover { border-color: var(--brand); color: var(--brand); background: #f5f9ff; }
.legend-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; font-weight: 800; color: #475569; }
.legend-swatch { width: 0.95rem; height: 0.95rem; border-radius: 0.2rem; box-shadow: inset 0 0 0 1px rgba(15,23,42,0.12); }

/* viewport — the signature element */
.viewport3d {
  position: relative; overflow: hidden; padding: 0;
  height: min(74vh, 760px); min-height: 460px;
  background:
    radial-gradient(120% 90% at 50% 0%, #1b2740 0%, #0c1424 55%, #070d18 100%);
  border: 1px solid #1e293b;
  box-shadow: 0 30px 60px -30px rgba(8, 13, 24, 0.8), inset 0 1px 0 rgba(148, 197, 255, 0.08);
}
.viewport3d-canvas { position: absolute; inset: 0; }
.viewport3d-badge {
  position: absolute; top: 0.9rem; left: 0.9rem; z-index: 2;
  padding: 0.4rem 0.8rem; border-radius: .4rem; font-size: 0.74rem; font-weight: 900;
  color: #dbe7ff; background: rgba(20, 32, 56, 0.7); border: 1px solid rgba(138, 163, 155, 0.3);
  backdrop-filter: blur(4px);
}
.viewport3d-hint {
  position: absolute; bottom: 0.9rem; right: 0.9rem; z-index: 2;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(148, 178, 220, 0.65);
}

/* side panel */
.chart3d-side { display: grid; gap: var(--chart-gap); align-content: start; min-width: 0; }
.seg-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; padding: 0.3rem;
  background: #eef2f7; border-radius: 0.55rem; border: 1px solid #e2e8f0;
}
.seg-tabs button { border: none; background: transparent; border-radius: 0.413rem; padding: 0.55rem; font-weight: 900; font-size: 0.82rem; color: #64748b; cursor: pointer; }
.seg-tabs button.active { background: #fff; color: var(--brand); box-shadow: 0 4px 12px -6px rgba(15, 23, 42, 0.3); }

/* surface map */
.surfacemap { display: grid; gap: 0.4rem; }
.sm-svg { width: 116px; height: 116px; border-radius: 0.495rem; background: #0c1424; padding: 6px; box-shadow: inset 0 0 0 1px #1e293b; }
.sm-zone { stroke: #0c1424; stroke-width: 1.5; cursor: pointer; transition: opacity 120ms ease; opacity: 0.92; }
.sm-zone:hover { opacity: 1; }
.sm-zone.sel { stroke: #8aa39b; stroke-width: 3; }
.sm-label { font-size: 9px; font-weight: 900; fill: #94a3b8; text-anchor: middle; pointer-events: none; }
.sm-label-o { fill: #cbd5e1; }
.sm-caption { font-size: 0.68rem; font-weight: 800; color: #94a3b8; max-width: 116px; line-height: 0.95rem; }

.mini-label { font-size: 0.68rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #94a3b8; margin-bottom: 0.3rem; }
.present-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; font-weight: 900; color: #475569; }
.present-toggle input { accent-color: var(--brand); }

/* entries */
.entry-row { border: 1px solid #e9eef5; border-radius: 0.495rem; background: #fbfdff; padding: 0.7rem 0.8rem; cursor: pointer; transition: border-color 120ms ease; }
.entry-row:hover { border-color: #cdd9ea; }
.entry-surfaces { display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 1.5rem; padding: 0 0.4rem; border-radius: 0.5rem; background: #0f172a; color: #fff; font-size: 0.72rem; font-weight: 900; }
.chip { display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; border-radius: .4rem; font-size: 0.72rem; font-weight: 850; }
.status-select { border: 1px solid #e2e8f0; border-radius: 0.33rem; padding: 0.3rem 0.5rem; font-size: 0.74rem; font-weight: 900; background: #fff; }
.entry-del { font-size: 0.72rem; font-weight: 900; color: #b91c1c; background: none; border: none; cursor: pointer; }
.entry-del:hover { text-decoration: underline; }

/* perio controls */
.probe-cell { display: grid; gap: 0.15rem; text-align: center; font-size: 0.62rem; font-weight: 900; color: #94a3b8; }
.probe-cell input { width: 100%; border: 1px solid #cbd5e1; border-radius: 0.45rem; padding: 0.25rem 0; text-align: center; font-weight: 900; color: #0f172a; }
.bop-cell { border: 1px solid #e2e8f0; border-radius: 0.5rem; padding: 0.3rem 0; font-size: 0.68rem; font-weight: 900; color: #94a3b8; background: #fff; cursor: pointer; }
.bop-cell.on { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.mob-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 0.33rem; padding: 0.45rem 0; font-size: 0.72rem; font-weight: 900; color: #475569; cursor: pointer; }
.mob-btn.active { border-color: var(--brand); background: #eef3f0; color: var(--brand); }
.range3d { width: 100%; accent-color: var(--brand); }

/* plan */
.phase-block { border: 1px solid #e9eef5; border-radius: 0.55rem; background: #fbfdff; padding: 0.8rem; }
.phase-head { display: flex; align-items: center; gap: 0.55rem; font-weight: 900; font-size: 0.86rem; color: #0f172a; }
.phase-num { font-size: 0.7rem; font-weight: 900; color: #5e8c82; background: #eaf1ff; border-radius: 0.248rem; padding: 0.1rem 0.4rem; }
.phase-count { margin-left: auto; font-size: 0.7rem; font-weight: 900; color: #94a3b8; background: #f1f5f9; border-radius: .4rem; padding: 0.05rem 0.5rem; }
.phase-empty { margin-top: 0.4rem; font-size: 0.74rem; font-weight: 700; color: #b6c0cd; }
.plan-item, .plan-find { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; width: 100%; text-align: left; border: 1px solid #e9eef5; background: #fff; border-radius: 0.385rem; padding: 0.5rem 0.6rem; cursor: pointer; }
.plan-item:hover, .plan-find:hover { border-color: #cdd9ea; }
.plan-status { margin-left: auto; font-size: 0.72rem; font-weight: 900; }

/* ============================================================ *\
   2D Odontogram (tab32 / R4-style chart)
\* ============================================================ */
.chart2d-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chart-side-w);
  gap: var(--chart-gap);
  align-items: start;
}
@media (max-width: 1500px) { .chart2d-grid { grid-template-columns: minmax(0, 1fr) var(--chart-side-w-sm); } }
@media (max-width: 1180px) { .chart2d-grid { grid-template-columns: 1fr; } }

.mode-switch {
  display: inline-flex; padding: 0.25rem; gap: 0.2rem; margin-right: 0.25rem;
  background: #eef2f7; border: 1px solid #e2e8f0; border-radius: 0.468rem;
}
.mode-switch button {
  border: none; background: transparent; border-radius: 0.33rem; padding: 0.5rem 0.85rem;
  font-size: 0.8rem; font-weight: 900; color: #64748b; cursor: pointer;
}
.mode-switch button.active { background: #fff; color: var(--brand); box-shadow: 0 4px 12px -6px rgba(15,23,42,0.3); }

.odo-wrap { padding: 1.1rem 1.2rem 1rem; }
.odo-quadrow { display: flex; justify-content: space-between; padding: 0 0.5rem; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: #94a3b8; }
.odo-quadrow span { width: 50%; }
.odo-quadrow span:last-child { text-align: right; }
.odo-scroll { overflow-x: auto; padding: 0.35rem 0; }
.odo-strip { min-width: 1010px; }
.odo-row { display: flex; align-items: flex-end; justify-content: center; gap: 1px; }
.odo-row:last-child { align-items: flex-start; }
.odo-midgap { width: 18px; flex: 0 0 18px; }
.odo-midline { height: 2px; background: linear-gradient(90deg, transparent, #e2e8f0 12%, #e2e8f0 88%, transparent); margin: 2px 0; }
.odo-cell {
  width: 58px; height: 152px; flex: 0 0 58px; cursor: pointer; border-radius: 6px;
  transition: background 120ms ease; overflow: visible;
}
.odo-cell.hov { background: rgba(94, 140, 130, 0.06); }
.odo-cell.sel { background: rgba(94, 140, 130, 0.09); }
.odo-cell-ring { fill: none; stroke: #5e8c82; stroke-width: 2; }
.odo-num { font-size: 12px; font-weight: 900; fill: #475569; }
.odo-cell.sel .odo-num { fill: #48756c; }

.odo-legendbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid #eef2f7; }
.odo-leg { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; font-weight: 800; color: #475569; }
.odo-leg-note { color: #94a3b8; font-weight: 700; }

/* bridge builder */
.bridge-preview { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.bridge-unit { font-size: 0.7rem; font-weight: 900; padding: 0.2rem 0.5rem; border-radius: 0.275rem; border: 1px solid; }
.bridge-unit.abut { background: #eef4ff; border-color: #c7dbff; color: #48756c; }
.bridge-unit.pontic { background: #fef2f4; border-color: #fbcfe8; color: #be185d; }

/* denture builder */
.bridge-unit.denture { background: #fdeef0; border-color: #f0c4cc; color: #b15464; }
.seg-tabs-sm { display: inline-flex; gap: 0.25rem; }
.seg-tabs-sm button { font-size: 0.72rem; font-weight: 900; padding: 0.28rem 0.7rem; border-radius: 0.303rem; border: 1px solid #d8dee6; background: #f3f5f8; color: #64748b; }
.seg-tabs-sm button.active { background: #4e9aa8; border-color: #4e9aa8; color: #fff; }
.bridge-unit.occupied { background: #eef1f4; border-color: #d3dae1; color: #94a3b8; }

/* duplicate-entry confirmation */
.dup-confirm { border: 1.5px solid #f59e0b !important; background: linear-gradient(180deg, #fffbeb, #fff7ed) !important; }

/* CAL (clinical attachment level) read-out in the perio section */
.cal-cell { display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px 2px; border-radius:4px; background:#f1f5f9; }
.cal-cell > span { font-size:9px; font-weight:800; color:#94a3b8; letter-spacing:.04em; }
.cal-val { font-size:13px; font-weight:900; color:#475569; line-height:1; }
.cal-cell.cal-hi { background:#fdecec; }
.cal-cell.cal-hi .cal-val { color:#c0392b; }
.cal-max { font-size:10px; font-weight:900; color:#64748b; }

/* ===== multi-select toolbar + bridge/denture builder popup ===== */
.odo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.odo-link-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 0.85rem; border-radius: .4rem; cursor: pointer;
  font-size: 0.78rem; font-weight: 900; letter-spacing: 0.01em;
  border: 1px solid #e2e8f0; background: #fff; color: #334155; transition: all 140ms ease;
}
.odo-link-btn:hover { border-color: var(--brand); color: var(--brand); background: #f5f9ff; }
.odo-link-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.odo-link-ico { font-size: 0.95rem; line-height: 1; }
.odo-link-hint { font-size: 0.72rem; font-weight: 800; color: #14b8a6; }
.odo-link-clear {
  font-size: 0.72rem; font-weight: 900; color: #64748b; cursor: pointer;
  padding: 0.35rem 0.7rem; border-radius: .4rem; border: 1px solid #e2e8f0; background: #fff;
}
.odo-link-clear:hover { background: #f1f5f9; }
.odo-build-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border-radius: .4rem; cursor: pointer;
  font-size: 0.78rem; font-weight: 900; letter-spacing: 0.01em;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); transition: all 140ms ease;
  animation: buildBtnIn 0.18s ease;
}
.odo-build-btn:hover { background: var(--brand-700); }
.odo-build-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
@keyframes buildBtnIn { from { opacity: 0; transform: translateY(-3px) scale(0.97); } to { opacity: 1; transform: none; } }

/* teal multi-select ring + tint */
.odo-cell.multi { background: rgba(20, 184, 166, 0.10); }
.odo-cell-mring { fill: none; stroke: #14b8a6; stroke-width: 2.4; stroke-dasharray: 5 3.5; }
.odo-cell.multi .odo-num { fill: #0f766e; }
.odo-cell.linking { cursor: copy; }

/* popup */
.prosth-overlay {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; background: rgba(15, 23, 42, 0.34); backdrop-filter: blur(2px); padding: 1rem;
  animation: prosthFade 0.16s ease;
}
@keyframes prosthFade { from { opacity: 0; } to { opacity: 1; } }
.prosth-card {
  width: min(420px, 96vw); margin: clamp(2.25rem, 13vh, 8rem) auto 2.5rem; padding: 1.15rem 1.25rem 1.25rem; border-radius: 0.55rem;
  animation: prosthPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes prosthPop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.prosth-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.prosth-title { font-size: 1.05rem; font-weight: 900; letter-spacing: -0.01em; color: #0f172a; }
.prosth-sub { margin-top: 0.15rem; font-size: 0.74rem; font-weight: 800; color: #94a3b8; }
.prosth-x { font-size: 0.95rem; font-weight: 900; color: #94a3b8; background: none; border: none; cursor: pointer; line-height: 1; padding: 0.2rem; }
.prosth-x:hover { color: #475569; }
.prosth-units { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.prosth-unit {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 52px;
  padding: 0.4rem 0.5rem; border-radius: 0.385rem; cursor: pointer;
  border: 1.5px solid transparent; font-weight: 900; transition: all 120ms ease;
}
.prosth-unit.ro { cursor: default; }
.prosth-unit .pu-fdi { font-size: 0.82rem; }
.prosth-unit .pu-role { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.85; }
.prosth-unit.abut { background: #eef3f0; border-color: #cdddd7; color: #48756c; }
.prosth-unit.pontic { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.prosth-unit.denture { background: #fdf2f6; border-color: #f0c2d4; color: #9d4368; }
.prosth-unit.occupied { background: #f1f5f9; border-color: #e2e8f0; color: #94a3b8; }
.prosth-unit.implant { background: #eef2f7; border-color: #c2c9d4; color: #5b6675; }
.prosth-unit:disabled { opacity: 1; }
.prosth-unit.pu-locked { cursor: default; box-shadow: inset 0 0 0 1.5px rgba(72, 117, 108,0.16); }
.prosth-unit.pu-locked:hover { filter: none; }
.prosth-unit.keep { background: #f8fafc; border-color: #e2e8f0; color: #64748b; }
.prosth-unit.abut:hover, .prosth-unit.pontic:hover { filter: brightness(0.97); }
.prosth-meta { font-size: 0.72rem; font-weight: 800; color: #64748b; }
.prosth-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
.prosth-actions .btn3d { width: auto; padding: 0.6rem 1.1rem; }

/* ---- Dentition toggle + eruption control (pediatric) ---- */
.dentition-stage { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: #eef4ff; color: var(--brand, #5e8c82); font-size: 12px; font-weight: 800; border: 1px solid #dbe6ff; white-space: nowrap; }
.erupt-card { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid #eef2f7; }
.erupt-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.erupt-btn { padding: 6px 4px; border-radius: 8px; font-size: 11.5px; font-weight: 800; color: #64748b; background: #fff; border: 1.5px solid #e2e8f0; cursor: pointer; transition: all .15s; }
.erupt-btn:hover { border-color: #cbd5e1; color: #334155; }
.erupt-btn.on { border-color: var(--brand, #5e8c82); color: var(--brand, #5e8c82); background: #eff4ff; box-shadow: inset 0 0 0 1px var(--brand, #5e8c82); }

/* implant: no caries / restorations note */
.implant-note { padding: 12px 14px; border-radius: 7px; background: #eef2f7; border: 1px solid #dbe3ec; color: #5b6675; font-size: 12.5px; font-weight: 700; line-height: 1.5; }

/* walk-in patient: add action + notice */
.walk-in-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.walk-in-notice { font-size: 12.5px; font-weight: 800; opacity: 0; transition: opacity .2s ease; }
.walk-in-notice.visible { opacity: 1; }
.walk-in-notice.ok { color: #047857; }
.walk-in-notice.error { color: #b91c1c; }
.input-error { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.15) !important; }

/* periodontal diagnosis card */
.perio-stage-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.perio-stage-badge { font-size: 15px; font-weight: 900; padding: 6px 14px; border-radius: 999px; color: #fff; background: #94a3b8; letter-spacing: .2px; }
.perio-stage-badge.stage-none { background: #10b981; }
.perio-stage-badge.stage-i { background: #84cc16; }
.perio-stage-badge.stage-ii { background: #eab308; }
.perio-stage-badge.stage-iii { background: #f97316; }
.perio-stage-badge.stage-iv { background: #dc2626; }
.perio-extent { font-size: 12.5px; font-weight: 800; color: #475569; background: #f1f5f9; padding: 4px 10px; border-radius: 999px; }
.perio-auto-hint { font-size: 11px; font-weight: 700; color: #94a3b8; }
.perio-factors { display: grid; gap: 6px; padding-left: 0; list-style: none; }
.perio-factors li { font-size: 12.5px; font-weight: 700; color: #334155; padding-left: 16px; position: relative; line-height: 1.4; }
.perio-factors li::before { content: '•'; position: absolute; left: 4px; color: #f97316; font-weight: 900; }
.perio-loss { border-top: 1px solid #e2e8f0; padding-top: 12px; }
.perio-flags { border-top: 1px solid #e2e8f0; padding-top: 12px; }

/* gingivitis / health diagnosis badges */
.perio-stage-badge.dx-gingivitis { background: #d97706; }
.perio-stage-badge.dx-health { background: #10b981; }

/* collapsible legend */
.odo-legend { margin-top: 10px; }
.odo-legend > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; color: #475569;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: .4rem; padding: 6px 14px; user-select: none; transition: background .15s ease; }
.odo-legend > summary::-webkit-details-marker { display: none; }
.odo-legend > summary:hover { background: #e9eef5; }
.odo-legend[open] > summary { background: #e2e8f0; margin-bottom: 8px; }
.odo-legend-ico { font-size: 13px; }
.odo-legend[open] .odo-legend-btn::after { content: ' ▾'; }
.odo-legend:not([open]) .odo-legend-btn::after { content: ' ▸'; }

/* perio chart display controls */
.perio-show-row { display: flex; gap: 8px; flex-wrap: wrap; }
.perio-show-btn { font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 999px; border: 1.5px solid #e2e8f0; background: #fff; color: #94a3b8; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.perio-show-btn::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .35; }
.perio-show-btn.on { color: #1e293b; border-color: #cbd5e1; }
.perio-show-btn.pocket.on::before { background: #f59e0b; opacity: 1; }
.perio-show-btn.bleeding.on::before { background: #e11d48; opacity: 1; }
.perio-show-btn.plaque.on::before { background: #fde047; opacity: 1; }

/* plaque entry row (mirrors bop-cell) */
.plaque-cell { font-size: 10px; font-weight: 800; padding: 5px 0; border-radius: 7px; border: 1.5px solid #e2e8f0; background: #fff; color: #94a3b8; cursor: pointer; }
.plaque-cell.on { background: #fde047; border-color: #eab308; color: #713f12; }

/* perio chart — 3 surfaces per side */
.perio-grid { display: grid; gap: 6px; }
.perio-grid-row { display: grid; grid-template-columns: 74px 1fr 1fr 1fr; gap: 6px; align-items: center; }
.perio-grid-head .perio-cn { font-size: 11px; font-weight: 800; color: #64748b; text-align: center; text-transform: uppercase; letter-spacing: .3px; }
.perio-grid-head .perio-rl { font-size: 11px; font-weight: 900; color: #334155; text-transform: uppercase; letter-spacing: .3px; }
.perio-rl { font-size: 11.5px; font-weight: 800; color: #475569; }
.perio-num { width: 100%; text-align: center; font-weight: 800; font-size: 14px; padding: 6px 0; border: 1.5px solid #e2e8f0; border-radius: 8px; background: #fff; color: #1e293b; }
.perio-num:focus { border-color: #5e8c82; outline: none; box-shadow: 0 0 0 3px rgba(94, 140, 130,.15); }
.perio-cal { text-align: center; font-weight: 900; font-size: 14px; padding: 6px 0; border-radius: 8px; background: #f1f5f9; color: #334155; }
.perio-cal.hi { background: #fee2e2; color: #b91c1c; }
.perio-dotbtn { height: 30px; border-radius: 8px; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; position: relative; transition: background .12s ease; }
.perio-dotbtn::after { content: ''; position: absolute; inset: 0; margin: auto; width: 11px; height: 11px; border-radius: 50%; background: #e2e8f0; }
.perio-dotbtn.bleed.on { border-color: #fca5a5; background: #fef2f2; }
.perio-dotbtn.bleed.on::after { background: #e11d48; }
.perio-dotbtn.plaq.on { border-color: #fcd34d; background: #fffbeb; }
.perio-dotbtn.plaq.on::after { background: #fde047; box-shadow: 0 0 0 1px #a16207; }

.perio-brush { display: flex; align-items: center; gap: 8px; }

/* multi-select pop-up menu */
.multi-menu { position: fixed; z-index: 1000; width: 234px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); padding: 12px; }
.multi-menu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.multi-menu-count { font-size: 13px; font-weight: 900; color: #1e293b; }
.multi-menu-fdis { font-size: 11px; font-weight: 700; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.multi-menu-x { border: none; background: #f1f5f9; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 900; color: #64748b; flex: none; }
.multi-menu-x:hover { background: #e2e8f0; }
.multi-menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.multi-act { padding: 9px 0; border-radius: 6px; border: 1.5px solid #c7d2fe; background: #eef3f0; color: #4338ca; font-weight: 800; font-size: 13px; cursor: pointer; }
.multi-act:hover:not(:disabled) { background: #e6efeb; }
.multi-act:disabled { opacity: .45; cursor: not-allowed; }
.multi-menu-sec { margin-top: 10px; }
.multi-menu .erupt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.multi-missing { width: 100%; margin-top: 10px; padding: 9px 0; border-radius: 6px; border: 1.5px solid #fca5a5; background: #fef2f2; color: #b91c1c; font-weight: 800; font-size: 13px; cursor: pointer; }
.multi-missing:hover { background: #fee2e2; }
.multi-missing.is-present { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.odo-shift-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #94a3b8; }
.inspect-state { font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: .4rem; background: #ecfdf5; color: #047857; }
.inspect-state.missing { background: #fef2f2; color: #b91c1c; }

/* resolved (restored) caries shown as history in the entry list */
.chip.chip-resolved { text-decoration: line-through; opacity: .7; }

.multi-menu-note { margin-top: 8px; font-size: 11px; font-weight: 700; color: #94a3b8; line-height: 1.4; }

/* Current-patients period selector */
.period-seg { display: inline-flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 6px; }
.period-seg[hidden] { display: none; }
.period-btn { padding: 6px 12px; border-radius: 4px; border: none; background: transparent; font-weight: 800; font-size: 12.5px; color: #64748b; cursor: pointer; transition: all .15s; white-space: nowrap; }
.period-btn:hover { color: #334155; }
.period-btn.active { background: #fff; color: var(--brand, #5e8c82); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }

/* Search-by criteria builder */
.patient-search-builder { display: grid; gap: 12px; }
.search-by-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.search-by-field { display: grid; gap: 6px; }
.search-by-field > span { font-size: 12px; font-weight: 800; color: #64748b; }
.search-by-field .select { min-width: 150px; }
.search-by-row .input { flex: 1; min-width: 200px; }
.criteria-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.criteria-chips:empty { display: none; }
.criteria-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: .4rem; border: 1.5px solid #dbe3ef; background: #f8fafc; cursor: pointer; font-size: 12.5px; transition: all .15s; }
.criteria-chip:hover { border-color: #fca5a5; background: #fef2f2; }
.criteria-chip-field { font-weight: 800; color: #5e8c82; }
.criteria-chip:hover .criteria-chip-field { color: #b91c1c; }
.criteria-chip-val { font-weight: 700; color: #334155; }
.criteria-chip-x { font-weight: 900; color: #94a3b8; font-size: 11px; }
.criteria-chip:hover .criteria-chip-x { color: #b91c1c; }

/* Single search bar (input + icon) and ghost clear button */
.search-input-wrap { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 0 14px; height: 46px; transition: border-color .15s, box-shadow .15s; }
.search-input-wrap:focus-within { border-color: var(--brand, #5e8c82); box-shadow: 0 0 0 3px rgba(94, 140, 130,.12); }
.search-input-wrap > span { color: #94a3b8; font-size: 17px; }
.search-input-wrap input { flex: 1; border: none; outline: none; background: transparent; font-size: 14.5px; font-weight: 600; color: #0f172a; }
.btn-ghost { border: none; background: transparent; color: #64748b; font-weight: 800; font-size: 13px; padding: 0 10px; height: 46px; cursor: pointer; border-radius: 6px; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

/* Doctor dropdown sits where the search input was */
#searchDoctor { flex: 1; min-width: 220px; height: 46px; }
#searchDoctor[hidden] { display: none; }

/* Editable patient-journey workflow */

/* Appointments — week & month views */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-nav-label { font-size: 14px; font-weight: 800; color: #334155; }
.cal-nav-btn { width: 38px; height: 38px; border-radius: 6px; border: 1.5px solid #e2e8f0; background: #fff; color: #334155; font-size: 20px; font-weight: 900; cursor: pointer; line-height: 1; transition: all .15s; }
.cal-nav-btn:hover { border-color: var(--brand, #5e8c82); color: var(--brand, #5e8c82); background: #f8fafc; }

.wk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border-radius: 9px; border: 1.5px solid #e2e8f0; background: #fff; cursor: pointer; transition: all .15s; min-height: 116px; justify-content: center; }
.wk-day:hover { border-color: var(--brand, #5e8c82); transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.wk-dow { font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.wk-date { font-size: 26px; font-weight: 900; color: #0f172a; line-height: 1; }
.wk-count { font-size: 12px; font-weight: 800; color: #94a3b8; }
.wk-day.has-appts .wk-count { color: var(--brand, #5e8c82); }
.wk-day.has-appts { background: #f5f9ff; border-color: #cfe0fb; }
.wk-day.is-today { border-color: #5e8c82; box-shadow: inset 0 0 0 1px #5e8c82; }
.wk-day.is-selected { background: #5e8c82; border-color: #5e8c82; }
.wk-day.is-selected .wk-dow, .wk-day.is-selected .wk-date, .wk-day.is-selected .wk-count { color: #fff; }
.wk-day.is-closed { background: #f8fafc; opacity: .6; cursor: default; }
.wk-day.is-closed:hover { transform: none; box-shadow: none; border-color: #e2e8f0; }

.mo-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.mo-dow { text-align: center; font-size: 10.5px; font-weight: 900; color: #9aa8a1; text-transform: uppercase; letter-spacing: .07em; padding-bottom: 6px; }
.mo-cell {
  position: relative;
  aspect-ratio: 1 / .82;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #e7ede9;
  background: #fdfefd;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
.mo-cell:hover { transform: translateY(-2px); border-color: rgba(94, 140, 130, .45); background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.mo-num { font-size: 13px; font-weight: 800; color: #334155; }
.mo-num { font-size: 13px; font-weight: 900; color: #33413a; line-height: 1; }
.mo-cell.is-out { opacity: .32; background: transparent; border-color: transparent; }
.mo-cell.is-out:hover { opacity: .6; transform: none; box-shadow: none; border-color: #e7ede9; background: #fff; }
.mo-cell.is-closed { background: #f3f6f4; }
.mo-cell.is-closed .mo-num { color: #9aa8a1; }
.mo-closed { position: absolute; left: 10px; bottom: 8px; font-size: 9px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: #b3bfb8; }
.mo-cell.is-today .mo-num {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  margin: -4px 0 0 -5px;
  border-radius: 4px;
  background: var(--brand, #5e8c82);
  color: #fff;
}
.mo-cell.is-selected { background: var(--tint, #e6efeb); border-color: var(--brand, #5e8c82); box-shadow: inset 0 0 0 1px var(--brand, #5e8c82); }
.mo-dots { position: absolute; left: 10px; bottom: 9px; display: inline-flex; gap: 4px; }
.mo-dots i { width: 7px; height: 7px; border-radius: .4rem; box-shadow: 0 0 0 2px #fff; }
.mo-cell.is-selected .mo-dots i { box-shadow: 0 0 0 2px var(--tint, #e6efeb); }
.mo-cell.is-closed .mo-dots i { box-shadow: 0 0 0 2px #f3f6f4; }
.mo-count {
  position: absolute;
  right: 8px;
  bottom: 7px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .4rem;
  background: var(--tint, #e6efeb);
  color: var(--brand-700, #48756c);
  font-size: 11px;
  font-weight: 900;
}
.mo-count.hot { background: var(--brand, #5e8c82); color: #fff; }

/* Dashboard — upcoming appointments grouped per doctor */
.upcoming-by-doctor { display: grid; gap: 14px; }
.upc-doctor { border: 1px solid #eef2f7; border-radius: 8px; overflow: hidden; background: #fff; }
.upc-doctor-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #f8fafc; border-bottom: 1px solid #eef2f7; }
.upc-doctor-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; color: #0f172a; font-size: 14px; }
.upc-dot { width: 10px; height: 10px; border-radius: .4rem; background: var(--doctor, #5e8c82); flex: 0 0 auto; }
.upc-count { font-size: 12px; font-weight: 800; color: #64748b; }
.upc-list { display: grid; }
.upc-appt { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f1f5f9; border-left: 3px solid var(--doctor, #5e8c82); transition: background .12s; }
.upc-appt:last-child { border-bottom: none; }
.upc-appt:hover { background: #f8fafc; }
.upc-time { font-weight: 900; color: #0f172a; font-size: 13px; }
.upc-main { min-width: 0; display: grid; }
.upc-main b { font-size: 13.5px; font-weight: 800; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upc-main small { font-size: 11.5px; font-weight: 700; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upc-empty { padding: 12px; font-size: 12.5px; font-weight: 700; color: #94a3b8; }

/* ============================================================
   App-wide rendering crispness — text, numbers & figures
   ============================================================ */

/* Sharp glyph rendering on every page (some pages lacked the smoothing pass) */
html { text-rendering: optimizeLegibility; }
*, *::before, *::after {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Stop promoting the whole page and static cards to soft composited layers.
   Permanent will-change keeps content on a GPU layer where text renders softer. */
.spa-view,
.spa-view.spa-leaving,
.spa-view.spa-entering,
.fade-up,
.metric-tile,
.flow-card,
.room-tile,
.done-row,
.mini-appt,
.work-card,
.patient-card,
.analysis-card {
  will-change: auto !important;
}

/* Drop frosted-glass backdrop blur everywhere — it softens edges and text and
   reads as low-resolution. Card/overlay backgrounds (solid/tinted) stay intact. */
*, *::before, *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* High-precision vector figures: the odontogram, charts, badges and icons */
svg { shape-rendering: geometricPrecision; }
svg text, svg tspan { text-rendering: geometricPrecision; }

/* Use only real font weights/styles — no synthesized (faux) bold/italic, which renders with rough edges */
html, body, * { font-synthesis: none; }

/* Chart — clinical notes (daily, auto-locking) */
.notes-card { padding: 20px 22px; }
.notes-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.notes-title { font-size: 18px; font-weight: 900; color: #0f172a; letter-spacing: -.01em; }
.notes-sub { margin-top: 2px; font-size: 12.5px; font-weight: 600; color: #64748b; max-width: 60ch; }
.notes-today-chip { flex: 0 0 auto; padding: 6px 12px; border-radius: .4rem; background: #eef3f0; color: #3730a3; font-size: 12px; font-weight: 800; white-space: nowrap; }

.notes-composer { margin-top: 16px; border: 1.5px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 12px; }
.notes-input { width: 100%; resize: vertical; border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px 12px; font-size: 14px; font-weight: 600; color: #0f172a; line-height: 1.5; background: #fff; outline: none; font-family: inherit; }
.notes-input:focus { border-color: var(--brand, #5e8c82); box-shadow: 0 0 0 3px rgba(94, 140, 130, .12); }
.notes-composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 12px; }
.notes-hint { font-size: 11.5px; font-weight: 700; color: #94a3b8; }

.notes-empty { margin-top: 16px; padding: 18px; border: 1.5px dashed #e2e8f0; border-radius: 8px; text-align: center; font-size: 13px; font-weight: 700; color: #94a3b8; }

.notes-groups { margin-top: 18px; display: grid; gap: 14px; }
.notes-group { border: 1.5px solid #e8edf3; border-radius: 8px; overflow: hidden; background: #fff; }
.notes-group.is-locked { background: #f8fafc; border-color: #e2e8f0; }
.notes-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: #f1f5f9; border-bottom: 1px solid #e8edf3; }
.notes-group.is-locked .notes-group-head { background: #eef2f6; }
.notes-group-date { font-size: 12.5px; font-weight: 900; color: #334155; }
.notes-group-tag { font-size: 11px; font-weight: 800; color: #5e8c82; text-transform: uppercase; letter-spacing: .03em; }
.notes-group-tag.locked { color: #64748b; }

.note-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border-bottom: 1px solid #f1f5f9; }
.note-row:last-child { border-bottom: none; }
.note-time { font-size: 12px; font-weight: 800; color: #94a3b8; padding-top: 2px; }
.note-body { min-width: 0; }
.note-text { font-size: 14px; font-weight: 600; color: #1e293b; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.notes-group.is-locked .note-text { color: #475569; }
.note-edited { display: inline-block; margin-top: 4px; font-size: 10.5px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.note-actions { margin-top: 8px; display: flex; gap: 14px; }
.note-link { background: none; border: none; padding: 0; font-size: 12.5px; font-weight: 800; color: var(--brand, #5e8c82); cursor: pointer; }
.note-link:hover { text-decoration: underline; }
.note-link-danger { color: #dc2626; }
.note-edit { display: grid; gap: 8px; }
.note-edit-actions { display: flex; gap: 8px; }

/* Chart — left column holds the chart with notes stacked beneath it */
.chart-col { display: grid; gap: var(--chart-gap); align-content: start; min-width: 0; }

/* ============================================================
   Typography: high-res Inter + readable letter/line spacing
   ============================================================ */
:root { --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

html, body, .font-sans, button, input, textarea, select, [class^="text-"], [class*=" text-"] {
  font-family: var(--font-ui) !important;
}

html {
  font-optical-sizing: auto;            /* Inter sharpens per size */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  line-height: 1.5;                     /* comfortable default */
  letter-spacing: -0.006em;            /* Inter reads best with a hair of negative tracking */
}

/* Prose / reading text gets a touch more line spacing and neutral tracking */
p, li { line-height: 1.6; letter-spacing: normal; }

/* Headings: consistent, gentle optical tracking instead of cramped values */
h1, h2, h3, .text-3xl, .text-4xl, .text-5xl { letter-spacing: -0.018em; line-height: 1.15; }
h4, h5, h6 { letter-spacing: -0.012em; line-height: 1.25; }

/* Form controls inherit the UI font cleanly */
input, textarea, select, button { letter-spacing: normal; }
/* Patient voice dictation */
.dictation-trigger {
  min-height: 42px;
  border: 1px solid #0f766e;
  border-radius: 4px;
  background: #0f766e;
  color: #fff;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.dictation-trigger:hover {
  background: #115e59;
}

.dictation-open {
  overflow: hidden;
}

.dictation-modal[hidden] {
  display: none;
}

.dictation-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dictation-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

.dictation-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
}

.dictation-head,
.dictation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.dictation-head {
  border-bottom: 1px solid #e2e8f0;
}

.dictation-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.dictation-kicker,
.dictation-meta span,
.dictation-controls label > span,
.dictation-field > span,
.dictation-destination legend {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
}

.dictation-close {
  width: 38px;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #334155;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dictation-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dictation-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dictation-meta > div {
  min-width: 0;
  border-left: 3px solid #14b8a6;
  background: #f8fafc;
  padding: 10px 12px;
}

.dictation-meta strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dictation-destination {
  margin: 0;
  border: 0;
  padding: 0;
}

.dictation-destination legend {
  margin-bottom: 7px;
}

.dictation-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f1f5f9;
}

.dictation-segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #475569;
  font-weight: 800;
  cursor: pointer;
}

.dictation-segmented button.active {
  background: #fff;
  color: #0f766e;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.dictation-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.dictation-controls select,
.dictation-field input,
.dictation-field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.dictation-controls select {
  min-width: 150px;
  height: 42px;
  margin-top: 6px;
  padding: 0 10px;
}

.dictation-api-state {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.dictation-api-state i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.dictation-api-state.ready {
  color: #166534;
}

.dictation-api-state.ready i {
  background: #22c55e;
}

.dictation-api-state.warning {
  color: #92400e;
}

.dictation-api-state.warning i {
  background: #f59e0b;
}

.dictation-api-state.error {
  color: #b91c1c;
}

.dictation-api-state.error i {
  background: #ef4444;
}

.dictation-recorder {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  padding: 20px;
}

.dictation-time {
  font-variant-numeric: tabular-nums;
  color: #334155;
  font-size: 26px;
  font-weight: 850;
}

.dictation-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 190px;
  min-height: 44px;
  border: 0;
  border-radius: 4px;
  background: #0f172a;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.dictation-record i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
}

.dictation-record.recording {
  background: #b91c1c;
}

.dictation-record.recording i {
  border-radius: 2px;
  background: #fff;
}

.dictation-record:disabled,
.dictation-save:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.dictation-status {
  min-height: 20px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.dictation-status[data-tone="recording"],
.dictation-status[data-tone="error"] {
  color: #b91c1c;
}

.dictation-status[data-tone="warning"] {
  color: #92400e;
}

.dictation-status[data-tone="working"] {
  color: #48756c;
}

.dictation-status[data-tone="success"] {
  color: #166534;
}

.dictation-field {
  display: grid;
  gap: 7px;
}

.dictation-field input {
  min-height: 44px;
  padding: 0 12px;
}

.dictation-field textarea {
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.dictation-controls select:focus,
.dictation-field input:focus,
.dictation-field textarea:focus {
  border-color: #0f766e;
  outline: 3px solid rgba(20, 184, 166, 0.15);
}

.dictation-actions {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dictation-secondary,
.dictation-save {
  min-height: 42px;
  border-radius: 4px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.dictation-secondary {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
}

.dictation-save {
  border: 1px solid #0f766e;
  background: #0f766e;
  color: #fff;
}

@media (max-width: 640px) {
  .dictation-modal {
    place-items: end center;
    padding: 0;
  }

  .dictation-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 4px 4px 0 0;
  }

  .dictation-meta,
  .dictation-controls {
    grid-template-columns: 1fr;
  }

  .dictation-controls {
    display: grid;
    align-items: stretch;
  }

  .dictation-api-state {
    min-height: 28px;
  }

  .dictation-actions {
    position: sticky;
    bottom: 0;
  }
}

/* Clinical-note SOAP structuring control (dictation modal) */
.dictation-soap-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -2px; }
.dictation-soap {
  min-height: 38px; border-radius: 4px; padding: 0 14px; font-weight: 800; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; font-size: 13px;
}
.dictation-soap:hover { filter: brightness(0.96); }
.dictation-soap:disabled { opacity: .6; cursor: default; }
.dictation-soap-state { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.dictation-soap-state[data-tone="working"] { color: var(--brand); }
.dictation-soap-state[data-tone="success"] { color: #15803d; }
.dictation-soap-state[data-tone="error"] { color: #b91c1c; }
.patient-note-card .note-body { line-height: 1.55; }

/* ============================================================
   Eucalyptus — bind Tailwind utilities to the palette
   (odontogram clinical color-coding is intentionally preserved)
   ============================================================ */
.bg-blue-600, .bg-blue-700, .bg-indigo-600, .bg-indigo-700, .bg-brand-600, .bg-brand-700 { background-color: var(--accent) !important; }
.hover\:bg-blue-700:hover, .hover\:bg-blue-600:hover, .hover\:bg-indigo-700:hover, .hover\:bg-brand-700:hover { background-color: var(--accent-strong) !important; }
.bg-blue-50, .bg-indigo-50, .bg-sky-50, .bg-cyan-50, .bg-brand-50 { background-color: var(--tint) !important; }
.bg-blue-100, .bg-indigo-100 { background-color: var(--tint-2) !important; }
.text-blue-700, .text-blue-600, .text-blue-500, .text-indigo-700, .text-indigo-600, .text-sky-600, .text-cyan-600, .text-cyan-700, .text-brand-600, .text-brand-700 { color: var(--accent-strong) !important; }
.hover\:text-blue-700:hover, .hover\:text-indigo-700:hover { color: var(--accent-strong) !important; }
.border-blue-200, .border-blue-300, .border-indigo-200, .border-sky-200, .border-cyan-200 { border-color: #cdddd7 !important; }
.ring-blue-500, .ring-blue-600, .ring-indigo-500, .ring-brand-500 { --tw-ring-color: var(--accent) !important; }

.text-slate-950, .text-slate-900 { color: var(--ink) !important; }
.text-slate-800, .text-slate-700, .text-slate-600 { color: var(--body-text) !important; }
.text-slate-500, .text-slate-400 { color: var(--muted) !important; }
.bg-slate-50 { background-color: var(--surface-2) !important; }
.bg-slate-100 { background-color: #eef2f0 !important; }
.border-slate-200, .border-slate-300 { border-color: var(--line) !important; }

.text-green-700, .text-green-600, .text-emerald-700, .text-emerald-600 { color: var(--success) !important; }
.bg-green-50, .bg-green-100, .bg-emerald-50 { background-color: #e6f1ea !important; }
.border-green-200, .border-emerald-200 { border-color: #cde6d9 !important; }
.text-amber-700, .text-amber-800, .text-yellow-700, .text-orange-700 { color: var(--warning) !important; }
.bg-amber-50, .bg-yellow-50, .bg-orange-50 { background-color: #f6efe1 !important; }
.border-amber-200, .border-yellow-200 { border-color: #ecdcc1 !important; }
.text-red-700, .text-red-600, .text-rose-600, .text-rose-500 { color: var(--danger) !important; }
.bg-red-50, .bg-red-100, .bg-rose-50 { background-color: #f6e8e4 !important; }
.border-red-200, .border-rose-200 { border-color: #ecd3cd !important; }

/* Polish: native controls + selection adopt the accent */
input[type="checkbox"], input[type="radio"], input[type="range"], progress, ::marker { accent-color: var(--accent); }
:focus-visible { outline-color: var(--accent); }
::selection { background: rgba(94,140,130,0.18); }

/* Two-part clinical dictation: Part 1 (history) -> Subjective, Part 2 -> Objective/Assessment/Plan */
.dictation-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}
.dictation-record-sm {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  font-size: 13px;
  background: var(--brand);
}
.dictation-record-sm:hover { filter: brightness(0.97); }
.dictation-twopart {
  display: grid;
  gap: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  padding: 16px;
}
.dictation-twopart-hint {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.dictation-part {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
}
.dictation-part-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}
.dictation-part-head strong { font-weight: 800; }
.dictation-part-tag {
  flex: none;
  padding: 2px 8px;
  border-radius: .4rem;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.dictation-part textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
}
.dictation-part textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(94, 140, 130, 0.18);
}
.dictation-twopart .dictation-soap-row { margin-top: 2px; }

/* Caption under the single recorder describing what the active tab captures */
.dictation-part-note {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

/* ---------------------------------------------------------------- Billing tab -- */
.billing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 4px 0 16px;
}
.billing-metric {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 14px;
  background: #fff;
  display: grid;
  gap: 4px;
}
.billing-metric span {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.billing-metric b { font-size: 20px; color: var(--ink); }
.billing-metric.is-paid b { color: #0f766e; }
.billing-metric.is-due { border-color: #f0b429; background: #fffbeb; }
.billing-metric.is-due b { color: #b45309; }
.billing-metric.is-clear b { color: #0f766e; }

.billing-actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.billing-list { display: grid; gap: 12px; }
.billing-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  background: #fff;
}
.billing-item-main { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.billing-item-info { min-width: 0; flex: 1 1 320px; display: grid; gap: 6px; align-content: start; }
.billing-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.billing-item-title b { font-size: 15px; color: var(--ink); }
.billing-item-meta { font-size: 12.5px; color: var(--muted); }
.billing-progress { height: 6px; border-radius: .4rem; background: #e5e7eb; overflow: hidden; max-width: 300px; }
.billing-progress span { display: block; height: 100%; background: var(--brand); }

.billing-item-numbers { display: flex; gap: 18px; align-items: flex-start; }
.billing-item-numbers > div { display: grid; gap: 2px; text-align: right; }
.billing-item-numbers span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.billing-item-numbers b { font-size: 15px; color: var(--ink); white-space: nowrap; }
.billing-item-numbers .is-paid b { color: #0f766e; }
.billing-item-numbers .is-due b { color: #b45309; }
.billing-item-numbers .is-clear b { color: #0f766e; }

.bill-status { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: .4rem; letter-spacing: 0.02em; }
.bill-status.paid { background: #dcfce7; color: #166534; }
.bill-status.partial { background: #fef3c7; color: #92400e; }
.bill-status.unpaid { background: #fee2e2; color: #991b1b; }

.billing-item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: .4rem;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.chip-danger:hover { border-color: #dc2626; color: #dc2626; }

.billing-form {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}
#billingAddForm { border-top: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; margin-bottom: 14px; }
.billing-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.billing-form-grid label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.billing-form-grid .billing-col-2 { grid-column: span 2; }
.billing-form-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.billing-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.billing-hint { font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .billing-item-numbers { width: 100%; justify-content: space-between; }
  .billing-form-grid .billing-col-2 { grid-column: auto; }
}

/* ---------------------------------------------------- Billing v2 refinements --- */
.billing-panel .billing-item { transition: box-shadow 0.15s ease; }
.billing-panel .billing-item:hover { box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06); }
.billing-item-title { row-gap: 4px; }
.bill-src {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: .4rem; border: 1px solid transparent;
}
.bill-src.chart { background: #eef2ff; color: #4338ca; }
.bill-src.custom { background: #f1f5f9; color: #475569; }
.bill-cat-tag {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: .4rem; margin-right: 4px;
}
.chip-btn.chip-primary { border-color: var(--brand); color: var(--brand); background: #f0f6f4; }
.chip-btn.chip-primary:hover { background: var(--brand); color: #fff; }
.ghost-btn {
  border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px;
  padding: 8px 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.ghost-btn:hover { color: var(--ink); }
.billing-standalone {
  border-top: 0; border: 1px solid var(--line); border-radius: 7px; padding: 14px;
  background: #f8fafc; margin-bottom: 14px;
}
.billing-take { background: #f0fdf4; border-color: #bbf7d0; }
.billing-foot-note { margin: 12px 2px 0; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ Settings page --- */
.settings-page { max-width: 1100px; }
.settings-head { margin-bottom: 16px; }
.settings-head h1 { font-size: 26px; font-weight: 900; color: var(--ink); }
.settings-card { }
.settings-note { margin: 6px 0 14px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.fee-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.fee-toolbar .rx-input { max-width: 320px; }
.fee-dirty { font-size: 12.5px; font-weight: 800; color: #b45309; }
.fee-saved { font-size: 13px; font-weight: 800; color: #0f766e; }

.fee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.fee-cat { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.fee-cat-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.fee-cat-head b { font-size: 14px; color: var(--ink); }
.fee-cat-head small { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--muted); }
.fee-dot { width: 10px; height: 10px; border-radius: .4rem; flex: none; }
.fee-restorative { background: #5e8c82; } .fee-endodontic { background: #7c3aed; }
.fee-prosthodontic { background: #0891b2; } .fee-surgical { background: #dc2626; }
.fee-periodontal { background: #d97706; } .fee-preventive { background: #16a34a; }
.fee-orthodontic { background: #db2777; }
.fee-items { display: grid; }
.fee-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 18px; border-top: 1px solid #eef2f0;
}
.fee-row:first-child { border-top: 0; }
.fee-row:hover { background: #fafcfb; }
.fee-name { font-size: 13px; color: var(--ink); font-weight: 600; line-height: 1.3; }
.fee-input-wrap { display: flex; align-items: center; gap: 6px; flex: none; }
.fee-price {
  width: 96px; text-align: right; border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ink); background: #fff;
}
.fee-price:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(94, 140, 130, 0.18); }
.fee-omr { font-size: 11px; font-weight: 800; color: var(--muted); }

.fee-footer {
  position: sticky; bottom: 0; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff;
}
.fee-footer-actions { display: flex; gap: 10px; margin-left: auto; }

/* ------------------------------------------------------ Settings hub layout --- */
.settings-layout { display: grid; grid-template-columns: 232px 1fr; gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; }
.settings-nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 14px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.settings-nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.settings-nav-btn.active { background: #eef4f2; color: var(--brand-700); border-color: #d5e4df; }
.settings-nav-ico { font-size: 16px; width: 20px; text-align: center; flex: none; }
.settings-pane { min-width: 0; }

.settings-form { margin-top: 4px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.settings-grid label, .settings-inline-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.settings-grid .col-2 { grid-column: 1 / -1; }
.settings-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* config lists (staff / rooms / payment methods) */
.cfg-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cfg-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.cfg-row-sm { padding: 10px 14px; }
.cfg-row:hover { border-color: #cfe0da; }
.cfg-avatar {
  width: 40px; height: 40px; border-radius: 11px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px;
}
.cfg-icon {
  width: 40px; height: 40px; border-radius: 6px; flex: none; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.cfg-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cfg-main b { font-size: 14px; color: var(--ink); font-weight: 800; }
.cfg-main small { font-size: 12px; color: var(--muted); }
.cfg-row-actions { display: flex; gap: 8px; flex: none; margin-left: auto; }

.cfg-edit { gap: 10px; flex-wrap: wrap; }
.cfg-edit .rx-input { flex: 1 1 150px; min-width: 130px; }
.cfg-edit .cfg-row-actions { flex-wrap: nowrap; }

.settings-inline-form {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 14px; border: 1px dashed var(--line); border-radius: 7px; background: var(--surface-2);
}
.settings-inline-form .rx-input { flex: 1 1 160px; min-width: 140px; }
.settings-inline-form select.rx-input { flex: 0 1 190px; }
.settings-inline-form .primary-btn { flex: none; }

@media (max-width: 820px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-nav-btn { width: auto; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* new-visit: optional hint + 'Other' visit type field */
.visit-form-grid label .opt { font-size: 10.5px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .03em; margin-left: 4px; }
.visit-type-other[hidden] { display: none !important; }
#newPatientAgeDisplay[readonly], #newPatientMrnPreview[readonly] { background: #f1f5f9; color: #475569; font-weight: 800; }

/* ---------------------------------------------------- Chart: entry timestamps + lock --- */
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 6px; }
.entry-stamp { font-size: 11px; font-weight: 700; color: #64748b; }
.entry-stamp.done { color: #0f766e; }
.entry-lock-badge { font-size: 12px; margin-left: 2px; }
.entry-row.entry-locked { opacity: .96; background: rgba(15, 23, 42, 0.02); }
.entry-locked-note { font-size: 11px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: .03em; }
.status-select:disabled { opacity: .75; cursor: not-allowed; }

/* ---------------------------------------------------- Chart: treatment plan items log --- */
.plan-log-card { padding: 20px 22px; }
.plan-log-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.plan-log-provider { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #64748b; }
.plan-log-provider .status-select { min-width: 130px; }
.plan-log-table { display: grid; gap: 2px; overflow-x: auto; }
.plan-log-row {
  display: grid; grid-template-columns: minmax(150px, 2.2fr) 0.9fr 0.9fr 0.9fr 0.9fr 1fr;
  gap: 10px; align-items: center; padding: 9px 6px; border-bottom: 1px solid #eef2f0; font-size: 12px;
}
.plan-log-row:last-child { border-bottom: 0; }
.plan-log-hd { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; border-bottom: 1.5px solid #e2e8f0; padding-bottom: 8px; }
.plan-log-tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.plan-log-tx b { font-size: 12.5px; color: var(--ink, #25322d); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-log-tx em { font-size: 10.5px; color: #94a3b8; font-style: normal; font-weight: 700; }
.plan-log-price { font-weight: 800; color: var(--ink, #25322d); white-space: nowrap; }
.plan-log-date, .plan-log-by { color: #64748b; font-weight: 600; }
.status-tag { display: inline-block; padding: 2px 8px; border-radius: .4rem; font-size: 10.5px; font-weight: 800; white-space: nowrap; }
.plan-log-foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: flex-end; margin-top: 12px;
  padding-top: 12px; border-top: 1.5px solid #e2e8f0; font-size: 12.5px; color: #64748b; font-weight: 700;
}
.plan-log-foot b { color: var(--ink, #25322d); font-weight: 900; }

/* New-visit: booking toast link */
.visit-toast-link { color: #93c5fd; font-weight: 900; text-decoration: underline; text-underline-offset: 2px; margin-left: 6px; }
.visit-toast-link:hover { color: #bfdbfe; }

/* Dictation: language-behavior hint */
.dictation-lang-note { margin: 6px 2px 0; font-size: 11.5px; font-weight: 700; color: #64748b; }

/* ------------------------------------------------- Settings: working days --- */
.day-chip-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-chip {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 12px 6px 10px;
  border: 1.5px solid var(--line, #dfe6e0);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.day-chip:hover { transform: translateY(-2px); border-color: rgba(94, 140, 130, .45); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05); }
.day-chip b { font-size: 13px; font-weight: 900; color: var(--ink, #25322d); }
.day-chip small { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--success, #4f9e76); }
.day-chip.is-closed { background: #fbf3f2; border-color: rgba(193, 107, 92, .4); }
.day-chip.is-closed b { color: #a14f42; }
.day-chip.is-closed small { color: var(--danger, #c16b5c); }
.closure-row { align-items: center; }
.closure-add-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 10px; align-items: end; }
.closure-add-row label { display: grid; gap: 4px; font-size: 12px; font-weight: 800; color: var(--muted, #6e7c74); }
@media (max-width: 720px) { .closure-add-row { grid-template-columns: 1fr; } .day-chip-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Appointments: closed-day banner on the day view */
.closed-banner {
  margin: 10px 0 12px;
  padding: 10px 14px;
  border: 1px solid rgba(193, 107, 92, .32);
  border-radius: 7px;
  background: #fbf3f2;
  color: #a14f42;
  font-size: 13px;
  font-weight: 800;
}

/* Patients search: date-of-birth picker + phone country-code controls */
.search-dob {
  border: 1px solid var(--line, #dfe6e0);
  border-radius: .9rem;
  background: #fff;
  padding: .55rem .8rem;
  font-weight: 800;
  color: var(--ink, #25322d);
  min-width: 12rem;
}
.search-phone-wrap { display: flex; gap: .5rem; min-width: 0; flex: 1; }
.search-phone-wrap select { width: 8.2rem; flex: none; }
.search-phone-wrap input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line, #dfe6e0);
  border-radius: .9rem;
  background: #fff;
  padding: .55rem .8rem;
  font-weight: 800;
  color: var(--ink, #25322d);
}
.search-dob:focus, .search-phone-wrap input:focus { outline: none; border-color: var(--brand, #5e8c82); box-shadow: 0 0 0 3px var(--ring, rgba(94,140,130,.28)); }

/* Care column overflow pill (Patients page): dashed to read as "there's more". */
.care-more {
  border-style: dashed;
  cursor: help;
}

/* Rooms: day-coverage detail under the card bar + mini bar in the Coverage panel. */
.room-coverage-note {
  color: #64748b;
  font-size: .68rem;
  font-weight: 800;
}
.room-coverage-bar {
  display: block;
  margin-top: .34rem;
  height: 5px;
  border-radius: .4rem;
  background: #eef2f7;
  overflow: hidden;
  white-space: normal;
}
.room-coverage-bar i {
  display: block;
  height: 100%;
  border-radius: .4rem;
  background: linear-gradient(90deg, #5e8c82, #7fb0a4);
}

/* --- New Visit v47: live scheduling feedback + mobile book bar ------------------- */
.visit-day-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .9rem;
  border: 1px solid #fecaca;
  border-radius: 0.495rem;
  background: #fef2f2;
  color: #991b1b;
  padding: .65rem .8rem;
  font-size: .78rem;
  font-weight: 850;
}
.visit-schedule-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-top: .7rem;
  min-height: 1.6rem;
}
.visit-ok-chip,
.visit-conflict-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border-radius: .4rem;
  padding: .3rem .65rem;
  font-size: .72rem;
  font-weight: 900;
}
.visit-ok-chip { border: 1px solid #bbe3c8; background: #f0fdf4; color: #166534; }
.visit-conflict-chip { border: 1px solid #fcd9a2; background: #fffbeb; color: #92400e; }
.visit-nextfree-btn {
  border: 1px solid rgba(94, 140, 130, .45);
  border-radius: .4rem;
  background: #eef3f0;
  color: #3d5c55;
  padding: .3rem .7rem;
  font-size: .72rem;
  font-weight: 900;
  cursor: pointer;
  transition: background .14s ease, transform .14s ease;
}
.visit-nextfree-btn:hover { background: #e1ebe7; transform: translateY(-1px); }
.visit-slot.is-clash { border-color: #fcd9a2; background: #fffbeb; }


@media (max-width: 900px) {
    .visit-page { padding-bottom: 4.6rem; }
    .visit-form-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .visit-form-grid-compact { grid-template-columns: 1fr; }
}

/* --- Patient file: live treatment plan card (chart-driven, fee-schedule priced) --- */
.plan-live-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.plan-live-list { display: grid; gap: .45rem; margin-top: .7rem; }
.plan-live-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .6rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.44rem;
  background: #fff;
  padding: .5rem .65rem;
}
.plan-live-main b { display: block; color: #0f172a; font-size: .8rem; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-live-main span { display: block; margin-top: .08rem; color: #64748b; font-size: .68rem; font-weight: 850; }
.plan-live-status { border-radius: .4rem; padding: .18rem .5rem; font-size: .64rem; font-weight: 900; white-space: nowrap; }
.plan-live-status.is-planned { background: rgba(94, 140, 130, .14); color: #3d5c55; }
.plan-live-status.is-progress { background: rgba(217, 119, 6, .14); color: #92400e; }
.plan-live-row em { color: #0f172a; font-size: .78rem; font-style: normal; font-weight: 900; white-space: nowrap; }
.plan-live-more { margin-top: .4rem; color: #64748b; font-size: .7rem; font-weight: 850; }
.plan-live-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .7rem;
  border-top: 1px dashed #e2e8f0;
  padding-top: .6rem;
}
.plan-live-total span { color: #64748b; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.plan-live-total b { color: #3d5c55; font-size: 1rem; font-weight: 900; }
.plan-live-note { margin-top: .65rem; color: #64748b; font-size: .72rem; font-weight: 800; line-height: 1.45; }
.billing-metric.is-plan { border-color: rgba(94, 140, 130, .4); background: #f4f8f6; }
.billing-metric.is-plan b { color: #3d5c55; }

/* ============================ Sharp UI pass (v54) ================================
 * Same layout, same outline — crisper edges. Radii scale ~55% (chips .4rem, cards
 * .45–.55rem), soft lifts become crisp two-layer shadows, thin bars go 2px, true
 * circles (avatars, status dots) stay circles, and the clinical chart drawing
 * (tooth/root/perio shapes) is untouched. Tailwind rounded-* is remapped below —
 * new UI must follow this scale. */
.rounded-3xl { border-radius: .5rem !important; }
.rounded-2xl { border-radius: .45rem !important; }
.rounded-xl { border-radius: .4rem !important; }
.rounded-lg { border-radius: .35rem !important; }
.rounded-md { border-radius: .3rem !important; }

/* circles stay circles */
.doctor-legend i,
.room-board-legend i,
.room-coverage-row > i,
.timeline-dot,
.live-dot,
.room-dot,
.staff-avatar,
.staff-shift-avatar,
.staff-avatar-modern,
.provider-avatar,
.visit-avatar,
.visit-avatar.large { border-radius: 50% !important; }

/* thin progress / coverage bars: flat and crisp */
.room-progress,
.room-progress i,
.room-coverage-bar,
.room-coverage-bar i,
.staff-coverage-bar,
.staff-coverage-bar i { border-radius: 2px !important; }

/* ============================ New Visit revamp (nv2) ============================
 * Single centred flow: Patient card -> Schedule card -> sticky confirm bar.
 * Alerts live inside the selected-patient strip; the provider day sits next to
 * the time picker; drafts are a header tray. Sharp scale (v54) applies. */
.nv2-page { max-width: 960px; margin-inline: auto; padding-bottom: 5.4rem; }
.nv2-card {
  border: 1px solid #e2e8f0;
  border-radius: .55rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  padding: 1.1rem 1.2rem 1.25rem;
}
.nv2-card + .nv2-card { margin-top: 1rem; }
.nv2-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .95rem;
}
.nv2-card-head > div { display: flex; align-items: center; gap: .6rem; }
.nv2-card-head h2 { color: #0f172a; font-size: 1.02rem; font-weight: 900; }

.nv2-count {
  display: inline-flex;
  min-width: 1.15rem;
  justify-content: center;
  margin-left: .3rem;
  border-radius: .3rem;
  background: #eef2f7;
  color: #334155;
  font-size: .68rem;
  font-weight: 900;
  padding: .05rem .3rem;
}
.nv2-drafts {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: -.4rem 0 1rem;
}
.nv2-draft-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #e2e8f0;
  border-radius: .4rem;
  background: #fff;
  overflow: hidden;
}
.nv2-draft-load { display: grid; gap: .05rem; border: 0; background: transparent; padding: .4rem .6rem; text-align: left; cursor: pointer; }
.nv2-draft-load:hover { background: #f8fafc; }
.nv2-draft-load b { color: #0f172a; font-size: .74rem; font-weight: 900; }
.nv2-draft-load span { color: #64748b; font-size: .66rem; font-weight: 850; }
.nv2-draft-del { border: 0; border-left: 1px solid #eef2f7; background: transparent; color: #94a3b8; font-size: .85rem; font-weight: 900; padding: 0 .5rem; cursor: pointer; }
.nv2-draft-del:hover { background: #fef2f2; color: #b91c1c; }
.nv2-draft-empty { color: #64748b; font-size: .74rem; font-weight: 800; }

.nv2-results { display: grid; gap: .45rem; margin-top: .8rem; }

.nv2-selected { display: grid; gap: .8rem; }
.nv2-selected-top { display: flex; align-items: center; gap: .85rem; }
.nv2-selected-id { min-width: 0; flex: 1; }
.nv2-selected-id h3 { color: #0f172a; font-size: 1rem; font-weight: 900; }
.nv2-selected-id p { margin-top: .12rem; color: #64748b; font-size: .74rem; font-weight: 850; }
.nv2-selected-case { color: #475569; }
.nv2-selected-actions { display: flex; flex: 0 0 auto; gap: .5rem; }
.nv2-selected-alerts { display: grid; gap: .4rem; border-top: 1px dashed #e2e8f0; padding-top: .75rem; }
.nv2-alert-more { color: #64748b; font-size: .68rem; font-weight: 850; }

.nv2-schedule-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 1.2rem;
  align-items: start;
}
.nv2-when { margin-bottom: .7rem; }
.nv2-reason { margin-top: 1rem; }
.nv2-day {
  border: 1px solid #eef2f7;
  border-radius: .45rem;
  background: #fbfcfe;
  padding: .8rem .85rem;
}
.nv2-day-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.nv2-day-head h3 { color: #0f172a; font-size: .82rem; font-weight: 900; }
.nv2-day-head span { color: #64748b; font-size: .66rem; font-weight: 850; }

.nv2-confirm {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .9rem;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(6px);
  padding: .7rem clamp(1rem, 4vw, 2rem) calc(.7rem + env(safe-area-inset-bottom, 0px));
}
.nv2-confirm-text { min-width: 0; flex: 1; }
.nv2-confirm-text b { display: block; overflow: hidden; color: #0f172a; font-size: .86rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.nv2-confirm-text span { display: block; overflow: hidden; margin-top: .1rem; color: #64748b; font-size: .72rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.nv2-confirm-pill { flex: 0 0 auto; }
.nv2-confirm-actions { display: flex; flex: 0 0 auto; gap: .55rem; }
.nv2-confirm .btn-primary:disabled { cursor: not-allowed; opacity: .45; }

@media (max-width: 1000px) {
  .nv2-schedule-grid { grid-template-columns: 1fr; }
  .nv2-day { order: 2; }
}
@media (max-width: 640px) {
  .nv2-selected-top { flex-wrap: wrap; }
  .nv2-selected-actions { width: 100%; }
  .nv2-selected-actions > * { flex: 1; }
  .nv2-confirm { flex-wrap: wrap; }
  .nv2-confirm-pill { display: none; }
  .nv2-confirm-actions { width: 100%; }
  .nv2-confirm-actions > * { flex: 1; }
  .nv2-page { padding-bottom: 7.6rem; }
}

/* roster quick-book */
.row-book-btn {
  border: 1px solid rgba(94, 140, 130, .45);
  border-radius: .35rem;
  background: #eef3f0;
  color: #3d5c55;
  font-size: .68rem;
  font-weight: 900;
  padding: .3rem .6rem;
  cursor: pointer;
  transition: background .14s ease;
}
.row-book-btn:hover { background: #e1ebe7; }

/* nv2 tiles: field groups read as cards, matching the app's tile language. */
.nv2-fields { display: grid; gap: .85rem; }
.nv2-tile {
  border: 1px solid #eef2f7;
  border-radius: .45rem;
  background: #fbfcfe;
  padding: .8rem .85rem .9rem;
}
.nv2-tile-dashed { border-style: dashed; background: #fff; }
.nv2-tile-head {
  margin-bottom: .6rem;
  color: #64748b;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.nv2-tile-grid {
  display: grid;
  grid-template-columns: 1fr;   /* When and Team & room each get their own full-width row */
  gap: .85rem;
}
.nv2-when { margin-bottom: 0; }
.nv2-reason { margin-top: 0; }
.nv2-feedback { margin-top: 0; }
.nv2-feedback:empty { display: none; }

/* selected-patient alerts as a warning-tinted tile */
.nv2-alerts-tile {
  border: 1px solid #fde9c8;
  border-top: 1px solid #fde9c8;
  border-radius: .45rem;
  background: #fffdf7;
  padding: .7rem .75rem;
}
.nv2-alerts-tile .visit-alert { background: #fff; }

/* --- Billing: payment ledger, receipt thumbs, full-screen viewer ---------------- */
.ledger-method { border-radius: .3rem; background: #eef2f7; color: #475569; font-size: .62rem; font-weight: 900; padding: .1rem .4rem; }
.ledger-void-tag { border-radius: .3rem; background: #fee2e2; color: #b91c1c; font-size: .62rem; font-weight: 900; padding: .1rem .4rem; }
.ledger-receipts { display: flex; flex: 0 0 auto; align-items: center; gap: .3rem; }
.receipt-thumb { width: 34px; height: 34px; border: 1px solid #e2e8f0; border-radius: .3rem; background: #fff; padding: 0; overflow: hidden; cursor: zoom-in; }
.receipt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.receipt-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px dashed #cbd5e1;
  border-radius: .3rem;
  background: #fff;
  color: #64748b;
  font-size: .95rem;
  font-weight: 900;
  cursor: pointer;
}
.receipt-add:hover { border-color: #5e8c82; color: #3d5c55; }
.rx-file { padding: .35rem; font-size: .7rem; }
.billing-receipt-label > input { margin-top: .25rem; }

.receipt-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  padding: 1.2rem;
}
.receipt-viewer-inner {
  display: grid;
  gap: .6rem;
  max-width: min(680px, 94vw);
  max-height: 90vh;
  border-radius: .55rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .05);
  padding: .8rem;
}
.receipt-viewer-inner header { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.receipt-viewer-inner header b { overflow: hidden; color: #0f172a; font-size: .8rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.receipt-viewer-inner header div { display: flex; flex: 0 0 auto; gap: .4rem; }
.receipt-viewer-inner img { max-width: 100%; max-height: calc(90vh - 4.5rem); border-radius: .35rem; object-fit: contain; justify-self: center; }

/* per-item payment rows (nested inside each charge card) */
.billing-pay-rows { display: grid; gap: .4rem; margin-top: .55rem; }
.billing-pay-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid #eef2f7;
  border-radius: .4rem;
  background: #fbfcfe;
  padding: .45rem .6rem;
}
.billing-pay-row .pay-main { min-width: 0; flex: 1; }
.billing-pay-row .pay-main b { display: flex; align-items: center; gap: .4rem; color: #0f172a; font-size: .76rem; font-weight: 900; }
.billing-pay-row .pay-main span { display: block; overflow: hidden; margin-top: .1rem; color: #64748b; font-size: .66rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.billing-pay-row.is-voided .pay-main b,
.billing-pay-row.is-voided .pay-main span { text-decoration: line-through; opacity: .6; }
.billing-pay-row .pay-void { flex: 0 0 auto; }

/* --- Visit flow stepper (patient overview) --------------------------------------- */
.vf-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.vf-meta { margin-top: .35rem; color: #64748b; font-size: .72rem; font-weight: 850; }
.vf-steps { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.vf-step {
  border: 1px solid #e2e8f0;
  border-radius: .4rem;
  background: #fff;
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
  padding: .42rem .7rem;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}
.vf-step:hover:not(:disabled) { border-color: #cdddd7; }
.vf-step.is-done { border-color: #bbe3c8; background: #f0fdf4; color: #166534; }
.vf-step.is-current { border-color: rgba(94, 140, 130, .55); background: #5e8c82; color: #fff; }
.vf-step.is-locked { cursor: not-allowed; opacity: .55; }
.vf-arrow { color: #94a3b8; font-size: .8rem; font-weight: 900; }
.vf-note { margin-top: .7rem; color: #64748b; font-size: .72rem; font-weight: 800; line-height: 1.45; }
.vf-link { color: #3d5c55; font-weight: 900; }
.vf-book { display: inline-flex; margin-top: .8rem; }

/* --- Patient tasks ----------------------------------------------------------------- */
.ptask-top { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-bottom: .7rem; }
.ptask-quick { display: flex; flex-wrap: wrap; gap: .35rem; }
.ptask-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; }
.ptask-suggest { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.ptask-suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px dashed rgba(94, 140, 130, .5);
  border-radius: .4rem;
  background: #f4f8f6;
  color: #3d5c55;
  font-size: .7rem;
  font-weight: 850;
  padding: .3rem .55rem;
}
.ptask-suggest-chip i { color: #64748b; font-size: .6rem; font-style: normal; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.ptask-suggest-chip button { border: 0; background: transparent; color: #3d5c55; font-size: .8rem; font-weight: 900; cursor: pointer; padding: 0 .1rem; }
.ptask-suggest-chip button:hover { color: #0f172a; }
.ptask-list { display: grid; gap: .45rem; margin-top: .75rem; }
.ptask-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid #eef2f7;
  border-radius: .45rem;
  background: #fff;
  padding: .5rem .65rem;
  transition: opacity .2s ease, transform .2s ease;
}
.ptask-row.is-going { opacity: 0; transform: translateX(8px); }
.ptask-check {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.ptask-check:hover { border-color: #5e8c82; background: #eef3f0; }
.ptask-main { min-width: 0; flex: 1; }
.ptask-main b { display: block; overflow: hidden; color: #0f172a; font-size: .78rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.ptask-main span { display: block; margin-top: .08rem; color: #94a3b8; font-size: .64rem; font-weight: 850; }
.ptask-del { flex: 0 0 auto; border: 0; background: transparent; color: #94a3b8; font-size: .95rem; font-weight: 900; cursor: pointer; padding: 0 .2rem; }
.ptask-del:hover { color: #b91c1c; }
@media (max-width: 640px) {
  .ptask-form { grid-template-columns: 1fr; }
}

/* visit flow: finish row + finished note */
.vf-finish-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: .8rem; }
.vf-finish-row .vf-note { margin-top: 0; }
.vf-finished-note { color: #166534; }
.vf-history-link { border: 0; background: transparent; color: #3d5c55; font-weight: 900; cursor: pointer; padding: 0; text-decoration: underline; }

/* history: finished visit rows */
.visit-hist-list { display: grid; gap: .5rem; }
.visit-hist-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  border: 1px solid #eef2f7;
  border-radius: .45rem;
  background: #fbfcfe;
  padding: .6rem .75rem;
}
.visit-hist-when { flex: 0 0 auto; text-align: left; }
.visit-hist-when b { display: block; color: #0f172a; font-size: .74rem; font-weight: 900; }
.visit-hist-when span { display: block; color: #64748b; font-size: .66rem; font-weight: 850; }
.visit-hist-main { min-width: 0; flex: 1; }
.visit-hist-main b { display: block; color: #0f172a; font-size: .8rem; font-weight: 900; }
.visit-hist-main span { display: block; margin-top: .08rem; color: #64748b; font-size: .68rem; font-weight: 850; }
.visit-hist-main small { display: block; overflow: hidden; margin-top: .12rem; color: #94a3b8; font-size: .64rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.visit-hist-amt { flex: 0 0 auto; text-align: right; }
.visit-hist-amt b { display: block; color: #3d5c55; font-size: .8rem; font-weight: 900; }
.visit-hist-amt span { display: block; color: #94a3b8; font-size: .62rem; font-weight: 850; }

/* prescription: medication item rows (Rx / Sig / Disp / Refills) */
.rx-meds-block { border: 1px solid #eef2f7; border-radius: .45rem; background: #fbfcfe; padding: .8rem .85rem .9rem; }
.rx-meds-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.rx-meds-title { color: #64748b; font-size: .66rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.rx-common { display: flex; flex-wrap: wrap; gap: .3rem; }
.rx-items { display: grid; gap: .6rem; }
.rx-item {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  border: 1px solid #e2e8f0;
  border-radius: .4rem;
  background: #fff;
  padding: .7rem .8rem .8rem 0.8rem;
}
.rx-item .rx-span-2 { grid-column: span 2; }
.rx-item-del {
  position: absolute;
  top: .35rem;
  right: .4rem;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: .95rem;
  font-weight: 900;
  cursor: pointer;
}
.rx-item-del:hover { color: #b91c1c; }
.rx-add-btn { margin-top: .6rem; }
@media (max-width: 640px) {
  .rx-item { grid-template-columns: 1fr; }
  .rx-item .rx-span-2 { grid-column: auto; }
}

/* dictation: draft persistence bar + trigger badge */
.dictation-draftbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  margin-top: .5rem;
  border: 1px dashed rgba(94, 140, 130, .45);
  border-radius: .4rem;
  background: #f4f8f6;
  padding: .45rem .6rem;
}
.dictation-draftbar span { color: #3d5c55; font-size: .68rem; font-weight: 850; }
.dictation-draftbar button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: .66rem;
  font-weight: 900;
  cursor: pointer;
  text-decoration: underline;
}
.dictation-draftbar button:hover { color: #b91c1c; }
.dictation-trigger { position: relative; }
.dictation-trigger.has-draft::after {
  content: '';
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #d97706;
}

/* persistence sync status dot */
#syncStatusDot {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 70;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .2);
}
#syncStatusDot[data-state="syncing"] { background: #d97706; animation: syncPulse 1s ease-in-out infinite; }
#syncStatusDot[data-state="offline"] { background: #dc2626; }
@keyframes syncPulse { 50% { opacity: .45; } }

/* settings: backups card */
.backup-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin: .3rem 0 .9rem; }
.backup-status { color: #64748b; font-size: .72rem; font-weight: 850; }
.backup-list { display: grid; gap: .45rem; }
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  border: 1px solid #eef2f7;
  border-radius: .45rem;
  background: #fbfcfe;
  padding: .5rem .7rem;
  text-decoration: none;
}
.backup-row:hover { border-color: #cdddd7; }
.backup-row b { color: #0f172a; font-size: .74rem; font-weight: 900; }
.backup-row span { color: #64748b; font-size: .66rem; font-weight: 850; }
.backup-note { margin-top: .8rem; color: #64748b; font-size: .7rem; font-weight: 800; line-height: 1.5; }
.backup-note code { background: #eef2f7; border-radius: .25rem; padding: .05rem .3rem; }

/* restored: shared flex baseline for treatment page rows (regex prune casualty) */
.treatment-mini-head,
.treatment-title-line,
.treatment-meta-line,
.treatment-sub-line,
.treatment-toolbar,
.provider-stat-row {
  display: flex;
  align-items: center;
}
.treatment-mini-head { justify-content: space-between; gap: .8rem; margin-bottom: .85rem; }
.treatment-mini-head h2 {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
}

/* mouth3d: fallback, rail controls */
.mouth3d-fallback {
  display: grid;
  place-content: center;
  gap: .35rem;
  height: 100%;
  min-height: 320px;
  text-align: center;
}
.mouth3d-fallback b { color: #0f172a; font-size: .9rem; font-weight: 900; }
.mouth3d-fallback span { max-width: 340px; color: #64748b; font-size: .74rem; font-weight: 800; line-height: 1.5; }
.m3d-mode.active { border-color: rgba(94, 140, 130, .6); background: #5e8c82; color: #fff; }
.m3d-slider { display: grid; gap: .35rem; margin-top: .7rem; }
.m3d-slider span { color: #64748b; font-size: .68rem; font-weight: 900; }
.m3d-slider input { width: 100%; accent-color: #5e8c82; }

/* auth: login page + header user chip */
.login-body { display: grid; place-items: center; min-height: 100vh; background: #f1f5f9; }
.login-wrap { width: min(420px, 92vw); }
.login-card { padding: 2rem 1.8rem; display: grid; gap: .55rem; }
.login-card h1 { color: #0f172a; font-size: 1.45rem; font-weight: 900; }
.login-sub { color: #64748b; font-size: .78rem; font-weight: 750; line-height: 1.5; }
.login-field { display: grid; gap: .3rem; margin-top: .6rem; }
.login-field span { color: #334155; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.login-field input { border: 1px solid #cbd5e1; border-radius: .45rem; padding: .6rem .7rem; font-size: .9rem; font-weight: 700; }
.login-field input:focus { outline: 2px solid rgba(94, 140, 130, .45); border-color: #5e8c82; }
.login-error { margin-top: .6rem; padding: .5rem .7rem; border-radius: .45rem; background: #fef2f2; color: #b91c1c; font-size: .76rem; font-weight: 800; }
.login-submit { margin-top: .9rem; width: 100%; padding: .65rem; border: none; border-radius: .45rem; background: #5e8c82; color: #fff; font-size: .85rem; font-weight: 900; cursor: pointer; }
.login-submit:hover { background: #4f7a71; }
.login-submit:disabled { opacity: .6; cursor: default; }
.login-foot { margin-top: .8rem; color: #94a3b8; font-size: .68rem; font-weight: 750; }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; margin-left: .8rem; padding: .25rem .35rem .25rem .6rem; border: 1px solid #e2e8f0; border-radius: .45rem; background: #fff; }
.user-chip-name { color: #0f172a; font-size: .72rem; font-weight: 900; }
.user-chip-role { color: #64748b; font-size: .62rem; font-weight: 850; text-transform: capitalize; }
.user-chip-logout { border: none; background: #f1f5f9; border-radius: .35rem; padding: .3rem .5rem; color: #334155; font-size: .64rem; font-weight: 900; cursor: pointer; }
.user-chip-logout:hover { background: #e2e8f0; color: #b91c1c; }
.user-chip-floating { position: fixed; top: .7rem; right: .8rem; z-index: 9999; box-shadow: 0 6px 18px rgba(15, 23, 42, .14); }
header .user-chip, .app-topbar .user-chip { margin-left: .8rem; }

/* ---- Users & access: redesigned ---- */
.access-me { padding: 0; overflow: hidden; }
.access-me-head { display: flex; align-items: center; gap: 1rem; padding: 1.3rem 1.5rem; background: linear-gradient(135deg, #f0f7f5 0%, #f8fafc 65%); border-bottom: 1px solid #e2e8f0; }
.access-me-id h2 { margin: 0; color: #0f172a; font-size: 1.15rem; font-weight: 900; }
.access-me-sub { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; color: #64748b; font-size: .74rem; font-weight: 800; }
.access-me-body { padding: 1.1rem 1.5rem 1.3rem; }
.access-hint { margin: 0 0 .8rem; color: #64748b; font-size: .72rem; font-weight: 750; }
.access-avatar { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: linear-gradient(135deg, #5e8c82, #3e6a60); color: #fff; font-size: .8rem; font-weight: 900; letter-spacing: .02em; flex: none; }
.access-avatar-lg { width: 3.2rem; height: 3.2rem; font-size: 1.05rem; }
.role-badge { display: inline-block; padding: .16rem .55rem; border-radius: 999px; font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.role-admin { background: #ede9fe; color: #6d28d9; }
.role-dentist { background: #e0f2f1; color: #0f766e; }
.role-hygienist { background: #e0f2fe; color: #0369a1; }
.role-assistant { background: #fef3c7; color: #b45309; }
.role-frontdesk { background: #fce7f3; color: #be185d; }
.access-pw { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .7rem; align-items: end; }
.access-pw label { display: grid; gap: .28rem; }
.access-pw label span { color: #334155; font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.access-pw input { border: 1px solid #cbd5e1; border-radius: .5rem; padding: .55rem .65rem; font-size: .78rem; font-weight: 750; }
.access-pw input:focus { outline: 2px solid rgba(94, 140, 130, .4); border-color: #5e8c82; }
.access-pw button { border: none; background: #5e8c82; color: #fff; border-radius: .5rem; padding: .6rem .95rem; font-size: .74rem; font-weight: 900; cursor: pointer; white-space: nowrap; }
.access-pw button:hover { background: #4f7a71; }
.access-pw-note, .access-note { margin-top: .65rem; font-size: .72rem; font-weight: 850; }
.access-locked { padding: 1.1rem 1.4rem; }
.access-locked-inner { display: flex; align-items: center; gap: .9rem; }
.access-locked-ico { font-size: 1.5rem; }
.access-locked h2 { margin: 0; font-size: .95rem; font-weight: 900; color: #0f172a; }
.access-locked p { margin: .15rem 0 0; color: #64748b; font-size: .74rem; font-weight: 750; }
.access-list { display: grid; gap: .55rem; margin-bottom: 1.3rem; }
.access-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: .8rem; align-items: center; padding: .65rem .8rem; border: 1px solid #e2e8f0; border-radius: .65rem; background: #fff; transition: border-color .15s, box-shadow .15s; }
.access-row:hover { border-color: #b9cfc9; box-shadow: 0 2px 10px rgba(15, 23, 42, .05); }
.access-row.is-disabled { opacity: .55; background: #f8fafc; }
.access-who b { display: flex; align-items: center; gap: .45rem; color: #0f172a; font-size: .82rem; font-weight: 900; }
.access-who span { display: flex; align-items: center; gap: .3rem; color: #64748b; font-size: .68rem; font-weight: 800; }
.access-you { padding: .1rem .45rem; border-radius: 999px; background: #f0f7f5; color: #3e6a60; font-size: .58rem; font-weight: 900; text-transform: uppercase; }
.access-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #cbd5e1; display: inline-block; }
.access-dot.on { background: #22c55e; }
.access-role { border: 1px solid #cbd5e1; border-radius: .5rem; padding: .4rem .5rem; font-size: .72rem; font-weight: 850; background: #fff; text-transform: capitalize; }
.access-row-actions { display: flex; gap: .45rem; }
.access-row-actions button { border: 1px solid #cbd5e1; background: #fff; border-radius: .5rem; padding: .4rem .65rem; font-size: .66rem; font-weight: 900; color: #334155; cursor: pointer; transition: all .12s; }
.access-row-actions button:hover:not(:disabled) { border-color: #5e8c82; color: #0f172a; }
.access-row-actions .is-danger:hover:not(:disabled) { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.access-row-actions .is-good { border-color: #86efac; color: #166534; }
.access-row-actions button:disabled { opacity: .45; cursor: default; }
.access-add { padding: 1.1rem 1.2rem; border: 1px dashed #cbd5e1; border-radius: .7rem; background: #fafcfb; }
.access-add-head h3 { margin: 0; color: #0f172a; font-size: .88rem; font-weight: 900; }
.access-add-head p { margin: .2rem 0 .9rem; color: #64748b; font-size: .7rem; font-weight: 750; }
.access-add-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-bottom: .85rem; }
.access-add-grid label { display: grid; gap: .28rem; }
.access-add-grid label span { color: #334155; font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.access-add-grid input, .access-add-grid select { border: 1px solid #cbd5e1; border-radius: .5rem; padding: .55rem .65rem; font-size: .76rem; font-weight: 750; background: #fff; }
.access-add-grid input:focus { outline: 2px solid rgba(94, 140, 130, .4); border-color: #5e8c82; }
.access-add-btn { border: none; background: #0f172a; color: #fff; border-radius: .5rem; padding: .6rem 1.1rem; font-size: .74rem; font-weight: 900; cursor: pointer; }
.access-add-btn:hover { background: #1e293b; }
@media (max-width: 860px) {
  .access-pw, .access-add-grid { grid-template-columns: 1fr 1fr; }
  .access-row { grid-template-columns: auto 1fr; }
  .access-row .access-role, .access-row .access-row-actions { grid-column: 2; justify-self: start; }
}
@media (max-width: 560px) { .access-pw, .access-add-grid { grid-template-columns: 1fr; } }
.sync-conflict-banner { position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%); z-index: 10000; display: flex; align-items: center; gap: .55rem; max-width: min(560px, 92vw); padding: .7rem 1rem; border-radius: .7rem; background: #7c2d12; color: #fff; font-size: .76rem; font-weight: 750; box-shadow: 0 10px 30px rgba(15, 23, 42, .35); }
.sync-conflict-banner b { font-weight: 950; white-space: nowrap; }
.sync-conflict-banner button { border: none; border-radius: .45rem; padding: .35rem .7rem; background: rgba(255,255,255,.18); color: #fff; font-weight: 900; font-size: .7rem; cursor: pointer; }
.sync-conflict-banner button:hover { background: rgba(255,255,255,.3); }
.rx-safety-box { grid-column: 1 / -1; margin-top: .7rem; display: grid; gap: .35rem; }
.rx-safety-head { color: #0f172a; font-size: .72rem; font-weight: 950; }
.rx-safety-head span { color: #94a3b8; font-weight: 800; font-size: .64rem; }
.rx-safety-clear { padding: .45rem .6rem; border-radius: .45rem; background: #f0fdf4; color: #166534; font-size: .7rem; font-weight: 800; }
.rx-w { display: flex; gap: .45rem; align-items: baseline; padding: .45rem .6rem; border-radius: .45rem; font-size: .7rem; font-weight: 750; line-height: 1.45; }
.rx-w b { font-size: .6rem; letter-spacing: .04em; flex: none; }
.rx-w-major { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.rx-w-caution { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.rx-w-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- Tier-2: reports, recall, imaging, plan acceptance ---- */
.reports-page { display: grid; gap: 1rem; max-width: 1500px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.reports-head { display: flex; align-items: end; justify-content: space-between; }
.reports-head h1 { margin: 0; font-size: 1.5rem; font-weight: 900; color: #0f172a; }
.reports-range { display: inline-flex; gap: .45rem; align-items: center; color: #334155; font-size: .7rem; font-weight: 900; text-transform: uppercase; }
.reports-range select { border: 1px solid #cbd5e1; border-radius: .45rem; padding: .35rem .5rem; font-size: .74rem; font-weight: 800; background: #fff; }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.reports-card { padding: 1.1rem 1.2rem; }
.reports-card h2 { margin: 0; font-size: .95rem; font-weight: 900; color: #0f172a; }
.rep-sub { margin: .1rem 0 .8rem; color: #64748b; font-size: .7rem; font-weight: 750; }
.reports-loading, .reports-empty { color: #94a3b8; font-size: .78rem; font-weight: 800; }
.rep-bars { display: flex; align-items: flex-end; gap: .55rem; min-height: 130px; overflow-x: auto; padding-bottom: .2rem; }
.rep-bar-col { display: grid; justify-items: center; gap: .25rem; min-width: 44px; }
.rep-bar { width: 26px; border-radius: .35rem .35rem 0 0; background: linear-gradient(180deg, #5e8c82, #3e6a60); }
.rep-bar-val { font-size: .58rem; font-weight: 900; color: #334155; }
.rep-bar-label { font-size: .58rem; font-weight: 800; color: #94a3b8; }
.rep-aging { display: flex; flex-wrap: wrap; gap: .6rem; }
.rep-age { display: grid; gap: .1rem; padding: .55rem .8rem; border-radius: .6rem; border: 1px solid #e2e8f0; min-width: 96px; }
.rep-age b { font-size: .92rem; } .rep-age span { font-size: .62rem; font-weight: 850; color: #64748b; text-transform: uppercase; }
.rep-age-ok { background: #f0fdf4; border-color: #bbf7d0; } .rep-age-warn { background: #fffbeb; border-color: #fde68a; }
.rep-age-bad { background: #fef2f2; border-color: #fecaca; } .rep-age-bad b { color: #b91c1c; }
.rep-att { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.rep-att div { display: grid; justify-items: center; gap: .1rem; }
.rep-att b { font-size: 1.3rem; font-weight: 900; color: #0f172a; }
.rep-att span { font-size: .62rem; font-weight: 850; color: #64748b; text-transform: uppercase; }
.rep-att-bad b { color: #b91c1c; }
.rep-util-row { display: grid; grid-template-columns: 3.4rem 1fr 3rem; align-items: center; gap: .6rem; margin-bottom: .45rem; font-size: .72rem; font-weight: 850; color: #334155; }
.rep-util-track { height: .55rem; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.rep-util-fill { height: 100%; border-radius: 999px; background: #5e8c82; }
.rep-util-fill.is-hot { background: #d97706; }
.reports-card-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: .8rem; }
.reports-card-head p { margin: .1rem 0 0; color: #64748b; font-size: .7rem; font-weight: 750; }
.recall-list { display: grid; gap: .5rem; }
.recall-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: .8rem; align-items: center; padding: .6rem .75rem; border: 1px solid #e2e8f0; border-radius: .6rem; background: #fff; }
.recall-row.is-contacted { opacity: .55; }
.recall-flag { padding: .18rem .55rem; border-radius: 999px; font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.rc-overdue { background: #fef2f2; color: #b91c1c; } .rc-due { background: #fffbeb; color: #b45309; } .rc-lapsed { background: #f1f5f9; color: #475569; }
.recall-who b { color: #0f172a; font-size: .8rem; } .recall-who a { text-decoration: none; }
.recall-who span { display: block; color: #64748b; font-size: .66rem; font-weight: 800; }
.recall-phone { color: #334155; font-size: .72rem; font-weight: 850; }
.recall-actions { display: flex; gap: .4rem; }
.recall-btn { border: 1px solid #cbd5e1; background: #fff; border-radius: .45rem; padding: .34rem .6rem; font-size: .64rem; font-weight: 900; color: #334155; cursor: pointer; text-decoration: none; }
.recall-btn:hover { border-color: #5e8c82; }
.recall-wa { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
@media (max-width: 760px) { .recall-row { grid-template-columns: auto 1fr; } .recall-row .recall-phone, .recall-row .recall-actions { grid-column: 2; } }
.imaging-card { display: grid; gap: .8rem; }
.imaging-head { display: flex; justify-content: space-between; align-items: start; }
.imaging-head h2 { margin: 0; font-size: 1rem; font-weight: 900; }
.imaging-head p { margin: .15rem 0 0; color: #64748b; font-size: .7rem; font-weight: 750; }
.imaging-upload-btn { display: inline-block; padding: .5rem .85rem; background: #0f172a; color: #fff; border-radius: .5rem; font-size: .72rem; font-weight: 900; cursor: pointer; white-space: nowrap; }
.imaging-upload-btn:hover { background: #1e293b; }
.imaging-meta-row { display: grid; grid-template-columns: auto 1fr 2fr; gap: .5rem; }
.imaging-meta-row select, .imaging-meta-row input { border: 1px solid #cbd5e1; border-radius: .45rem; padding: .42rem .55rem; font-size: .72rem; font-weight: 800; }
.imaging-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.imaging-tile { position: relative; margin: 0; border: 1px solid #e2e8f0; border-radius: .6rem; overflow: hidden; background: #fff; cursor: pointer; }
.imaging-tile:hover { border-color: #5e8c82; }
.imaging-thumb { height: 110px; background: #0f172a center/cover no-repeat; display: grid; place-items: center; }
.imaging-file-ico { font-size: 1.6rem; color: #94a3b8; }
.imaging-tile figcaption { padding: .45rem .55rem; display: grid; gap: .1rem; }
.imaging-tile figcaption b { font-size: .66rem; color: #0f172a; }
.imaging-tile figcaption span { font-size: .62rem; color: #64748b; font-weight: 750; }
.imaging-by { color: #94a3b8 !important; }
.imaging-del { position: absolute; top: .3rem; right: .3rem; border: none; background: rgba(15,23,42,.75); color: #fff; width: 1.4rem; height: 1.4rem; border-radius: 50%; font-size: .68rem; cursor: pointer; }
.imaging-empty { color: #94a3b8; font-size: .76rem; font-weight: 800; }
.img-lightbox { position: fixed; inset: 0; z-index: 10000; background: rgba(15, 23, 42, .92); display: grid; place-items: center; padding: 2rem; }
.img-lightbox img { max-width: 92vw; max-height: 82vh; border-radius: .5rem; }
.img-lightbox-cap { color: #cbd5e1; font-size: .75rem; font-weight: 800; }
.img-lightbox-close { position: absolute; top: 1rem; right: 1.2rem; border: none; background: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.plan-accept { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed #e2e8f0; }
.plan-accept-state { display: flex; align-items: center; gap: .5rem; }
.plan-accept-state > span { font-size: .64rem; font-weight: 900; text-transform: uppercase; color: #334155; }
.plan-accept-state select { border: 1px solid #cbd5e1; border-radius: .45rem; padding: .3rem .45rem; font-size: .7rem; font-weight: 850; }
.plan-accept-meta { color: #64748b; font-size: .64rem; font-weight: 800; font-style: normal; }
.plan-estimate-btn { border: 1px solid #cbd5e1; background: #fff; border-radius: .45rem; padding: .4rem .7rem; font-size: .68rem; font-weight: 900; color: #334155; cursor: pointer; }
.plan-estimate-btn:hover { border-color: #5e8c82; color: #0f172a; }

/* ── Appointment editor + calendar upgrades (v70-t3) ─────────────────── */
.day-grid-time.is-after-hours, .day-grid-cell.is-after-hours { background: rgba(148, 163, 184, 0.08); }
.day-grid-event.is-cancelled { opacity: 0.45; filter: saturate(0.3); }
.day-grid-event.is-cancelled .appt-main-v13 { text-decoration: line-through; }

.appt-edit-btn {
  position: absolute; top: 4px; right: 4px; z-index: 5;
  width: 22px; height: 22px; border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12); background: rgba(255, 255, 255, 0.92);
  color: #0f172a; font-size: 12px; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
.day-grid-event:hover .appt-edit-btn, .appt-edit-btn:focus-visible { display: inline-flex; }
.appt-edit-btn:hover { background: #0f172a; color: #fff; }

.appt-editor-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.appt-editor {
  width: min(560px, 100%); background: #fff; border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.appt-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.appt-editor-head b { display: block; font-size: 17px; font-weight: 900; color: #0f172a; }
.appt-editor-head span { font-size: 12.5px; font-weight: 700; color: #64748b; }
.appt-editor-x {
  border: 0; background: transparent; font-size: 15px; cursor: pointer;
  color: #64748b; padding: 4px 8px; border-radius: 8px;
}
.appt-editor-x:hover { background: #f1f5f9; color: #0f172a; }
.appt-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.appt-editor-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 800; color: #475569; }
.appt-editor-grid select, .appt-editor-grid input {
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px 10px;
  font-size: 13.5px; font-weight: 600; color: #0f172a; background: #fff;
}
.appt-editor-grid select:focus, .appt-editor-grid input:focus { outline: 2px solid #5e8c82; outline-offset: 1px; }
.appt-editor-msg { min-height: 16px; font-size: 12.5px; font-weight: 700; color: #b91c1c; }
.appt-editor-actions { display: flex; align-items: center; gap: 8px; }
.appt-editor-actions .flex-1 { flex: 1; }
.appt-editor-save {
  border: 0; border-radius: 12px; padding: 9px 16px; cursor: pointer;
  background: #0f172a; color: #fff; font-weight: 800; font-size: 13.5px;
}
.appt-editor-save:hover { background: #1e293b; }
.appt-editor-cancel {
  border: 1px solid #cbd5e1; border-radius: 12px; padding: 9px 14px; cursor: pointer;
  background: #fff; color: #0f172a; font-weight: 800; font-size: 13.5px;
}
.appt-editor-delete {
  border: 1px solid #fecaca; border-radius: 12px; padding: 9px 14px; cursor: pointer;
  background: #fef2f2; color: #b91c1c; font-weight: 800; font-size: 13.5px;
}
.appt-editor-delete:hover { background: #b91c1c; color: #fff; }
@media (max-width: 560px) { .appt-editor-grid { grid-template-columns: 1fr; } }

/* ── Role gating (v70-t4) ────────────────────────────────────────────── */
.role-lock-note {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 12px;
  background: #fffbeb; border: 1px solid #fde68a;
  color: #92400e; font-size: 13px; font-weight: 700;
}
.chart-readonly-banner {
  position: sticky; top: 0; z-index: 60; text-align: center;
  background: #fffbeb; border-bottom: 1px solid #fde68a;
  color: #92400e; font-size: 13px; font-weight: 800; padding: 8px 12px;
}
