:root {
    --dental-primary: #8B1A4A;
    --dental-primary-dark: #6d1439;
    --dental-light: #f7eef3;
    --dental-border: #d4a8be;
}

/* ── Color utilities ── */
.bg-dental          { background-color: var(--dental-primary) !important; }
.bg-dental-light    { background-color: var(--dental-light) !important; }
.text-dental        { color: var(--dental-primary) !important; }
.btn-dental         { background-color: var(--dental-primary); color: #fff; border: none; }
.btn-dental:hover   { background-color: var(--dental-primary-dark); color: #fff; }
.btn-dental:focus   { box-shadow: 0 0 0 .2rem rgba(139,26,74,.35); }
.btn-outline-dental { color: var(--dental-primary); border-color: var(--dental-primary); background: transparent; }
.btn-outline-dental:hover { background-color: var(--dental-primary); color: #fff; }
.badge.bg-dental    { background-color: var(--dental-primary) !important; }

/* ── Table header ── */
.table-dental th {
    background-color: var(--dental-light);
    color: var(--dental-primary);
    border-color: var(--dental-border);
    font-weight: 600;
    font-size: .85rem;
}

/* ── Navbar ── */
.navbar.bg-dental .nav-link { color: rgba(255,255,255,.85); }
.navbar.bg-dental .nav-link:hover { color: #fff; }
.navbar.bg-dental .navbar-brand { letter-spacing: .5px; }

/* ── Tabs ── */
.nav-tabs .nav-link { color: #555; }
.nav-tabs .nav-link.active {
    color: var(--dental-primary);
    border-color: var(--dental-border) var(--dental-border) #fff;
    font-weight: 600;
}
.nav-tabs .nav-link:hover { color: var(--dental-primary); }

/* ── Cards ── */
.card { border-radius: .6rem; }
.card-header { border-radius: .6rem .6rem 0 0 !important; }

/* ── Login logo ── */
.dental-logo-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--dental-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Footer ── */
.footer { font-size: .8rem; }

/* ── Responsive table ── */
@media (max-width: 576px) {
    .table-responsive table { font-size: .82rem; }
}

/* ── Odontograma ── */
.odo-wrap {
    overflow-x: auto;
    padding: .5rem 0;
}
.odo-arcada {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 3px;
    min-width: 640px;
    margin-bottom: 3px;
}
.odo-linea-media {
    min-width: 640px;
    border-top: 1px dashed #c9b3bf;
    margin: 6px 0;
}
.odo-sep { width: 14px; flex-shrink: 0; }
.odo-diente {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.odo-num {
    font-size: .62rem;
    color: #666;
    font-weight: 600;
    line-height: 1;
}
.odo-svg {
    width: 34px;
    height: 34px;
    display: block;
}
.odo-cara {
    fill: #fffdf7;
    stroke: #b9a0ac;
    stroke-width: .6;
    transition: fill .1s;
}
.odo-cara:hover { fill: #f3e3ec; }
.odo-overlay { pointer-events: none; }
.odo-diente.odo-ausente .odo-cara { fill: #f0f0f0 !important; opacity: .5; }

/* Panel de diagnósticos */
.odo-diag-list .odo-diag-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    text-align: left;
    border: 1px solid #e7e7e7;
    background: #fff;
    border-radius: .4rem;
    padding: .3rem .5rem;
    margin-bottom: .25rem;
    cursor: pointer;
    font-size: .82rem;
    transition: border-color .12s, box-shadow .12s;
}
.odo-diag-item:hover { border-color: var(--dental-primary); }
.odo-diag-item.active {
    border-color: var(--dental-primary);
    box-shadow: 0 0 0 2px rgba(139,26,74,.18);
    font-weight: 600;
}
.odo-diag-swatch {
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.25);
    flex-shrink: 0;
}

/* ── Toggle de ítems en presupuesto ── */
.btn-toggle-pres i {
    transition: transform .2s;
    display: inline-block;
}
.btn-toggle-pres[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* ── Editor de Mapa Facial ── */
.face-map-canvas {
    position: relative;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    border: 1px solid #e2d3dc;
    border-radius: .6rem;
    overflow: hidden;
    background: #fff;
}
.face-map-canvas img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}
.face-map-points {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}
.face-map-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,.45);
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
    pointer-events: auto;
    cursor: pointer;
    z-index: 6;
    transition: box-shadow .1s;
}
.face-map-dot:hover { transform: translate(-50%, -50%) scale(1.3); box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0,0,0,.5); }

/* No-readonly: cursor de "agregar" sobre el lienzo */
.face-map-canvas:not(.readonly) { cursor: crosshair; }

/* Paleta con nombres (chips) */
.face-map-palette {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: stretch;
}
.face-map-swatch-named {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    border: 2px solid #e2d3dc;
    border-radius: 2rem;
    padding: .35rem .75rem;
    cursor: pointer;
    font-size: .85rem;
    color: #444;
    transition: border-color .15s, box-shadow .15s;
}
.face-map-swatch-named:hover { border-color: var(--dental-primary); }
.face-map-swatch-named.active {
    border-color: var(--dental-primary);
    box-shadow: 0 0 0 2px rgba(139,26,74,.18);
    font-weight: 600;
}
.face-map-swatch-named .swn-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,.3);
    flex-shrink: 0;
}
.face-map-swatch-named .swn-count {
    font-size: .7rem;
    min-width: 1.4em;
}

/* Paleta de colores (versión antigua de solo círculos) */
.face-map-palette-circles {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    justify-content: center;
}
.face-map-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .1s;
    position: relative;
}
.face-map-swatch:hover { transform: scale(1.1); }
.face-map-swatch.active {
    border-color: #333;
    box-shadow: 0 0 0 2px #fff inset;
}
.face-map-swatch .swatch-count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: .65rem;
    line-height: 1;
    padding: 1px 4px;
    color: #333;
    font-weight: 600;
}

@media (min-width: 768px) {
    .face-map-canvas { max-width: 320px; }
}
