/* ================================================================
 * Internet Rural — panel del backoffice (layout map-first)
 * Mapa a pantalla completa con chrome flotante tipo glass.
 * ================================================================ */

:root {
  --ru-bg: #0B0D10;
  --ru-bg-2: #111418;
  --ru-panel: #191D23;
  --ru-border: rgba(255, 255, 255, 0.08);
  --ru-border-strong: rgba(255, 255, 255, 0.16);
  --ru-text: #F4F4F2;
  --ru-text-dim: rgba(244, 244, 242, 0.72);
  --ru-text-muted: rgba(244, 244, 242, 0.45);
  --ru-accent: #E4B900;
  --ru-accent-glow: rgba(228, 185, 0, 0.35);
  --ru-success: #3DD68C;
  --ru-warning: #FF9F1C;
  --ru-danger: #FF5C5C;
  --ru-info: #6FB1FF;
  --ru-aire: #6A9DE0;
  --ru-finetwork: #E4476B;
  --ru-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ru-shadow-lift: 0 18px 50px rgba(0, 0, 0, 0.5);
  --ru-glass: rgba(11, 13, 16, 0.62);
  --ru-glass-strong: rgba(11, 13, 16, 0.86);
}

/* ================================================================
 * Rural section: two layouts depending on active view
 *   - map view: full-bleed, escapes admin-main padding
 *   - admin views (installed / stock / manual): stay inside admin-main,
 *     use white bg matching the rest of the backoffice
 * ================================================================ */
.rural-section[data-rural-active="map"] {
  margin: -24px -32px -48px;
}
@media (max-width: 768px) {
  .rural-section[data-rural-active="map"] { margin: -16px; }
}

.rural-app {
  position: relative;
  height: calc(100vh - 56px);
  min-height: 640px;
  background: #05070A;
  overflow: hidden;
  isolation: isolate;
}
.rural-app[hidden] { display: none; }

/* ================================================================
 * Map canvas (full bleed inside .rural-app)
 * ================================================================ */
.rural-app__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.rural-app__map canvas { outline: none; }
.rural-app__map .maplibregl-ctrl-attrib {
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}
.rural-app__map .maplibregl-ctrl-attrib a { color: rgba(255, 255, 255, 0.85); }
.rural-app__map .maplibregl-ctrl-group {
  background: rgba(20, 22, 27, 0.92);
  border: 1px solid var(--ru-border);
  box-shadow: var(--ru-shadow-soft);
}
.rural-app__map .maplibregl-ctrl-group button {
  background: transparent;
  filter: invert(1) brightness(1.1);
}
.rural-app__map .maplibregl-ctrl-scale {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
}

/* ================================================================
 * Topbar (floating glass chrome)
 * ================================================================ */
.rural-app__topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--ru-glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--ru-border);
  border-radius: 14px;
  box-shadow: var(--ru-shadow-lift);
  color: var(--ru-text);
  pointer-events: auto;
}

.rural-nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ru-border);
  border-radius: 12px;
}
.rural-pill {
  background: transparent;
  border: none;
  color: var(--ru-text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rural-pill:hover { color: var(--ru-text); background: rgba(255, 255, 255, 0.05); }
.rural-pill.is-active {
  background: var(--ru-accent);
  color: #0B0D10;
  box-shadow: 0 2px 12px rgba(228, 185, 0, 0.32);
}

/* ================================================================
 * Bottombar (layer toggles + action buttons)
 * ================================================================ */
.rural-app__bottombar {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  background: var(--ru-glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--ru-border);
  border-radius: 14px;
  box-shadow: var(--ru-shadow-soft);
  pointer-events: auto;
}
.rural-layers {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.rural-layer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ru-text-dim);
  cursor: pointer;
  user-select: none;
}
.rural-layer input[type="checkbox"] {
  accent-color: var(--ru-accent);
  width: 16px; height: 16px;
}
.rural-layer:has(input:checked) { color: var(--ru-text); }

.rural-acts {
  display: flex;
  gap: 6px;
  align-items: center;
}
.rural-ghostbtn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ru-border);
  color: var(--ru-text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.rural-ghostbtn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--ru-border-strong);
}
.rural-ghostbtn:active { transform: translateY(1px); }
.rural-ghostbtn--accent {
  background: var(--ru-accent);
  color: #0B0D10;
  border-color: transparent;
}
.rural-ghostbtn--accent:hover {
  background: #f0c319;
  border-color: transparent;
}

