:root {
  --base-font-size: 16px;
  --rojo: #c00000;
  --rojo-hover: #9d0000;
  --verde: #05b82e;
  --azul: #0d6efd;
  --texto: #2d2d2d;
  --muted: #6b7280;
  --borde: #e2e6ea;
  --panel: rgba(255, 255, 255, .96);
  --shadow: 0 8px 26px rgba(0, 0, 0, .14);
  --header-h: 72px;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'Roboto', sans-serif;
  font-size: var(--base-font-size);
  font-weight: 400;
  color: var(--texto);
  background: #f3f4f6;
}

.app-header {
  height: var(--header-h);
  padding: 0 22px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--borde);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  position: relative;
  /*z-index: 1100;*/
}

.header-left,
.header-right,
.brand-app,
.peru-box {
  display: flex;
  align-items: center;
}

.header-right { justify-content: flex-end; }

body.ui-ocultar .header-right,
body.ui-ocultar .local-row.local-row-radio,
body.ui-ocultar .text-size-panel,
body.ui-ocultar .sabias-que-float,
body.ui-ocultar #botonmapas,
body.ui-ocultar #botonesDerechoIE,
body.ui-ocultar #panelTipoMapa,
body.ui-ocultar #panelHerramientas {
  display: none !important;
}

.sound-toggle{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 7px 10px;
  border-radius: 5px;
  background: #f4f6f8;
  border: 1px solid #dfe4ea;
}

.sound-toggle .form-check-input{
  margin-left: 0;
  margin-top: 0;
  cursor: pointer;
}

.sound-toggle .form-check-label{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2f3640;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}

.peru-box {
  gap: 10px;
  min-width: 0;
}

.peru-mark {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #d00000 0 50%, #fff 50% 100%);
  border: 1px solid #ddd;
  font-size: 18px;
  flex: 0 0 auto;
}

.minedu-title {
  font-size: .96rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.minedu-subtitle {
  max-width: 390px;
  margin-top: 2px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-app { gap: 10px; }

.brand-icon {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--rojo);
    color: #fff;
    font-size: 3.2rem;
}

.brand-name {
  color: var(--rojo);
  font-size: 2.9rem;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 0.8;
}

.brand-version {
  display: inline-block;
  margin-left: 8px;
  padding: 6px 8px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: .3em;
  font-weight: 700;
  letter-spacing: .8px;
  vertical-align: middle;
}

.brand-caption {
  margin-top: 2px;
  color: #000;
  font-size: .76rem;
}

.btn-history {
  border: none;
  border-radius: 5px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--rojo);
  color: #fff;
  font-size: .86rem;
  font-weight: 500;
  white-space: nowrap;
  transition: .2s ease;
}

.btn-history:hover {
  background: var(--rojo-hover);
  transform: translateY(-1px);
}

.btn-history:disabled,
.btn-history[aria-disabled="true"] {
  background: #b9bec4 !important;
  color: #eef1f4 !important;
  cursor: not-allowed;
  opacity: .9;
  transform: none !important;
  box-shadow: none;
}

.btn-history:disabled:hover,
.btn-history[aria-disabled="true"]:hover {
  background: #b9bec4 !important;
  transform: none !important;
}

.map-wrapper {
  width: 100%;
  height: calc(100vh - var(--header-h));
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.banner-sismo88 {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  min-height: 54px;
  background: rgba(192, 0, 0, 0.92);
  color: #fff;
  border: 1px solid #ff4c4c;
  border-radius: 999px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  white-space: nowrap;
  padding: 16px 22px;
}

.banner-sismo88 span {
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.banner-sismo88.show {
  display: inline-flex;
}

.banner-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.banner-close:hover {
  color: #ffffff;
}

.floating-panel {
  position: absolute;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid rgba(195, 195, 195, .75);
  border-radius: 5px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-left {
  top: 22px;
  left: 22px;
  width: min(380px, calc(100vw - 44px));
  padding: 18px 20px;
}

body.institucional-activa .panel-left {
  top: 72px;
}

body.capture-mode .panel-left {
  top: 22px;
}

body.capture-mode .panel-left,
body.capture-mode .panel-right,
body.capture-mode .usuario-sesion-institucional {
  animation: none;
}

body.capture-mode::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  background: none;
  opacity: 0;
}

.panel-right {
  top: 22px;
  right: 22px;
  width: min(360px, calc(100vw - 44px));
  padding: 18px 20px;
}

.text-size-panel {
  position: absolute;
  top: 0;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
  z-index: 1001;
  max-width: calc(100vw - 44px);
  transition: top 0.2s ease;
}

.text-size-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
}

.text-size-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.text-size-buttons .btn-font {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #222;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.text-size-buttons .btn-font:hover {
  transform: translateY(-1px);
  background: #f7f8fa;
  border-color: rgba(0, 0, 0, 0.14);
}

.usuario-sesion-institucional {
  position: absolute;
  top: 18px;
  left: 22px;
  z-index: 1002;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(380px, calc(100vw - 44px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
  color: var(--rojo);
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.1;
  backdrop-filter: blur(8px);
}

.magnitude-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin-bottom: 12px;
}

.pulse-icon {
  color: #111;
  font-size: 4rem;
  line-height: 1;
}

.magnitude-badge {
  min-width: 84px;
  min-height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--verde);
  color: #fff;
  font-size: 2.45rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.reference-title,
.panel-title {
  margin: 4px 0 14px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}

.reference-title1 {
  margin: 4px 0 14px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.35;
}

.panel-title {
  margin-bottom: 6px;
  font-weight: 700;
}

.data-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-list li,
.local-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #d9dde3;
}

.local-row-txt {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #d9dde3;
}

.data-list li {
  padding: 9px 0;
  font-size: .94rem;
  line-height: 1.25;
}

.data-list li:last-child,
.local-row:last-child { border-bottom: none; }

.data-label,
.local-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #303030;
  font-weight: 500;
}

