/* =====================================================================
 * Heatmap de ONs (BeroONsMap) — paleta Bero, claro / oscuro
 * ===================================================================== */
.omap {
    --om-ink: #1e293b;
    --om-muted: #64748B;
    --om-line: #E2E8F0;
    --om-soft: #F8FAFC;
    --om-card: #ffffff;
    --om-head: #001D3B;
    --om-accent: #3fa892;
    --om-up: #12805c;
    --om-down: #c2362b;
    --om-esp-O: #d08a14;
    --om-esp-D: #2a5d9c;
    --om-esp-C: #3fa892;
    --om-surface: #F8FAFC;
    display: flex; flex-direction: column; flex: 1; height: 100%; min-height: 0;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--om-ink);
    font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .omap {
    --om-ink: #dbe4ee;
    --om-muted: #94a3b8;
    --om-line: rgba(255, 255, 255, .10);
    --om-soft: rgba(255, 255, 255, .03);
    --om-card: #04203f;
    --om-head: #ffffff;
    --om-accent: #59C2AB;
    --om-up: #3fbf95;
    --om-down: #f07167;
    --om-esp-O: #e3b341;
    --om-esp-D: #7da2ef;
    --om-esp-C: #59C2AB;
    --om-surface: #001226;
}

/* ---------- encabezado del modal ---------- */
#onsHeatmapModal .modal-content { border-radius: 0 !important; border: 0 !important; background: var(--card-bg); }
#onsHeatmapModal .modal-header { border-bottom: 3px solid #59C2AB !important; padding: 12px 22px; }
.om-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #59C2AB; display: block; line-height: 1; margin-bottom: 4px; }
#onsHeatmapModal .modal-title { font-size: 1.15rem; letter-spacing: -.01em; }
.om-head-r { display: flex; align-items: center; gap: 12px; margin-left: auto; margin-right: 14px; color: #cbd5e1; font-size: 12px; font-weight: 600; }
.om-reload { width: 32px; height: 32px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #e2e8f0; display: inline-flex; align-items: center; justify-content: center; }
.om-reload:hover { background: rgba(255,255,255,.14); }
#onsHeatmapModal .modal-header .btn-close { margin-left: 0 !important; }
#onsHeatmapModal.om-loading .om-reload i { animation: om-spin .8s linear infinite; }
@keyframes om-spin { to { transform: rotate(360deg); } }
#onsHeatmapModal .modal-body { padding: 16px 22px 18px !important; background: var(--card-bg); }

/* ---------- KPIs ---------- */
.om-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.om-kpi { border: 1px solid var(--om-line); border-radius: 16px; padding: 11px 14px 10px; background: var(--om-card); min-width: 0; }
.om-kpi-l { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--om-muted); }
.om-kpi-v { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; color: var(--om-head); margin: 2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.om-kpi-v small { font-size: .8rem; font-weight: 600; color: var(--om-muted); }
.om-kpi-txt { font-size: 1.05rem; line-height: 1.6rem; }
.om-kpi-s { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--om-muted); font-weight: 600; }
.om-kpi-s span { display: inline-flex; align-items: center; gap: 5px; }
.om-split, .om-breadth { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; margin-bottom: 6px; background: var(--om-line); }
.om-split-seg, .om-breadth span { display: block; min-width: 0; }
.om-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.om-esp-O { background: var(--om-esp-O); }
.om-esp-D { background: var(--om-esp-D); }
.om-esp-C { background: var(--om-esp-C); }
.om-up { color: var(--om-up); }
.om-down { color: var(--om-down); }
.om-flat { color: var(--om-muted); }
.om-up-bg { background: var(--om-up); }
.om-down-bg { background: var(--om-down); }
.om-flat-bg { background: var(--om-muted); opacity: .4; }

/* ---------- barra de controles ---------- */
.om-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; padding: 10px 14px; border: 1px solid var(--om-line); border-radius: 16px; background: var(--om-soft); margin-bottom: 12px; }
.om-ctl { display: flex; flex-direction: column; gap: 4px; }
.om-ctl > label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--om-muted); margin: 0; }
.om-seg { display: inline-flex; border: 1px solid var(--om-line); border-radius: 999px; background: var(--om-card); padding: 2px; }
.om-seg button { border: 0; background: transparent; color: var(--om-muted); font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; white-space: nowrap; }
.om-seg button:hover { color: var(--om-head); }
.om-seg button.on { background: #001D3B; color: #fff; }
[data-theme="dark"] .om-seg button.on { background: #59C2AB; color: #001D3B; }
.om-select { height: 32px; border: 1px solid var(--om-line); border-radius: 12px; background: var(--om-card); color: var(--om-ink); font-size: 12.5px; font-weight: 600; padding: 0 28px 0 10px; }
.om-search { height: 32px; width: 170px; border: 1px solid var(--om-line); border-radius: 999px; background: var(--om-card); color: var(--om-ink); font-size: 12.5px; padding: 0 12px 0 30px; text-transform: uppercase; }
.om-search::placeholder { text-transform: none; color: var(--om-muted); }
.om-search-w { position: relative; }
.om-search-w i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--om-muted); font-size: 12px; }
.om-select:focus, .om-search:focus { outline: none; border-color: #59C2AB; box-shadow: 0 0 0 3px rgba(89,194,171,.25); }

.om-map-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 8px 4px 0; }
.om-legend { margin-left: auto; display: grid; grid-template-columns: auto 200px auto; grid-template-rows: auto auto; align-items: center; gap: 2px 10px; flex: none; }
.om-legend-t { grid-row: 1 / 3; }
.om-legend-bar { grid-column: 2; grid-row: 1; }
.om-legend-lbl { grid-column: 2; grid-row: 2; }
.om-legend-nd { grid-column: 3; grid-row: 1 / 3; }
.om-legend-t { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--om-muted); }
.om-legend-bar { height: 8px; border-radius: 4px; }
.om-legend-lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--om-muted); font-weight: 600; }
.om-legend-nd { font-size: 10.5px; color: var(--om-muted); display: inline-flex; align-items: center; gap: 5px; }
.om-legend-nd i { width: 14px; height: 8px; border-radius: 2px; border: 1px dashed var(--om-muted); display: inline-block; }

