.dental-chart-shell {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.18));
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    rgba(7, 21, 36, 0.4);
}

.dental-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.dental-chart-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #eef5ff);
}

.dental-chart-meta {
  margin-top: 4px;
  color: var(--muted, #a7bed8);
  font-size: 12px;
}

.dental-dentition-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dental-mode-btn,
.dental-btn-clear,
.dental-btn-done {
  border: 1px solid var(--line, rgba(255, 255, 255, 0.18));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #eef5ff);
  padding: 7px 12px;
  cursor: pointer;
}

.dental-mode-btn.active {
  border-color: var(--accent, #6ef3c5);
  color: var(--accent, #6ef3c5);
  box-shadow: 0 0 0 1px rgba(110, 243, 197, 0.24) inset;
}

.dental-chart-body {
  display: grid;
  gap: 12px;
}

.dental-arch-section {
  display: grid;
  gap: 8px;
}

.dental-arch-title {
  color: var(--muted, #a7bed8);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dental-arch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.dental-side {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dental-side-right {
  justify-content: flex-end;
}

.dental-side-left {
  justify-content: flex-start;
}

.dental-midline {
  color: var(--muted, #a7bed8);
  font-size: 11px;
  writing-mode: vertical-lr;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.75;
}

.dental-tooth {
  position: relative;
  width: 72px;
  min-height: 86px;
  padding: 8px 6px 10px;
  border-radius: 16px 16px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.04);
  color: var(--text, #eef5ff);
  display: grid;
  gap: 6px;
  align-content: start;
  justify-items: center;
  cursor: pointer;
}

.dental-tooth:hover {
  border-color: var(--accent-2, #8ac5ff);
  transform: translateY(-1px);
}

.dental-tooth.has-selection {
  border-color: var(--accent, #6ef3c5);
  box-shadow: 0 0 0 1px rgba(110, 243, 197, 0.2) inset;
}

.dental-tooth-shape {
  width: 28px;
  height: 28px;
  border-radius: 12px 12px 10px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(220, 234, 247, 0.76));
  box-shadow: inset 0 -5px 10px rgba(83, 110, 140, 0.2);
}

.dental-tooth-code {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dental-status-badges {
  min-height: 20px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.dental-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-color, #9db4d0) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-color, #9db4d0) 50%, transparent);
  color: var(--text, #eef5ff);
  font-size: 10px;
  font-weight: 700;
}

.dental-note-indicator {
  font-size: 9px;
  color: var(--muted, #a7bed8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.dental-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dental-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted, #a7bed8);
  font-size: 12px;
}

.dental-legend-swatch,
.dental-status-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--status-color, #9db4d0);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-color, #9db4d0) 22%, transparent);
}

.dental-legend-code {
  color: var(--text, #eef5ff);
  font-weight: 700;
}

.dental-popover {
  position: absolute;
  z-index: 20;
  width: min(310px, calc(100vw - 48px));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.18));
  border-radius: 14px;
  padding: 12px;
  background: var(--panel, rgba(18, 36, 58, 0.96));
  box-shadow: 0 22px 40px rgba(2, 10, 20, 0.42);
  display: grid;
  gap: 10px;
}

.dental-popover.hidden {
  display: none;
}

.dental-popover-head {
  display: grid;
  gap: 4px;
}

.dental-popover-head strong {
  font-size: 16px;
}

.dental-popover-head span {
  color: var(--muted, #a7bed8);
  font-size: 12px;
}

.dental-popover-statuses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dental-status-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.dental-status-option input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.dental-popover-note {
  display: grid;
  gap: 6px;
}

.dental-popover-note span {
  color: var(--muted, #a7bed8);
  font-size: 12px;
}

.dental-popover-note textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text, #eef5ff);
  padding: 9px 10px;
  font: inherit;
}

.dental-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dental-btn-done {
  border-color: var(--accent, #6ef3c5);
  color: var(--accent, #6ef3c5);
}

.dental-empty-copy {
  color: var(--muted, #a7bed8);
  font-size: 12px;
}

@media (max-width: 960px) {
  .dental-arch-row {
    grid-template-columns: 1fr;
  }

  .dental-side-right,
  .dental-side-left {
    justify-content: center;
  }

  .dental-midline {
    writing-mode: initial;
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .dental-popover-statuses {
    grid-template-columns: 1fr;
  }

  .dental-tooth {
    width: 64px;
    min-height: 80px;
  }
}