.data-label { min-width: 135px; }

.data-value {
  color: #2f343a;
  text-align: right;
  font-weight: 400;
}

.source {
  margin-top: 10px;
  text-align: center;
  color: #444;
  font-size: .82rem;
}

.source strong { font-weight: 700; }

.local-row {
  align-items: center;
  padding: 12px 0;
}

.local-row-radio {
  align-items: center;
}

.local-value-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}

#radioLocalesKm {
  width: 88px;
  text-align: center;
  border-radius: 5px;
  border: 1px solid #ced4da;
}

.btn-radio-aplicar {
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 5px;
  background: #c00;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  transition: .2s ease;
}

.btn-danger {
  background-color: #c00000 !important;
  border-color: #c00000 !important;
}

.btn-danger:hover,
.btn-danger:focus {
  background-color: #9d0000 !important;
  border-color: #9d0000 !important;
}

.btn-radio-aplicar:hover {
  background: #a00;
}

.local-label { font-size: .97rem; }

.local-value {
  color: #222;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-actions{
  top: 82px;
  margin-top: 10px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#btnDescargarLocales {
  margin: 0 auto;
}

.btn-panel {
  border: none;
  border-radius: 5px;
  padding: 8px 11px;
  background: #f0f2f5;
  color: #333;
  font-size: .82rem;
  font-weight: 500;
  transition: .2s ease;
}

.btn-panel:hover { background: #e5e7eb; }

  .panel-left { top: 24px; }
.btn-panel.primary {
  background: var(--rojo);
  color: #fff;
}

.btn-panel.primary:hover { background: var(--rojo-hover); }

.legend-map {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, .94);
  border-radius: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  font-size: .83rem;
}

.legend-map strong {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: .85rem;
}

.legend-items-row {
  display: flex;
  gap: 6px;
}

.legend-items-row + .legend-items-row {
  margin-top: 0;
}

.legend-item {
  border-radius: 5px;
  padding: 7px 10px;
  color: #fff;
  line-height: 1.3;
  /*flex: 1;*/
}

.legend-item-green  { background: #05b82e; }
.legend-item-yellow { background: #ffd100; color: #1a1a1a; }
.legend-item-red    { background: #d40000; }

.legend-item-title {
  font-weight: 700;
  font-size: .78rem;
  margin-bottom: 2px;
  white-space: nowrap;
}

.legend-item-desc {
  font-size: .73rem;
  opacity: .93;
  line-height: 1.25;
}

.legend-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green  { background: #05b82e; }
.dot-yellow { background: #ffd100; }
.dot-red    { background: #d40000; }

.coes-logo {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
}

.logo-coes-img {
  width: clamp(90px, 8vw, 135px);
  height: auto;
  display: block;
  padding: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, .15);
}

#modalDescarga .modal-dialog { max-width: 700px; }

#modalDescarga .modal-content {
  border: none;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .18);
}

#modalDescarga .modal-header {
  padding: 12px 18px;
  background: var(--rojo);
  border: none;
}

#modalDescarga .modal-title {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .3px;
}

#modalDescarga .btn-close {
  filter: invert(1);
  opacity: .9;
}

#modalDescarga .modal-body {
  padding: 24px;
  background: #fff;
}

#modalDescarga .modal-footer {
  justify-content: center;
  padding: 14px;
  background: #fafafa;
  border-top: 1px solid #ececec;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-excel,
.btn-login-download,
.btn-dark-small {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 5px;
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: .2s ease;
}

.btn-excel {
  background: #198754;
  color: #fff;
}