/* ---------- cuerpo: mapa + panel ---------- */
.om-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
.om-map-col { display: flex; flex-direction: column; min-height: 0; }
.om-map-wrap { position: relative; flex: 1; min-height: 360px; border: 1px solid var(--om-line); border-radius: 16px; background: var(--om-surface); padding: 4px; overflow: hidden; }
.om-map { position: absolute; inset: 4px; }
.om-note { font-size: 12px; color: var(--om-muted); }
.om-note:empty { display: none; }
.om-linkbtn { border: 0; background: none; padding: 0; color: var(--om-accent); font-weight: 700; text-decoration: underline; }

.om-group { position: absolute; border-radius: 8px; background: var(--om-card); box-shadow: inset 0 0 0 1px var(--om-line); overflow: hidden; }
.om-group-h { height: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 7px; font-size: 11px; font-weight: 800; color: var(--om-head); white-space: nowrap; overflow: hidden; }
.om-group-n { overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.om-group-v { font-weight: 600; color: var(--om-muted); flex: none; }

.om-tile { position: absolute; border-radius: 4px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.15; padding: 2px; transition: opacity .15s, box-shadow .12s; }
.om-tile:hover { box-shadow: inset 0 0 0 2px rgba(255,255,255,.85), 0 0 0 1px rgba(0,29,59,.5); z-index: 2; }
.om-tile.om-sel { box-shadow: inset 0 0 0 2px #59C2AB, 0 0 0 2px #59C2AB; z-index: 3; }
.om-tile.om-dim { opacity: .18; }
.om-tile.om-nd { background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(127,140,160,.18) 5px 6px) !important; }
.om-t-tk { font-weight: 800; font-size: 12.5px; letter-spacing: .01em; white-space: nowrap; }
.om-t-v { font-size: 11.5px; font-weight: 700; opacity: .95; white-space: nowrap; }
.om-t-s { font-size: 10.5px; font-weight: 600; opacity: .8; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.om-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--om-muted); font-weight: 600; font-size: 13px; padding: 20px; text-align: center; }
.om-err { color: var(--om-down); }
.omap.om-loading .om-map { opacity: .45; }

.om-tip { position: absolute; z-index: 10; pointer-events: none; min-width: 210px; max-width: 280px; background: var(--om-card); color: var(--om-ink); border: 1px solid var(--om-line); border-radius: 12px; box-shadow: 0 16px 32px -12px rgba(0,29,59,.35); padding: 9px 12px; font-size: 12px; }
.om-tip b { color: var(--om-head); }
.om-tip-g { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin-top: 6px; }
.om-tip-g span { color: var(--om-muted); }
.om-tip-g b { text-align: right; font-weight: 700; color: var(--om-ink); }

