/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 48px 44px;
  width: 380px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .4s ease;
}
@keyframes fadeUp { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: none; } }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo .logo-icon { width: 38px; height: 38px; background: var(--navy); border-radius: 8px; display:flex; align-items:center; justify-content:center; font-size:17px; color: #fff; }
.login-logo .logo-text { font-size: 18px; font-weight: 600; letter-spacing: .3px; color: var(--text-1); }
.login-logo .logo-text .dim { color: var(--blue-mid); font-weight: 300; }
.login-logo .logo-sub  { font-size: 10px; color: var(--text-3); font-family: var(--mono); letter-spacing: .1em; margin-top: 2px; }
.login-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: var(--text-1); letter-spacing: .2px; }
.login-sub   { font-size: 13px; color: var(--text-2); margin-bottom: 28px; }
.login-nota  { margin: -16px 0 20px; font-size: 13px; color: var(--text-1); }
.login-mantener { display: flex; width: fit-content; align-items: center; gap: 10px; min-height: 24px; margin: 0 0 16px; font-size: 13px; color: var(--text-1); cursor: pointer; }
.login-mantener[hidden], .login-nota[hidden] { display: none; }
.login-mantener input[type=checkbox] { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--blue); }
@media (pointer: coarse) { .login-mantener { min-height: 44px; } .login-mantener input[type=checkbox] { width: 44px; height: 44px; } }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; margin-bottom: 6px; font-family: var(--mono); }
.form-input {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: var(--sans);
}
.form-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--blue-bg); }
.form-input::placeholder { color: var(--text-3); }
.form-input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }

.btn-primary {
  width: 100%; background: var(--navy);
  color: #fff; font-weight: 600; font-size: 13px;
  padding: 11px; border-radius: var(--r);
  transition: background var(--transition), transform .1s;
}
.btn-primary:hover { background: var(--navy-soft); }
.btn-primary:active { transform: scale(.99); }
.login-error {
  background: var(--red-bg); border: 1px solid var(--red);
  border-radius: var(--r); padding: 10px 14px;
  color: var(--red); font-size: 12px; margin-top: 14px; display: none;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 20px 22px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.open::before  { background: var(--amber); }
.stat-card.proc::before  { background: var(--blue-mid); }
.stat-card.closed::before{ background: var(--green); }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; margin-bottom: 6px; font-family: var(--mono); }
.stat-value { font-size: 32px; font-weight: 600; font-family: var(--mono); line-height: 1; letter-spacing: -.5px; }
.stat-card.open  .stat-value { color: var(--amber); }
.stat-card.proc  .stat-value { color: var(--blue); }
.stat-card.closed .stat-value { color: var(--green); }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px;
}
.panel-title { font-size: 12px; font-weight: 600; color: var(--text-1); letter-spacing: .2px; text-transform: uppercase; font-family: var(--mono); }
.panel-body  { padding: 20px; }

.form-select {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 13px;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9890' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--blue-bg); }
.form-select:disabled { opacity: .55; cursor: not-allowed; }

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  z-index: 100;
  max-height: 240px; overflow-y: auto;
  box-shadow: var(--shadow);
  display: none;
  margin-top: 2px;
}
.autocomplete-list.open { display: block; }
.ac-item {
  padding: 9px 14px; font-size: 12px;
  cursor: pointer; color: var(--text-2);
  transition: background var(--transition);
  display: flex; align-items: center; gap: 10px;
}
.ac-item:hover, .ac-item.selected { background: var(--blue-bg); color: var(--navy-text); }
.ac-item.create-new {
  border-top: 1px solid var(--border);
  color: var(--green);
  font-weight: 500;
}
.ac-item.create-new:hover { background: var(--green-bg); color: var(--green); }
.ac-tipo {
  font-size: 9px; font-weight: 600; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
  text-transform: uppercase; font-family: var(--mono);
}
.ac-tipo-cc     { background: var(--blue-bg);   color: var(--blue);   border: 1px solid #cfe0f5; }
.ac-tipo-bl     { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.ac-tipo-pmv    { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }
.ac-tipo-ca { background: var(--purple-bg); color: var(--purple); border: 1px solid #d9c9ea; }
.ac-tipo-ddv { background: var(--pink-bg);   color: var(--pink);   border: 1px solid var(--pink-bd); }
.ac-tipo-otro   { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-2); }

/* (B-PMV1) Badges para el tipo de PMV (A/B/C) — tarjetas y popups */
.pmv-tipo-badge {
  display: inline-block;
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  padding: 1px 7px; border-radius: 4px; line-height: 1.5;
  letter-spacing: .04em;
}
.pmv-tipo-A { background: var(--blue-bg);   color: var(--blue);   border: 1px solid #cfe0f5; }
.pmv-tipo-B { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
.pmv-tipo-C { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }

.ac-main { flex: 1; min-width: 0; }
.ac-codigo { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--text-1); }
.ac-desc   { font-size: 11px; color: var(--text-3); margin-top: 1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition); cursor: pointer; border: none;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-2); }
.btn-ghost:hover { color: var(--text-1); border-color: var(--border); background: var(--surface-2); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-save { background: var(--navy); color: #fff; }
.btn-save:hover { background: var(--navy-soft); }
.btn[disabled] { opacity: .4; pointer-events: none; }

/* ============================================================
   TABLE
   ============================================================ */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  color: var(--text-3); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 11px 14px; font-size: 13px; color: var(--text-2); }
tbody td .folio { font-family: var(--mono); font-size: 11px; color: var(--text-1); }
tbody td .cc    { font-family: var(--mono); font-size: 12px; color: var(--navy-text); font-weight: 500; }

/* STATUS BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 500; font-family: var(--mono);
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.badge-open   { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-bd); }
.badge-open::before { background: var(--amber); }
.badge-proc   { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-bd); }
.badge-proc::before { background: var(--blue-mid); animation: pulse 2s infinite; }
.badge-closed { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.badge-closed::before { background: var(--green); }
.badge-marked { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-bd); }
.badge-marked::before { background: var(--purple); animation: pulse 2s infinite; }
.badge-cancel { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bd); }
.badge-cancel::before { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,39,68,.35);
  z-index: 500; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  width: 540px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .25s ease;
}
.modal.modal-lg { width: 720px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-folio { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: 6px; }
.modal-close { margin-left: auto; background: none; color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.modal-close:hover { color: var(--text-1); background: var(--surface-2); }
.modal-body   { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.filter-search {
  flex: 1; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 8px 14px;
  color: var(--text-1); font-size: 13px;
}
.filter-search:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--blue-bg); }
.filter-select {
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 8px 32px 8px 12px;
  color: var(--text-1); font-size: 12px; font-family: var(--mono);
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9890' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--navy); }

.refresh-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
.refresh-txt { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* ============================================================
   ELEMENT CARD (selección en captura)
   ============================================================ */
.elem-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
}
.elem-card-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.elem-tipo-big {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase;
  font-family: var(--mono);
}
.elem-nombre { font-size: 14px; font-weight: 600; }
.elem-codigo { font-size: 11px; font-family: var(--mono); color: var(--text-3); }
.elem-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.elem-field .ef-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing:.06em; margin-bottom:2px; font-family: var(--mono); }
.elem-field .ef-val   { font-size: 13px; color: var(--text-1); min-height: 18px; }
.elem-field.full { grid-column: 1/-1; }
.elem-empty { color: var(--text-3); font-size: 12px; text-align: center; padding: 20px 0; }

/* IPs panel inside elem card */
.ips-block {
  border-top: 1px solid var(--border);
  margin-top: 14px; padding-top: 12px;
}
.ips-title {
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .08em;
  font-family: var(--mono); margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.ip-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.ip-row:hover { border-color: var(--border-2); background: var(--surface-2); }
/* (2026-07) Desplegable SubNet/Gateway por canal (datos derivados de la
   regla de subred /24; ver _ipDatosRed en captura.js) */
.ip-red-btn {
  background: none; border: none; padding: 2px 4px; cursor: pointer;
  color: var(--text-3); font-size: 13px; line-height: 1; margin-left: auto;
}
.ip-red-btn:hover { color: var(--navy-text); }
.ip-red-btn i { transition: transform .15s; display: inline-block; }
.ip-red-btn.open i { transform: rotate(180deg); }
.ip-red-det {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 1px dashed var(--border-2);
  border-radius: 6px; padding: 5px 10px; margin: 2px 0 6px 26px;
}
.ip-red-det b.ip-red-cop {
  font-family: var(--mono); font-weight: 600; color: var(--navy-text);
  cursor: pointer;
}
.ip-red-det b.ip-red-cop:hover { text-decoration: underline; }
.ip-row.active {
  border-color: var(--green);
  background: var(--green-bg);
}
.ip-row input[type=radio] { accent-color: var(--green); cursor: pointer; }
.ip-row .ip-canal {
  font-size: 9px; font-family: var(--mono); font-weight: 600;
  color: var(--text-3); text-transform: uppercase;
  width: 60px; flex-shrink: 0;
}
.ip-row.active .ip-canal { color: var(--green); }
.ip-row .ip-val {
  font-family: var(--mono); font-size: 12px; color: var(--text-1);
  flex: 1;
}
.ip-row .ip-desc {
  font-size: 11px; color: var(--text-3);
}
.ip-row.empty { opacity: .4; cursor: default; }
.ip-row.empty:hover { border-color: var(--border); background: transparent; }
.ip-warning {
  font-size: 10px; color: var(--amber);
  font-family: var(--mono);
  padding: 6px 10px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-bd);
  border-radius: 6px;
  margin-bottom: 8px;
  display: none;
}
.ip-warning.show { display: block; }