.btn-excel:hover { background: #146c43; }

.btn-excel:disabled,
.btn-excel[aria-disabled="true"] {
  background: #c9d1d9 !important;
  color: #6b7280 !important;
  cursor: not-allowed;
  opacity: .95;
  box-shadow: none;
  filter: grayscale(.2);
}

.btn-excel:disabled:hover,
.btn-excel[aria-disabled="true"]:hover {
  background: #c9d1d9 !important;
  color: #6b7280 !important;
}

.btn-login-download {
  background: var(--rojo);
  color: #fff;
}

.btn-login-download:hover { background: var(--rojo-hover); }

.btn-dark-small {
  height: 34px;
  padding: 0 16px;
  background: #495057;
  color: #fff;
  font-size: 12px;
}

.btn-dark-small:hover { background: #343a40; color: #fff;}

.login-panel {
  display: none;
  margin-top: 20px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #dde2e8;
  border-radius: 5px;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
}

.login-panel.active { display: block; }

.login-panel .login-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.login-panel .login-row label {
  width: 120px;
  margin: 0;
  color: #3b4758;
  font-size: 0.94rem;
  font-weight: 600;
}

.login-panel .login-row input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #c7cdd8;
  border-radius: 5px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 0.95rem;
  font-family: 'Roboto', sans-serif;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-panel .login-row input:focus {
  outline: none;
  border-color: var(--rojo);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(192, 0, 0, 0.08);
}

.login-panel .form-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid #e6eaef;
  border-radius: 14px;
  background: #f7f9fb;
  justify-content: center;
}

.login-panel .form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 0;
  border: 1px solid #c7cdd8;
  border-radius: 6px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.login-panel .form-check-input:checked {
  background-color: var(--rojo);
  border-color: var(--rojo);
}

.login-panel .form-check-label {
  margin-bottom: 0;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 500;
}

.login-actions {
  margin-top: 20px;
  text-align: center;
}

.msg-error {
  display: none;
  margin-top: 15px;
  text-align: center;
  color: #dc3545;
  font-size: 12px;
}

.msg-error.active { display: block; }

@media (max-width: 1199px) {
  .brand-name { font-size: 1.7rem; }
  .panel-left { width: 350px; }
  .panel-right { width: 330px; }
  .magnitude-badge {
    min-width: 76px;
    min-height: 76px;
    font-size: 2.25rem;
  }
  .pulse-icon { font-size: 2.55rem; }
}

@media (max-width: 991px) {
  html,
  body { overflow: auto; }

  .app-header {
    height: auto;
    min-height: 70px;
    padding: 10px 14px;
    grid-template-columns: 1fr auto auto;
  }

  .minedu-subtitle,
  .brand-caption { display: none; }

  .brand-name { font-size: 1.55rem; }
  .brand-icon { width: 34px; height: 34px; }
  .btn-history { padding: 9px 12px; font-size: .8rem; }

  .map-wrapper {
    height: auto;
    min-height: calc(100vh - 78px);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #map {
    order: 2;
    height: 52vh;
    min-height: 360px;
    border-radius: 5px;
  }

  .floating-panel {
    position: relative;
    inset: auto;
    width: 100%;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .10);
  }

  .panel-left { order: 1; padding: 16px; }
  .panel-right { order: 3; padding: 16px; }
  .usuario-sesion-institucional {
    top: 14px;
    left: 14px;
    max-width: calc(100vw - 28px);
    font-size: .82rem;
  }
  body.institucional-activa .panel-left { top: 74px; }
  body.capture-mode .panel-left { top: 24px; }
  .legend-map { display: none; }
  .coes-logo { display: none; }
}

@media (max-width: 575px) {
  .app-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .header-left,
  .header-right { justify-content: center; }
  .minedu-title { text-align: center; font-size: .9rem; }
  .btn-history { width: 100%; justify-content: center; }
  .sound-toggle { width: 100%; justify-content: center; }
  
  .pulse-icon { font-size: 2rem; }
  .magnitude-badge {
    min-width: 68px;
    min-height: 68px;
    font-size: 2rem;
  }
  .data-list li { font-size: .88rem; }
  .data-label { min-width: 120px; }
  #map { height: 52vh; min-height: 320px;}

  #modalDescarga .modal-body { padding: 18px; }
  .modal-actions { flex-direction: column; }
  .btn-excel,
  .btn-login-download { width: 100%; }
  .login-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .login-row label,
  .login-row input { width: 100%; }

  .btn-sabias-que-text { display: none; }
}

.btn-whats{
    background:#198754;
}

.btn-whats:hover{
    background:#146c43;
}

/* ── Mapa histórico panel ── */
.mh-panel {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  background: rgba(255,255,255,.98);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: calc(100vw - 44px);
  border: 1px solid rgba(192,0,0,.14);
  border-top: 4px solid #c00;
  backdrop-filter: blur(10px);
}

.mh-titulo {
  font-weight: 700;
  font-size: .92rem;
  color: #c00;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mh-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mh-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 240px;
}

.mh-field label {
  font-size: .76rem;
  font-weight: 700;
  color: #4a4a4a;
  margin: 0;
  letter-spacing: .2px;
}

.mh-field select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d6dbe1;
  border-radius: 5px;
  font-size: .84rem;
  font-family: 'Roboto', sans-serif;
  background: #fff;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
}