/* ================================================================
 * Style switcher (right side of topbar, segmented control)
 * ================================================================ */
.rural-styleswitch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ru-border);
  border-radius: 10px;
  pointer-events: auto;
}
.rural-styleswitch__btn {
  background: transparent;
  border: 0;
  color: var(--ru-text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.rural-styleswitch__btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ru-text);
}
.rural-styleswitch__btn.is-active {
  background: var(--ru-accent);
  color: #0B0D10;
  box-shadow: 0 1px 6px rgba(228, 185, 0, 0.28);
}

/* ================================================================
 * Proximity cells badge (top-center, floating indicator)
 * ================================================================ */
.rural-cells-badge {
  position: absolute;
  top: auto;
  bottom: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--ru-glass-strong);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--ru-border);
  border-radius: 999px;
  color: var(--ru-text);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--ru-shadow-soft);
  pointer-events: none;
  animation: ruralBadgeIn .24s ease-out;
}
.rural-cells-badge strong {
  color: var(--ru-accent);
  font-weight: 700;
}
.rural-cells-badge__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ru-accent);
  box-shadow: 0 0 8px var(--ru-accent-glow);
}
@keyframes ruralBadgeIn {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ================================================================
 * Coverage prediction panel (bottom-right floating)
 * Aparece al escanear antenas: predice cobertura por operador host
 * (Movistar / Vodafone / Orange) basada en torres conocidas cercanas.
 * ================================================================ */
.rural-coverage {
  position: absolute;
  right: 12px;
  bottom: 82px;
  z-index: 11;
  width: 260px;
  padding: 12px 14px;
  background: var(--ru-glass-strong);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--ru-border);
  border-radius: 12px;
  color: var(--ru-text);
  font-size: 12.5px;
  box-shadow: var(--ru-shadow-soft);
  animation: ruralBadgeIn .24s ease-out;
}
.rural-coverage__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ru-muted, #8a8f99);
  margin: 0 0 8px 0;
}
.rural-coverage__row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.rural-coverage__row:first-of-type { border-top: 0; }
.rural-coverage__op {
  flex: 0 0 64px;
  font-weight: 600;
}
.rural-coverage__bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.rural-coverage__fill {
  height: 100%;
  border-radius: 3px;
  transition: width .24s ease;
}
.rural-coverage__fill--alta      { background: #19c37d; }
.rural-coverage__fill--media     { background: #e4b900; }
.rural-coverage__fill--baja      { background: #f0883e; }
.rural-coverage__fill--muy_baja  { background: #d44a4a; }
.rural-coverage__fill--sin_cobertura { background: #555; }
.rural-coverage__score {
  flex: 0 0 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rural-coverage__meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--ru-muted, #8a8f99);
  padding-left: 64px;
}
.rural-coverage__note {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  font-size: 10.5px;
  color: var(--ru-muted, #8a8f99);
  line-height: 1.4;
}

/* ================================================================
 * Unlinked devices alert (ACS-detected routers sin site asignado)
 * Pill flotante centrada debajo del topbar, clickable, color danger.
 * ================================================================ */
.rural-unlinked-banner {
  position: absolute;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  background: #24101A;
  border: 1.5px solid rgba(255, 92, 92, 0.75);
  border-radius: 10px;
  color: var(--ru-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 92, 92, 0.25), 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.rural-unlinked-banner:hover {
  background: #321624;
  border-color: rgba(255, 92, 92, 0.95);
  transform: translateX(-50%) translateY(-1px);
}
.rural-unlinked-banner__icon {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  color: var(--ru-danger);
}
.rural-unlinked-banner strong {
  color: var(--ru-danger);
  font-weight: 700;
}
.rural-unlinked-banner small {
  display: block;
  color: var(--ru-text-dim);
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
}

/* Installed table: subsección "Sin vincular" */
.rural-unlinked-section {
  margin-bottom: 24px;
  border: 1px solid rgba(255, 92, 92, 0.4);
  border-radius: 10px;
  overflow: hidden;
}
.rural-unlinked-section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 92, 92, 0.12);
  color: #8a2020;
  font-size: 13px;
  font-weight: 600;
}
.rural-unlinked-section__head .rural-unlinked-banner__icon {
  color: var(--ru-danger);
}

/* ================================================================
 * Probe marker (sonar / radar pulse) + right-click context menu
 * ================================================================ */
.rural-probe {
  position: relative;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.rural-probe__dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ru-accent);
  box-shadow: 0 0 12px var(--ru-accent-glow), 0 0 0 3px rgba(11, 13, 16, 0.85);
  transform: translate(-50%, -50%);
  z-index: 2;
}
.rural-probe__ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ru-accent);
  transform: translate(-50%, -50%) scale(0.25);
  opacity: 0.9;
  animation: ruralSonar 2.4s cubic-bezier(0, 0.55, 0.45, 1) infinite;
}
.rural-probe__ring--2 { animation-delay: 0.8s; }
.rural-probe__ring--3 { animation-delay: 1.6s; }
@keyframes ruralSonar {
  0%   { transform: translate(-50%, -50%) scale(0.25); opacity: 0.9; border-width: 2px; }
  70%  { opacity: 0.15; border-width: 1px; }
  100% { transform: translate(-50%, -50%) scale(6.5); opacity: 0; border-width: 1px; }
}

.rural-ctxmenu {
  position: fixed;
  z-index: 50;
  min-width: 220px;
  padding: 6px;
  background: var(--ru-glass-strong);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--ru-border);
  border-radius: 12px;
  box-shadow: var(--ru-shadow-lift);
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: auto;
}
.rural-ctxmenu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.rural-ctxmenu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ru-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.rural-ctxmenu__item:hover,
.rural-ctxmenu__item:focus-visible {
  background: rgba(228, 185, 0, 0.14);
  color: var(--ru-accent);
  outline: none;
}
.rural-ctxmenu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  color: var(--ru-text-dim);
}
.rural-ctxmenu__item:hover .rural-ctxmenu__icon,
.rural-ctxmenu__item:focus-visible .rural-ctxmenu__icon {
  color: var(--ru-accent);
}

