:root{
  --bg:#edf1f4;
  --panel:#fff;
  --panel-soft:#f7f9fb;
  --ink:#14202c;
  --muted:#72808d;
  --line:#dce3e8;
  --line-soft:#edf1f4;
  --blue:#17689f;
  --blue-dark:#103d5c;
  --blue-soft:#e7f1f8;
  --green:#2b8a68;
  --timeline-h:112px;
  --shadow:0 8px 30px rgba(26,44,58,.13);
}

*{
  box-sizing:border-box;
}

html,
body{
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color:var(--ink);
  background:var(--bg);
}

button,
input{
  font:inherit;
}

button{
  -webkit-tap-highlight-color:transparent;
}

#app{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
}


/* =========================================================
   TOP
   ========================================================= */

.topbar{
  height:58px;
  flex:0 0 58px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 13px;
  background:#fff;
  border-bottom:1px solid var(--line);
  z-index:100;
}

.drawer-toggle{
  display:none;
  width:37px;
  height:37px;
  border:1px solid var(--line);
  border-radius:9px;
  background:white;
  color:#314454;
  cursor:pointer;
}

.brand{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:215px;
}

.brand-mark{
  width:31px;
  height:31px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:linear-gradient(
    145deg,
    #174e75,
    #168aad
  );
  color:white;
  font-size:13px;
  font-weight:900;
}

.brand-name{
  font-size:14px;
  font-weight:850;
  white-space:nowrap;
}

.brand-sub{
  margin-top:1px;
  color:#86929d;
  font-size:8.5px;
  font-weight:750;
  text-transform:uppercase;
  letter-spacing:.55px;
}

.model-tabs{
  display:flex;
  gap:2px;
  padding:3px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f5f7f9;
}

.model-tab{
  height:30px;
  min-width:67px;
  padding:0 9px;
  border:0;
  border-radius:7px;
  background:transparent;
  color:#586672;
  cursor:pointer;
  font-size:11px;
  font-weight:850;
}

.model-tab.active{
  background:var(--blue);
  color:#fff;
  box-shadow:
    0 2px 7px
    rgba(23,104,159,.22);
}

.model-tab:disabled{
  opacity:.28;
  cursor:not-allowed;
}

.model-count{
  margin-left:3px;
  font-size:8px;
  opacity:.7;
}

.run-block{
  margin-left:auto;
  text-align:right;
}

.run-label{
  color:#84909a;
  font-size:8px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.6px;
}

.run-value{
  margin-top:1px;
  font-size:10.5px;
  font-weight:800;
}

.qa-chip{
  padding:6px 9px;
  border:1px solid #cbe7dc;
  border-radius:999px;
  background:#eef9f5;
  color:#26765c;
  font-size:9px;
  font-weight:850;
  white-space:nowrap;
}


/* =========================================================
   WORKSPACE
   ========================================================= */

.workspace{
  position:relative;
  flex:1;
  min-height:0;
  display:flex;
}

.drawer{
  width:286px;
  flex:0 0 286px;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:#fff;
  border-right:1px solid var(--line);
  z-index:70;
}

.drawer-head{
  padding:13px 11px 10px;
  border-bottom:1px solid var(--line-soft);
}

.drawer-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:12px;
}

.drawer-title span{
  color:#8a96a0;
  font-size:8.5px;
  font-weight:750;
}

.product-search{
  width:100%;
  height:35px;
  margin-top:9px;
  padding:0 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fafbfc;
  outline:0;
  color:var(--ink);
  font-size:11px;
}

.product-search:focus{
  border-color:#87b5d1;
}

.product-list{
  flex:1;
  overflow:auto;
  padding:8px 7px 16px;
}

.product-group{
  margin-bottom:10px;
}

.product-group-title{
  padding:7px 7px 4px;
  color:#85919c;
  font-size:8px;
  font-weight:900;
  letter-spacing:.9px;
  text-transform:uppercase;
}

