/* Exact web translation of DentalChartControl.xaml. Values mirror MAUI desktop defaults; phone media rules mirror OnIdiom Phone. */
.dcm-control {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0;
    background: transparent;
    color: #172033;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dcm-control *, .dcm-control *::before, .dcm-control *::after { box-sizing: border-box; }
button { font-family: inherit; }

.dcm-fixed-card {
    margin: 10px 12px 6px;
    padding: 14px 16px 16px;
    background: #fff;
    border: 1px solid #E4E8F0;
    border-radius: 22px;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .14);
}
.dcm-fixed-stack { display: flex; flex-direction: column; gap: 12px; }
.dcm-header-scroll, .dcm-chart-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.dcm-header-scroll::-webkit-scrollbar, .dcm-chart-scroll::-webkit-scrollbar { display: none; }
.dcm-header-row { display: flex; align-items: center; gap: 10px; width: max-content; min-width: 100%; padding: 1px 2px; }

.dcm-dentition-selector { display: flex; gap: 3px; padding: 4px; background: #F1F3F8; border-radius: 15px; }
.dcm-dentition-button {
    min-height: 34px; padding: 7px 12px; border: 0; border-radius: 12px;
    background: transparent; color: #687386; font-size: 11px; font-weight: 700; cursor: pointer;
}
.dcm-dentition-button.active { background: #4F46E5; color: #fff; }

.dcm-statistics { display: flex; gap: 6px; padding: 6px 7px; background: #F8FAFC; border: 1px solid #E4E8F0; border-radius: 16px; }
.dcm-stat { display: flex; align-items: center; gap: 5px; padding: 4px 7px; white-space: nowrap; }
.dcm-stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.dcm-stat-label { font-size: 10px; color: #687386; }
.dcm-stat-value { font-size: 13px; }

.dcm-chart-frame { padding: 8px; background: #FCFDFE; border: 1px solid #EDF0F5; border-radius: 16px; }
.dcm-chart-scroll { padding: 2px 0; }
.dcm-teeth-row { display: flex; justify-content: center; align-items: flex-end; gap: 1px; min-width: max-content; }
.dcm-lower { align-items: flex-start; }
.dcm-arch-gap { height: 7px; }
.dcm-tooth {
    position: relative; flex: 0 0 auto; width: clamp(24px, 3.05vw, 50px); height: clamp(72px, 8.7vw, 142px);
    padding: 15px 1px 1px; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer;
}
.dcm-tooth:hover { background: #F8FAFC; }
.dcm-tooth.selected { background: #EEF2FF; border-color: #A5B4FC; }
.dcm-tooth-svg { width: 100%; height: 100%; overflow: visible; display: block; filter: drop-shadow(0 1px 1px rgba(23,32,51,.12)); }
.dcm-tooth-svg path { stroke: #626A78; stroke-width: .65; vector-effect: non-scaling-stroke; }
.dcm-tooth-number { position: absolute; top: 1px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; color: #687386; }
.dcm-extract-x line { stroke: #D9485F; stroke-width: 3; vector-effect: non-scaling-stroke; }

.dcm-workspace { position: relative; min-height: 290px; padding: 4px 14px 18px; }
.dcm-conditions-scroll { overflow-y: auto; overflow-x: hidden; height: 100%; }
.dcm-conditions-card { padding: 14px; background: #fff; border: 1px solid #E4E8F0; border-radius: 18px; box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.dcm-conditions-stack { display: flex; flex-direction: column; gap: 14px; }
.dcm-add-condition { display: flex; flex-direction: column; gap: 10px; }
.dcm-section-heading { display: flex; gap: 7px; align-items: center; }
.dcm-plus { display: grid; place-items: center; padding: 6px; min-width: 29px; background: #EEF2FF; border-radius: 8px; color: #4F46E5; font-size: 15px; font-weight: 700; }
.dcm-section-title { font-size: 15px; font-weight: 700; color: #172033; }
.dcm-section-subtitle { font-size: 11px; color: #687386; }
.dcm-condition-groups { display: flex; flex-direction: column; gap: 7px; }
.dcm-condition-group { display: flex; flex-direction: column; gap: 7px; }
.dcm-group-title { margin: 5px 0 1px 2px; font-size: 10px; font-weight: 700; color: #687386; }
.dcm-condition-flex { display: flex; flex-wrap: wrap; }
.dcm-condition {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; padding: 6px 9px;
    background: #fff; border: 1px solid #E0E4EB; border-radius: 13px; color: #172033; font-size: 11px; cursor: pointer;
}
.dcm-condition:hover, .dcm-condition.active { border-color: #A5B4FC; background: #EEF2FF; }
.dcm-swatch { width: 9px; height: 9px; border-radius: 50%; }
.dcm-divider { height: 1px; background: #E4E8F0; }
.dcm-legend { display: flex; flex-direction: column; gap: 8px; }
.dcm-legend-flex { display: flex; flex-wrap: wrap; }
.dcm-legend-item { display: inline-flex; align-items: center; gap: 3px; margin: 0 14px 6px 0; color: #687386; font-size: 11px; }
.dcm-legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.dcm-selected-float { position: absolute; z-index: 30; top: 4px; right: 18px; max-height: 100px; }
.dcm-selected-scroll { width: 300px; max-width: 320px; max-height: 100px; overflow-y: auto; }
.dcm-selected-card { padding: 9px 11px; background: #fff; border: 1px solid #E4E8F0; border-radius: 18px; box-shadow: 0 5px 14px rgba(0,0,0,.20); }
.dcm-selected-stack { display: flex; flex-direction: column; gap: 6px; }
.dcm-selected-heading { display: flex; gap: 7px; align-items: flex-start; }
.dcm-selected-number { padding: 3px 7px; background: #EEF2FF; border-radius: 9px; color: #4F46E5; font-size: 11px; font-weight: 700; }
.dcm-selected-copy { min-width: 0; display: flex; flex-direction: column; }
.dcm-selected-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #172033; font-size: 14px; }
.dcm-selected-copy span { color: #687386; font-size: 10px; }
.dcm-selected-copy small { color: #687386; font-size: 9px; }
.dcm-applied { display: flex; flex-wrap: wrap; align-items: flex-start; }
.dcm-applied-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 2px 4px 0; padding: 4px 4px 4px 8px; border: 1px solid #D8DDFB; border-radius: 12px; background: #EEF2FF; color: #4F46E5; font-size: 11px; font-weight: 700; }
.dcm-applied-chip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #E0E7FF; color: #4F46E5; font-size: 12px; font-weight: 700; cursor: pointer; }
.dcm-empty { width: 100%; text-align: center; margin-top: 2px; color: #A0A0B8; font-size: 11px; }

.dcm-clear-actions { position: absolute; z-index: 50; right: 24px; bottom: 28px; display: flex; gap: 8px; }
.dcm-clear-button { padding: 7px 12px; border: 1px solid #E4E8F0; border-radius: 16px; background: #fff; color: #687386; font-size: 11px; font-weight: 700; cursor: pointer; }
.dcm-clear-all { color: #DC4C64; }

.dcm-busy { position: absolute; z-index: 1000; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(255,255,255,.82); color: #4F46E5; font-size: 13px; font-weight: 700; border-radius: 18px; }
.dcm-busy[hidden] { display: none; }
.dcm-spinner { width: 30px; height: 30px; border: 3px solid #E0E7FF; border-top-color: #4F46E5; border-radius: 50%; animation: dcm-spin .75s linear infinite; }
@keyframes dcm-spin { to { transform: rotate(360deg); } }
.dcm-toast { position: absolute; z-index: 1100; top: 18px; left: 50%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; padding: 9px 12px; border-radius: 10px; background: #172033; color: #fff; font-size: 12px; transition: .18s; }
.dcm-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
    .dcm-fixed-card { margin: 4px; padding: 8px 8px 10px; border-radius: 22px; }
    .dcm-fixed-stack { gap: 6px; }
    .dcm-header-row { gap: 6px; }
    .dcm-dentition-selector { gap: 2px; padding: 2px; }
    .dcm-dentition-button { min-height: 28px; padding: 4px 8px; font-size: 9px; }
    .dcm-statistics { gap: 2px; padding: 3px 4px; }
    .dcm-stat { gap: 2px; padding: 2px 4px; }
    .dcm-stat-dot { width: 5px; height: 5px; }
    .dcm-stat-label { font-size: 8px; }
    .dcm-stat-value { font-size: 10px; }
    .dcm-chart-frame { padding: 4px; }
    .dcm-tooth { width: clamp(20px, 6.4vw, 38px); height: clamp(62px, 19vw, 112px); padding-top: 13px; }
    .dcm-workspace { padding: 4px 4px 10px; min-height: 260px; }
    .dcm-conditions-card { padding: 10px; }
    .dcm-conditions-stack { gap: 10px; }
    .dcm-add-condition { gap: 6px; }
    .dcm-section-heading { gap: 4px; }
    .dcm-plus { min-width: 23px; padding: 4px; font-size: 13px; }
    .dcm-section-title { font-size: 13px; }
    .dcm-section-subtitle { font-size: 9px; }
    .dcm-condition-groups, .dcm-condition-group { gap: 4px; }
    .dcm-group-title { margin-top: 3px; font-size: 8px; }
    .dcm-condition { gap: 4px; margin: 0 4px 4px 0; padding: 4px 6px; font-size: 9px; }
    .dcm-swatch, .dcm-legend-dot { width: 7px; height: 7px; }
    .dcm-legend { gap: 4px; }
    .dcm-legend-item { margin: 0 8px 4px 0; font-size: 9px; }
    .dcm-selected-float { top: 6px; right: 4px; }
    .dcm-selected-scroll { width: 160px; max-width: 180px; }
    .dcm-selected-card { padding: 6px 8px; }
    .dcm-selected-stack { gap: 3px; }
    .dcm-selected-heading { gap: 4px; }
    .dcm-selected-number { padding: 2px 5px; font-size: 9px; }
    .dcm-selected-copy strong { font-size: 11px; }
    .dcm-selected-copy span { font-size: 8px; }
    .dcm-selected-copy small { font-size: 7px; }
    .dcm-applied-chip { gap: 4px; padding: 3px 3px 3px 5px; font-size: 9px; }
    .dcm-applied-chip button { width: 18px; height: 18px; font-size: 10px; }
    .dcm-empty { font-size: 9px; }
    .dcm-clear-actions { right: 8px; bottom: 16px; gap: 4px; }
    .dcm-clear-button { padding: 5px 8px; font-size: 9px; }
}

/* Rendering parity fixes with MAUI ToothCanvasView. */
.dcm-chart-frame {
    overflow: visible;
}

.dcm-chart-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

.dcm-teeth-row {
    min-height: clamp(86px, 10vw, 158px);
    overflow: visible;
}

.dcm-tooth {
    overflow: visible;
}

.dcm-tooth-svg .dcm-overlay-layer {
    stroke: none;
}

.dcm-tooth-badges {
    position: absolute;
    right: 1px;
    top: 1px;
    z-index: 3;
}

.dcm-tooth-badges > span {
    display: grid;
    place-items: center;
    min-width: 13px;
    height: 13px;
    padding: 0 3px;
    border-radius: 7px;
    background: #4F46E5;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
}

/* Ensure both arches remain in normal document flow and cannot overlap/clamp. */
.dcm-upper,
.dcm-lower {
    position: relative;
    display: flex;
    visibility: visible;
    opacity: 1;
}

.dcm-arch-gap {
    flex: 0 0 10px;
    height: 10px;
}
