:root{
  --bg1:#f1f3f6;
  --bg2:#d9dee6;
  --panel:#f4f6f9;
  --panel-soft:#eceff4;
  --navy:#0b2e57;
  --navy-2:#123f74;
  --red:#c90000;
  --red-dark:#990000;
  --yellow:#e0b800;
  --yellow-dark:#b89200;
  --green:#1e9e55;
  --green-dark:#147543;
  --gray:#96a3b2;
  --gray-dark:#6f7c8b;
  --line:#d2d8e0;
  --card:#ffffff;
  --text:#1a2330;
  --shadow:0 10px 24px rgba(0,0,0,.12);
  --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:linear-gradient(180deg,var(--bg1) 0%, var(--bg2) 100%);
  color:var(--text);
}
button,input,select,textarea{font-family:inherit}
.app{min-height:100%;display:flex;flex-direction:column}

.topbar{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:12px 16px 8px;
  color:#fff;
  background:linear-gradient(180deg,#db0000 0%, #b70000 100%);
  box-shadow:0 4px 18px rgba(0,0,0,.14);
}
.topbar-row{display:flex;align-items:center;justify-content:space-between;gap:14px}
.topbar-row-1{align-items:flex-start}
.brand{flex:1;min-width:0;max-width:52%}
.brand-title{
  font-size:24px;
  font-weight:700;
  letter-spacing:.2px;
  color:#fff;
  line-height:1.02;
}
.brand-title .light{font-weight:500}
.brand-sub{
  margin-top:3px;
  font-size:12px;
  color:#fff;
  opacity:.94;
}

.logos{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:flex-end;
  gap:14px;
  min-width:250px;
  flex-wrap:nowrap;
}
.logo-item{display:flex;align-items:center;gap:8px}
.logo-img,
.logo-img-idelec{
  width:36px;
  height:36px;
  object-fit:contain;
  border-radius:0;
  background:transparent;
  padding:0;
}
.logo-text{
  color:#fff;
  font-size:14px;
  font-weight:700;
  letter-spacing:.1px;
  white-space:nowrap;
  line-height:1;
}
.logo-text .light{font-weight:500}
.logo-text-main{font-weight:800}
.logo-reg{font-size:10px;vertical-align:super;opacity:.85}

.toolbar{
  width:100%;
  display:grid;
  grid-template-columns:auto auto auto auto;
  gap:10px;
  align-items:center;
}
.segmented{display:flex;gap:10px;align-items:center;flex-wrap:nowrap}
.seg{
  width:34px;
  min-width:34px;
  height:34px;
  border-radius:999px;
  border:4px solid rgba(255,255,255,.72);
  cursor:pointer;
  padding:0;
  font-size:0;
  box-shadow:0 0 0 1px rgba(11,46,87,.12), inset 0 0 0 1px rgba(255,255,255,.08);
}
.seg:nth-child(1){background:var(--green)}
.seg:nth-child(2){background:var(--yellow)}
.seg:nth-child(3){background:var(--red)}
.seg.active:nth-child(1){background:var(--green-dark)}
.seg.active:nth-child(2){background:var(--yellow-dark)}
.seg.active:nth-child(3){background:var(--red-dark)}
.seg.active{border-color:#fff;border-width:4px}
.seg:not(.active){opacity:.96}

.btn,
.days-box select{
  height:36px;
  border-radius:999px;
  border:2px solid var(--navy);
  background:#fff;
  color:var(--navy);
  font-size:17px;
  font-weight:700;
}
.btn{padding:0 16px;cursor:pointer}
.btn.primary{background:var(--red);border-color:var(--red);color:#fff}
.btn.ghost{background:#fff;color:var(--navy);border-color:var(--navy)}

.days-box{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  height:44px;
  padding:0 14px;
  border-radius:999px;
  background:rgba(255,255,255,.12);
  border:2px solid rgba(255,255,255,.18);
  color:#fff;
  font-size:15px;
  font-weight:700;
}
.days-box select{width:82px;padding:0 12px}

#btnReload{
  width:42px;
  min-width:42px;
  padding:0;
  font-size:0;
  position:relative;
}
#btnReload::before{
  content:"↻";
  font-size:24px;
  line-height:1;
  font-weight:700;
}
.pill{
  height:36px;
  min-width:118px;
  padding:0 14px;
  border-radius:999px;
  background:var(--navy);
  border:2px solid rgba(255,255,255,.24);
  color:#fff;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  letter-spacing:.15px;
}

.panel{
  margin:0 10px 10px;
  background:rgba(244,246,249,.98);
  border-radius:16px;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.filters-panel{padding:10px 12px}
.filters-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
}
.search-wrap{display:flex;align-items:center;gap:10px;min-width:0}
.search-wrap label{
  display:block;
  font-size:13px;
  font-weight:700;
  color:#5d6875;
  margin:0;
  white-space:nowrap;
}
.search-wrap input{
  width:100%;
  height:44px;
  border-radius:16px;
  border:1px solid #cad4df;
  padding:0 16px;
  font-size:16px;
  color:#4c5561;
  background:#fff;
}
.summary-wrap{display:grid;grid-template-columns:repeat(4,76px);gap:8px}
.summary-chip{
  height:60px;
  border-radius:14px;
  border:1px solid #cad4df;
  background:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding-top:2px;
}
.summary-chip span{font-size:12px;color:#6c7480}
.summary-chip strong{font-size:16px;color:var(--navy);font-weight:700}

.table-panel{flex:1;min-height:0}
.table-wrap{overflow:auto;max-height:calc(100vh - 188px);background:#f7f8fb}
.dash-table{width:100%;border-collapse:separate;border-spacing:0;min-width:860px}
.dash-table thead th{
  position:sticky;
  top:0;
  z-index:5;
  background:var(--navy);
  color:#fff;
  font-size:16px;
  font-weight:700;
  text-align:left;
  padding:12px 10px;
  letter-spacing:.1px;
}
.dash-table thead th:first-child{border-top-left-radius:16px}
.dash-table thead th:last-child{border-top-right-radius:16px}
.dash-table tbody td{
  padding:10px 8px;
  border-bottom:1px solid var(--line);
  vertical-align:middle;
  background:#fcfcfd;
}
.dash-table tbody tr.priority-row td{background:#fffaf6}
.dash-table th:nth-child(1), .dash-table td:nth-child(1){width:24%}
.dash-table th:nth-child(2), .dash-table td:nth-child(2){width:10%}
.dash-table th:nth-child(3), .dash-table td:nth-child(3){width:10%}
.dash-table th:nth-child(4), .dash-table td:nth-child(4){width:11%}
.th-mini,.td-mini{text-align:center;width:48px}
.td-phone{text-align:center;width:82px}

.user-name{
  font-size:14px;
  font-weight:600;
  color:var(--navy-2);
  cursor:pointer;
  line-height:1.02;
  letter-spacing:.05px;
}
.user-sub{
  margin-top:3px;
  font-size:10px;
  color:#707986;
  text-transform:uppercase;
  line-height:1.08;
}
.user-sub .prom-label{font-weight:700;color:#243240;margin-right:4px}
.ur-text,
.phone-text,
.phone-btn{
  font-size:14px;
  font-weight:600;
  color:#1c2430;
  line-height:1.04;
}
.phone-btn{
  display:inline;
  min-width:0;
  height:auto;
  border:none;
  border-radius:0;
  background:transparent;
  color:#214fbb;
  padding:0;
  text-decoration:underline;
  box-shadow:none;
}
.phone-btn.disabled{
  background:transparent;
  color:#a4aab2;
  cursor:not-allowed;
  pointer-events:none;
  text-decoration:none;
}
.date-main{font-size:12px;font-weight:600;color:#111;line-height:1.02}
.date-sub{margin-top:3px;font-size:11px;color:#6f7a86;line-height:1}
.action-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:64px;
  height:34px;
  border:none;
  border-radius:999px;
  color:#fff;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  padding:0 10px;
}
.action-map{background:#0b4ea2}
.action-block{background:var(--red)}
.action-unblock{background:#6e7784}
.sem{display:inline-block;width:22px;height:22px;border-radius:50%;box-shadow:inset 0 0 0 2px rgba(0,0,0,.06)}
.sem.verde{background:var(--green)}
.sem.amarillo{background:var(--yellow)}
.sem.rojo{background:var(--red)}
.sem.gris{background:var(--gray)}
.empty{text-align:center;padding:24px !important;font-size:16px;color:#617081}

.toast{
  position:fixed;
  right:14px;
  bottom:14px;
  min-width:260px;
  max-width:360px;
  background:#fff;
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:14px 14px 12px;
  display:none;
  z-index:1200;
}
.toast.show{display:block}
.toast-title{font-size:18px;font-weight:700;color:var(--navy)}
.toast-body{margin-top:6px;font-size:15px;color:#4b5560;line-height:1.18}
.toast-actions{margin-top:12px;display:flex;gap:8px;justify-content:flex-end}
.toast-actions a,.toast-actions button{
  height:34px;
  border:none;
  border-radius:999px;
  padding:0 14px;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  background:#0b4ea2;
  color:#fff;
  text-decoration:none;
}
.toast-actions button[disabled]{background:#c2cad4;cursor:not-allowed}

.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:1300}
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:1301;padding:18px}
.modal[hidden],.modal-backdrop[hidden]{display:none !important}
.modal-card{width:min(960px,95vw);max-height:92vh;overflow:hidden;display:flex;flex-direction:column;border-radius:22px;background:#fff;box-shadow:var(--shadow)}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;background:var(--red);color:#fff}
.modal-title{font-size:22px;font-weight:700}
.modal-close{border:none;background:transparent;color:#fff;font-size:36px;line-height:1;cursor:pointer}
.modal-body{padding:18px;overflow:auto}
.modal-actions{display:flex;justify-content:flex-end;gap:12px;padding:0 18px 18px}
.modal-actions.hidden{display:none}
.modal-body textarea{margin-top:12px;width:100%;min-height:100px;border:1px solid #cfd8e3;border-radius:14px;padding:12px;font-size:16px;resize:vertical}

.map-shell{display:grid;grid-template-rows:auto 1fr;gap:12px;height:min(78vh,820px)}
.map-top{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.map-user{font-size:20px;font-weight:700;color:var(--navy)}
.map-sub{margin-top:4px;font-size:15px;color:#5f6a76}
.map-days{display:flex;align-items:center;gap:10px;font-size:16px;font-weight:700;color:#4f5a65}
.map-days select{height:42px;border-radius:999px;border:2px solid var(--red);padding:0 14px;font-size:17px;font-weight:700;color:var(--red);background:#fff}
.map-canvas{height:100%;min-height:500px;border-radius:16px;overflow:hidden;border:1px solid #d3dbe4}
#mapCanvas{height:100%;width:100%}
.map-note{margin-top:10px;font-size:14px;color:#707b87}
.time-label{background:rgba(255,255,255,.97);border:1px solid #bcc7d3;border-radius:999px;padding:2px 8px;font-size:12px;font-weight:700;color:#263445;box-shadow:0 1px 6px rgba(0,0,0,.18)}

@media (max-width:1200px){
  .filters-row{grid-template-columns:1fr}
  .summary-wrap{grid-template-columns:repeat(4, minmax(66px,1fr))}
}
@media (max-width:900px){
  .topbar{padding:10px 10px 8px}
  .topbar-row{flex-direction:row;align-items:flex-start}
  .brand{max-width:56%}
  .brand-title{font-size:22px}
  .brand-sub{font-size:11px}
  .logos{min-width:172px;gap:8px}
  .logo-img,.logo-img-idelec{width:34px;height:34px}
  .logo-text{font-size:12px}
  .toolbar{grid-template-columns:auto auto auto auto;gap:8px}
  .days-box{height:40px;padding:0 10px;gap:8px}
  .days-box select{width:74px}
  .filters-panel{padding:8px 10px}
  .search-wrap{display:grid;grid-template-columns:1fr;gap:6px}
  .search-wrap input{height:42px;font-size:14px}
  .summary-wrap{grid-template-columns:repeat(4, 1fr);gap:6px}
  .summary-chip{height:54px}
  .summary-chip span{font-size:11px}
  .summary-chip strong{font-size:14px}
  .table-wrap{max-height:calc(100vh - 174px)}
  .dash-table{min-width:800px}
  .dash-table thead th{font-size:15px;padding:11px 8px}
  .dash-table tbody td{padding:9px 8px}
  .th-mini,.td-mini{width:46px}
  .td-phone{width:80px}
  .user-name,.ur-text,.phone-btn{font-size:14px;font-weight:600}
  .user-sub{font-size:10px}
  .date-main{font-size:12px}
  .date-sub{font-size:10px}
  .action-btn{min-width:62px;height:32px;font-size:15px;padding:0 10px}
  .sem{width:20px;height:20px}
}


/* PHONE FIX — toolbar móvil Access Control */
@media (max-width: 430px){
  .topbar-row-2{justify-content:center;}
  .toolbar{
    width:100%;
    display:flex;
    justify-content:center;
    align-items:center;
    flex-wrap:nowrap;
    gap:9.5mm;
  }
  .segmented,
  .days-box,
  #btnReload{
    flex:0 0 auto;
    margin:0;
  }
  .segmented{gap:6px;}
  .seg,
  .seg.active{
    width:30px;
    min-width:30px;
    height:30px;
    border-width:3px;
  }
  .days-box{
    height:38px;
    padding:0 8px;
    gap:6px;
  }
  .days-box span{font-size:14px;}
  .days-box select{
    width:64px;
    height:34px;
    font-size:16px;
    padding:0 8px;
  }
  #btnReload{
    width:38px;
    min-width:38px;
    height:38px;
  }
  #btnReload::before{font-size:21px;}
  #pillVersion{display:none;}
}
