:root {
  --ui:#0e01f5; --bg:#ffffff; --acc:#f3f5f8; --btn:#0e01f5; --btn2:#0e01f5; --danger:#e63946;
  --chip:#ffffff; --chip-border:#0e01f5;
}
*{ box-sizing:border-box; }

/* 1) Font faces */
@font-face {
  font-family: "RationalTWDisplayDEMOSemiBold";
  src:
    url("webFonts/RationalTWDisplayDEMOSemiBold/font.woff2") format("woff2"),
    url("webFonts/RationalTWDisplayDEMOSemiBold/font.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "RationalTWDisplayDEMOSemiBold";
  src:
    url("webFonts/RationalTWDisplayDEMOSemiBold/font.woff2") format("woff2"),
    url("webFonts/RationalTWDisplayDEMOSemiBold/font.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* 2) Global typography */
:root, html, body,
button, input, select, textarea {
  font-family: "RationalTWDisplayDEMOSemiBold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html, body { height: 100%; }
body{
  margin: 0;
  color: var(--ui);
  background: var(--bg);
}

/* Map */
#map{ position:absolute; inset: 0 0 0 260px; }

/* Sidebar (desktop) */
#sidebar{
  position:absolute; inset:0 auto 0 0; width:260px; background:var(--bg);
  border-right:1px solid #e6e9ef; padding:12px; overflow:auto; z-index:998;
  display:flex; flex-direction:column; gap:12px;
}

/* Headings */
h1{ margin:1px 0 3px; font-size:1rem; font-weight:600; color:#0e01f5; }
h3{ margin:2px 0 6px; font-size:12px; font-weight:600; color:#0e01f5; }

.group{ background:#fff; padding:12px; padding-top:0; padding-bottom:0;}
.row{ display:flex; gap:8px; }
.row>*{ flex:1; }

/* Inputs */
input[type="text"]{
  width:100%; padding:12px 12px; border:1px solid #0e01f5; border-radius:1px; font-size:12px;
  font-weight:400;
}

/* Buttons */
button, input, select, textarea {
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  color:#0e01f5;
}
button{
  padding:12px 14px; border-radius:1px; border:0px solid #0e01f5; background:#fff; cursor:pointer;
  font-weight:600; font-size:10px; line-height:1; touch-action:manipulation;
}
button:active{ transform: translateY(15px); }
.primary{ background:var(--btn); color:#fff; }
.alt{ background:var(--btn2); color:#fff; }
.danger{ background:var(--danger); color:#fff; }
.ghost{ background:#fff; color:var(--ui); border:1px solid #0e01f5; }
.hint{ font-size:10px; color:#667; margin-top:6px; }

#peopleList{ list-style:none; padding:0; margin:6px 0 0; max-height:140px; overflow:auto; }
#peopleList li{ font-size:9px; padding:6px 2px; border-bottom:1px dashed #edf0f4; }

/* Floating map chips */
.chip {
  position:absolute; top:12px; left:12px; display:flex; gap:0px; z-index:999;
}
.chip button{
  background:var(--chip); border:1px solid var(--chip-border); border-radius:1px; padding:10px 12px; font-size:9px;
  font-weight:600;
}

/* FABs */
.fab-stack {
  position:absolute; right:12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index:999;
  display:flex; flex-direction:column; gap:10px;
}
.fab {
  border-radius:1px; padding:12px 16px; background:#fff; border:1px solid #0e01f5; font-size:9px;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
  font-weight:600;
}

/* Bottom sheet (mobile) */
#sheet {
  display:none;
  position: fixed; left:0; right:0; bottom:0;
  background: var(--bg);
  border-top-left-radius:16px; border-top-right-radius:16px;
  box-shadow: 0 -10px 30px rgba(0,0,0,.08);
  z-index: 1000;
  max-height: 70vh;
  transition: transform .25s ease;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
#sheetHeader{
  position:sticky; top:0; background:var(--bg); padding:8px 12px 6px;
  border-bottom:1px solid #eef2f6; border-top-left-radius:16px; border-top-right-radius:16px;
}
.drag{ width:44px; height:5px; background:#d9dfe7; border-radius:1px; margin:6px auto 10px; }
#sheetBody{ overflow:auto; display:flex; flex-direction:column; gap:12px; }

#sheet,
#sheetHeader,
#sheetHandle,
.drag {
  touch-action: none;
  user-select: none;
  cursor: grab;
}

#sheetHeader { position: sticky; top: 0; z-index: 1002; }

#sheetDragOverlay {
  position: fixed; inset: 0; z-index: 1001;
  background: transparent; display: none; pointer-events: auto;
}
#sheetHotspot {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 72px; z-index: 1001; display: none; background: transparent;
  pointer-events: auto;
}

.controlRow{ display:grid; grid-template-columns: 1fr 1fr; gap:0px; }
.controlRow .ghost{ font-weight:600; }

/* Legend */
#legend {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--legend-bottom, 12px) + env(safe-area-inset-bottom));
  display: flex; gap: 18px; font-size: 8px; z-index: 1001;
}
#legend .legend-item { display: flex; align-items: center; gap: 6px; width:95%; }
#legend .legend-color { width: 16px; height: 16px; opacity: 50%; }

/* Mobile layout */
@media (max-width: 820px){
  #map{ inset: 0; }
  #legend{ width:95%; }
  #sidebar{ display:none; }
  .chip{ top: 10px; left: 10px; right:auto;width:95%; }
  .fab-stack{ right:10px; }
  #sheet{ display:block; }
}
/* ============================= */
/* Créditos SACPC – barra superior azul sólida */
/* ============================= */
:root{ --credit-h: 56px; }

#creditBar{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--credit-h);
  background: #0e01f5; /* azul Tec */
  border-bottom: 2px solid #ffffff;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

#creditBar img{
  display: block;
  height: calc(var(--credit-h) - 14px);
  width: auto;
  opacity: 0.95;
}

/* Empuja todo hacia abajo */
#map{ inset: var(--credit-h) 0 0 260px !important; }
#sidebar{ inset: var(--credit-h) auto 0 0 !important; }
.chip{ top: calc(var(--credit-h) + 8px) !important; }

/* --- Móvil --- */
@media (max-width: 820px){
  :root{ --credit-h: 44px; }
  #creditBar{
    background: #0e01f5;
    padding: 4px 6px;
  }
  #creditBar img{
    height: calc(var(--credit-h) - 10px);
  }
  #map{ inset: var(--credit-h) 0 0 0 !important; }
  .chip{ top: calc(var(--credit-h) + 8px) !important; }
}