/* CC info block (modelo + rol + esclavos) */
.cc-block {
  border-top: 1px solid var(--border);
  margin-top: 14px; padding-top: 12px;
}
.cc-block .cc-row {
  display: flex; gap: 14px; margin-bottom: 6px;
  font-size: 12px;
}
.cc-block .cc-label {
  color: var(--text-3); font-family: var(--mono);
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; min-width: 70px;
}
.cc-block .cc-val { color: var(--text-1); }
.cc-block .rol-badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 10px; font-family: var(--mono); font-weight: 500;
}
.rol-maestro       { background: var(--purple-bg); color: var(--purple); border: 1px solid #d9c9ea; }
.rol-esclavo       { background: var(--blue-bg); color: var(--blue); border: 1px solid #cfe0f5; }

.esclavos-list {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.esclavo-chip {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 7px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
/* El grupo maestro/esclavo en la ficha del elemento: codigo + donde esta. */
.grupo-list { display:flex; flex-direction:column; gap:3px; margin-top:4px; }
.grupo-item { display:flex; align-items:baseline; gap:6px; font-size:11.5px; line-height:1.35; }
.grupo-cc { font-family:var(--mono); font-weight:600; color:var(--text-1); flex:none; }
.grupo-tag { font-size:9px; text-transform:uppercase; letter-spacing:.05em; font-weight:700;
  color:var(--purple); background:var(--purple-bg); border:1px solid var(--purple-bd);
  border-radius:8px; padding:0 5px; flex:none; }
.grupo-ubi { color:var(--text-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }


/* Árbol de categorías y subcategorías, con sus reglas de cierre. */
.cat-arbol-top { display:flex; gap:8px; align-items:center; margin-bottom:14px; flex-wrap:wrap; }
.cat-arbol-top .form-input { max-width:260px; }
.cat-filtro { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-2); margin-left:auto; }
.cat-grupo { border:1px solid var(--border); border-radius:8px; margin-bottom:8px; overflow:hidden; }
.cat-grupo-h { display:flex; align-items:center; gap:8px; padding:10px 12px; cursor:pointer;
  background:var(--surface-2); user-select:none; }
.cat-grupo-h:hover { background:var(--surface-3, var(--surface-2)); }
.cat-caret { color:var(--text-3); font-size:11px; width:10px; }
.cat-grupo-n { font-weight:600; font-size:13.5px; }
.cat-grupo-c { margin-left:auto; font-size:11px; color:var(--text-3); }
.cat-grupo-b { padding:6px 12px 12px; }
.cat-vacio { color:var(--text-3); font-size:12px; padding:8px 0; }
.cat-sub { border-top:1px solid var(--border); padding:9px 0 4px; }
.cat-sub:first-child { border-top:none; }
.cat-sub-h { display:flex; align-items:center; gap:8px; }
.cat-sub-n { font-size:13px; }
.cat-sub-cod { font-family:var(--mono); font-size:10.5px; color:var(--text-3); }
.cat-sub-reglas { margin-left:auto; }
.cat-pill { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  padding:2px 7px; border-radius:9px; color:var(--green); background:var(--green-bg);
  border:1px solid var(--green-bd); }
.cat-pill.off     { color:var(--amber); background:var(--amber-bg); border-color:var(--amber-bd); }
.cat-pill.neutra  { color:var(--text-3); background:var(--surface-2); border-color:var(--border); }
.cat-pill.err     { color:var(--red); background:var(--red-bg); border-color:var(--red-bd); }
.cat-sub-b { padding:4px 0 0 2px; }
.cat-editable { cursor:pointer; border-radius:6px; padding:4px 6px; margin:-4px -6px; min-height:32px; }
.cat-editable:hover { background:var(--surface-2); }
.cat-editable:focus-visible { outline:2px solid var(--accent, var(--blue)); outline-offset:1px; }
.cat-propia .cat-sub-n { font-weight:600; }
.cat-propia-n { font-size:11px; color:var(--text-3); }
.cat-pill.cat-mun { text-transform:none; letter-spacing:0; font-weight:600; }
.catvis-sw { display:flex; align-items:center; gap:10px; font-size:14px; font-weight:600; min-height:44px; cursor:pointer; }
.catvis-sw input { width:20px; height:20px; accent-color:var(--green); }
.catvis-nota { font-size:12.5px; color:var(--text-2); margin:4px 0 10px; line-height:1.5; }
.catvis-impacto { font-size:12.5px; color:var(--text); margin:0 0 8px; line-height:1.5; }
.catvis-impacto:empty { display:none; }
.catvis-err { color:var(--red); font-size:12px; padding:8px; background:var(--red-bg); border-radius:6px; }
.catvis-eliminar { margin-right:auto; }
.cat-regla { display:flex; align-items:flex-start; gap:9px; padding:5px 0; font-size:12.5px; line-height:1.45; }
.cat-regla.off { color:var(--amber); }
.cat-regla.off .cat-regla-t { color:var(--amber); }
.cat-regla.off .cat-sw { color:var(--amber); }
.cat-regla-t { flex:1; color:var(--text-2); }
.cat-sw { display:flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700;
  text-transform:uppercase; letter-spacing:.04em; color:var(--text-3); flex:none; min-width:64px; }
.cat-regla-add { display:flex; gap:6px; align-items:center; margin-top:6px; }
.cat-regla-add .form-select { max-width:260px; font-size:12px; }
.cat-nueva { display:flex; flex-direction:column; gap:8px; margin-top:8px; padding:10px 12px;
  border:1px dashed var(--border-2); border-radius:7px; max-width:420px; }
.cat-campo { display:flex; flex-direction:column; gap:3px; font-size:11.5px; }
.cat-campo > span { font-weight:600; color:var(--text-2); }
.cat-campo > em { font-style:normal; font-size:10.5px; color:var(--text-3); }

/* ============================================================
   EXPORT SCREEN
   ============================================================ */
.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.check-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition);
  font-size: 12px; color: var(--text-2);
}
.check-item:hover { border-color: var(--border-2); background: var(--surface-2); }
.check-item input[type=checkbox] { accent-color: var(--navy); width: 14px; height: 14px; cursor: pointer; }
.check-item.checked { border-color: var(--navy); background: var(--blue-bg); color: var(--navy-text); }

/* ============================================================
   USERS / CATALOGS
   ============================================================ */
.user-actions { display: flex; gap: 10px; margin-bottom: 18px; }
.role-badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 11px; font-family: var(--mono); font-weight: 500;
  /* (Gertrude F0, 2026-08-20) Sin esto, "Contratista · Ingeniería" se parte en
     el "·" a partir de 768px (medido: 40.1px de alto, dos renglones) y se lee
     como dos cosas distintas dentro de una misma fila. Solo les pasa a las dos
     nuevas — las seis viejas no llegan a 95px y nunca envuelven —, así que es
     regresión de este cambio. Importa más de lo normal porque el contratista
     comparte matiz con su rol espejo: el rótulo es el único discriminante que
     queda, y partido deja de serlo. Una píldora de radio 20px con 40px de alto
     tampoco se lee ya como píldora. */
  white-space: nowrap;
}
.role-admin      { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-bd); }
.role-coordinador,
.role-contratista-coordinador { background: #eef0fb; color: #4f46e5;    border: 1px solid #c7ccf5; }
.role-operador,
.role-operador-cg { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-bd); }
.role-ingenieria,
.role-contratista-ingenieria { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-bd); }
.role-cuadrilla  { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-bd); }
.role-consulta   { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-bd); }
/* (Gertrude F0, 2026-08-20) Los dos roles de CONTRATISTA comparten el matiz de
   su rol espejo — índigo con coordinador, morado con ingeniería. Cero matices
   nuevos: seis roles ya consumían seis, y dos más serían ocho indistinguibles
   de un vistazo, además de competir con la paleta de estado de Gertrude. Lo
   "externo" lo dice la ETIQUETA ("Contratista · Ingeniería"), en texto y sin
   depender de color ni de forma. Borde SÓLIDO como los demás: el punteado se
   lee como "deshabilitado" y a 11 px con esquinas redondeadas desaparece.

   Un rol que no esté en OptiviaRoles cae aquí en gris neutro. Antes se pintaba
   como "consulta" — un rol real y con menos acceso — justo en la tabla donde
   se auditan los accesos. */
.role-desconocido{ background: var(--surface-2); color: var(--text-2);  border: 1px solid var(--border-2); }

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 20px;
  font-size: 13px; color: var(--text-1);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all .25s ease;
  z-index: 9999; pointer-events: none; max-width: 340px;
}
#toast.show { transform: none; opacity: 1; }
#toast.success { border-left: 3px solid var(--green); }
#toast.error   { border-left: 3px solid var(--red); }
#toast.info    { border-left: 3px solid var(--blue-mid); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============================================================
   MISC
   ============================================================ */
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
textarea.form-input { resize: vertical; min-height: 80px; }
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-3); font-size: 13px;
}
.empty-state .ei { font-size: 36px; margin-bottom: 12px; opacity: .4; }
tbody td .calles { font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
tbody td .registrado { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* incompleto badge */
.est-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
  padding: 2px 7px; border-radius: 10px;
  border: 1px solid transparent;
}
/* Tercer estado: ni online ni offline — no se sabe. Neutro, no ausente. */
.est-badge.sindato, .est-badge.esclavo, .est-badge.bodega, .est-badge.sinip {
  background:var(--surface-2); border-color:var(--border); color:var(--text-2); }
.est-badge.sindato .dot, .est-badge.esclavo .dot, .est-badge.bodega .dot,
.est-badge.sinip .dot { background:var(--text-3); }
.est-badge.online {
  background: var(--green-bg); color: var(--green);
  border-color: var(--green-bd);
}
.est-badge.offline {
  background: var(--red-bg); color: var(--red);
  border-color: var(--red-bd);
}
.est-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
/* Contador en header del acordeón */
.inv-section-stats {
  display: inline-flex; gap: 6px; font-size: 10px; margin-left: 6px;
}
.inv-section-stats .on  { color: var(--green); font-weight: 600; }
.inv-section-stats .off { color: var(--red); font-weight: 600; }
.inv-section-stats .sd  { color: var(--text-2); font-weight: 600; }
/* Toggle switch en el modal */
.est-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r1);
  cursor: pointer; user-select: none;
}
.est-toggle input { display: none; }
.est-switch {
  position: relative;
  width: 40px; height: 22px;
  background: var(--border-2); border-radius: 11px;
  transition: background .2s;
  flex-shrink: 0;
}
.est-switch::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--surface); border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.est-toggle input:checked + .est-switch { background: var(--green); }
.est-toggle input:checked + .est-switch::after { transform: translateX(18px); }
.est-toggle-label {
  flex: 1;
  font-size: 13px; font-weight: 600;
}
.est-toggle-label .sub {
  display: block;
  font-size: 10px; font-weight: 400; color: var(--text-3);
}
.est-declarado {
  margin: 0; padding: 10px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--border-2);
  border-radius: var(--r1);
  font-size: 13px; font-weight: 600; color: var(--text-1);
}
.est-declarado .sub {
  display: block;
  font-size: 10px; font-weight: 400; color: var(--text-3);
}