/* ================================================================
 * Sidepanel (site/device detail, right drawer)
 * ================================================================ */
.rural-sidepanel {
  position: absolute;
  top: 76px;
  right: 16px;
  bottom: 74px;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--ru-glass-strong);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--ru-border);
  border-radius: 16px;
  box-shadow: var(--ru-shadow-lift);
  color: var(--ru-text);
  z-index: 13;
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.34s cubic-bezier(0.22, 0.81, 0.36, 1);
}
.rural-sidepanel[aria-hidden="false"] { transform: translateX(0); }
.rural-sidepanel__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ru-border);
  color: var(--ru-text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.rural-sidepanel__close:hover { background: rgba(255, 255, 255, 0.12); }
.rural-sidepanel__body {
  height: 100%;
  overflow-y: auto;
  padding: 20px 22px 22px;
}

.rural-sp-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
  padding-right: 32px;
}
.rural-sp-subtitle {
  font-size: 13px;
  color: var(--ru-text-dim);
  margin: 0 0 14px;
}
.rural-sp-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.rural-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ru-text);
  border: 1px solid var(--ru-border);
}
.rural-chip--success { background: rgba(61, 214, 140, 0.16); color: var(--ru-success); border-color: transparent; }
.rural-chip--warn { background: rgba(255, 159, 28, 0.16); color: var(--ru-warning); border-color: transparent; }
.rural-chip--danger { background: rgba(255, 92, 92, 0.18); color: var(--ru-danger); border-color: transparent; }
.rural-chip--info { background: rgba(111, 177, 255, 0.16); color: var(--ru-info); border-color: transparent; }
.rural-chip--aire { background: rgba(106, 157, 224, 0.22); color: var(--ru-aire); border-color: transparent; }
.rural-chip--finetwork { background: rgba(228, 71, 107, 0.22); color: var(--ru-finetwork); border-color: transparent; }
.rural-chip--accent { background: rgba(228, 185, 0, 0.2); color: var(--ru-accent); border-color: transparent; }