.mh-btn {
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 5px;
  background: #c00;
  color: #fff;
  font-size: .84rem;
  font-weight: 500;
  font-family: 'Roboto', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s;
}

.mh-btn:hover { background: #a00; }

.mh-btn-close {
  background: #6c757d;
  padding: 0 10px;
}

.mh-btn-close:hover { background: #495057; }

.mh-contador {
  font-size: .84rem;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
  align-self: center;
  padding: 0 4px;
}

.mh-panel .bootstrap-select {
  min-width: 240px !important;
}

.mh-panel .bootstrap-select > .dropdown-toggle {
  height: 36px;
  padding: 0 12px;
  border-radius: 5px;
  border: 1px solid #d6dbe1;
  background: linear-gradient(180deg, #ffffff 0%, #f5f7fa 100%);
  color: #222;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
}

.mh-panel .bootstrap-select > .dropdown-toggle:focus,
.mh-panel .bootstrap-select > .dropdown-toggle:active,
.mh-panel .bootstrap-select > .dropdown-toggle.show {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(192,0,0,.12);
}

.mh-panel .bootstrap-select .dropdown-menu {
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
}

.mh-panel .bootstrap-select .dropdown-item.active,
.mh-panel .bootstrap-select .dropdown-item:active {
  background: #c00;
}

/* ── Herramientas dropdown ── */
.herramientas-wrapper {
  position: relative;
}

.btn-herramientas {
  background: #2c3e50;
  gap: 6px;
}

.btn-herramientas:hover { background: #1a252f; }

.btn-herramientas .herramientas-chevron {
  font-size: .72rem;
  transition: transform .25s ease;
}

.btn-herramientas[aria-expanded="true"] .herramientas-chevron {
  transform: rotate(180deg);
}

.herramientas-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9999;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 6px;
  flex-direction: column;
  gap: 2px;
}

.herramientas-panel.open {
  display: flex;
}

.herramientas-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 13px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #2c3e50;
  font-size: .875rem;
  font-weight: 500;
  font-family: 'Roboto', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}

.herramientas-item:hover { background: #f0f2f5; }

.herramientas-item i { font-size: 1rem; color: #c00; }

.herramientas-sound { cursor: default; }
.herramientas-sound:hover { background: transparent; }

/* ── Panel de tipo de mapa ── */
.maptype-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-tipo-mapa {
  background: #2c3e50;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  border: none;
  transition: background .2s ease;
}

.btn-tipo-mapa:hover {
  background: #1a252f;
}

.maptype-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 9999;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  padding: 12px;
  gap: 8px;
}

.maptype-panel.open {
  display: flex;
  flex-direction: column;
}

.maptype-header {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.maptype-field {
  width: 100%;
}

.herramientas-sound .form-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  font-weight: 500;
  color: #2c3e50;
  cursor: pointer;
}

.herramientas-item.active {
  background: #e8f4fd;
  color: #1565c0;
}

.herramientas-item.active i { color: #1565c0; }

.btn-identie{
    background:#1253b1;
}

.btn-identie:hover{
    background:#0a336f;
}

.btn-capture{
    background:#495057;
}

.btn-capture:hover{
    background:#000000;
}

.btn-sabias-que {
  background: #e67e22;
}

.btn-sabias-que:hover {
  background: #ca6f1e;
}

.btn-inicio {
  background: #0d6efd;
}

.btn-inicio:hover {
  background: #0b5ed7;
}

/* Modal ¿Sabías que? */
.sabiasque-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.sabiasque-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: #f8f9fa;
  border-left: 4px solid #c00;
  border-radius: 5px;
}

.sabiasque-icon {
  font-size: 1.8rem;
  color: #c00;
  flex: 0 0 auto;
  line-height: 1;
}

.sabiasque-titulo {
  font-weight: 700;
  margin-bottom: 4px;
  color: #1a1a1a;
}

.sabiasque-card p {
  margin: 0;
  font-size: .92rem;
  color: #333;
  line-height: 1.5;
}

.sabiasque-card a {
  color: #c00;
  text-decoration: none;
  font-weight: 500;
}

.sabiasque-card a:hover {
  text-decoration: underline;
}

/* Modal novedades V2.0 */
.modal-novedades-v2{
  border:none;
  /*border-radius: 5px;*/
  overflow:hidden;
  box-shadow:0 20px 50px rgba(0,0,0,.25);
}

.modal-novedades-v2 .modal-header{
  border:none;
  /*background:linear-gradient(120deg, #b60000 0%, #ff3c2b 55%, #ff8a00 100%);*/
  background:#C00000;
  color:#fff;
  padding:14px 18px;
}

.modal-novedades-v2 .modal-title{
  font-size:1.1rem;
  font-weight:700;
  letter-spacing:.2px;
}

.modal-novedades-v2 .modal-body{
  background:radial-gradient(circle at top right, #fff5f3 0%, #ffffff 48%, #f5f8ff 100%);
  padding:20px;
}

.nv2-intro{
  margin-bottom:14px;
  color:#2d3748;
  font-size:.95rem;
}

.nv2-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.nv2-card{
  border:1px solid #eef1f6;
  border-radius:12px;
  padding:12px;
  background:#fff;
  box-shadow:0 6px 18px rgba(0,0,0,.06);
}

.nv2-icon{
  width:36px;
  height:36px;
  border-radius: 5px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-bottom:8px;
  color:#fff;
  /*background:linear-gradient(135deg, #c00000, #ff6a00);*/
  background:#C00000;
}

.nv2-card h6{
  margin:0 0 6px;
  color:#1f2937;
  font-size:.92rem;
  font-weight:700;
}

.nv2-card p{
  margin:0;
  color:#4b5563;
  font-size:.84rem;
  line-height:1.45;
}

.modal-novedades-v2 .modal-footer{
  border-top:1px solid #f0f2f6;
  background:#fff;
  padding:12px 16px;
}

.btn-nv2-empezar{
  border:none;
  border-radius: 5px;
  padding:9px 16px;
  /*background:linear-gradient(120deg, #b60000, #ff5a1f);*/
  background:#C00000;
  color:#fff;
  font-weight:700;
  font-size:.9rem;
}

.btn-nv2-empezar:hover{
  filter:brightness(.95);
}

@media (max-width: 575px){
  .nv2-grid{
    grid-template-columns:1fr;
  }

  .btn-nv2-empezar{
    width:100%;
  }
}

.btn-probar-sismo{
  background:#fd7e14;
}

.btn-probar-sismo:hover{
  background:#e56b00;
}

.btn-probar-alerta{
  background:#dee2e6;
}

.btn-probar-alerta:hover{
  background:#8796a5;
}

.marker-captura-html{
position:absolute;
width:38px;
height:38px;
background:#ff9d28;
border:3px solid #004b9b;
border-radius:50% 50% 50% 0;
transform:translate(-50%, -100%) rotate(-45deg);
z-index:999999;
box-shadow:0 3px 8px rgba(0,0,0,.35);
display:flex;
align-items:center;
justify-content:center;
pointer-events:none;
}

.marker-captura-html::before{
  content:"★";
  transform:rotate(45deg);
  color:#004b9b;
  font-size:19px;
  font-weight:700;
}

.modal-whatsapp{
  border:none;
  border-radius: 5px;
  overflow:hidden;
  box-shadow:0 12px 35px rgba(0,0,0,.18);
}

#modalWhatsapp .modal-header{
  background:#198754;
  border:none;
  padding:12px 18px;
}

#modalWhatsapp .modal-title{
  color:#fff;
  font-size:15px;
  font-weight:500;
}

#modalWhatsapp .btn-close{
  filter:invert(1);
}

#modalWhatsapp .modal-body{
  padding:20px;
}