.product-button{
  width:100%;
  margin:1px 0;
  padding:8px 9px;
  border:0;
  border-radius:8px;
  background:transparent;
  text-align:left;
  color:#354553;
  cursor:pointer;
}

.product-button:hover{
  background:#f2f6f8;
}

.product-button.active{
  background:#e6f1f8;
  color:#0f5787;
  box-shadow:
    inset 3px 0 0
    var(--blue);
}

.product-button-title{
  font-size:11px;
  line-height:1.2;
  font-weight:800;
}

.product-button-sub{
  margin-top:3px;
  color:#87939e;
  font-size:8.5px;
  line-height:1.25;
}

.drawer-foot{
  padding:9px 11px;
  border-top:1px solid var(--line-soft);
  background:#fafbfc;
}

.opacity-row{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:8px;
  align-items:center;
  color:#6c7985;
  font-size:9px;
  font-weight:750;
}

.opacity-row input{
  width:100%;
  accent-color:var(--blue);
}

.drawer-backdrop{
  display:none;
}


/* =========================================================
   MAP
   ========================================================= */

.map-shell{
  position:relative;
  flex:1;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background:#e7ecef;
}

#map{
  position:absolute;
  inset:0 0 var(--timeline-h) 0;
}

.maplibregl-canvas{
  outline:0;
}

.maplibregl-ctrl-top-right{
  top:7px;
  right:7px;
}

.maplibregl-ctrl-group{
  border-radius:8px !important;
  box-shadow:
    0 4px 15px
    rgba(30,47,60,.12)
    !important;
}

.maplibregl-ctrl-attrib{
  font-size:8px !important;
}

.map-heading{
  position:absolute;
  z-index:20;
  top:10px;
  left:10px;
  max-width:min(
    480px,
    calc(100% - 90px)
  );
  padding:8px 10px;
  border:1px solid rgba(207,218,226,.96);
  border-radius:9px;
  background:rgba(255,255,255,.94);
  box-shadow:
    0 5px 18px
    rgba(30,47,60,.10);
  pointer-events:none;
  backdrop-filter:blur(5px);
}

.map-heading-top{
  display:flex;
  align-items:center;
  gap:6px;
  color:#75818c;
  font-size:8.5px;
  font-weight:850;
  letter-spacing:.5px;
}

.model-pill{
  padding:3px 6px;
  border-radius:999px;
  background:#153f5c;
  color:white;
}

.map-heading-title{
  margin-top:3px;
  font-size:14px;
  font-weight:900;
}

.map-heading-desc{
  margin-top:2px;
  color:#75818d;
  font-size:9px;
}

.coord-chip{
  position:absolute;
  z-index:20;
  left:10px;
  bottom:calc(
    var(--timeline-h) + 10px
  );
  padding:6px 8px;
  border:1px solid var(--line);
  border-radius:7px;
  background:rgba(255,255,255,.95);
  box-shadow:
    0 3px 12px
    rgba(30,47,60,.09);
  color:#64727f;
  font-size:9px;
  pointer-events:none;
}


/* =========================================================
   LEGEND
   ========================================================= */

.legend{
  position:absolute;
  z-index:20;
  right:10px;
  bottom:calc(
    var(--timeline-h) + 10px
  );
  width:min(
    450px,
    calc(100% - 80px)
  );
  padding:7px 8px 6px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(255,255,255,.95);
  box-shadow:
    0 4px 16px
    rgba(30,47,60,.10);
}

.legend-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-bottom:4px;
}

.legend-name{
  color:#5d6a76;
  font-size:8.5px;
  font-weight:850;
}

.legend-unit{
  color:#87929c;
  font-size:8px;
  font-weight:800;
}

.legend-bar{
  height:8px;
  display:flex;
  overflow:hidden;
  border-radius:3px;
}

.legend-color{
  flex:1;
}

.legend-labels{
  position:relative;
  height:14px;
  margin-top:2px;
  color:#687581;
  font-size:7.5px;
}