.rural-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.rural-kv dt {
  color: var(--ru-text-muted);
  font-weight: 600;
}
.rural-kv dd {
  margin: 0;
  color: var(--ru-text);
  word-break: break-word;
}

.rural-sp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.rural-sp-actions .btn {
  flex: 1;
  min-width: 120px;
}

.rural-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.rural-device-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ru-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.rural-device-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ru-border-strong);
}
.rural-device-row__icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: rgba(228, 185, 0, 0.12);
  color: var(--ru-accent);
  border-radius: 8px;
  font-size: 16px;
}
.rural-device-row__name {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}
.rural-device-row__meta {
  font-size: 11.5px;
  color: var(--ru-text-muted);
}

/* Signal bars */
.rural-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.rural-signal span {
  width: 3px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 1px;
}
.rural-signal span:nth-child(1) { height: 4px; }
.rural-signal span:nth-child(2) { height: 7px; }
.rural-signal span:nth-child(3) { height: 10px; }
.rural-signal span:nth-child(4) { height: 13px; }
.rural-signal.is-1 span:nth-child(-n+1),
.rural-signal.is-2 span:nth-child(-n+2),
.rural-signal.is-3 span:nth-child(-n+3),
.rural-signal.is-4 span:nth-child(-n+4) { background: var(--ru-success); }
.rural-signal.is-weak span:nth-child(-n+1) { background: var(--ru-warning); }
.rural-signal.is-bad span:nth-child(-n+1) { background: var(--ru-danger); }

/* ================================================================
 * Admin-style rural views (Installed / Stock / Manual)
 * Light background matching the rest of the backoffice. Persistent
 * slim topbar with nav pills so the user can return to the map.
 * ================================================================ */