.el-maestro-preview {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--r1);
  font-size: 12px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.el-maestro-preview.ok     { border-color: var(--green); border-style: solid; background: rgba(34,197,94,.05); }
.el-maestro-preview.notfound { border-color: var(--red); border-style: solid; background: rgba(239,68,68,.05); }
.el-maestro-preview .cod {
  font-family: var(--mono); font-weight: 700; color: var(--navy-text);
}

.el-codigo-group {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--r1);
  overflow: hidden;
  background: var(--surface-1);
}
.el-codigo-group:focus-within { border-color: var(--blue-mid); }
.el-codigo-prefix {
  padding: 0 12px; display: flex; align-items: center;
  font-family: var(--mono); font-weight: 700;
  background: var(--surface-2); color: var(--navy-text);
  border-right: 1px solid var(--border);
  font-size: 13px; min-width: 52px; justify-content: center;
}
.el-codigo-input {
  border: none !important; border-radius: 0 !important;
  background: transparent !important;
  flex: 1; font-family: var(--mono);
}
.el-codigo-input:focus:not(:focus-visible) { outline: none; box-shadow: none; }

.tag-incompleto {
  display: inline-block; font-size: 9px; font-family: var(--mono);
  padding: 1px 6px; border-radius: 8px; margin-left: 6px;
  background: var(--amber-bg); color: var(--amber);
  border: 1px solid var(--amber-bd);
}

/* ============================================================
   CATALOG TABS
   ============================================================ */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.cat-tab {
  padding: 9px 18px; font-size: 12px; font-weight: 500;
  color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent;
  transition: all var(--transition); margin-bottom: -1px;
}
.cat-tab:hover { color: var(--text-2); }
.cat-tab.active { color: var(--navy-text); border-bottom-color: var(--navy); }
.cat-pane { display: none; }
.cat-pane.active { display: block; }
.cat-list { list-style: none; margin-bottom: 14px; max-height: 200px; overflow-y: auto; }
.cat-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 6px; font-size: 12px;
  font-family: var(--mono); color: var(--text-2);
  transition: background var(--transition);
}
.cat-list li:hover { background: var(--surface-2); }
.cat-list li .del-btn { background: none; color: var(--text-3); font-size: 14px; padding: 0 4px; border-radius: 3px; }
.cat-list li .del-btn:hover { color: var(--red); }
.cat-add-row { display: flex; gap: 8px; }
.cat-solo-lectura .cat-pane .del-btn,
.cat-solo-lectura .cat-pane:not(#catpane-componentes) .cat-add-row,
.cat-solo-lectura .cat-pane .cat-cruce-grid,
.cat-solo-lectura #nc-cat, .cat-solo-lectura #btn-add-cat,
.cat-solo-lectura #btn-add-rep, .cat-solo-lectura #btn-add-at { display: none; }
.cat-add-row input { flex: 1; }
.cat-cruce-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.glos-bloque { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.glos-bloque > summary { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text-1); cursor: pointer; }
.glos-bloque[open] > summary { border-bottom: 1px solid var(--border); }
.glos-tabla-wrap { overflow-x: auto; }
.glos-tabla { width: 100%; min-width: 720px; font-size: 12px; table-layout: fixed; }
.glos-c-num { width: 48px; }
.glos-c-nom { width: 15%; }
.glos-c-fuente { width: 22%; }
.glos-ultima { margin: 0 0 12px; font-size: 12px; color: var(--text-2); }
.glos-vigente { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 8px; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.glos-vigente p { margin: 0 0 4px; }
.glos-tabla td { vertical-align: top; }
.glos-tabla .glos-def { white-space: pre-wrap; overflow-wrap: anywhere; }
.glos-fila { cursor: pointer; }
.glos-fila:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.glos-nada, .glos-vacio { color: var(--text-3); }
.glos-vacio { font-size: 12px; padding: 14px; text-align: center; }
.cat-section-title {
  font-size: 11px; color: var(--text-2); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  margin: 18px 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   TIMELINE (historial de eventos en modal)
   ============================================================ */
.timeline {
  border-left: 2px solid var(--border);
  margin-left: 6px;
  padding-left: 16px;
  max-height: 240px;
  overflow-y: auto;
}
.tl-item {
  position: relative;
  padding: 8px 0 12px 0;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -22px; top: 12px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border-2);
}
.tl-item.tl-creacion::before     { background: var(--text-2); border-color: var(--text-2); }
.tl-item.tl-intervencion::before { background: var(--blue-mid); border-color: var(--blue-mid); }
.tl-item.tl-cierre::before       { background: var(--green); border-color: var(--green); }
.tl-item.tl-ip_cambio::before    { background: var(--amber); border-color: var(--amber); }
.tl-item.tl-comentario::before   { background: var(--text-3); border-color: var(--text-3); }
.tl-item.tl-status_cambio::before{ background: var(--purple); border-color: var(--purple); }

.tl-time {
  font-family: var(--mono); font-size: 10px;
  color: var(--text-3); margin-bottom: 2px;
}
.tl-desc { font-size: 12px; color: var(--text-1); line-height: 1.5; }
.tl-user { font-size: 10px; color: var(--text-3); margin-top: 2px; font-family: var(--mono); }

/* ============================================================
   COLLAPSIBLE
   ============================================================ */
.collapsible {
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.collapsible-header {
  padding: 12px 0;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .08em;
  user-select: none;
}
.collapsible-header:hover { color: var(--text-1); }
.collapsible-header .chev {
  transition: transform var(--transition);
  font-size: 9px;
}
.collapsible.open .collapsible-header .chev { transform: rotate(90deg); }
.collapsible-body { display: none; padding-bottom: 8px; }
.collapsible.open .collapsible-body { display: block; }

/* ============================================================
   SCREEN: HISTÓRICOS
   ============================================================ */
.hist-search-bar { display:flex; gap:10px; margin-bottom:20px; align-items:center; }
.hist-search-bar .autocomplete-wrap { flex:1; }
.hist-elem-header {
  display:flex; align-items:center; gap:12px;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.hist-elem-tipo {
  font-size:10px; font-weight:700; letter-spacing:.08em;
  padding:3px 10px; border-radius:20px; text-transform:uppercase;
  font-family:var(--mono); flex-shrink:0;
}
.hist-elem-nombre { font-size:15px; font-weight:600; }
.hist-elem-meta   { font-size:11px; color:var(--text-3); font-family:var(--mono); margin-top:2px; }
.hist-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; padding:16px 20px; border-bottom:1px solid var(--border); }
.hist-stat-item { text-align:center; }
.hist-stat-val  { font-size:22px; font-weight:600; font-family:var(--mono); color:var(--navy-text); }
.hist-stat-lbl  { font-size:10px; color:var(--text-3); text-transform:uppercase; letter-spacing:.06em; margin-top:2px; }
.hist-reportes-list { padding:0 4px; }
.hist-reporte-row {
  display:grid; grid-template-columns:140px 1fr 120px 90px;
  gap:12px; align-items:center;
  padding:12px 16px; border-bottom:1px solid var(--border);
  cursor:pointer; transition:background var(--transition);
}
.hist-reporte-row:hover { background:var(--surface-2); }
.hist-reporte-row:last-child { border-bottom:none; }
.hist-reporte-folio { font-family:var(--mono); font-size:11px; color:var(--text-2); }
.hist-reporte-desc  { font-size:13px; }
.hist-reporte-sub   { font-size:11px; color:var(--text-3); margin-top:2px; }
.hist-th {
  display:grid; grid-template-columns:140px 1fr 120px 90px;
  gap:12px; padding:8px 16px;
  font-size:10px; font-weight:600; letter-spacing:.08em; text-transform:uppercase;
  color:var(--text-3); border-bottom:1px solid var(--border);
  font-family:var(--mono);
}
.hist-con-origen .hist-reporte-row,
.hist-con-origen .hist-th { grid-template-columns:140px 1fr 120px 100px 90px; }
.hist-empty { text-align:center; padding:60px 20px; color:var(--text-3); }
/* Con la nota presente, el filete de las tarjetas duplicaria el de abajo. */
.hist-con-origen .hist-stats { border-bottom:none; }
.hist-stats-nota {
  display:flex; align-items:flex-start; gap:6px;
  padding:0 20px 12px; font-size:12px; color:var(--text-2);
  border-bottom:1px solid var(--border);
}
.hist-stats-nota i { color:var(--blue); flex:none; margin-top:2px; }
.hist-stats-nota b { font-family:var(--mono); }
.hist-esclavos-acc { padding:0 16px 8px; }
.hist-esclavos-lbl {
  display:inline-flex; align-items:center; gap:8px;
  min-height:32px; padding:0 6px; margin-left:-6px; border-radius:6px;
  font-size:12px; color:var(--text-2); cursor:pointer; user-select:none;
}
.hist-esclavos-lbl:hover { background:var(--surface-2); }
.hist-esclavos-lbl input { width:16px; height:16px; cursor:pointer; accent-color:var(--blue); }
.hist-heredado { color:var(--blue); font-weight:600; display:inline-flex; align-items:center; gap:4px; }
.hist-heredado i { font-size:12px; }

/* La 4a columna solo existe cuando hay filas heredadas; si no, repite el mismo
   codigo en todas las filas y se come 112 px. */
.hist-col-origen { display:none; }
.hist-con-origen .hist-col-origen { display:block; }

.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ============================================================
   SCREEN: MAPA DE CALOR
   ============================================================ */
/* minmax(0,1fr): permite que la columna derecha encoja (tablas/mapa anchos)
   sin desbordar el grid. Los grids con auto-fit reacomodan los bloques según
   el ancho de la ventana (la página usa .sa-main--wide, ancho completo). */
.hm-layout { display:grid; grid-template-columns:280px minmax(0,1fr); gap:20px; align-items:start; }
/* El mapa y los reportes usan tambien el ancho de los filtros: debajo de ellos
   ese hueco solo era espacio muerto al desplazar. */
.hm-ancho { grid-column: 1 / -1; container-type: inline-size; }
.hm-filters { display:flex; flex-direction:column; gap:12px; }
.hm-kpi-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:16px; }
.hm-kpi {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--r2); padding:14px 16px; text-align:center;
}
.hm-kpi-val { font-size:28px; font-weight:700; font-family:var(--mono); color:var(--navy-text); line-height:1; }
.hm-kpi-lbl { font-size:11px; color:var(--text-3); text-transform:uppercase; letter-spacing:.06em; margin-top:4px; }
.hm-kpi-sub { font-size:12px; color:var(--text-2); margin-top:2px; }
.hm-charts-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(340px,1fr)); gap:16px; margin-bottom:16px; }
.hm-chart-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--r2); padding:16px; }
.hm-chart-title { font-size:12px; font-weight:600; color:var(--text-2); text-transform:uppercase; letter-spacing:.06em; margin-bottom:14px; }
.hm-bar-row { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.hm-bar-label { font-size:11px; color:var(--text-2); width:130px; flex-shrink:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hm-bar-track { flex:1; background:var(--surface-2); border-radius:4px; height:8px; overflow:hidden; }
.hm-bar-fill  { height:100%; border-radius:4px; background:var(--blue-mid); transition:width .5s ease; }
.hm-bar-count { font-size:11px; font-family:var(--mono); color:var(--text-3); width:28px; text-align:right; flex-shrink:0; }
.hm-bar-fill.hm-cat-0 { background: var(--blue-mid); }
.hm-bar-fill.hm-cat-1 { background: var(--green); }
.hm-bar-fill.hm-cat-2 { background: var(--amber-solid); }
.hm-bar-fill.hm-cat-3 { background: var(--purple); }
.hm-bar-fill.hm-cat-4 { background: var(--pink); }
.hm-bar-fill.hm-cat-5 { background: var(--red); }
.hm-bar-fill.hm-cat-6 { background: var(--navy-text); }
.hm-bar-fill.hm-cat-7 { background: var(--text-3); }
.hm-cat-badge { display: inline-block; max-width: 140px; margin-top: 2px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px; font-size: 9px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); background: var(--surface-2); }
.hm-cat-badge.hm-cat-0 { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-bd); }
.hm-cat-badge.hm-cat-1 { color: var(--green); background: var(--green-bg); border-color: var(--green-bd); }
.hm-cat-badge.hm-cat-2 { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-bd); }
.hm-cat-badge.hm-cat-3 { color: var(--purple); background: var(--purple-bg); border-color: var(--purple-bd); }
.hm-cat-badge.hm-cat-4 { color: var(--pink); background: var(--pink-bg); border-color: var(--pink-bd); }
.hm-cat-badge.hm-cat-5 { color: var(--red); background: var(--red-bg); border-color: var(--red-bd); }
.hm-cat-badge.hm-cat-6 { color: var(--navy-text); }
.hm-elem-placeholder { padding:24px 16px; font-size:12px; color:var(--text-3); text-align:center; }
.hm-elem-coment { max-width:280px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#hm-elem-panel tbody tr { cursor:default; }  /* tabla de solo lectura */
#hm-map {
  background:var(--surface);
  min-height:460px; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  position:relative; min-width:0;
}
#hm-hex { width:100%; height:460px; }
.hm-kpi-row.is-viejo .hm-kpi-val, .hm-graficas.is-viejo .hm-chart-card { opacity:.45; }