.whatsapp-text{
  width:100%;
  min-height:390px;
  resize:none;
  border:1px solid #d9dee3;
  border-radius:8px;
  padding:14px;
  font-family:'Roboto',sans-serif;
  font-size:14px;
  line-height:1.55;
  color:#212529;
  background:#f8f9fa;
}

.whatsapp-text:focus{
  outline:none;
  border-color:#198754;
  box-shadow:0 0 0 3px rgba(25,135,84,.10);
}

#modalWhatsapp .modal-footer{
  justify-content:center;
  gap:8px;
  background:#fafafa;
  border-top:1px solid #ececec;
  padding:14px;
}

.btn-copy-whatsapp,
.btn-send-whatsapp{
  border:none;
  border-radius:5px;
  height:36px;
  padding:0 15px;
  font-size:13px;
  font-weight:500;
  color:#fff;
}

.btn-copy-whatsapp{
  background:#495057;
}

.btn-send-whatsapp{
  background:#198754;
}

.btn-copy-whatsapp:hover{
  background:#343a40;
}

.btn-send-whatsapp:hover{
  background:#146c43;
}

@media(max-width:576px){
  .whatsapp-text{
    min-height:430px;
    font-size:13px;
  }

  .btn-copy-whatsapp,
  .btn-send-whatsapp,
  #modalWhatsapp .btn-dark-small{
    width:100%;
  }
}

.epicentro-marker{
  background: transparent !important;
  border: none !important;
}

.epicentro-pin{
    width:48px;
    height:48px;

    background:linear-gradient(
        135deg,
        #d50000,
        #b00000
    );

    border-radius:50% 50% 50% 0;

    transform:rotate(-45deg);

    display:flex;
    align-items:center;
    justify-content:center;

    border:2px solid #fff;

    box-shadow:
        0 0 0 5px rgba(192,0,0,.12),
        0 8px 20px rgba(0,0,0,.25);

    animation:pulseEpicentro 2s infinite;
}

.epicentro-pin i{
    transform:rotate(45deg);
    font-size:30px;
    color:#fff;
}

