:root{
  --bg1:#0a3c66;
  --bg2:#0b2947;
  --red:#cc0000;
  --text:#0c1b2a;
  --muted:#6a7a8a;
  --line:#d7dee6;
  --card:#ffffff;
  --w-ur: 150px;
  --w-ur-root: 110px;
  --w-small: 80px; /* 90px como pediste */;
  --title-h: 40px;
  --font: "Arial Nova Cond", "Arial Narrow", Arial, sans-serif;
}

*{box-sizing:border-box;}
html,body{height:100%; margin:0;}
body{
  font-family: var(--font);
  background: radial-gradient(1200px 700px at 30% 10%, #1b6cb3 0%, transparent 60%),
              linear-gradient(135deg, var(--bg1), var(--bg2));
  color: var(--text);
}

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

.topbar{
  overflow-x:hidden;
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding: 14px 18px 10px 18px;
  color:#fff;
}

.topbarRow1{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
}

.brand-title{
  font-size:34px;
  font-weight:800;
  letter-spacing:0.3px;
}
.brand-title .lightText{font-weight:400;}
.brand-sub{margin-top:2px; font-size:14px; opacity:0.9;}

.logos{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 18px;
  flex-wrap:nowrap;
}
.logoItem{display:flex; align-items:center; gap:10px;}
.logoImg{
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius:14px;
  background: rgba(255,255,255,0.10);
  padding: 3px;
}
.logoText{
  color:#eaf4ff;
  font-size:18px;
  font-weight:800;
  letter-spacing:0.2px;
  white-space:nowrap;
}
.logoText .lightText{font-weight:400;}

.topbarRow2{width:100%;}
.controls{
  display:grid;
  grid-template-columns: 40px 84px 52px 52px 40px;
  gap: 6px;
  align-items:center;
}
.btn{
  height:40px;
  font-family: var(--font);
  border-radius:999px;
  border:3px solid var(--red);
  background: #ffffff;
  color: var(--red);
  font-size: 12px;
  font-weight:600;
  cursor:pointer;
}
.btn.primary{
  background: var(--red);
  color:#ffffff;
}
.btn.icon{font-size:22px; font-weight:900;}
.btn:active{transform: translateY(1px);}
.pill{
  height:44px;
  padding: 0 16px;
  border-radius:999px;
  background: rgba(0,0,0,0.35);
  border:2px solid rgba(255,255,255,0.18);
  color:#fff;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:center;
}

.panel{
  margin: 0 16px 10px 16px;
  background: rgba(255,255,255,0.86);
  border-radius: 14px;
  overflow:hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.titlebar{height:46px; display:grid; align-items:center; padding:0 18px; background:var(--red); color:#fff; border-top-left-radius:18px; border-top-right-radius:18px;}

/* filas */
.row{min-height:46px; padding:10px 18px; border-bottom:1px solid rgba(20,40,60,.15); column-gap:6px;}
.row:last-child{border-bottom:none;}

/* Promotor: renglón superior blanco */
#promoterRow{ background:#fff; }

/* grids dinámicos */



.cell{
  padding: 0 8px;
  overflow:hidden;
}

.ur{
  font-weight:800; /* UR en negritas */
  color:#0b4ea2;
  text-decoration: none;
  cursor:pointer;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.name{
  font-weight:600;
  color:#111;
  line-height: 1.1;
}

.name-info{ color:#0b4ea2; }

.name.link{color:#0b4ea2; cursor:pointer; text-decoration:none;}



.bar{
  width: 92%;
  height: 12px;
  background: #eef3f8;
  border-radius: 10px;
  overflow:hidden;
  border: 1px solid #d2dbe6;
}
.bar > div{
  height:100%;
  width:0%;
  background: #1aa34a;
}

.count{font-size:14px; font-weight:800; color:#000;}

/* LIST SCROLL */
.panel-list{flex:1; display:flex; flex-direction:column; min-height:0;}
.list{
  flex:1;
  min-height:0;
  overflow-y:auto;
  scrollbar-gutter: stable;
  background:#fff;
}

.status{
  position: fixed;
  left: 18px;
  bottom: 12px;
  right: 18px;
  padding: 10px 12px;
  font-size: 13px;
  color: #fff;
  background: rgba(0,0,0,0.35);
  border-radius: 12px;
  display:none;
}

/* compact on small screens */
@media (max-width: 980px){
  :root{ --w-ur: 190px; }
  .brand-title{font-size: 28px;}
}


/* ---------------------------------------------------------
   Compatibilidad de clases (HTML nuevo vs CSS antiguo)
   --------------------------------------------------------- */

.topbar-row-1{ /* alias de .topbarRow1 */
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
}
.topbar-row-2{ width:100%; }

/* Brand light span */
.brand-title .light{ font-weight:400; }

/* Logos: soporta .logo-item/.logo-img/.logo-text (HTML) y .logoItem/.logoImg/.logoText (CSS viejo) */
.logo-item, .logoItem{ display:flex; align-items:center; gap: 8px; }
.logo-img, .logoImg{
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  padding: 2px;
}
.logo-text, .logoText{
  color:#eaf4ff;
  font-size:18px;
  font-weight:800;
  letter-spacing:0.2px;
  white-space:nowrap;
}
.logo-text .light, .logoText .lightText{ font-weight:400; }
.logo-text-main{ font-weight:900; }
.logo-reg{ font-size: 12px; vertical-align: super; opacity: 0.85; }

/* Root width (UR mas angosta en nivel QROO) */
.root{ --w-ur: var(--w-ur-root); }

/* ---------------------------------------------------------
   Modal / Popups
   --------------------------------------------------------- */

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 999;
}

/* IMPORTANT: respetar el atributo HTML [hidden] (si no, el modal tapa todo) */
.modal-backdrop[hidden]{
  display: none !important;
}

.modal{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal[hidden]{
  display: none !important;
}

.modal-card{
  /* 20% menos ancho aprox (antes 96vw) */
  width: min(520px, 78vw);
  max-height: 86vh;
  overflow: hidden;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.45);
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 14px;
  background: var(--red);
  color: #fff;
}

.modal-title{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.3px;
}

.modal-close{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.12);
  color:#fff;
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
}

.modal-close:active{ transform: translateY(1px); }

.modal-body{
  padding: 14px 14px 16px 14px;
  overflow: auto;
  max-height: calc(86vh - 64px);
  color: #0c1b2a;
  font-size: 15px;
}

.modal-row{ display:flex; gap:12px; align-items:flex-start; }
.modal-img{
  width: 140px;
  height: 170px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #e5edf5;
  background: #f4f7fb;
}

/* Selfie en popup PERSONA (30 x 38 mm) */
.modal-img-id{
  width: 30mm;
  height: 38mm;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #e5edf5;
  background: #f4f7fb;
}

.tel-link{
  color: #0b3b66;
  text-decoration: underline;
  font-weight: 900;
}

.modal-divider{ height:1px; background:#e6eef6; margin: 12px 0; }

.modal-kv{
  display:grid;
  grid-template-columns: 150px 1fr;
  gap: 6px 10px;
  align-items: start;
}

.modal-kv .k{
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}

.modal-kv .v{
  font-weight: 700;
  color: #0c1b2a;
  word-break: break-word;
}

.badge{
  display:inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef3f8;
  border: 1px solid #d2dbe6;
  color: #0c1b2a;
  font-weight: 900;
  font-size: 12px;
}


.muted{ color: var(--muted); font-weight: 800; }
.addr{ font-weight: 900; font-size: 16px; line-height: 1.2; }


/* Metric cell with progress bar */



.metric .bar > i{
  display:block;
  height:100%;
  width:0%;
  background: rgba(204,0,0,.55);
}

/* Grid variants */
.grid4{display:grid; grid-template-columns: 1fr 2fr 1fr 2fr; column-gap:10px; align-items:center;}
.grid5{display:grid; grid-template-columns: 1fr 2fr 80px 80px 80px; column-gap:6px; align-items:center;}
.grid4split{display:grid; grid-template-columns: 1fr 2fr 80px 80px; column-gap:6px; align-items:center;}



/* ---- Metrics ---- */
.metric{width: 110px; display:flex; flex-direction:column; align-items:flex-end; gap:4px;}
.metric .bar{width:100%; height:10px; background:#e6edf5; border-radius:999px; overflow:hidden;}
.metric .bar i{display:block; height:100%; background:#1bb35a; border-radius:999px;}
.metric .txt{width:100%; text-align:center; font-size:14px; font-weight:700; color:#1a2733;}
.metric.metric-dash .txt{font-weight:800;}

.respRoot{color:#0b4fb3; font-weight:800; text-decoration:none;}

.promoterRow{background:#fff;}


/* ---------------------------------------------------------
   PHONE UX: pan horizontal en bloque + no colapsar columnas
   y ocultar topbar en landscape al hacer scroll
   --------------------------------------------------------- */
@media (max-width: 520px){
  /* Header compacto */
  .brand-title{font-size:24px; font-weight:700;}
  .brand-sub{display:none;}
  .logos{
    flex-direction:column;
    align-items:flex-end;
    gap:10px;
  }
  .logoImg{width:30px; height:30px;}
  .logoText{font-size:15px; font-weight:600;}

  /* Controles (botones) — más chicos y sin bold */
  .controls{
    grid-template-columns: 56px 110px 72px 72px 56px; /* back, QROO, DF, DL, refresh */
    gap: 10px;
  }
  .pill{display:none;}

  .btn{
    height:30px;
    border-width:2px;
    border-radius:12px;
    font-size:13px;
    font-weight:500;
    letter-spacing:-0.4px;
  }
  .btn.icon{font-size:16px; font-weight:500;}

  /* Panel: scroll horizontal SOLO en la lista de datos */
  .panel{ margin: 0 12px 10px 12px; overflow:hidden; }

  /* Promotor (arriba): permitir paneo horizontal para ver métricas */
  .panel:not(.panel-list){
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  .panel:not(.panel-list) .titlebar,
  .panel:not(.panel-list) .row,
  .panel:not(.panel-list) #promoterRow{ width: max-content; min-width: 760px; }
  .panel-list{ min-height: 0; }

  .titlebar{
    height:18px;
    padding: 0 10px;
    font-size:0; /* sin textos en barra roja */
  }

  /* Horizontal pan SOLO en la lista (no en la franja roja) */
  .panel-list{ overflow-x:hidden; }
  .panel-list .titlebar{ width:100%; }
  .list{
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  /* Renglón con ancho natural (si no cabe, se panea) */
  .row{ padding: 10px 12px; }
  .row, #promoterRow{ width: max-content; }

  /* Grillas: columnas legibles */
  .grid5{ grid-template-columns: 160px 220px 110px 110px 110px; }
  .grid4split{ grid-template-columns: 160px 220px 110px 110px; }
  .grid4rgsplit{ grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.7fr) minmax(120px, 1fr) minmax(180px, 1.7fr); }

  /* Texto: 2 líneas, no vertical */
  .ur, .name{
    display:-webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-break: break-word;
  }
  .name{ font-weight:600; }

  /* Métricas: barra arriba + texto MUN-7/11 abajo */
  .metric{ width:84px; align-items:center; gap:4px; }
  .metric .bar{ height:10px; }
  .metric .txt{ font-size:12px; font-weight:600; }
  .metric.metric-dash .txt{ font-weight:700; }


  /* Alinear titlebar y filas dentro del paneo horizontal */
  .panel-list .list{ width: 100%; }
  .panel-list .row{ width: max-content; min-width: 760px; }
}


/* Ocultar topbar (zona azul) en teléfono acostado cuando se hace scroll */
body.phone-hide-top .topbar{
  overflow-x:hidden;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
}
body.phone-hide-top .topbar *{
  pointer-events: none;
}

/* v10 phone-only button widths */
#btnHome{white-space:nowrap;}
.controls{max-width:100%;}


/* v11: shrink top buttons width so all fit on phone (back, Q ROO, DF, DL, reload) */
@media (max-width: 680px){
  .controls{
    display: grid !important;
    grid-template-columns: 38px 82px 50px 50px 38px !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }
  .controls .btn{
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 6px !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
  }
  /* keep Q ROO on one line */
  #btnHome{ white-space: nowrap !important; }
}