.hm-hx { fill-opacity: var(--hx-opacidad); stroke: var(--hx-separador); stroke-width: 1; stroke-dasharray: none; }
.hm-hx--c0 { fill: var(--hx-c0); }
.hm-hx--c1 { fill: var(--hx-c1); }
.hm-hx--c2 { fill: var(--hx-c2); }
.hm-hx--c3 { fill: var(--hx-c3); }
.hm-hx--c4 { fill: var(--hx-c4); }
.hm-hx--c5 { fill: var(--hx-c5); }
.hm-hx--insuf { fill: var(--hx-insuf-relleno); fill-opacity: .10; stroke: var(--hx-insuf-borde); stroke-width: 1.25; stroke-dasharray: 3 3; }

.hm-mapa-cab { flex-wrap: wrap; row-gap: 8px; }
.hm-map-label { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.hm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); }
.hm-chip.is-error { border-color: var(--red); color: var(--red); }
.hm-aviso { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 500; max-width: calc(100% - 24px); box-sizing: border-box; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--hx-separador); background: #fff; color: #1f2430; font-size: 12px; text-align: center; pointer-events: none; }

.hm-mapa-cuerpo { display: grid; grid-template-columns: minmax(0,1fr) 360px; }
.hm-lado { border-left: 1px solid var(--border); overflow: auto; contain: size; scroll-padding-top: 36px; background: var(--surface); }
.hm-lado-cab { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; }
.hm-lado-t { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-1); }
.hm-lado-t:focus { outline: none; }
.hm-lado-t:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.hm-lado table { table-layout: auto; }
.hm-lado thead th { position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 8px; background: var(--surface); }
.hm-lado tbody tr { height: var(--hm-fila, 40px); }
.hm-lado tbody td { padding: 3px 8px; font-size: 12px; line-height: 16px; }
.hm-lado td.num, .hm-lado th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hm-lado tbody tr.is-sel { background: var(--surface-2); }
.hm-lado .hm-cero { color: var(--text-3); }
.hm-lado .hm-sin { color: var(--text-3); font-family: var(--sans); }
.hm-zona-cod { font-family: var(--mono); font-size: 12px; color: var(--navy-text); font-weight: 500; }
.hm-zona-mas { font-family: var(--mono); font-size: 12px; color: var(--navy-text); }
.hm-zona-mun { display: block; font-size: 11px; line-height: 14px; color: var(--text-3); }
.hm-en { display: block; font-size: 11px; line-height: 14px; color: var(--text-3); }
.hm-tasa { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.hm-tasa svg { width: 12px; height: 12px; flex: 0 0 12px; background: #f6f6f4; border-radius: 2px; }
.hm-nota { margin: 0; padding: 8px 12px; font-size: 11px; color: var(--text-3); }
.hm-lado-acc { padding: 4px 12px 8px; }
.hm-lado-sub { margin: 8px 0 0; padding: 8px 12px 4px; font-size: 11px; font-weight: 600; color: var(--text-2); border-top: 1px solid var(--border); }

.hm-escala { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--r); overflow: hidden; }
.hm-escala button { min-height: 32px; padding: 0 12px; border: 0; background: var(--surface); color: var(--text-2); font-size: 12px; cursor: pointer; }
.hm-escala button + button { border-left: 1px solid var(--border-2); }
.hm-escala button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.hm-escala button:disabled { opacity: .6; cursor: default; }

.hm-selbar { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.hm-selbar-t { flex: 1; min-width: 0; }
.hm-selbar b { font-family: var(--mono); color: var(--text-1); }
.hm-selbar-x { min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface); color: var(--text-2); cursor: pointer; }

.hm-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 64px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.hm-leyenda-t { font-weight: 600; color: var(--text-1); }
.hm-leg-clases { display: contents; }
.hm-leg { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); }
.hm-leg svg { width: 16px; height: 16px; flex: 0 0 16px; background: #f6f6f4; border-radius: 3px; }
.hm-leg-n { color: var(--text-3); }
.hm-leyenda-meta { flex-basis: 100%; color: var(--text-3); }
.hm-guia { flex-basis: 100%; color: var(--text-3); }

@container (max-width: 1000px) {
  .hm-mapa-cuerpo { grid-template-columns: 1fr; }
  .hm-lado { contain: none; border-left: none; border-top: 1px solid var(--border); max-height: 420px; }
}
@media (pointer: coarse) {
  .hm-escala button { min-height: 44px; }
  .hm-selbar-x { min-width: 44px; min-height: 44px; }
  .hm-lado { --hm-fila: 44px; }
}
/* ── Inventario nuevo ─────────────────────────────── */
.inv-toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.inv-search {
  flex: 1; min-width: 200px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--r1); font-size: 13px;
  background: var(--surface-1); color: var(--text-1);
  outline: none;
}
.inv-search:focus { border-color: var(--blue-mid); }
.inv-section {
  border: 1px solid var(--border);
  border-radius: var(--r2);
  margin-bottom: 10px;
  overflow: hidden;
}
.inv-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; cursor: pointer;
  background: var(--surface-1);
  user-select: none;
  transition: background .15s;
}
.inv-section-header:hover { background: var(--surface-2); }
.inv-section-header.open  { background: var(--surface-2); }
.inv-section-icon  { font-size: 16px; }
.inv-section-title { font-size: 14px; font-weight: 600; color: var(--text-1); flex: 1; }
.inv-section-count {
  font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  border-radius: 10px; padding: 2px 8px; min-width: 24px; text-align: center;
}
.inv-section-chevron {
  font-size: 11px; color: var(--text-3);
  transition: transform .2s;
}
.inv-section-header.open .inv-section-chevron { transform: rotate(180deg); }
.inv-section-body {
  display: none; padding: 12px;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
}
.inv-section-body.open { display: block; }
.inv-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.inv-card {
  background: var(--surface-2); border-radius: 8px;
  padding: 11px 13px; border: 1px solid var(--border-2);
  transition: border-color .15s;
}
.inv-card:hover { border-color: var(--blue-mid); }
.inv-card-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 6px;
}
.inv-card-codigo {
  font-family: var(--mono); font-size: 13px;
  font-weight: 700; color: var(--navy-text);
}
.inv-card-body {
  /* (T2) 11 -> 12.5 px: con los botones fuera hay sitio. */
  font-size: 12.5px; color: var(--text-2); line-height: 1.6;
}
.inv-card-body b { color: var(--text-1); }
.inv-card-footer {
  display: flex; justify-content: space-between;
  align-items: center; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--border-2);
}
.inv-badge-bodega {
  font-size: 10px; font-weight: 600;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px; padding: 2px 7px;
}
/* GPRS card */
.inv-gprs-card {
  background: var(--surface-2); border-radius: 8px;
  padding: 10px 13px; border: 1px solid var(--border-2);
}
.inv-gprs-info { font-size: 12px; color: var(--text-2); }
.inv-gprs-serie { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--navy-text); }
/* Bodega section */
.inv-section.bodega .inv-section-header { background: #fffbeb; }
.inv-section.bodega .inv-section-header:hover { background: #fef3c7; }
.inv-section.bodega .inv-section-header.open  { background: #fef3c7; }

.hm-map-placeholder {
  text-align:center; color:var(--text-3);
  pointer-events:none;
}
.hm-map-placeholder .mp-icon { font-size:48px; opacity:.3; margin-bottom:12px; }
.hm-map-placeholder p { font-size:13px; }

.mi-filters {
  display: flex; gap: 16px; align-items: flex-end;
  flex-wrap: wrap; margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
}
.mi-filter-group { display: flex; flex-direction: column; gap: 6px; }
.mi-filter-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
}
.mi-filters .form-select { min-width: 180px; }

.mi-tipo-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mi-chip {
  background: var(--surface-1); color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: 16px; padding: 6px 14px;
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  height: 38px; display: inline-flex; align-items: center;
}
.mi-chip:hover { background: var(--surface-2); }
.mi-chip.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.mi-counter {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  background: var(--surface-2);
  padding: 0 14px; border-radius: 16px;
  height: 38px; display: inline-flex; align-items: center;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   SCREEN: MAPA DE INVENTARIO
   ════════════════════════════════════════════════════════════ */
.mi-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}
.mi-map-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  background: var(--surface);
  height: 600px;
}
#mi-map { width: 100%; height: 100%; }

.mi-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mi-side-header {
  padding: 12px 14px;
  background: #fffbeb; border-bottom: 1px solid #fde68a;
  font-size: 13px; font-weight: 600; color: #92400e;
  display: flex; justify-content: space-between; align-items: center;
}
.mi-side-close {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: #92400e;
}
.mi-side-body { flex: 1; overflow-y: auto; padding: 10px; }

/* Popup del mapa */
.mi-popup { font-family: inherit; min-width: 200px; }
.mi-popup-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; gap: 10px;
}
.mi-popup-codigo {
  font-family: var(--mono); font-weight: 700;
  color: var(--navy-text); font-size: 13px;
}
.mi-popup-body {
  font-size: 11px; color: var(--text-2); line-height: 1.55;
}
.mi-popup-body b { color: var(--text-1); }
.mi-popup-footer {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border-2);
  display: flex; gap: 6px;
}
.mi-popup-section {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--border-2);
}
.mi-popup-section-ttl {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--navy-text); margin-bottom: 5px;
}
.mi-popup-gprs {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 5px 8px; margin-bottom: 4px;
  font-size: 10px; line-height: 1.5;
}
.mi-popup-gprs b { color: var(--text-1); }