@keyframes pulseEpicentro{
  0%{
    box-shadow:
      0 0 0 0 rgba(192,0,0,.35),
      0 6px 16px rgba(0,0,0,.25);
  }

  70%{
    box-shadow:
      0 0 0 15px rgba(192,0,0,0),
      0 6px 16px rgba(0,0,0,.25);
  }

  100%{
    box-shadow:
      0 0 0 0 rgba(192,0,0,0),
      0 6px 16px rgba(0,0,0,.25);
  }
}

.modal-monitoreo{
  border:none;
  border-radius: 5px;
  overflow:hidden;
  box-shadow:0 12px 35px rgba(0,0,0,.18);
}

.modal-monitoreo .modal-header{
  background:#198754;
  border:none;
  padding:12px 18px;
}

.modal-monitoreo .modal-title{
  color:#fff;
  font-size:15px;
  font-weight:500;
}

.modal-monitoreo .btn-close{
  filter:invert(1);
}

.modal-aceleraciones{
  border:none;
  border-radius: 5px;
  overflow:hidden;
  box-shadow:0 18px 45px rgba(0,0,0,.22);
}

.modal-aceleraciones .modal-header{
  border:none;
  padding:14px 18px;
}

.modal-aceleraciones .modal-footer{
  border-top:1px solid #edf0f4;
  background:#fff;
  padding:12px 16px;
}

.modal-aceleraciones .btn-close{
  filter:invert(1);
}

.modal-aceleraciones-dialog{
  max-width:min(1100px, calc(100vw - 32px));
}

.mapa-aceleraciones-card{
  width:100%;
  flex-direction:column;
  gap:10px;
}

.img-mapa-aceleraciones{
  display:block;
  width:100%;
  max-height:72vh;
  object-fit:contain;
  border-radius:8px;
  background:#fff;
  box-shadow:0 4px 14px rgba(0,0,0,.08);
}

.mapa-aceleraciones-status{
  width:100%;
  padding:16px 18px;
  margin-bottom:12px;
  border-radius:12px;
  background:#fff8dc;
  color:#5a4200;
  font-size:16px;
  line-height:1.5;
  border:1px solid #f0d9a7;
  text-align:center;
}

#msgErrorMonitoreo{
  display:none;
}

#msgErrorMonitoreo.active{
  display:block;
}

#modalListadoIIEE .modal-body{
    overflow:auto;
    padding:20px;
}

#modalListadoIIEE .table-responsive{
    height:calc(100vh - 150px);
    overflow:auto;
}

#modalListadoIIEE .modal-dialog{
    margin:0;
    max-width:100%;
    width:100%;
    height:100vh;
}

#modalListadoIIEE .modal-content{
    height:100vh;
    border-radius:0;
    border:none;
}

.app-header{
  transition: all .25s ease;
}

.header-hidden{
  display:none !important;
}

.monitor-stats{
    display:flex;
    align-items:center;
    gap:18px;

    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:8px;

    padding:10px 16px;
    margin-bottom:15px;

    box-shadow:0 1px 3px rgba(0,0,0,.04);
}

.stat-item{
    display:flex;
    align-items:center;
    gap:8px;
}

.stat-label{
    color:#6c757d;
    font-size:.85rem;
}

.stat-value{
    font-size:1.15rem;
    font-weight:600;
}

.stat-divider{
    width:1px;
    height:22px;
    background:#dee2e6;
}

@media(max-width:768px){

    .monitor-stats{
        flex-wrap:wrap;
        gap:10px;
    }

    .stat-divider{
        display:none;
    }

}

.btn-simulador{
  background:#6f42c1;
}

.btn-simulador:hover{
  background:#59359a;
}

.sim-result-card{
  border:1px solid #e5e7eb;
  border-radius: 5px;
  padding:14px;
  background:#f8f9fa;
}

.sim-result-number{
  font-size:2rem;
  font-weight:700;
  color:#c00000;
}

#modalSimuladorSismo .modal-header,
#modalListadoSimulado .modal-header{
  background:#6f42c1;
  color:#fff;
}

#modalSimuladorSismo .btn-close,
#modalListadoSimulado .btn-close{
  filter:invert(1);
}

.sim-educativo{
  margin-top:18px;
}

.sim-alerta{
  border-radius:12px;
  padding:16px;
  font-size:14px;
  line-height:1.5;
  border-left:6px solid #ccc;
  background:#f8f9fa;
  margin-bottom: 1rem !important;
}

.sim-alerta.leve{
  border-left-color:#198754;
  background:#eefaf2;
}

.sim-alerta.moderado{
  border-left-color:#ffc107;
  background:#fff8e1;
}

.sim-alerta.fuerte{
  border-left-color:#fd7e14;
  background:#fff1e6;
}

.sim-alerta.severo{
  border-left-color:#dc3545;
  background:#fdecec;
}