.legend-label{
  position:absolute;
  transform:translateX(-50%);
  white-space:nowrap;
}

.legend-label.first{
  transform:none;
}

.legend-label.last{
  transform:translateX(-100%);
}


/* =========================================================
   TIMELINE
   ========================================================= */

.timeline{
  position:absolute;
  z-index:30;
  left:0;
  right:0;
  bottom:0;
  height:var(--timeline-h);
  padding:8px 13px;
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.985);
  box-shadow:
    0 -5px 18px
    rgba(30,47,60,.05);
}

.timeline-top{
  display:grid;
  grid-template-columns:
    minmax(200px,1fr)
    auto
    minmax(80px,1fr);
  gap:12px;
  align-items:center;
}

.valid-date{
  font-size:12px;
  font-weight:900;
}

.valid-meta{
  margin-top:2px;
  color:#7b8791;
  font-size:8.5px;
}

.play-controls{
  display:flex;
  gap:5px;
  align-items:center;
}

.icon-button{
  width:31px;
  height:31px;
  display:grid;
  place-items:center;
  border:1px solid var(--line);
  border-radius:8px;
  background:white;
  color:#354756;
  cursor:pointer;
  font-weight:900;
}

.play-button{
  width:38px;
  background:#142b3d;
  border-color:#142b3d;
  color:white;
}

.lead-badge{
  justify-self:end;
  padding:5px 8px;
  border-radius:7px;
  background:#edf4f8;
  color:#254d68;
  font-size:10px;
  font-weight:900;
}

.slider-wrap{
  position:relative;
  margin-top:7px;
}

#leadSlider{
  position:relative;
  z-index:3;
  width:100%;
  margin:0;
  appearance:none;
  -webkit-appearance:none;
  background:transparent;
  cursor:pointer;
}

#leadSlider::-webkit-slider-runnable-track{
  height:4px;
  border-radius:999px;
  background:
    linear-gradient(
      to right,
      var(--blue) 0,
      var(--blue) var(--progress,0%),
      #d8e0e5 var(--progress,0%),
      #d8e0e5 100%
    );
}

#leadSlider::-webkit-slider-thumb{
  width:14px;
  height:14px;
  margin-top:-5px;
  border:3px solid white;
  border-radius:50%;
  appearance:none;
  -webkit-appearance:none;
  background:var(--blue);
  box-shadow:
    0 1px 5px
    rgba(20,65,95,.35);
}

#leadSlider::-moz-range-track{
  height:4px;
  background:#d8e0e5;
}

#leadSlider::-moz-range-progress{
  height:4px;
  background:var(--blue);
}

#leadSlider::-moz-range-thumb{
  width:10px;
  height:10px;
  border:3px solid white;
  border-radius:50%;
  background:var(--blue);
}

.frame-dots{
  position:absolute;
  left:0;
  right:0;
  top:7px;
  height:8px;
  pointer-events:none;
}

.frame-dot{
  position:absolute;
  top:50%;
  width:4px;
  height:4px;
  border-radius:50%;
  transform:translate(-50%,-50%);
  background:#8e9ba6;
}

.frame-dot.major{
  width:6px;
  height:6px;
  background:#536575;
}

.frame-dot.unavailable{
  opacity:.18;
}

.timeline-days{
  position:relative;
  height:14px;
}

.day-label{
  position:absolute;
  top:0;
  transform:translateX(-50%);
  color:#75828e;
  font-size:7.5px;
  font-weight:800;
  white-space:nowrap;
}


/* =========================================================
   POINT PANEL
   ========================================================= */