/* Marcadores circulares por tipo */
.mi-marker {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 10px;
  font-family: var(--mono);
}
.mi-marker-cc   { background: var(--blue-mid); }
.mi-marker-bl   { background: var(--green); }
.mi-marker-pmv  { background: var(--amber); }
.mi-marker-ca   { background: var(--purple); }
.mi-marker-ddv  { background: var(--pink); }
.mi-marker-otro { background: var(--text-3); }

/* Responsive */
@media (max-width: 1024px) {
  .mi-layout { grid-template-columns: 1fr; }
  .mi-side {
    position: fixed; right: 0; top: 52px; bottom: 0;
    width: 85%; max-width: 360px;
    z-index: 350;
    transform: translateX(110%);
    transition: transform .25s ease;
    border-radius: 0;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
  }
  .mi-side.open { transform: translateX(0); }
  .mi-side-close { display: inline-flex; align-items: center; justify-content: center; }
  #mi-btn-bodega-toggle { display: inline-flex !important; }
}
@media (max-width: 768px) {
  .mi-filters { padding: 10px; gap: 10px; }
  .mi-filters .form-select { min-width: 0; width: 100%; }
  .mi-filter-group { width: 100%; }
  .mi-tipo-chips { width: 100%; }
  .mi-chip { padding: 5px 12px; font-size: 11px; height: 34px; }
  .mi-counter { height: 34px; font-size: 11px; }
  #mi-map { min-height: 400px; }
}


/* ── Pantalla: Importar datos BL ──────────────────────── */
#screen-importar-bl.active { display: flex; flex-direction: column; height: 100%; gap: 16px; }
.imp-page { display: flex; flex-direction: column; gap: 16px; }
.imp-page > .aviso-barra { margin-bottom: 0; }

.imp-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 10px;
}
.imp-title { font-size: 18px; font-weight: 700; color: var(--navy-text); }
.imp-subtitle { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.imp-instructions {
  background: var(--blue-bg); border: 1px solid var(--blue-bd);
  border-radius: var(--r2); padding: 14px 16px;
  font-size: 12px; color: var(--blue); line-height: 1.6;
}
.imp-instructions b { color: var(--blue); }
.imp-instructions ol { margin: 6px 0 0 18px; }

.imp-paste-area {
  flex: 1; width: 100%; min-height: 200px;
  font-family: var(--mono); font-size: 11px;
  background: var(--surface-1); color: var(--text-1);
  border: 2px dashed var(--border);
  border-radius: var(--r2); padding: 14px;
  resize: vertical; outline: none;
  transition: border-color .15s;
  line-height: 1.5;
}
.imp-paste-area:focus { border-color: var(--blue-mid); border-style: solid; }
.imp-paste-area::placeholder { color: var(--text-3); font-family: var(--sans, inherit); font-size: 13px; }

.imp-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.imp-counter { font-size: 12px; color: var(--text-3); margin-left: auto; }

.imp-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  display: none;
}
.imp-preview.visible { display: block; }
.imp-preview-header {
  padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--navy-text);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 4px 16px;
}
.imp-preview-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.imp-preview-table th {
  background: var(--surface-2); color: var(--text-3);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: 10px;
  padding: 7px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.imp-preview-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border-2);
  color: var(--text-1);
}
.imp-preview-table tr:last-child td { border-bottom: none; }
.imp-preview-table tr.row-ok:hover td { background: var(--surface-1); }
.imp-preview-table tr.row-err td { background: var(--red-bg); }
.imp-preview-scroll { max-height: 320px; overflow-y: auto; }
.imp-tag-online  { color: var(--green); font-weight: 600; }
.imp-tag-offline { color: var(--red); font-weight: 600; }

.imp-result {
  padding: 14px 16px; border-radius: var(--r2);
  font-size: 13px; font-weight: 500;
  display: none;
}
.imp-result.ok   { background: var(--green-bg); border: 1px solid var(--green-bd); color: var(--green); }
.imp-result.err  { background: var(--red-bg); border: 1px solid var(--red-bd); color: var(--red); }
.imp-result.visible { display: block; }

@media (max-width: 768px) {
  .imp-paste-area { min-height: 140px; }
  .imp-actions { flex-direction: column; align-items: stretch; }
  .imp-counter { margin-left: 0; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE & TABLET RESPONSIVE
   Breakpoints:
     ≤1024px — tablet: sidebar se vuelve drawer
     ≤768px  — tablet pequeña/móvil landscape
     ≤480px  — móvil portrait
   ════════════════════════════════════════════════════════════ */

/* (H2/C-UI-6) .nav-toggle / .nav-overlay y el drawer móvil del sidebar
   persistente se retiraron: la navegación es el drawer compartido
   (nav-lateral.js), que trae su propia pestaña ☰, overlay y estilos. */

/* ─── ≤1024px: TABLET ─────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Content con menos padding */
  #content { padding: 20px; }

  /* Grids de formulario: 2 columnas → 1 */
  .cat-cruce-grid { grid-template-columns: 1fr; }

  /* Mapa de calor: filtros arriba, contenido abajo (el grid de charts
     ya es fluido con auto-fit) */
  .hm-layout { grid-template-columns: 1fr; }

  /* Login card más angosto */
  .login-card { width: 100%; max-width: 380px; padding: 36px 28px; }
}

/* ─── ≤768px: MÓVIL LANDSCAPE / TABLET PEQUEÑA ────────────── */
@media (max-width: 768px) {
  /* Drawer más angosto */
  :root { --nav-w: 260px; }

  /* Topbar más compacto */
  #topbar {
    height: 52px;
    padding: 0 14px;
    gap: 10px;
  }
  #topbar h1 { font-size: 14px; }
  #topbar .breadcrumb { display: none; }

  /* Botones del topbar más pequeños */
  .topbar-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Content con aún menos padding */
  #content { padding: 14px; }

  /* Stat cards padding reducido */
  .stat-card { padding: 16px 18px; }

  /* Paneles padding menor */
  .panel-header { padding: 12px 16px; }
  .modal-body { padding: 18px 18px; }

  /* Botones más compactos */
  .btn { padding: 8px 14px; font-size: 12px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }

  /* Toolbar de inventario: stack vertical */
  .inv-toolbar { flex-direction: column; align-items: stretch; }
  .inv-toolbar .inv-search,
  
  .inv-toolbar button { width: 100%; }

  /* Inventario: tarjetas más angostas */
  .inv-cards-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Acordeón: header más compacto */
  .inv-section-header { padding: 10px 12px; gap: 8px; }
  .inv-section-title { font-size: 13px; }

  /* Modal ocupa casi todo el ancho */
  .modal { width: 95vw; max-width: 95vw; }
  .modal-lg { width: 95vw; max-width: 95vw; }

  /* Form inputs más altos (mejor tap target en móvil) */
  .form-input, .form-select {
    padding: 12px 14px;
    font-size: 14px;  /* evita zoom en iOS si < 16px */
  }

  /* `#toast` primero: el elemento real es <div id="toast">, nunca lleva la clase. */
  #toast, .toast {
    bottom: 14px; right: 14px; left: 14px;
    max-width: unset;
  }

  /* Fuentes grandes más razonables */
  .stat-card .stat-value,
  .stat-num { font-size: 28px !important; }

  /* Mapa de calor: filtros en columna */
  .hm-filters > * { width: 100%; }

  /* KPI row en mapa de calor */
  .hm-kpi-row { grid-template-columns: 1fr 1fr !important; }
}