.sim-extra{
  margin-top:12px;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.sim-extra div{
  flex:1;
  min-width:160px;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius: 5px;
  padding:10px 12px;
}

.sim-extra small{
  display:block;
  color:#6b7280;
  font-size:12px;
}

.sim-extra strong{
  font-size:16px;
}

.sim-barra{
  height:12px;
  background:#e9ecef;
  border-radius:30px;
  overflow:hidden;
}

.sim-barra div{
  height:100%;
  width:0%;
  border-radius:30px;
  transition:.4s;
}

.btn-opcion{
  border:1px solid #dee2e6;
  background:#fff;
  border-radius:8px;
  padding:8px 10px;
  margin:4px;
  font-size:13px;
}

.btn-opcion:hover{
  background:#f1f3f5;
}

.sim-tip{
  background:#eef6ff;
  border:1px solid #d6eaff;
  border-radius: 5px;
  padding:12px;
  font-size:13px;
}

.modal-sismo-shake.shake{
  animation: shakeSismo .55s ease-in-out 2;
}

@keyframes shakeSismo{
  0%{ transform:translate(0,0) rotate(0deg); }
  15%{ transform:translate(-6px,2px) rotate(-1deg); }
  30%{ transform:translate(6px,-2px) rotate(1deg); }
  45%{ transform:translate(-5px,1px) rotate(-1deg); }
  60%{ transform:translate(5px,2px) rotate(1deg); }
  75%{ transform:translate(-3px,-1px) rotate(0deg); }
  100%{ transform:translate(0,0) rotate(0deg); }
}

.btn-opcion{
  border:1px solid #dee2e6;
  background:#fff;
  border-radius:8px;
  padding:9px 12px;
  font-size:13px;
  text-align:left;
}

.btn-opcion:hover{
  background:#f1f3f5;
}

.modal-backdrop.show{
    opacity:.88 !important;
  background:#000 !important;
}

/* ── Optimización para TV (pantallas grandes 1920px+)
@media (min-width: 1920px) {
  :root {
    --panel: rgba(255, 255, 255, .85);
  }
  
  .floating-panel {
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, .80);
  }

  .legend-map {
    background: rgba(255, 255, 255, .80);
  }

  .usuario-sesion-institucional {
    background: rgba(255, 255, 255, .80);
  }

  .mh-panel {
    background: rgba(255, 255, 255, .82);
  }

  .panel-left {
    width: min(420px, calc(100vw - 44px));
  }

  .panel-right {
    width: min(400px, calc(100vw - 44px));
  }

  .data-list li,
  .local-row {
    font-size: 1rem;
  }

  .magnitude-badge {
    min-width: 96px;
    min-height: 96px;
    font-size: 2.8rem;
  }

  .pulse-icon {
    font-size: 5rem;
  }

  .reference-title1 {
    font-size: 1.8rem;
  }

  .local-value {
    font-size: 1.2rem;
  }

  #map {
    z-index: 1;
  }
}
 ── */
/************************************************/
#modalResultadoEducativo{
  z-index: 1085 !important;
}

.backdrop-educativo{
  z-index: 1080 !important;
  opacity:.92 !important;
  background:#000 !important;
}

body.modal-open .app-container,
body.modal-open .map-wrapper,
body.modal-open main{
    filter: blur(4px);
    transition: .25s ease;
}

#modalResultadoEducativo .modal-content{
    border: none;
    border-radius: 5px;
    overflow: hidden;
    box-shadow:
        0 25px 60px rgba(0,0,0,.45),
        0 0 0 1px rgba(255,255,255,.05);
}

#modalResultadoEducativo .modal-dialog{
    animation: modalZoom .25s ease;
}

@keyframes modalZoom{
    from{
        opacity:0;
        transform:scale(.92);
    }
    to{
        opacity:1;
        transform:scale(1);
    }
}

#modalResultadoEducativo .modal-header{
    background: linear-gradient(
        135deg,
        #c00000,
        #8b0000
    );
    color:#fff;
}

#modalResultadoEducativo .btn-close{
    filter: invert(1);
}

#mensajeResultadoSismo{
    margin-bottom: 18px !important;
}

#modalResultadoEducativo .sim-alerta{
    margin-bottom: 18px;
}

#modalResultadoEducativo .sim-extra{
    margin-top: 18px;
}

#modalResultadoEducativo .sim-extra div{
    padding: 14px 16px;
}

.swal2-container{
    z-index: 3000 !important;
}

.modal-historial{
  border: none;
  /*border-radius: 5px;*/
  overflow: hidden;
}

/*
#modalHistorialSismos .modal-dialog{
  max-width: min(96vw, 1700px);
}
*/

#modalListadoLocalesEducativos .modal-dialog{
  max-width: min(96vw, 1700px);
}

#modalSimuladorSismo .modal-dialog{
  max-width: min(96vw, 1700px);
}

.modal-historial .modal-header{
  background: #343a40;
  border: none;
  padding: 12px 18px;
}

