: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 { padding-top: .55rem; padding-bottom: .55rem; }
.navbar.bg-dental .navbar-brand {
    letter-spacing: .3px;
    font-size: 1.12rem;
    display: flex;
    align-items: center;
}
.navbar.bg-dental .navbar-nav { gap: .25rem; }
.navbar.bg-dental .nav-link {
    color: rgba(255,255,255,.82);
    font-weight: 500;
    font-size: .92rem;
    padding: .45rem .85rem;
    border-radius: 9px;
    transition: background .15s, color .15s;
}
.navbar.bg-dental .nav-link:hover { color: #fff; background: rgba(255,255,255,.10); }
.navbar.bg-dental .nav-link.active { color: #fff; background: rgba(255,255,255,.18); font-weight: 600; }
.navbar.bg-dental .nav-link.show { background: rgba(255,255,255,.12); color: #fff; }
.navbar.bg-dental .dropdown-toggle::after { margin-left: .45em; opacity: .65; }

/* Dropdowns elegantes */
.navbar .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.16);
    padding: .4rem;
    margin-top: .55rem;
    min-width: 230px;
}
.navbar .dropdown-item {
    border-radius: 8px;
    padding: .55rem .7rem;
    font-size: .9rem;
    display: flex;
    align-items: center;
}
.navbar .dropdown-item:hover { background: var(--dental-light); color: var(--dental-primary); }
.navbar .dropdown-item:active { background: var(--dental-primary); color: #fff; }
.navbar .dropdown-header {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9aa0a6;
    padding: .4rem .7rem .2rem;
}

/* Menú de usuario con avatar */
.user-menu .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.22);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}
.user-menu .nav-link { padding-left: .5rem; padding-right: .5rem; }
.user-menu .nav-link:hover { background: transparent; }

/* ── Tabs (estilo subrayado moderno) ── */
.nav-tabs {
    border-bottom: 2px solid var(--dental-border);
    gap: .15rem;
    flex-wrap: wrap;
}
.nav-tabs .nav-link {
    color: #6a6a6a;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    padding: .55rem .95rem;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: -2px;
    transition: color .15s, background .15s, border-color .15s;
}
.nav-tabs .nav-link:hover {
    color: var(--dental-primary);
    background: var(--dental-light);
    border-bottom-color: var(--dental-border);
}
.nav-tabs .nav-link.active {
    color: var(--dental-primary);
    background: transparent;
    border-bottom: 2px solid var(--dental-primary);
    font-weight: 700;
}
.nav-tabs .nav-link .badge { font-weight: 600; }

/* ── 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; }
}