/* ─── ≤480px: MÓVIL PORTRAIT ──────────────────────────────── */
@media (max-width: 480px) {
  /* Topbar mínimo */
  #topbar { padding: 0 10px; gap: 8px; }
  .topbar-btn { font-size: 10px; padding: 4px 8px; }

  /* Content padding mínimo */
  #content { padding: 10px; }

  /* Login card padding reducido */
  .login-card { padding: 28px 20px; }

  /* Tarjeta de elemento: más compacta */
  .inv-card { padding: 10px 12px; }
  .inv-card-codigo { font-size: 12px; }
  .inv-card-body { font-size: 11.5px; line-height: 1.5; }   /* (T2) 10 -> 11.5, misma proporcion */

  /* Modal casi full screen */
  .modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .modal-lg { width: 100vw; max-width: 100vw; }
  .modal-body { padding: 16px; }

  /* Fuentes grandes */
  .stat-card .stat-value,
  .stat-num { font-size: 24px !important; }
}

/* ============================================================
   TOGGLE Todos / Mis asignados (lista de reportes)
   ------------------------------------------------------------
   (Gertrude F0, 2026-08-20) Colgaba de body.rol-ingenieria /
   body.rol-coordinador. Dos problemas con eso: un rol nuevo con los MISMOS
   permisos veía menos interfaz que su rol espejo (y agregarlo obligaba a
   volver aquí), y un ingeniero SIN cuadrilla veía el toggle, lo usaba, y
   recibía un 400 — "Mis asignados" no tiene sentido sin alguien a quien
   asignar. Ahora cuelga de TENER persona de atención (body.tiene-persona,
   que pone auth.js desde la sesión), que es la condición real.
   ============================================================ */
.rep-toggle { display: none; gap: 0; }
body.tiene-persona .rep-toggle, body.tiene-lomio .rep-toggle { display: inline-flex; }
.rep-lomio { margin-top: 3px; font-size: 11px; color: var(--text-2); max-width: 220px; }
.rep-lomio-marca { display: inline-block; padding: 0 6px; border-radius: 8px; background: var(--green-bg, #e7f1ec);
  color: var(--green, #1f6f54); font-weight: 700; }
.rep-lomio-bloque { color: var(--text-1); font-weight: 600; }
tr.rep-lomio-nuevo td:first-child { box-shadow: inset 3px 0 0 var(--green, #1f6f54); }
.m-lomio { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2);
  border: 1px solid var(--border); }
.m-lomio-linea { margin: 0; font-size: 14px; color: var(--text-1); font-weight: 600; }
.m-lomio-preg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px;
  color: var(--text-2); }
.m-lomio-preg .btn { min-height: 44px; }
 
.rep-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 8px 14px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.rep-toggle-btn:first-child { border-radius: var(--r) 0 0 var(--r); border-right: none; }
.rep-toggle-btn:last-child  { border-radius: 0 var(--r) var(--r) 0; }
.rep-toggle-btn:hover { background: var(--surface-2); color: var(--text-1); }
.rep-toggle-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
 
/* ============================================================
   Botón "Crear y auto-asignar"
   ------------------------------------------------------------
   (Gertrude F0, 2026-08-20) Mismo criterio que el toggle: auto-asignar
   requiere una persona de atención a la que asignar, no un rol concreto.
   captura.js ya rechazaba el clic sin cuadrilla con un toast; ahora el botón
   ni siquiera aparece cuando no puede funcionar.
   ============================================================ */
#btn-guardar-asignar { display: none; }
body.tiene-persona #btn-guardar-asignar { display: inline-flex; }
 
/* ============================================================
   Ordenamiento de tablas — encabezados clickeables
   Aplica a todas las tablas con clase .sortable o th[data-sort]
   ============================================================ */
table th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
  transition: color var(--transition);
}
table th[data-sort]:hover { color: var(--text-1); }
table th[data-sort]::after {
  content: '⇅';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.35;
  font-weight: normal;
}
table th[data-sort].sort-asc::after  { content: '▲'; opacity: 1; color: var(--blue-mid); }
table th[data-sort].sort-desc::after { content: '▼'; opacity: 1; color: var(--blue-mid); }

/* El botón que table-sort.js inserta dentro de cada th ordenable. Es lo que
   hace la tabla operable con teclado (WCAG 2.1.1, nivel A): un <th> no es
   enfocable, así que antes NINGUNA tabla se podía ordenar sin ratón.
   Se estiliza para desaparecer visualmente: el encabezado debe verse igual
   que antes; lo que cambia es que ahora se puede alcanzar con Tab. */
table th[data-sort] > button.th-sort {
  all: unset;
  display: block;
  width: 100%;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: inherit;
  /* Objetivo táctil: el th ya trae padding, pero un encabezado angosto podía
     quedar por debajo del mínimo de 24x24 de WCAG 2.2 §2.5.8. */
  min-height: 24px;
}
table th[data-sort] > button.th-sort:focus-visible {
  outline: 2px solid var(--focus-ring, currentColor);
  outline-offset: 2px;
  border-radius: 3px;
}
 
/* ============================================================
   Visibilidad por rol  (H2/C-UI-6)
   Las reglas que ocultaban items del sidebar persistente (#nav-*) por rol
   se retiraron al quitar el sidebar. El gateo del launcher de Inicio vive
   ahora en renderHub()/_claveVisible (nav.js) y el del drawer en
   nav-lateral.js; ambos por permiso/rol, no por CSS.
   ============================================================ */
/* ============================================================
   HISTÓRICO DEL ELEMENTO (panel captura)
   ============================================================ */
.hist-grupo {
  margin-bottom: 14px;
}
.hist-grupo-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hist-count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
}
.hist-item {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.hist-item:hover {
  background: var(--surface-2);
  border-color: var(--blue-mid);
}
.hist-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.hist-item-sub {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   IPs CLICKEABLES + ABRIR CONTROLADOR + BLOQUE VDT
   (B-CC1/2/3) - panel de "Elemento seleccionado" en captura
   ============================================================ */

/* IP convertida en link (protocolo firefox-cc://) + boton copy */
.ip-link-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ip-link {
  color: var(--blue);
  font-family: var(--mono);
  text-decoration: none;
  border-bottom: 1px dashed var(--blue);
  cursor: pointer;
}
.ip-link:hover {
  color: var(--navy-text);
  border-bottom-style: solid;
}
.ip-copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  transition: all var(--transition);
}
.ip-copy-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-1);
}
.ip-copy-btn:active {
  background: var(--blue-bg);
  border-color: var(--blue);
}

/* Botón grande "Abrir controlador" (IP activa) */
.btn-open-controller {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-bd);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-open-controller:hover {
  background: var(--green);
  color: #fff;
  transform: translateY(-1px);
}
.btn-open-controller .boc-ip {
  font-family: var(--mono);
  font-size: 12px;
  opacity: .85;
}