.modal-historial .modal-title{
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-historial .btn-close{
  filter: invert(1);
}

.historial-table thead th{
  background: #3b4148 !important;
  color: #fff !important;
  font-weight: 600;
  border-color: #4a525c !important;
  background-image: none !important;
}

#tablaHistorialSismos thead{
  display: table-header-group !important;
}

#tablaHistorialSismos thead th,
#tablaHistorialSismos.dataTable thead th,
#tablaHistorialSismos_wrapper .dataTables_scrollHead table thead th,
#tablaHistorialSismos thead th .dt-column-title,
#tablaHistorialSismos thead th .dt-column-order,
#tablaHistorialSismos thead th .dt-column-order::before,
#tablaHistorialSismos thead th .dt-column-order::after{
  background: #3b4148 !important;
  color: #fff !important;
  border-color: #4a525c !important;
  background-image: none !important;
}

#tablaHistorialSismos thead th .dt-column-title,
#tablaHistorialSismos thead th .dt-column-order,
#tablaHistorialSismos thead th .dt-column-order::before,
#tablaHistorialSismos thead th .dt-column-order::after{
  opacity: 1 !important;
}

/* Styling for the DataTable header inside the locales modal to match historial tables */
#tablaListadoLocalesEducativosApi thead th,
#tablaListadoLocalesEducativosApi.dataTable thead th,
#tablaListadoLocalesEducativosApi_wrapper .dataTables_scrollHead table thead th,
#tablaListadoLocalesEducativosApi thead th .dt-column-title,
#tablaListadoLocalesEducativosApi thead th .dt-column-order,
#tablaListadoLocalesEducativosApi thead th .dt-column-order::before,
#tablaListadoLocalesEducativosApi thead th .dt-column-order::after{
  background: #3b4148 !important;
  color: #fff !important;
  border-color: #4a525c !important;
  background-image: none !important;
}

#tablaListadoLocalesEducativosApi thead th .dt-column-title,
#tablaListadoLocalesEducativosApi thead th .dt-column-order,
#tablaListadoLocalesEducativosApi thead th .dt-column-order::before,
#tablaListadoLocalesEducativosApi thead th .dt-column-order::after{
  opacity: 1 !important;
}

.historial-table td,
.historial-table th{
  vertical-align: middle;
  white-space: nowrap;
}

.historial-table td:nth-child(3){
  max-width: 380px;
  white-space: normal;
}

#tablaHistorialSismos th:nth-child(9),
#tablaHistorialSismos td:nth-child(9){
  text-align: center;
}

#tablaHistorialSismos th:nth-child(1),
#tablaHistorialSismos td:nth-child(1){
  text-align: center;
}

#tablaHistorialSismos th:nth-child(2),
#tablaHistorialSismos td:nth-child(2){
  text-align: center;
}

#tablaListadoLocales th:nth-child(3),
#tablaListadoLocales td:nth-child(3){
  text-align: center;
}

#tablaListadoLocales th:nth-child(5),
#tablaListadoLocales td:nth-child(5){
  text-align: center;
}

.badge-magnitud{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #06b324;
  color: #fff;
  font-weight: 700;
}

.btn-ver-mapa{
  width: 34px;
  height: 28px;
  border: none;
  border-radius: 0;
  background: #c00000;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ver-mapa:hover{
  background: #9d0000;
}

#tablaHistorialSismos_wrapper .dt-paging-button{
  border: none !important;
  background: transparent !important;
}

.pagination {
    --bs-pagination-color: #fff;
    --bs-pagination-bg: #454b55;
    --bs-pagination-border-color: #979ba0;

    --bs-pagination-hover-color: #fff;
    --bs-pagination-hover-bg: #C00000;

    --bs-pagination-active-bg: #C00000;
    --bs-pagination-active-border-color: #979ba0;
    --bs-pagination-active-color: #fff;
}

.sabias-que-float{
    position: fixed;
    bottom: -10px;
    right: 150px;
    width: 270px;
    max-width: 25vw;
    height: auto;
    cursor: pointer;
    z-index: 9999;
    transition: transform .3s ease;
}

.sabias-que-float:hover{
    transform: scale(1.08);
}

.label-departamento {
    background: transparent !important;
    border: none !important;
}

.texto-departamento {
    color: #ffffff;

    font-size: 12px;
    font-weight: 700;

    text-align: center;

    white-space: nowrap;

    text-shadow:
        -1px -1px 2px #000,
         1px -1px 2px #000,
        -1px  1px 2px #000,
         1px  1px 2px #000;

    pointer-events: none;

    transform: translate(-50%, -50%);
}

/* Tablets */
@media (max-width:768px){
    .sabias-que-float{
        width:100px;
        bottom:15px;
        right:15px;
    }
}

/* Celulares */
@media (max-width:480px){
    .sabias-que-float{
        width:100px;
        bottom:10px;
        right:10px;
    }
}
