.dental-toolbar,
.dental-tabs,
.dental-selected,
.dental-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dental-arch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 16px;
  margin: 28px 0;
  padding: 20px 8px;
  background: #f4f9ff;
  border-radius: 20px;
}
.dental-quadrant {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.dental-quadrant-group {
  min-width: 0;
}
.dental-quadrant-label {
  color: #49617b;
  font-size: 12px;
  margin-bottom: 10px;
  text-align: center;
}
.dental-tooth {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 92px;
  max-width: 58px;
  padding: 8px 2px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #0a1a2f;
  background: white;
  cursor: pointer;
  font: inherit;
}
.dental-tooth svg {
  width: 44px;
  max-width: 100%;
  height: 78px;
  fill: none;
  stroke: #517391;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dental-tooth .tooth-root {
  fill: #f0e8d6;
  stroke: #a2957b;
}
.dental-tooth .tooth-crown {
  fill: #fffef8;
  stroke: #647d91;
}
.dental-tooth .tooth-ridges {
  fill: none;
  stroke: #bbc9d2;
  stroke-width: 1;
}
.dental-tooth.selected {
  border-color: #147bff;
  box-shadow: 0 0 0 2px #147bff33;
}
.dental-tooth:focus-visible {
  outline: 3px solid #147bff;
  outline-offset: 3px;
}
.dental-mark {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cad5e2;
  flex-shrink: 0;
}
.dental-0 {
  background: #16804b;
}
.dental-1 {
  background: #c43737;
}
.dental-2 {
  background: #147bff;
}
.dental-3 {
  background: #a37200;
}
.dental-4 {
  background: #4b5563;
}
.dental-5 {
  background: #0a7484;
}
.dental-6 {
  background: #7e42ad;
}
.dental-7 {
  background: #c36512;
}
.dental-8 {
  background: #985470;
}
.dental-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding-bottom: 22px;
}
.dental-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.dental-selected {
  border-top: 1px solid #dce6f1;
  padding-top: 20px;
}
.dental-selected-tooth {
  display: flex;
  align-items: center;
  gap: 18px;
}
.dental-selected-tooth svg {
  width: 64px;
  height: 116px;
  flex-shrink: 0;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dental-selected-tooth .tooth-root {
  fill: #f0e8d6;
  stroke: #a2957b;
}
.dental-selected-tooth .tooth-crown {
  fill: #fffef8;
  stroke: #647d91;
}
.dental-selected-tooth .tooth-ridges {
  fill: none;
  stroke: #bbc9d2;
  stroke-width: 1;
}
.dental-entries article {
  border: 1px solid #dce6f1;
  border-radius: 16px;
  padding: 18px;
  margin-top: 16px;
}
.dental-entries small {
  color: #49617b;
}
.dental-history {
  border-left: 3px solid #dce6f1;
  margin: 14px 0;
  padding-left: 14px;
}
.dental-surfaces {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #dce6f1;
  border-radius: 12px;
}
.dental-surfaces label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
}
@media (max-width: 800px) {
  .dental-arch {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px 8px;
  }
  .dental-quadrant {
    gap: 8px;
  }
  .dental-tooth {
    min-height: 84px;
  }
}

/* Native SVG markings remain distinct without relying on colour alone. */
.dental-layers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.dental-layers .button {
  min-height: 44px;
}
.dental-symbols {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dental-symbols .chart-missing {
  stroke: #4b5563;
  stroke-width: 3;
}
.dental-symbols .chart-caries {
  fill: #b32632;
  stroke: white;
  stroke-width: 1;
}
.dental-symbols .chart-filling {
  fill: #147bff;
  stroke: #064491;
}
.dental-symbols .chart-crown {
  fill: #f7d880;
  stroke: #875d00;
}
.dental-symbols .chart-implant {
  stroke: #087182;
}
.dental-symbols .chart-root-canal {
  stroke: #7e42ad;
}
.dental-symbols .chart-fracture {
  stroke: #b6530b;
}
.dental-symbols .chart-wire {
  stroke: #495e75;
  stroke-width: 2;
}
.dental-symbols .chart-bracket rect {
  fill: #dce6f1;
  stroke: #3d526c;
}
.dental-symbols .chart-bracket path {
  stroke: #3d526c;
  stroke-width: 1.5;
}
.dental-symbols .chart-retainer {
  stroke: #087b83;
  stroke-width: 3;
}
.dental-symbols .chart-appliance {
  stroke: #6d42a1;
  stroke-dasharray: 3 3;
}
.dental-status {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #49617b;
}
.dental-9,
.dental-10 {
  background: #495e75;
}
.dental-11 {
  background: #087b83;
}
.dental-12 {
  background: #6d42a1;
}
@media (max-width: 480px) {
  .dental-quadrant {
    flex-wrap: wrap;
  }
  .dental-tooth {
    flex: 0 0 calc(25% - 8px);
    max-width: none;
    min-width: 44px;
  }
  .dental-layers .button {
    flex: 1 1 40%;
  }
}
.dental-legend .tooth-anatomy {
  width: 24px;
  height: 36px;
  flex-shrink: 0;
}
.dental-legend .tooth-crown {
  fill: #fffef8;
  stroke: #647d91;
}
.dental-legend .tooth-root {
  fill: #f0e8d6;
  stroke: #a2957b;
}
.dental-legend .tooth-ridges {
  fill: none;
  stroke: #bbc9d2;
}
.dental-chart-guidance {
  margin: 20px 0 8px;
  line-height: 1.6;
}

.dental-selection-toolbar {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #dce6f1;
  border-radius: 14px;
}
.dental-selection-actions,
.dental-selection-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.dental-selection-summary {
  justify-content: space-between;
}
.dental-selection-summary [role='status'] {
  flex: 1 1 220px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.dental-selection-toolbar .button {
  min-height: 44px;
}
@media (max-width: 480px) {
  .dental-selection-actions .button {
    flex: 1 1 40%;
  }
  .dental-selection-summary > .button {
    width: 100%;
  }
}