/* Bloque VDTs del cruce */
.vdt-block {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 12px;
}
.vdt-title {
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .08em;
  font-family: var(--mono);
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.vdt-title .vdt-summary {
  font-family: var(--sans, inherit);
  font-size: 11px;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: normal;
}
.vdt-title .vdt-summary strong { color: var(--text-1); }
.vdt-title .vdt-esclavos { color: var(--purple); }
.vdt-title .vdt-loading {
  font-size: 10px;
  color: var(--text-3);
  font-style: italic;
  text-transform: none;
}
.vdt-intf-list {
  display: flex; flex-direction: column; gap: 4px;
}
.vdt-intf-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.vdt-intf-row:hover { border-color: var(--border-2); background: var(--surface-2); }
.vdt-intf-row .vdt-intf-serie {
  font-family: var(--mono);
  color: var(--text-2);
  min-width: 90px;
}
.vdt-intf-row .vdt-intf-ip {
  flex: 1;
  font-family: var(--mono);
}
.vdt-intf-row .vdt-intf-count {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}
.vdt-intf-row .vdt-intf-bodega {
  font-size: 10px;
  color: var(--amber);
  font-family: var(--mono);
  text-transform: uppercase;
}

/* (B-A8) La alerta de captura de correo se reubicó del sidebar a un banner
   bajo el topbar (.topbar-email-alert en layout.css). El estilo viejo
   .nav-email-alert se retiró con el sidebar (H2/C-UI-6). */

/* ============================================================
   (B-PERM1) Tabla de permisos (en modales de usuario)
   ============================================================ */
.perm-tabla-wrap {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.u-perm-propio {
  margin-bottom: 6px; padding: 6px 10px;
  font-size: 12px; color: var(--amber);
  background: var(--amber-bg); border: 1px solid var(--amber-bd); border-radius: 6px;
}
.u-perm-propio[hidden] { display: none; }
.perm-tabla {
  display: flex; flex-direction: column;
  font-size: 12px;
}
.perm-tabla-head {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 12px;
  padding: 6px 12px;
  background: var(--surface-2, #f5f4f0);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}
.perm-grupo { border-bottom: 1px solid var(--border); }
.perm-grupo:last-child { border-bottom: none; }
.perm-grupo-titulo {
  padding: 6px 12px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2, #f5f4f0));
  font-weight: 600;
  font-size: 11px;
  color: var(--navy-text);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.perm-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.perm-row:hover { background: var(--surface-2, #f5f4f0); }
.perm-row.changed { background: var(--amber-bg); }
.perm-row.changed:hover { background: var(--amber-bg); box-shadow: inset 2px 0 0 var(--amber); }
.perm-row-name { display: flex; flex-direction: column; gap: 2px; }
.perm-row-name .perm-clave {
  font-weight: 500; color: var(--text-1);
}
.perm-row-name .perm-desc {
  font-size: 10px; color: var(--text-3); line-height: 1.3;
}
.perm-row .perm-check, .perm-row .perm-default { text-align: center; }
.perm-row input[type=checkbox] {
  width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy);
}

/* (P1) Arbol de permisos en acordeon: Modulo > Pagina > Seccion
   (crearArbolPermisos en js/permisos.js). Reusa .perm-row para las filas. */
.permx { font-size: 12px; }
.permx-top { position: sticky; top: 0; z-index: 2; }
.permx-tools {
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
  padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.permx-buscar {
  flex: 1 1 160px; min-width: 0; padding: 5px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-1);
}
.permx-solo { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); cursor: pointer; }
.permx-btn {
  border: 1px solid var(--border); background: var(--surface-2, #f5f4f0); color: var(--text-2);
  border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer;
}
.permx-btn:hover { color: var(--blue); border-color: var(--blue); }
.permx-cols {
  display: grid; grid-template-columns: 1fr 80px 80px; gap: 12px;
  padding: 5px 12px; background: var(--surface-2, #f5f4f0); border-bottom: 1px solid var(--border);
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.permx-cols span:not(:first-child) { text-align: center; }
.permx-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; user-select: none;
  border-top: 1px solid var(--border);
}
.permx-head:hover { background: var(--surface-2, #f5f4f0); }
.permx-head:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.permx-head input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--blue); flex-shrink: 0; }
.permx-row input[type=checkbox] { accent-color: var(--blue); }
.permx-caret { width: 10px; color: var(--text-3); font-size: 11px; flex-shrink: 0; }
.permx-titulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.permx-head-mod {
  background: linear-gradient(180deg, var(--surface), var(--surface-2, #f5f4f0));
  font-weight: 700; font-size: 13px; color: var(--text-1); letter-spacing: .01em;
}
.permx-mod:first-child > .permx-head-mod { border-top: none; }
.permx-head-pag { padding-left: 26px; font-weight: 600; color: var(--text-1); }
.permx-head-sec { padding-left: 44px; font-weight: 500; font-size: 11px; color: var(--text-2); }
.permx-pag .perm-row { padding-left: 46px; }
.permx-sec .perm-row { padding-left: 64px; }
.permx-cnt {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  background: var(--surface-2, #f5f4f0); border: 1px solid var(--border); border-radius: 10px; padding: 0 6px;
}
.permx-dot { font-size: 10px; color: var(--amber); font-weight: 600; white-space: nowrap; }
.permx-tag {
  font-size: 9px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  color: var(--blue); border: 1px solid var(--blue-bd, var(--border)); border-radius: 4px; padding: 0 4px; margin-left: 4px;
}
.permx-sinacceso {
  font-size: 9px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  color: var(--text-3); border: 1px dashed var(--border); border-radius: 4px; padding: 0 4px;
}
.permx-row.permx-bloq .perm-row-name { opacity: .5; }
.permx-row.permx-bloq input[disabled] { cursor: not-allowed; }
.permx-vacio { padding: 14px; text-align: center; color: var(--text-3); }
@media (max-width: 560px) {
  .permx-cols, .permx-row { grid-template-columns: 1fr 56px 56px; gap: 6px; }
  .permx-pag .perm-row { padding-left: 30px; }
  .permx-sec .perm-row { padding-left: 40px; }
  .permx-head-pag { padding-left: 18px; }
  .permx-head-sec { padding-left: 28px; }
}

/* ============================================================
   HUB / LAUNCHER (pantalla Inicio — Fase 9, 2026-06)
   ============================================================ */
.hub-welcome { margin-bottom: 22px; }
.hub-title {
  font-size: 22px; font-weight: 700; color: var(--navy-text); margin: 0 0 4px;
}
.hub-sub { font-size: 13px; color: var(--text-3); margin: 0; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.hub-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px 16px 16px; min-height: 132px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--text-1);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.hub-card:hover {
  border-color: var(--navy);
  box-shadow: 0 4px 14px rgba(12, 68, 124, 0.12);
  transform: translateY(-2px);
}
.hub-card-icon {
  font-size: 30px; line-height: 1; color: var(--navy-text); margin-bottom: 4px;
}
.hub-card-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.hub-card-desc  {
  font-size: 12px; color: var(--text-3); line-height: 1.4;
  flex: 1;  /* empuja el indicador al fondo */
}
.hub-card-stat {
  margin-top: 6px; font-size: 11px; color: var(--blue);
  background: var(--blue-bg); padding: 2px 8px; border-radius: 20px;
}
.hub-card-stat b { font-weight: 700; }
/* (Puerta 2, UX/O5) «Sin datos» del chip del hub: atenuado y SIN rojo. No es
   una alarma —el modulo no esta mal, es que no se pudo leer el dato— y usar el
   color de error competiria con los tiles que si semaforizan. Antes esto era
   un hueco, indistinguible de «este modulo no tiene indicador». */
.hub-card-stat--sindatos {
  color: var(--text-2);
  background: var(--surface-2);
  font-style: italic;
}
/* Flecha "ir" arriba a la derecha; se realza al pasar el mouse */
.hub-card-go {
  position: absolute; top: 14px; right: 14px;
  font-size: 16px; color: var(--text-3); opacity: .45;
  transition: opacity var(--transition), transform var(--transition);
}
.hub-card:hover .hub-card-go {
  opacity: 1; color: var(--navy-text); transform: translateX(2px);
}
.hub-card:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 2px;
}
/* Secciones del hub (agrupadas como el menú lateral) */
.hub-section { margin-bottom: 26px; }
.hub-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
/* Chips de acción rápida dentro de la tarjeta */
.hub-card-actions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.hub-chip {
  font-family: inherit; font-size: 11px; font-weight: 500;
  color: var(--navy-text); background: var(--blue-bg, rgba(12,68,124,.08));
  border: 1px solid transparent; border-radius: 20px;
  padding: 3px 10px; cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.hub-chip:hover { background: var(--surface); border-color: var(--navy); }

/* (H2/C-UI-6) El sidebar colapsable de escritorio (#nav riel de iconos) se
   retiró junto con el sidebar persistente. La navegación primaria de
   bitacora.html es ahora el drawer off-canvas compartido (nav-lateral.js). */

/* ============================================================
   Accesibilidad transversal (Fase C auditoría) — global, todas las páginas
   ============================================================ */

/* 1) Foco visible por teclado en todo control interactivo.
   :focus-visible solo se activa con teclado, no con click de mouse, así que
   no ensucia la interacción táctil/mouse. Coexiste con el :focus de inputs. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
.sa-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* 2) Respeta "reducir movimiento" del SO: neutraliza animaciones/transiciones
   (pulse, spin, flash, fadeUp, shimmer…) en sesiones largas. */
/* El bloque de prefers-reduced-motion se movio a theme.css: lo cargan 33 de 37
   paginas contra 30 de esta hoja, e incluye cuadrillas.html (app de campo),
   que no carga components.css y quedaba SIN la proteccion. Auditoria 2026-07-25. */

/* 3) Objetivos táctiles >= 44px SOLO en pantallas táctiles (pointer: coarse),
   sin engordar el desktop (mouse). */
@media (pointer: coarse) {
  .sa-btn,
  .btn,
  .btn-sm,
  .btn-primary,
  .btn-ghost,
  .filter-select,
  .filter-search,
  .cat-tab,
  .omod-tab {
    min-height: 44px;
  }
}

/* ============================================================
   AVISO EN BARRA — condición que afecta a TODA la página.
   ------------------------------------------------------------
   Componente ÚNICO. El patrón estaba inventado tres veces en el
   proyecto (.topbar-email-alert en layout.css, .gprs-avisos-banner
   en gprs.css, .c200-banner-block en c200.css); migrar esas tres a
   este componente queda pendiente aparte.

   Dos severidades, y la diferencia NO es solo el color: cambia la
   FORMA del ícono (triángulo -> octágono, la misma escala que ya
   documenta c200.css), el grosor de la regla izquierda y el peso del
   título. Así se distingue en escala de grises, con daltonismo y en
   forced-colors, donde los fondos se pierden.

   El límite del bloque lo hace la REGLA IZQUIERDA, no el tinte: medido,
   --amber-bg contra --bg da 1.02:1 y --red-bg 1.07:1 — un tinte que no
   delimita nada. La regla mide 6.0-8.6:1.
   ============================================================ */
.aviso-barra {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: var(--r2, 8px);
  background: var(--surface);
}
.aviso-barra > i     { font-size: 20px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.aviso-barra-tx      { flex: 1; min-width: 0; }
.aviso-barra-t       { font-size: 13px; font-weight: 600; color: var(--text-1); }
.aviso-barra-s       { font-size: 12.5px; color: var(--text-2); margin: 2px 0 0; line-height: 1.45; }
.aviso-barra-acc     { flex-shrink: 0; align-self: center; display: flex; align-items: center; gap: 8px; }
.aviso-barra-resp    { font-size: 12px; color: var(--text-2); }
.aviso-barra-resp b  { color: var(--text-1); font-weight: 600; }

.aviso-barra--aviso  { background: var(--amber-bg); border-color: var(--amber-bd);
                       border-left-color: var(--amber); }
.aviso-barra--aviso > i,
.aviso-barra--aviso .aviso-barra-t { color: var(--amber); }

.aviso-barra--critico { background: var(--red-bg); border-color: var(--red-bd);
                        border-left-color: var(--red); border-left-width: 6px; }
.aviso-barra--critico > i            { font-size: 24px; color: var(--red); }
.aviso-barra--critico .aviso-barra-t { font-size: 14px; font-weight: 700; color: var(--red); }

/* Tercera severidad: INFORMATIVA. No es una alarma --nada esta mal-- sino un
   cambio de contexto que hay que explicar: por ejemplo «cambio el criterio del
   KPI, no se perdio trabajo». Sin ella, quien necesita decir eso se construye
   una barra a medida y vuelve a caer en el tinte-que-no-delimita que la
   cabecera de este componente ya tiene medido. Icono de circulo (no triangulo
   ni octagono): la forma sigue distinguiendo las tres en escala de grises.
   Regla izquierda en --blue: 9.84:1 en claro y 7.19:1 en oscuro. */
.aviso-barra--info  { background: var(--blue-bg); border-color: var(--blue-bd);
                      border-left-color: var(--blue); }
.aviso-barra--info > i,
.aviso-barra--info .aviso-barra-t { color: var(--blue); }

/* Tablet/campo: la acción baja a ancho completo y sube a 44 px. */
@media (max-width: 720px) {
  .aviso-barra { flex-wrap: wrap; }
  .aviso-barra-acc { width: 100%; }
  .aviso-barra-acc .btn { width: 100%; min-height: 44px; justify-content: center; }
}
/* (T1) La celda Código es el foco de la fila: un botón real que no se ve como botón. */
.inv-cod-btn { all: unset; cursor: pointer; display: inline; font: inherit; color: inherit;
  position: relative; scroll-margin-top: 88px; }
.inv-cod-btn::after { content: ""; position: absolute; inset: -6px -8px; }
.inv-cod-btn:focus-visible { outline: 2px solid var(--navy-text); outline-offset: -1px;
  border-radius: 3px; }

/* (T2) La tarjeta es un <button>: hay que devolverle la caja y el texto. */
.inv-card { display: block; width: 100%; text-align: left; font: inherit;
  color: inherit; cursor: pointer; white-space: normal;
  -webkit-appearance: none; appearance: none;
  -webkit-user-select: text; user-select: text; }
.inv-card:focus-visible { outline: 2px solid var(--navy-text); outline-offset: 2px; }

/* (T3) Barra de pestañas del modal de elemento. Va FUERA del panel. */
.ed-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--border);
  background: var(--surface); }
.ed-tabs button { font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-2);
  background: none; border: none; border-bottom: 2.5px solid transparent;
  padding: 12px 14px; cursor: pointer; }
.ed-tabs button:hover { color: var(--text-1); background: var(--surface-2); }
.ed-tabs button[aria-selected="true"] { color: var(--navy-text); border-bottom-color: var(--navy-text); }
.ed-tabs button:focus-visible { outline: 2px solid var(--navy-text); outline-offset: -2px; }
#ed-p-inv, #ed-p-com, #ed-p-edi { padding-top: 14px; }
#ed-p-inv:focus-visible, #ed-p-com:focus-visible, #ed-p-edi:focus-visible { outline: none; }

/* (T3) El scroll vive en .modal, asi que la barra de pestañas se iba con el
   contenido y quedaba bajo el encabezado sticky. Se acota al cuerpo. */
#modal-elem-detalle .modal { overflow: hidden; display: flex; flex-direction: column; }
#modal-elem-detalle .modal-body { overflow-y: auto; flex: 1; min-height: 0; }

/* (T4) El bloque que sustituye a los controles que un esclavo no puede tener. */
.ed-noaplica { grid-column: 1 / -1; margin-top: 14px; padding: 12px 14px;
  border: 1px solid var(--border-2); border-left: 3px solid var(--text-3);
  border-radius: var(--r); background: var(--surface-2); }
.ed-noaplica p { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 0 0 6px; }
.ed-noaplica p:last-child { margin-bottom: 0; }
.ed-noaplica-sub { font-size: 13px; color: var(--text-2); margin: 0 0 8px; }
.ed-noaplica-link { margin-top: 10px; }

/* (T5) Filtros de multiseleccion de la barra de Inventario. */
.inv-fx { position: relative; }
.inv-fx-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px;
  color: var(--text-1); background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); padding: 8px 12px; min-height: 38px; cursor: pointer; white-space: nowrap; }
.inv-fx-btn:hover { background: var(--surface-2); }
.inv-fx-btn:focus-visible { outline: 2px solid var(--navy-text); outline-offset: 2px; }
.inv-fx-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 230px;
  max-height: 320px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: 0 10px 28px rgba(0,0,0,.38); padding: 6px; }
.inv-fx-op { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-1);
  padding: 7px 8px; border-radius: 6px; cursor: pointer; min-height: 34px; }
.inv-fx-op:hover { background: var(--surface-2); }
.inv-fx-op input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy); }
.inv-fx-todos { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 12px;
  color: var(--text-2); background: none; border: none; border-top: 1px solid var(--border);
  padding: 8px; cursor: pointer; text-align: left; min-height: 34px; }
.inv-fx-todos:hover { background: var(--surface-2); color: var(--text-1); }
.inv-fx-nota { font-size: 12px; color: var(--text-2); align-self: center; }
@media (pointer: coarse) { .inv-fx-op, .inv-fx-todos { min-height: 44px; } .inv-fx-btn { min-height: 44px; } }

/* ── (T6) La carga troceada ─────────────────────────────────────────── */
.inv-rotulo { font-size: 12px; color: var(--text-2); margin: 0 0 10px 2px;
  min-height: 18px; display: flex; align-items: center; gap: 8px; }
.inv-rot-cargando { color: var(--text-3); }
.inv-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* El navegador ancla el scroll por su cuenta y la compensacion de
   _invEscribirSeccion se suma a la suya: medido, la tarjeta que el usuario leia
   saltaba 30 731 px fuera de pantalla, en Chromium Y en WebKit. La
   compensacion se queda —es la que sabe si la seccion esta sobre el viewport—
   y se apaga el anclaje del navegador. */
#inv-acordeones { overflow-anchor: none; }
/* La ranura del conteo mide lo mismo en los cuatro estados: si colapsara, la
   cabecera cambiaria de alto al aterrizar y todo lo de abajo se desplazaria. */
.inv-section-count { min-width: 2.2em; text-align: center; }
.inv-count-pill { display: inline-block; width: 1.8em; height: .85em;
  border-radius: 99px; background: var(--border, #ddd); opacity: .6;
  animation: inv-late 1.4s ease-in-out infinite; vertical-align: middle; }
.inv-count-na { color: var(--text-3); font-weight: 600; }
.inv-esqueleto { color: var(--text-3); font-style: normal; }
.inv-fallo { text-align: left; line-height: 1.55; }
.inv-fallo strong { display: block; margin-bottom: 4px; }
@keyframes inv-late { 0%,100% { opacity: .35 } 50% { opacity: .7 } }
@media (prefers-reduced-motion: reduce) { .inv-count-pill { animation: none } }

/* Estado de una fila de catálogo (usuarios). Misma forma que .cam-pill de
   Cámaras: mismo concepto, misma representación. Lleva TEXTO, no solo color. */
.est-pill { display:inline-block; padding:1px 8px; border-radius:999px; font-size:11px; font-weight:600; white-space:nowrap; }
.est-pill.est-ok   { background:var(--green-bg); color:var(--green); }
.est-pill.est-baja { background:var(--red-bg);   color:var(--red); }
.est-pill.est-aviso { background:var(--amber-bg); color:var(--amber); }

/* Fila dada de baja. La atenuación va por ROL TIPOGRÁFICO, no por `opacity`:
   medido, opacity .62 tiraba 7 elementos por debajo de AA y el alfa que sí
   cumple (.94) ya no se percibe. Banda izquierda + píldora + acción distinta. */
.u-baja > td             { color: var(--text-3); }
.u-baja > td .folio      { color: var(--text-2); }
.u-baja > td:first-child { box-shadow: inset 3px 0 0 var(--border-2); }

/* Texto de ayuda de un formulario. NO es una alerta: son instrucciones
   permanentes, y vestirlas de alerta enseña a ignorar las alertas de verdad
   (regla de C7). Mismo tamaño y tinta que la nota de zona del modal. */
.form-ayuda { font-size: 11px; color: var(--text-3); margin: 4px 0 10px; line-height: 1.45; }

/* «Avisos por correo» (AL4-E8) */
.avc-grupo { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; margin: 0 0 12px; }
.avc-grupo legend { padding: 0 4px; font-weight: 600; color: var(--text-1); }
.avc-op { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; }
.avc-op input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.avc-op b { display: block; font-weight: 600; color: var(--text-1); }
.avc-op small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.avc-nota { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.avc-aviso { font-size: 13px; color: var(--red); margin: 0 0 12px; }
.avc-msg { margin-right: auto; font-size: 13px; color: var(--text-2); }
@media (max-width: 600px), (pointer: coarse) {
  #modal-editar .modal-footer .btn, #modal-avisos-correo .modal-footer .btn, #avc-verificar { min-height: 44px; }
  #modal-editar .modal-close, #modal-avisos-correo .modal-close { min-width: 44px; min-height: 44px; }
}