.point-panel{
  position:absolute;
  z-index:60;
  left:12px;
  right:12px;
  bottom:calc(
    var(--timeline-h) + 10px
  );
  height:350px;
  display:grid;
  grid-template-rows:
    auto
    auto
    auto
    1fr;
  overflow:hidden;
  border:1px solid #d7e0e6;
  border-radius:13px;
  background:rgba(255,255,255,.985);
  box-shadow:
    0 16px 45px
    rgba(20,40,55,.22);
  transform:
    translateY(
      calc(100% + 30px)
    );
  opacity:0;
  pointer-events:none;
  transition:
    transform .22s ease,
    opacity .18s ease;
}

body.point-open
.point-panel{
  transform:translateY(0);
  opacity:1;
  pointer-events:auto;
}

body.point-open
.legend{
  opacity:0;
  pointer-events:none;
}

.point-panel-head{
  min-height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 12px 7px;
  border-bottom:1px solid var(--line-soft);
}

.point-location-kicker{
  color:#7e8a95;
  font-size:7.5px;
  font-weight:900;
  letter-spacing:.8px;
}

.point-title{
  margin-top:2px;
  font-size:14px;
  font-weight:900;
}

.point-subtitle{
  margin-top:1px;
  color:#76838e;
  font-size:8.5px;
}

.point-close{
  width:31px;
  height:31px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#f8fafb;
  color:#4e5d69;
  cursor:pointer;
  font-size:20px;
}

.point-tabs{
  display:flex;
  gap:3px;
  padding:6px 9px;
  border-bottom:1px solid var(--line-soft);
  overflow-x:auto;
}

.point-tab{
  flex:0 0 auto;
  height:29px;
  padding:0 10px;
  border:0;
  border-radius:7px;
  background:transparent;
  color:#687682;
  cursor:pointer;
  font-size:9px;
  font-weight:850;
}

.point-tab.active{
  background:#e8f2f8;
  color:#115c8b;
}

.point-stats{
  display:flex;
  gap:6px;
  padding:6px 9px;
  overflow-x:auto;
  background:#fafbfc;
}

.stat-card{
  flex:1 1 0;
  min-width:100px;
  padding:5px 8px;
  border:1px solid #e4e9ed;
  border-radius:7px;
  background:white;
}

.stat-label{
  color:#84909b;
  font-size:7.5px;
  font-weight:800;
  text-transform:uppercase;
}

.stat-value{
  margin-top:1px;
  font-size:13px;
  font-weight:900;
}

.stat-unit{
  margin-left:2px;
  color:#788590;
  font-size:8px;
  font-weight:700;
}

.point-chart-shell{
  position:relative;
  min-height:0;
}

.point-chart{
  position:absolute;
  inset:0;
}

.point-loading{
  position:absolute;
  inset:0;
  z-index:5;
  display:grid;
  place-items:center;
  background:white;
  color:#73818d;
  font-size:10px;
}

.ensemble-placeholder{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  gap:15px;
  padding:25px;
  color:#5f6d79;
}

.ensemble-placeholder.visible{
  display:flex;
}

.ensemble-icon{
  width:57px;
  height:57px;
  flex:0 0 57px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:#173e59;
  color:#fff;
  font-size:18px;
  font-weight:950;
}

.ensemble-placeholder strong{
  color:#263644;
  font-size:12px;
}

.ensemble-placeholder p{
  max-width:500px;
  margin:5px 0 0;
  font-size:9.5px;
  line-height:1.45;
}


/* =========================================================
   LOADING
   ========================================================= */

.loading{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  background:#f3f6f8;
}

.loading-card{
  width:min(380px,calc(100% - 30px));
  padding:22px;
  display:flex;
  flex-direction:column;
  gap:5px;
  border:1px solid var(--line);
  border-radius:12px;
  background:white;
  box-shadow:var(--shadow);
  text-align:center;
}

.loading-card strong{
  font-size:14px;
}