.rural-admin[hidden] { display: none; }
.rural-admin {
  display: flex;
  flex-direction: column;
}
.rural-admin__topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 16px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
}
.rural-admin__nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 10px;
}
.rural-tab {
  background: transparent;
  border: none;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rural-tab:hover { color: #0B0D10; background: rgba(0, 0, 0, 0.04); }
.rural-tab.is-active {
  background: #E4B900;
  color: #0B0D10;
  box-shadow: 0 1px 4px rgba(228, 185, 0, 0.32);
}
.rural-admin__body {
  flex: 1;
  min-height: 0;
}

/* ================================================================
 * Stock legend (color key above table)
 * ================================================================ */
.rural-stock-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 14px;
  font-size: 12px;
  color: #6b7280;
}
.rural-stock-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rural-stock-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rural-stock-dot--ok { background: #16a34a; }
.rural-stock-dot--low { background: #f59e0b; }
.rural-stock-dot--out { background: #dc2626; }
.rural-stock-dot--ondemand { background: #9ca3af; }

/* Stock row color coding (left border indicator) */
.rural-stock-row--ok td:first-child { box-shadow: inset 4px 0 0 #16a34a; }
.rural-stock-row--low td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.rural-stock-row--out td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.rural-stock-row--ondemand td:first-child { box-shadow: inset 4px 0 0 #9ca3af; }
.rural-stock-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
}
.rural-stock-count--ok { background: #dcfce7; color: #166534; }
.rural-stock-count--low { background: #fef3c7; color: #92400e; }
.rural-stock-count--out { background: #fee2e2; color: #991b1b; }
.rural-stock-count--ondemand { background: #f3f4f6; color: #4b5563; }

/* ================================================================
 * Map markers
 * ================================================================ */
.rural-marker {
  position: relative;
  width: 30px;
  height: 38px;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: transform .15s ease;
}
.rural-marker:hover { transform: translateY(-2px) scale(1.08); }
.rural-marker__pin {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 28px;
  height: 34px;
  background: var(--ru-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 34'><path d='M14 0C6.3 0 0 6.3 0 14c0 10.5 14 20 14 20s14-9.5 14-20C28 6.3 21.7 0 14 0z'/></svg>") no-repeat center/contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 34'><path d='M14 0C6.3 0 0 6.3 0 14c0 10.5 14 20 14 20s14-9.5 14-20C28 6.3 21.7 0 14 0z'/></svg>") no-repeat center/contain;
}
.rural-marker__icon {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: #0B0D10;
  border-radius: 50%;
  font-size: 11px;
  color: var(--ru-accent);
  font-weight: 700;
  line-height: 1;
}
/* Site markers: sin icono, coloreados por salud de dispositivos */
.rural-marker--site .rural-marker__pin { background: var(--ru-text-muted); }
.rural-marker--health-ok .rural-marker__pin { background: var(--ru-success); }
.rural-marker--health-warn .rural-marker__pin { background: var(--ru-warning); }
.rural-marker--health-bad .rural-marker__pin { background: var(--ru-danger); }
.rural-marker--health-neutral .rural-marker__pin { background: var(--ru-text-muted); }

/* Puntitos encima del pin: uno por dispositivo del site */
.rural-marker__dots {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  padding: 3px 5px;
  background: rgba(11, 13, 16, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.rural-marker__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ru-text-muted);
  flex: 0 0 auto;
}
.rural-marker__dot--ok { background: var(--ru-success); }
.rural-marker__dot--warn { background: var(--ru-warning); }
.rural-marker__dot--bad { background: var(--ru-danger); }

/* Etiqueta sobre el pin del site: alias + senal/Mbps del peor dispositivo */
.rural-marker__label {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: rgba(11, 13, 16, 0.88);
  border: 1px solid var(--ru-border);
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  text-align: center;
  line-height: 1.15;
}
.rural-marker__label-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ru-text);
  letter-spacing: 0.1px;
}
.rural-marker__label-sub {
  font-size: 10.5px;
  color: var(--ru-text-dim);
  margin-top: 1px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.rural-marker__label--ok { border-color: rgba(61, 214, 140, 0.55); }
.rural-marker__label--warn { border-color: rgba(255, 159, 28, 0.55); }
.rural-marker__label--bad { border-color: rgba(255, 92, 92, 0.60); }
.rural-marker--site .rural-marker__dots { bottom: 90px; }

.rural-marker--cell {
  width: 18px;
  height: 18px;
}
.rural-marker--cell .rural-marker__pin {
  width: 14px;
  height: 14px;
  bottom: 2px;
  border-radius: 50%;
  mask: none; -webkit-mask: none;
  background: var(--ru-aire);
  box-shadow: 0 0 0 3px rgba(106, 157, 224, 0.2);
}
.rural-marker--cell[data-mnc="06"] .rural-marker__pin,
.rural-marker--cell[data-mnc="07"] .rural-marker__pin {
  background: var(--ru-finetwork);
  box-shadow: 0 0 0 3px rgba(228, 71, 107, 0.2);
}

/* ================================================================
 * Markers de cobertura del device
 *   --cov-connected-exact  verde  (conectado, posicion exacta)
 *   --cov-connected-approx naranja (conectado, posicion inferida)
 *   --cov-nearest          azul   (mejor torre cercana del SIM)
 *   --cov-optimal          verde  (coincide conectado == mejor)
 * ================================================================ */
.rural-marker--cov {
  width: 0;
  height: 0;
  position: relative;
}
.rural-marker__cov-pin {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
}
.rural-marker--cov-connected-exact .rural-marker__cov-pin,
.rural-marker--cov-optimal .rural-marker__cov-pin {
  background: #0CA678;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 4px rgba(12, 166, 120, 0.22);
}
.rural-marker--cov-connected-approx .rural-marker__cov-pin {
  background: #F08C00;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 4px rgba(240, 140, 0, 0.22);
}
.rural-marker--cov-nearest .rural-marker__cov-pin {
  background: #1971C2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 4px rgba(25, 113, 194, 0.22);
}
.rural-marker__cov-label {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 18, 22, 0.92);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.15);
}
.rural-marker--cov-connected-exact .rural-marker__cov-label,
.rural-marker--cov-optimal .rural-marker__cov-label {
  border-color: rgba(12, 166, 120, 0.6);
}
.rural-marker--cov-connected-approx .rural-marker__cov-label {
  border-color: rgba(240, 140, 0, 0.6);
}
.rural-marker--cov-nearest .rural-marker__cov-label {
  border-color: rgba(25, 113, 194, 0.6);
}
.rural-marker__cov-tag {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}
.rural-marker__cov-title { font-weight: 600; }
.rural-marker__cov-sub { opacity: 0.75; font-family: monospace; font-size: 10px; }

/* ================================================================
 * Bloque "Cobertura" en el panel de dispositivo
 * ================================================================ */
.rural-cov {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rural-cov__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--ru-border);
}
.rural-cov__row--connected-exact,
.rural-cov__row--optimal {
  border-left: 3px solid #0CA678;
}
.rural-cov__row--connected-approx {
  border-left: 3px solid #F08C00;
}
.rural-cov__row--nearest {
  border-left: 3px solid #1971C2;
}
.rural-cov__row--miss {
  border-left: 3px solid #868E96;
  opacity: 0.8;
}
.rural-cov__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.rural-cov__dot--connected-exact,
.rural-cov__dot--optimal { background: #0CA678; }
.rural-cov__dot--connected-approx { background: #F08C00; }
.rural-cov__dot--nearest { background: #1971C2; }
.rural-cov__dot--miss { background: #868E96; }
.rural-cov__body { flex: 1; min-width: 0; }
.rural-cov__tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--ru-text-dim);
  margin-bottom: 2px;
}
.rural-cov__title {
  font-weight: 600;
  font-size: 13px;
}
.rural-cov__meta {
  font-family: monospace;
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rural-cov__verdict {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 2px;
  line-height: 1.4;
}
.rural-cov__verdict--ok {
  background: rgba(12, 166, 120, 0.12);
  border: 1px solid rgba(12, 166, 120, 0.35);
  color: #3ac296;
}
.rural-cov__verdict--warn {
  background: rgba(240, 140, 0, 0.12);
  border: 1px solid rgba(240, 140, 0, 0.35);
  color: #f0ad4e;
}
.rural-cov__verdict--info {
  background: rgba(25, 113, 194, 0.12);
  border: 1px solid rgba(25, 113, 194, 0.35);
  color: #4ea1db;
}

/* ================================================================
 * Form styles inside sidepanel
 * ================================================================ */
.rural-sidepanel .form .field { margin-bottom: 12px; }
.rural-sidepanel .label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ru-text-muted);
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}
.rural-sidepanel .input,
.rural-sidepanel .select,
.rural-sidepanel .textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ru-border);
  color: var(--ru-text);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
  box-sizing: border-box;
}
.rural-sidepanel .input:focus,
.rural-sidepanel .select:focus,
.rural-sidepanel .textarea:focus {
  outline: none;
  border-color: var(--ru-accent);
  box-shadow: 0 0 0 3px rgba(228, 185, 0, 0.15);
}

/* ================================================================
 * Empty state
 * ================================================================ */
.rural-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--ru-text-muted);
  font-size: 13px;
  text-align: center;
}

/* ================================================================
 * Intro curtain (fade-out over map while we flyTo Villena)
 * ================================================================ */
.rural-app.is-intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(5, 7, 10, 0.9) 80%);
  pointer-events: none;
  z-index: 11;
  animation: ruralFadeOut 2.8s ease-out forwards;
}
@keyframes ruralFadeOut {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ================================================================
 * Manual viewer (admin view, light background)
 * ================================================================ */
.rural-admin--manual .rural-admin__body.rural-manual {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  min-height: calc(100vh - 220px);
}
.rural-manual__nav {
  border-right: 1px solid #e5e7eb;
  padding: 16px 14px;
  overflow: auto;
  background: #f9fafb;
}
.rural-manual__nav strong {
  display: block;
  margin: 14px 0 6px;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  color: #6b7280;
  font-weight: 700;
}
.rural-manual__dir:first-child > strong { margin-top: 0; }
.rural-manual__dirlabel {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 6px 4px;
  margin-top: 8px;
  color: #6b7280;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}
.rural-manual__dirlabel:hover { color: #1f2937; }
.rural-manual__chev {
  display: inline-block;
  transition: transform .15s ease;
  font-size: 10px;
  color: #9ca3af;
  width: 10px;
}
.rural-manual__dir.is-open > .rural-manual__dirlabel .rural-manual__chev { transform: rotate(90deg); }
.rural-manual__dirbody { display: none; }
.rural-manual__dir.is-open > .rural-manual__dirbody { display: block; }
.rural-manual__link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: #1f2937;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
  transition: background .15s ease;
}
.rural-manual__link:hover { background: rgba(228, 185, 0, 0.12); }
.rural-manual__link.is-active {
  background: rgba(228, 185, 0, 0.22);
  color: #8a6d00;
  font-weight: 600;
}
.rural-manual__doc {
  overflow: auto;
  padding: 24px 32px 48px;
  line-height: 1.7;
  color: #1f2937;
  background: #fff;
}
.rural-manual__head { margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb; }
.rural-manual__head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #0B0D10;
}
.rural-manual__html h1 { font-size: 24px; margin: 28px 0 10px; color: #0B0D10; }
.rural-manual__html h2 { font-size: 19px; margin: 24px 0 8px; color: #0B0D10; }
.rural-manual__html h3 { font-size: 16px; margin: 18px 0 6px; color: #0B0D10; }
.rural-manual__html p { margin: 10px 0; }
.rural-manual__html ul, .rural-manual__html ol { padding-left: 22px; margin: 10px 0; }
.rural-manual__html li { margin: 4px 0; }
.rural-manual__html code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #b91c1c;
}
.rural-manual__html pre {
  background: #f9fafb;
  padding: 12px 14px;
  border-radius: 8px;
  overflow: auto;
  font-size: 12.5px;
  border: 1px solid #e5e7eb;
}
.rural-manual__html pre code { background: transparent; padding: 0; color: #1f2937; }
.rural-manual__html table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.rural-manual__html th, .rural-manual__html td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  text-align: left;
}
.rural-manual__html th { background: #f9fafb; font-weight: 700; }
.rural-manual__html blockquote {
  border-left: 3px solid #E4B900;
  padding: 6px 14px;
  margin: 12px 0;
  background: #fffbeb;
  color: #4b5563;
}
.rural-manual__html a { color: #b45309; }
.rural-manual__html hr { border: 0; border-top: 1px solid #e5e7eb; margin: 22px 0; }

@media (max-width: 900px) {
  .rural-admin--manual .rural-admin__body.rural-manual {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .rural-manual__nav { border-right: 0; border-bottom: 1px solid #e5e7eb; max-height: 180px; }
}

/* ================================================================
 * Responsive
 * ================================================================ */
@media (max-width: 900px) {
  .rural-app { height: calc(100vh - 56px); min-height: 520px; }
  .rural-app__topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }
  .rural-nav { flex: 1 1 auto; justify-content: center; }
  .rural-styleswitch { flex: 0 0 auto; }
  .rural-app__bottombar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .rural-sidepanel {
    width: calc(100vw - 32px);
    top: auto;
    right: 16px;
    left: 16px;
    bottom: 90px;
    height: 60vh;
  }
  .rural-drawer { left: 8px; right: 8px; bottom: 8px; }
  .rural-cells-badge { top: auto; bottom: 180px; font-size: 11.5px; }
}

/* ============================================================
   Combobox (site form: buscador de cliente) — dark theme
   ============================================================ */
.rural-combobox {
  position: relative;
}
.rural-combobox__input {
  width: 100%;
  padding-right: 32px;
}
.rural-combobox__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ru-text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.rural-combobox__clear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ru-danger);
}
.rural-combobox__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: #14181E;
  border: 1px solid var(--ru-border-strong);
  border-radius: 10px;
  box-shadow: var(--ru-shadow-lift);
  z-index: 50;
}
.rural-combobox__item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--ru-border);
  font-size: 13.5px;
  color: var(--ru-text);
  transition: background .12s ease;
}
.rural-combobox__item:last-child {
  border-bottom: none;
}
.rural-combobox__item:hover {
  background: rgba(228, 185, 0, 0.12);
}
.rural-combobox__sub {
  color: var(--ru-text-dim);
  font-size: 11.5px;
  margin-top: 3px;
  letter-spacing: 0.1px;
}
.rural-combobox__empty {
  padding: 12px;
  color: var(--ru-text-dim);
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   Sidepanel action rows (compactas, jerarquicas)
   ============================================================ */
.rural-actions--primary {
  margin-top: 14px;
}
.rural-btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
}
.rural-actions--secondary {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.rural-btn-secondary {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ru-border);
  color: var(--ru-text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.rural-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--ru-border-strong);
}
.rural-btn-secondary--warning {
  background: rgba(255, 159, 28, 0.14);
  border-color: rgba(255, 159, 28, 0.40);
  color: var(--ru-warning);
}
.rural-btn-secondary--warning:hover {
  background: rgba(255, 159, 28, 0.22);
  border-color: rgba(255, 159, 28, 0.60);
}
.rural-btn-secondary--danger {
  background: rgba(255, 92, 92, 0.12);
  border-color: rgba(255, 92, 92, 0.35);
  color: var(--ru-danger);
}
.rural-btn-secondary--danger:hover {
  background: rgba(255, 92, 92, 0.20);
  border-color: rgba(255, 92, 92, 0.55);
}

/* Tarjetas de dispositivo dentro del panel de site */
.rural-devcards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.rural-devcard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ru-border);
  border-radius: 10px;
  color: var(--ru-text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.rural-devcard:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ru-border-strong);
}
.rural-devcard:active { transform: scale(0.99); }
.rural-devcard__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.rural-devcard__name {
  font-weight: 600;
  font-size: 13.5px;
}
.rural-devcard__meta {
  font-size: 12px;
  color: var(--ru-text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.rural-devcard__metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ru-text-dim);
}
.rural-signal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ru-text-muted);
}
.rural-signal-dot--ok { background: var(--ru-success); }
.rural-signal-dot--warn { background: var(--ru-warning); }
.rural-signal-dot--bad { background: var(--ru-danger); }

.rural-actions--danger {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--ru-border);
  text-align: right;
}
.rural-btn-link-danger {
  background: transparent;
  border: none;
  color: var(--ru-text-muted);
  font-size: 11.5px;
  cursor: pointer;
  padding: 4px 6px;
  letter-spacing: 0.2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rural-btn-link-danger:hover {
  color: var(--ru-danger);
}
