.dental-chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dental-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

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

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dental-board {
  direction: ltr;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: auto;
}

.dental-arch-row {
  display: grid;
  grid-template-columns: 1fr 2px 1fr;
  gap: 8px;
  align-items: stretch;
  min-width: 580px;
}

.dental-quadrant {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dental-quadrant-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  direction: rtl;
}

.dental-teeth-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.dental-midline {
  background: var(--border-strong);
  border-radius: 2px;
  opacity: 0.7;
}

.dental-arch-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 580px;
}

.dental-arch-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
  opacity: 0.7;
}

.dental-arch-divider-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  direction: rtl;
  white-space: nowrap;
}

.tooth-btn {
  position: relative;
  width: 34px;
  min-height: 58px;
  padding: 4px 2px;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.tooth-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.tooth-btn.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-2px);
}

.tooth-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.tooth-svg-wrap {
  width: 22px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tooth-count-dot {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

/* ألوان حالات الأسنان */
.tooth-btn.status-healthy {
  color: var(--text-secondary);
}

.tooth-btn.status-caries {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.tooth-btn.status-planned {
  border-color: #f59e0b;
  border-style: dashed;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.tooth-btn.status-filled {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
}

.tooth-btn.status-rct {
  border-color: #9333ea;
  background: rgba(147, 51, 234, 0.14);
  color: #7e22ce;
}

.tooth-btn.status-crown {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.16);
  color: #b45309;
}

.tooth-btn.status-implant {
  border-color: #0d9488;
  background: rgba(13, 148, 136, 0.16);
  color: #0f766e;
}

.tooth-btn.status-missing {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
  color: var(--text-muted);
  opacity: 0.62;
}

[data-theme='dark'] .tooth-btn.status-caries { color: #fca5a5; }
[data-theme='dark'] .tooth-btn.status-planned { color: #fcd34d; }
[data-theme='dark'] .tooth-btn.status-filled { color: #7dd3fc; }
[data-theme='dark'] .tooth-btn.status-rct { color: #d8b4fe; }
[data-theme='dark'] .tooth-btn.status-crown { color: #fbbf24; }
[data-theme='dark'] .tooth-btn.status-implant { color: #5eead4; }

/* لوحة تفاصيل السن المحدد */
.tooth-editor-panel {
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn var(--transition-fast) ease-out;
}

.tooth-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.tooth-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill-btn {
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.status-pill-btn:hover {
  border-color: var(--accent);
}

.status-pill-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.surface-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.surface-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.surface-btn.active {
  background: var(--info);
  border-color: var(--info);
  color: #ffffff;
}

.treated-teeth-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.treated-tooth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.treated-tooth-chip:hover,
.treated-tooth-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}
