/* ==========================================================================
   HIDROGEO 3D — Componentes de panel, tablas, escenarios, validación
   ========================================================================== */

.section { margin-bottom: 18px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.section-title { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #9db5c4; display: flex; align-items: center; gap: 7px; }
.section-title .ic { width: 14px; height: 14px; color: var(--accent); }
.section-desc { font-size: 10px; color: var(--dim); line-height: 1.4; margin-top: 3px; }
.section-actions { display: flex; gap: 5px; flex: none; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; min-width: 0; }
.stat span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat b { display: block; font-family: var(--mono); font-size: 13px; font-weight: 600; margin-top: 2px; color: var(--text); }
.stat small { font-size: 8.5px; color: var(--dim); font-family: var(--mono); }
.stat.accent b { color: var(--accent); }
.stat.warn b { color: var(--amber); }
.stat.bad b { color: var(--red); }

.callout { display: flex; gap: 8px; padding: 8px 10px; border-radius: 6px; background: rgba(72,169,255,.06); border: 1px solid rgba(72,169,255,.20); font-size: 10px; color: #a9c8dd; line-height: 1.45; }
.callout.warn { background: rgba(242,169,59,.065); border-color: rgba(242,169,59,.25); color: #d9bd8a; }
.callout.bad { background: rgba(239,100,100,.06); border-color: rgba(239,100,100,.25); color: #e2a5a5; }
.callout.ok { background: rgba(69,201,138,.06); border-color: rgba(69,201,138,.22); color: #9fd6b8; }
.callout .ic { width: 14px; height: 14px; margin-top: 1px; flex: none; }

/* ------------------------------- estratigrafía --------------------------- */
.layer-list { display: flex; flex-direction: column; gap: 7px; }
.layer-card { border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); overflow: hidden; }
.layer-card.open { border-color: var(--line2); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.layer-head { display: flex; align-items: center; gap: 8px; padding: 8px 9px; cursor: pointer; user-select: none; }
.layer-head:hover { background: rgba(255,255,255,.018); }
.swatch { width: 9px; height: 30px; border-radius: 2px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.layer-id { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.layer-id b { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-id span { font-size: 9px; color: var(--dim); font-family: var(--mono); }
.layer-quick { display: flex; gap: 4px; flex: none; }
.qpill { font-family: var(--mono); font-size: 9px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }
.qpill.k { color: #a8d9c9; }
.layer-chev { color: var(--dim); transition: transform .18s; flex: none; }
.layer-card.open .layer-chev { transform: rotate(180deg); }
.layer-body { display: none; padding: 2px 9px 10px; border-top: 1px solid var(--line); }
.layer-card.open .layer-body { display: block; }
.layer-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding-top: 9px; }
.layer-tools { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.mini-btn { height: 25px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--line2); background: transparent; color: var(--muted); font-size: 9.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.mini-btn:hover { color: var(--text); border-color: #3d5b6c; background: var(--panel3); }
.mini-btn.danger:hover { color: var(--red); border-color: rgba(239,100,100,.45); }
.mini-btn .ic { width: 12px; height: 12px; }

.soil-key { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; background: rgba(0,0,0,.14); font-size: 9.5px; color: var(--dim); margin-top: 8px; }
.soil-key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* --------------------------------- flujo --------------------------------- */
.well-card { border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); padding: 9px; margin-bottom: 7px; }
.well-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 7px; }
.well-head b { font-size: 10.5px; }
.well-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.switch { position: relative; width: 30px; height: 17px; border-radius: 9px; background: #1c2c38; border: 1px solid var(--line2); cursor: pointer; transition: .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); transition: .15s; }
.switch.on { background: rgba(47,195,168,.22); border-color: rgba(47,195,168,.55); }
.switch.on::after { left: 15px; background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.profile-wrap { border: 1px solid var(--line); border-radius: 6px; background: linear-gradient(180deg, #0d1922, #0a131a); padding: 6px; }
.profile-svg { width: 100%; height: 132px; display: block; }
.profile-legend { display: flex; justify-content: space-between; font-size: 8.5px; color: var(--dim); padding: 3px 4px 0; }

/* -------------------------------- fuente --------------------------------- */
.compound-desc { font-size: 9.5px; color: var(--dim); line-height: 1.45; padding: 6px 0 2px; }
.mass-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.mass-flow .stat { background: rgba(47,195,168,.045); border-color: rgba(47,195,168,.16); }

/* ------------------------------- escenarios ------------------------------ */
.scn-list { display: flex; flex-direction: column; gap: 8px; }
.scn-card { border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); overflow: hidden; position: relative; }
.scn-card.selected { border-color: rgba(47,195,168,.6); box-shadow: 0 0 0 1px rgba(47,195,168,.18); }
.scn-top { display: flex; gap: 9px; padding: 9px; }
.scn-thumb { width: 94px; height: 62px; border-radius: 4px; background: #0a1319; border: 1px solid var(--line); flex: none; object-fit: cover; }
.scn-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.scn-info b { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scn-info span { font-size: 9px; color: var(--dim); font-family: var(--mono); }
.scn-mini { display: flex; gap: 8px; margin-top: 4px; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.scn-mini i { color: var(--accent); font-style: normal; }
.scn-actions { display: flex; gap: 4px; padding: 0 9px 8px; }
.scn-check { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line2); background: var(--bg2); display: grid; place-items: center; color: transparent; font-size: 11px; }
.scn-card.selected .scn-check { background: var(--accent); border-color: var(--accent); color: #04120f; }
.empty { text-align: center; padding: 22px 14px; border: 1px dashed var(--line2); border-radius: 7px; color: var(--dim); font-size: 10.5px; line-height: 1.5; }
.empty b { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }

/* ------------------------------- validación ------------------------------ */
.check-list { display: flex; flex-direction: column; gap: 5px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel2); }
.check-badge { flex: none; margin-top: 1px; width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; font-size: 9px; font-weight: 800; }
.check-badge.pass { background: rgba(69,201,138,.14); color: var(--green); border: 1px solid rgba(69,201,138,.32); }
.check-badge.warn { background: rgba(242,169,59,.14); color: var(--amber); border: 1px solid rgba(242,169,59,.32); }
.check-badge.fail { background: rgba(239,100,100,.14); color: var(--red); border: 1px solid rgba(239,100,100,.32); }
.check-main { min-width: 0; flex: 1; }
.check-name { font-size: 10.5px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.check-name em { font-family: var(--mono); font-style: normal; font-size: 9px; color: var(--muted); font-weight: 500; text-align: right; }
.check-detail { font-size: 9px; color: var(--dim); line-height: 1.4; margin-top: 2px; }
.check-group { font-size: 8.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); margin: 11px 0 4px; }

.summary-ring { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); }
.ring { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 700; flex: none; }
.ring.ok { background: radial-gradient(circle at center, var(--panel2) 58%, transparent 60%), conic-gradient(var(--green) var(--p), var(--line) 0); }
.ring.mid { background: radial-gradient(circle at center, var(--panel2) 58%, transparent 60%), conic-gradient(var(--amber) var(--p), var(--line) 0); }
.ring.bad { background: radial-gradient(circle at center, var(--panel2) 58%, transparent 60%), conic-gradient(var(--red) var(--p), var(--line) 0); }
.summary-txt b { font-size: 12px; }
.summary-txt span { display: block; font-size: 9.5px; color: var(--dim); line-height: 1.4; }

.chart-wrap { border: 1px solid var(--line); border-radius: 6px; background: #091119; padding: 7px 6px 3px; }
.chart-svg { width: 100%; height: 180px; display: block; }
.chart-legend { display: flex; gap: 14px; padding: 2px 6px 5px; font-size: 9px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 4px; }

.assumption { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 9.5px; color: var(--muted); line-height: 1.5; }
.assumption:last-child { border-bottom: 0; }
.assumption b { color: #a9c1d0; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; margin-right: 5px; }

/* ------------------------------- trazabilidad ---------------------------- */
.hash-card { padding: 10px 11px; border: 1px solid rgba(47,195,168,.22); border-radius: 6px; background: rgba(47,195,168,.045); }
.hash-card .hash { font-family: var(--mono); font-size: 10px; color: var(--accent); word-break: break-all; line-height: 1.45; }
.hash-card .hash-meta { display: flex; justify-content: space-between; font-size: 8.5px; color: var(--dim); margin-top: 4px; }
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 66px 1fr auto; gap: 7px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 9.5px; align-items: baseline; }
.audit-row time { color: var(--dim); font-family: var(--mono); font-size: 8px; }
.audit-row .what { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-row .what b { color: #b6cbd8; font-weight: 500; }
.audit-row .vals { font-family: var(--mono); font-size: 8.5px; color: var(--dim); text-align: right; white-space: nowrap; }
.audit-row .vals i { color: var(--accent); font-style: normal; }
.audit-filter { display: flex; gap: 6px; margin-bottom: 8px; }
.audit-filter input { flex: 1; background: var(--bg2); border: 1px solid var(--line2); border-radius: 4px; padding: 5px 7px; font-size: 10px; outline: none; }

/* --------------------------------- tablas -------------------------------- */
.table-wrap { border: 1px solid var(--line); border-radius: 6px; overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.tbl th { text-align: left; padding: 6px 7px; background: var(--panel3); color: var(--muted); font-weight: 600; font-size: 8.5px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line2); }
.tbl td { padding: 5px 7px; border-bottom: 1px solid var(--line); color: #c3d5e0; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-family: var(--mono); text-align: right; }
.tbl tr.hl td { background: rgba(47,195,168,.05); }
.tbl .pos { color: var(--green); }
.tbl .neg { color: var(--red); }

/* ------------------------------ sensibilidad ----------------------------- */
.sensitivity-block { margin-top: 10px; }
.sensitivity-rank { display: grid; grid-template-columns: 18px 44px 1fr 50px auto; align-items: center; gap: 7px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 9.5px; }
.sensitivity-rank:last-child { border-bottom: 0; }
.sensitivity-rank .rank { width: 16px; height: 16px; border-radius: 4px; background: var(--panel3); color: var(--accent); font-family: var(--mono); font-size: 8.5px; display: grid; place-items: center; }
.sensitivity-rank .rank-name { color: #b6cbd8; font-weight: 600; }
.sensitivity-rank .rank-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.sensitivity-rank .rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.sensitivity-rank .rank-val { font-family: var(--mono); color: var(--accent); text-align: right; }
.sensitivity-rank .rank-detail { font-family: var(--mono); font-size: 8px; color: var(--dim); white-space: nowrap; }

/* ------------------------------- report panel ---------------------------- */
.report-options { display: flex; flex-direction: column; gap: 7px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.checkline input { accent-color: var(--accent); width: 13px; height: 13px; }

/* -------------------------------- responsive ----------------------------- */
@media (max-width: 1320px) {
  .workspace { grid-template-columns: 70px minmax(0, 1fr) 372px; }
  .brand { min-width: 270px; }
  .scenario-chip { width: 200px; }
  .topbar-actions .btn span:not(.badge) { display: none; }
  .topbar-actions .btn { padding: 0 9px; }
  .toast-wrap { right: 388px; }
  .hud-legend { width: 208px; }
  .hud-strata { width: 196px; }
}
@media (max-width: 1080px) {
  .scenario-chip { display: none; }
  .workspace { grid-template-columns: 64px minmax(0, 1fr) 340px; }
  .hud-legend { top: 212px; right: 10px; bottom: auto; width: 152px; padding: 7px 8px; }
  .hud-legend .legend-note { display: none; }
  .hud-legend .legend-scale { font-size: 8px; }
  .legend-head { font-size: 8.5px; margin-bottom: 4px; }
  .hud-strata { left: 10px; bottom: 84px; width: 168px; padding: 6px 8px 5px; }
  .strata-row { padding: 1px 0; }
  .scenario-card { width: 262px; padding: 9px 11px 8px; }
  .hud-time > span:first-child { font-size: 21px; }
  .hud-metrics b { font-size: 12px; }
}
@media (max-width: 720px) {
  .hud-legend { top: 206px; width: 136px; }
  .hud-strata { width: 146px; }
  .strata-name { font-size: 8.5px; }
  .scenario-card { width: 240px; }
}