/* ---------- panel lateral ---------- */
.om-side { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
.om-card { border: 1px solid var(--om-line); border-radius: 16px; background: var(--om-card); padding: 12px 14px; position: relative; }
.om-card h6 { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--om-head); margin: 0 0 8px; display: flex; align-items: baseline; gap: 6px; }
.om-card h6 small { font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--om-muted); font-size: 11px; }
.om-card h6::before { content: ''; width: 4px; height: 12px; border-radius: 2px; background: #59C2AB; display: inline-block; align-self: center; }
.om-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.om-two .om-row { grid-template-columns: minmax(0, 1fr) auto; }
.om-two .om-row-a small, .om-two .om-row-b { display: none; }
.om-foot { grid-column: 1 / -1; margin: 6px 0 0; font-size: 11px; color: var(--om-muted); }
.om-muted { color: var(--om-muted); font-size: 12px; }
.om-hint { font-size: 12.5px; color: var(--om-muted); border: 1px dashed var(--om-line); border-radius: 16px; padding: 12px 14px; display: flex; gap: 8px; align-items: center; }

.om-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 62px; align-items: center; gap: 8px; border: 0; background: transparent; padding: 5px 4px; border-radius: 8px; text-align: left; color: var(--om-ink); font-size: 12.5px; }
.om-row:hover { background: rgba(89,194,171,.10); }
.om-row-a { display: flex; flex-direction: column; min-width: 0; }
.om-row-a b { font-weight: 800; color: var(--om-head); }
.om-row-a small { font-size: 11px; color: var(--om-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.om-row-b { font-weight: 600; white-space: nowrap; }
.om-row-c { text-align: right; font-weight: 700; white-space: nowrap; }

.om-sec { display: grid; grid-template-columns: 120px 1fr 36px; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.om-sec-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.om-sec-bar { height: 6px; border-radius: 3px; background: var(--om-line); overflow: hidden; display: block; }
.om-sec-bar i { display: block; height: 100%; background: #59C2AB; border-radius: 3px; }
.om-sec-bar i.om-esp-O { background: var(--om-esp-O); }
.om-sec-bar i.om-esp-D { background: var(--om-esp-D); }
.om-sec-bar i.om-esp-C { background: var(--om-esp-C); }
.om-sec-v { text-align: right; font-weight: 700; color: var(--om-muted); }

.om-detail { border-color: rgba(89,194,171,.55); box-shadow: 0 0 0 3px rgba(89,194,171,.12); }
.om-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--om-muted); }
.om-d-tk { font-size: 1.25rem; font-weight: 800; color: var(--om-head); display: flex; align-items: center; gap: 8px; }
.om-chip { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; background: rgba(89,194,171,.15); color: var(--om-accent); border: 1px solid rgba(89,194,171,.45); }
.om-d-em { font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.om-d-meta { font-size: 11.5px; color: var(--om-muted); margin-top: 2px; }
.om-d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 12px 0; padding: 10px 0; border-top: 1px solid var(--om-line); border-bottom: 1px solid var(--om-line); }
.om-d-grid div { display: flex; flex-direction: column; min-width: 0; }
.om-d-grid span { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--om-muted); }
.om-d-grid b { font-size: 14px; font-weight: 800; color: var(--om-head); white-space: nowrap; }
.om-d-grid b small { font-size: 10.5px; font-weight: 600; color: var(--om-muted); }
.om-d-grid b.om-up { color: var(--om-up); }
.om-d-grid b.om-down { color: var(--om-down); }
.om-d-esp-h { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.om-d-esp-h span { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--om-muted); }
.om-d-esp-r { display: grid; grid-template-columns: 62px 1fr 76px 48px; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; }
.om-d-esp-r span:first-child { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.om-d-esp-r span:nth-child(3) { text-align: right; font-weight: 700; }
.om-d-esp-r .om-muted { text-align: right; font-size: 11px; }
.om-d-act { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.om-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 999px; border: 1px solid var(--om-line); background: var(--om-card); color: var(--om-ink); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.om-btn:hover { border-color: #59C2AB; }
.om-btn-p { background: #001D3B; border-color: #001D3B; color: #fff; }
.om-btn-p:hover { background: #0A2E5C; }
[data-theme="dark"] .om-btn-p { background: #59C2AB; border-color: #59C2AB; color: #001D3B; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
    .om-body { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 992px) {
    .om-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .om-body { display: flex; flex-direction: column; flex: none; }
    .om-map-wrap { flex: none; height: 62vh; min-height: 320px; }
    .om-map-foot { flex-direction: column; }
    .om-kpi-v { font-size: 1.1rem; }
    .om-side { overflow: visible; }
    .om-legend { margin-left: 0; }
    #onsHeatmapModal .modal-body { overflow-y: auto; }
    .omap { height: auto; }
}
@media (max-width: 576px) {
    #onsHeatmapModal .modal-body { padding: 12px !important; }
    .om-head-r .om-updated { display: none; }
    .om-search { width: 100%; }
}