.loading-card span{
  color:#76838e;
  font-size:10px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media(max-width:900px){

  :root{
    --timeline-h:122px;
  }

  .topbar{
    height:94px;
    flex:0 0 94px;
    flex-wrap:wrap;
    gap:6px;
    padding:6px 8px;
  }

  .drawer-toggle{
    display:block;
    order:0;
  }

  .brand{
    order:1;
    min-width:0;
    flex:1;
  }

  .brand-name{
    font-size:12px;
  }

  .brand-sub{
    display:none;
  }

  .qa-chip{
    order:2;
  }

  .model-tabs{
    order:3;
    width:100%;
  }

  .model-tab{
    flex:1;
  }

  .run-block{
    display:none;
  }

  .drawer{
    position:absolute;
    inset:0 auto 0 0;
    width:min(350px,88vw);
    transform:translateX(-103%);
    transition:transform .22s;
    box-shadow:
      14px 0 32px
      rgba(20,35,48,.20);
    z-index:90;
  }

  body.drawer-open
  .drawer{
    transform:translateX(0);
  }

  .drawer-backdrop{
    position:absolute;
    inset:0;
    z-index:85;
    background:rgba(20,32,42,.28);
  }

  body.drawer-open
  .drawer-backdrop{
    display:block;
  }

  .map-heading{
    top:7px;
    left:7px;
    max-width:
      calc(100% - 65px);
    padding:6px 8px;
  }

  .map-heading-title{
    font-size:11px;
  }

  .map-heading-desc{
    display:none;
  }

  .coord-chip{
    display:none;
  }

  .legend{
    right:7px;
    bottom:
      calc(
        var(--timeline-h) + 7px
      );
    width:
      calc(100% - 14px);
  }

  .timeline{
    padding:7px 8px;
  }

  .timeline-top{
    grid-template-columns:
      minmax(0,1fr)
      auto
      auto;
    gap:6px;
  }

  .valid-date{
    font-size:10px;
  }

  .valid-meta{
    font-size:7.5px;
  }

  .point-panel{
    left:5px;
    right:5px;
    bottom:
      calc(
        var(--timeline-h) + 5px
      );
    height:min(58vh,430px);
    border-radius:13px 13px 8px 8px;
  }

  .point-panel-head{
    min-height:52px;
  }

  .point-title{
    font-size:12px;
  }

  .point-tabs{
    padding:5px 6px;
  }

  .point-tab{
    padding:0 8px;
    font-size:8px;
  }

  .point-stats{
    padding:5px 6px;
  }

  .stat-card{
    min-width:86px;
  }
}

@media(max-width:520px){

  .qa-chip{
    display:none;
  }

  .brand-mark{
    width:27px;
    height:27px;
  }

  .maplibregl-ctrl-attrib{
    display:none;
  }

}


/* =========================================================
   v0.5.3 · VALORES DE CELDA
   ========================================================= */

.values-toggle{
  position:absolute;
  z-index:25;
  top:94px;
  right:10px;

  height:30px;
  padding:0 10px;

  border:1px solid #d5dee5;
  border-radius:8px;

  background:rgba(255,255,255,.96);

  color:#52616d;

  box-shadow:
    0 4px 14px
    rgba(28,46,60,.10);

  cursor:pointer;

  font-size:8.5px;
  font-weight:900;
  letter-spacing:.35px;
}

.values-toggle:hover:not(:disabled){
  background:#f2f7fa;
  color:#154f75;
}

.values-toggle.active{
  background:#163f5c;
  border-color:#163f5c;
  color:#fff;
}

.values-toggle:disabled{
  opacity:.38;
  cursor:not-allowed;
}


/* Más aire en las tarjetas del panel */

.point-stats{
  scrollbar-width:thin;
}

.stat-card{
  min-width:126px;
}


/* Las gráficas ganan algo de altura visual */

.point-chart-shell{
  background:
    linear-gradient(
      to bottom,
      rgba(248,250,251,.45),
      rgba(255,255,255,.98)
    );
}


@media(max-width:900px){

  .values-toggle{
    top:92px;
    right:7px;

    height:28px;

    padding:0 8px;

    font-size:7.5px;
  }

  .stat-card{
    min-width:115px;
  }
}
