/* Sistema NetPlus — estilos compartidos */
:root {
  --purple: #5a2696;
  --navy: #17204b;
  --cyan: #08b8df;
  --ink: #172033;
  --muted: #6c7484;
  --bg: #f3f5fa;
  --line: #e4e7ef;
  --green: #16a66a;
  --orange: #f59e0b;
  --red: #b52b43;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
p { margin: 0; color: var(--muted); }
h1 { font-size: 25px; line-height: 1.1; margin: 4px 0 2px; }
h2 { font-size: 20px; margin: 3px 0; }
h3 { margin: 22px 0 8px; }
a { color: var(--purple); }
.hidden { display: none !important; }
.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; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--purple); }
.error { color: #a91f38 !important; }

/* ── Barra superior y menú ── */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  height: 68px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border-bottom: 1px solid #e7e9f1;
}
.brand-logo { display: block; width: 160px; height: 58px; object-fit: contain; }
.site-navigation { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.current-section { font-size: 15px; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; cursor: pointer;
  border: 1px solid #dce0ea; border-radius: 10px; background: #f3f4f9; color: var(--navy);
  padding: 10px 12px; font: 700 16px/1.2 var(--font);
}
.menu-toggle span:first-child { font-size: 21px; line-height: 1; }
.site-menu {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 1100;
  width: 270px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 100px); overflow: auto;
  padding: 12px; background: #fff; border: 1px solid #dce0ea; border-radius: 14px; box-shadow: 0 16px 44px #17203930;
}
.menu-user { padding: 6px 10px 10px; border-bottom: 1px solid #e7e9f1; margin-bottom: 4px; }
.menu-user strong { display: block; color: var(--navy); }
.menu-user small { color: var(--muted); }
.menu-group { font-size: 13px; font-weight: 700; color: #647087; margin: 12px 10px 6px; }
.site-menu-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-radius: 8px; background: transparent; color: #172039; text-decoration: none;
  font: 16px/1.4 var(--font); padding: 12px;
}
.site-menu-item:hover { background: #f1eef7; }
.site-menu-item.active { background: linear-gradient(135deg, var(--purple), var(--navy)); color: #fff; font-weight: 700; }
.site-menu-item.logout { color: var(--red); }
.menu-toggle:focus-visible, .site-menu-item:focus-visible { outline: 3px solid #8755cb; outline-offset: 2px; }

/* ── Estructura ── */
main { max-width: 760px; margin: auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
.section-head, .form-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-head { margin-bottom: 12px; }
.count { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 800; display: grid; place-items: center; }
.message { text-align: center; font-size: 13px; line-height: 1.45; padding: 10px 12px 0; }
.empty-state { background: #fff; border: 1px dashed #cfd4e2; border-radius: 16px; padding: 22px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; }

/* ── Botones y formularios ── */
.primary {
  display: block; width: 100%; text-align: center; text-decoration: none; cursor: pointer;
  border: 0; border-radius: 15px; background: linear-gradient(135deg, var(--purple), var(--navy)); color: #fff;
  font: 800 16px var(--font); padding: 16px; margin-top: 12px; box-shadow: 0 8px 20px #32146f32;
}
.primary:active { transform: translateY(1px); }
.primary:disabled, .secondary:disabled { opacity: .6; }
.secondary {
  width: 100%; cursor: pointer; border: 1px solid #dce0ea; border-radius: 15px; background: #eef0f6; color: var(--navy);
  font: 800 16px var(--font); padding: 14px; margin-top: 12px;
}
.mini-btn { border: 0; border-radius: 10px; background: #ece7f5; color: var(--purple); font: 800 14px var(--font); padding: 9px 12px; cursor: pointer; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 17px; margin-bottom: 14px; }
.form-card form { margin-top: 12px; }
.form-card label, .field { display: block; color: #41495a; font-size: 14px; font-weight: 700; margin-top: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; border: 1px solid #d8dce6; background: #fafbfe; border-radius: 12px;
  padding: 13px; font: 16px var(--font); color: var(--ink); outline: none;
}
textarea { min-height: 85px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px #5a269618; }
.coord-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-message { text-align: center; font-size: 14px; margin-top: 10px; min-height: 20px; color: var(--green); }
summary { font-size: 18px; font-weight: 700; cursor: pointer; color: var(--navy); }
.hint { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 6px; }

/* ── Alineador ── */
.tower-card { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tower-select { display: block; max-width: 280px; border: 0; background: transparent; color: var(--ink); font: 800 24px/1.1 var(--font); margin: 3px 0 1px; padding: 0 24px 0 0; box-shadow: none; }
.tower-icon { width: 45px; height: 45px; border-radius: 14px; background: linear-gradient(135deg, var(--purple), var(--navy)); display: grid; place-items: center; color: #fff; font-size: 28px; flex: none; }
#map { height: 34vh; min-height: 260px; max-height: 390px; background: #dfe4ee; border-radius: 20px; overflow: hidden; box-shadow: 0 8px 24px #26305618; }
.leaflet-control-attribution { font-size: 10px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.metrics.three { grid-template-columns: repeat(3, 1fr); }
.metrics article { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 12px 6px; text-align: center; min-width: 0; }
.metrics span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.metrics strong { font-size: 19px; color: var(--navy); white-space: nowrap; }
.aim-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: center; }
.compass { width: 128px; height: 128px; border: 8px solid #edf0f6; border-radius: 50%; position: relative; background: radial-gradient(circle, #fff 0 53%, #f5f7fb 54%); }
.compass > span { position: absolute; font-size: 11px; font-weight: 800; color: #7c8491; }
.north { top: 3px; left: 50%; transform: translateX(-50%); color: var(--purple) !important; }
.south { bottom: 3px; left: 50%; transform: translateX(-50%); }
.east { right: 5px; top: 50%; transform: translateY(-50%); }
.west { left: 5px; top: 50%; transform: translateY(-50%); }
.target-arrow { position: absolute; inset: 13px; transition: transform .2s ease; }
.target-arrow::before { content: ""; position: absolute; left: 50%; top: 1px; transform: translateX(-50%); border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 45px solid var(--cyan); filter: drop-shadow(0 3px 3px #0892b65c); }
.target-arrow i { position: absolute; left: 50%; bottom: 1px; transform: translateX(-50%); border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 36px solid #dce0e9; }
.compass.aligned { border-color: #c9f0dc; }
.compass.aligned .target-arrow::before { border-bottom-color: var(--green); }
.center-dot { width: 15px; height: 15px; border-radius: 50%; background: var(--navy); position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 4px #fff; }
.instruction { display: flex; align-items: flex-start; gap: 10px; }
.instruction strong { font-size: 18px; display: block; line-height: 1.25; }
.instruction small { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 4px; }
.status-dot { width: 11px; height: 11px; flex: none; border-radius: 50%; background: var(--orange); margin-top: 6px; box-shadow: 0 0 0 5px #f59e0b1e; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 5px #16a66a22; }
.sensor-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; font-weight: 700; color: var(--navy); background: #eef0f6; border-radius: 999px; padding: 5px 9px; }
.chip.warn { color: #8a4b00; background: #fff4df; }
.inline-setting { display: flex; align-items: center; gap: 10px; margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 10px 14px; }
.inline-setting label { flex: 1; font-size: 14px; font-weight: 700; color: #41495a; }
.inline-setting input { width: 92px; margin: 0; padding: 10px; text-align: center; }

/* ── Listas de torres y enlaces ── */
.tower-list { display: grid; gap: 9px; margin-bottom: 16px; }
.tower-row { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; }
.pin { width: 36px; height: 36px; border-radius: 11px; background: #ece7f5; color: var(--purple); display: grid; place-items: center; font-size: 19px; flex: none; }
.tower-info { min-width: 0; flex: 1; }
.tower-info strong { display: block; font-size: 16px; }
.tower-info span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 5px; }
.row-btn { border: 0; background: #f0f2f7; color: var(--navy); border-radius: 9px; padding: 9px 10px; font: 700 14px var(--font); cursor: pointer; }
.row-btn.delete { color: var(--red); background: #fff0f2; }
.link-row { border-left: 4px solid var(--cyan); }
.point-b-head { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e6e8ef; }
.point-b-head strong { font-size: 18px; }

/* ── Enlaces y perfil ── */
#linkMap { height: 300px; border-radius: 20px; overflow: hidden; background: #dfe4ee; }
.fresnel-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: linear-gradient(135deg, #17204b, #31206a); color: #fff; border-radius: 17px; padding: 15px; margin: 0 0 12px; }
.fresnel-card div { background: #ffffff12; border: 1px solid #ffffff1c; border-radius: 12px; padding: 11px; }
.fresnel-card span { display: block; font-size: 12px; color: #cdd6ef; margin-bottom: 4px; }
.fresnel-card strong { font-size: 21px; }
.fresnel-card p { grid-column: 1 / -1; color: #d8dcef; font-size: 12px; line-height: 1.4; margin: 2px 3px 0; }
.profile-card { background: #fff; border: 1px solid #e1e5ee; border-radius: 20px; padding: 15px; margin-bottom: 12px; }
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.profile-status { font-size: 12px; font-weight: 800; color: var(--purple); background: #eee8f7; border-radius: 999px; padding: 7px 9px; white-space: nowrap; }
.profile-status.error { color: #a32d42; background: #fff0f2; }
.profile-legend { display: flex; flex-wrap: wrap; gap: 11px; margin: 13px 0 8px; color: var(--muted); font-size: 12px; }
.profile-legend span { display: flex; align-items: center; gap: 5px; }
.profile-legend i { width: 17px; height: 4px; border-radius: 4px; display: inline-block; }
.terrain-key { background: #66745f; } .los-key { background: #08b8df; } .fresnel-key { background: #7b2cbf; }
.profile-wrap { position: relative; background: linear-gradient(#151824, #0e1220); border-radius: 15px; overflow: hidden; touch-action: none; }
.profile-wrap svg { display: block; width: 100%; height: auto; }
.profile-cursor { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; box-shadow: 0 0 0 1px #17204b66; }
.profile-help { text-align: center; font-size: 12px; margin: 9px 0; color: var(--muted); }
.terrain-point { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid #e6e9f0; padding-top: 11px; }
.terrain-point div { background: #f5f7fb; border-radius: 11px; padding: 9px; }
.terrain-point span { display: block; font-size: 11px; color: var(--muted); }
.terrain-point strong { display: block; font-size: 14px; margin-top: 2px; }
.maps-button { grid-column: 1 / -1; text-align: center; text-decoration: none; border-radius: 12px; background: #edf1f7; color: var(--navy); font-weight: 800; padding: 12px; }
.profile-grid { stroke: #ffffff18; stroke-width: 1; }
.profile-axis { fill: #aeb7c9; font-size: 11px; }
.profile-terrain { fill: #82917b; stroke: #aab8a2; stroke-width: 2; }
.profile-fresnel { fill: #7b2cbf35; stroke: #a24fe0; stroke-width: 2; }
.profile-los { fill: none; stroke: #16c6ed; stroke-width: 3; }
.profile-point { fill: #fff; stroke: #5a2696; stroke-width: 4; }
.align-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.align-actions .secondary { margin-top: 0; }

/* ── Operación técnica ── */
.ops { max-width: 1100px; }
.toolbar { display: flex; gap: 12px; margin: 16px 0; }
.toolbar input { flex: 1; min-width: 0; margin: 0; }
.toolbar select { max-width: 220px; margin: 0; }
.work-card { background: #fff; border: 1px solid #dfe3ed; border-radius: 14px; padding: 18px; margin: 12px 0; }
.work-card h2 { font-size: 1.12rem; margin: 0 0 8px; }
.work-card p { margin: 6px 0; overflow-wrap: anywhere; }
.work-card .secondary { width: auto; padding: 11px 16px; margin-top: 10px; }
.work-card.inactive { opacity: .6; }
.badge { display: inline-block; padding: 5px 10px; background: #eef0fa; color: #32146f; border-radius: 6px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.badge.s-asignada { background: #eef0fa; } .badge.s-en-curso { background: #e3f6fc; color: #075c70; }
.badge.s-pendiente-de-revision { background: #fff4df; color: #8a4b00; }
.badge.s-requiere-correccion { background: #fff0f2; color: #a32d42; } .badge.s-completada { background: #e3f6ec; color: #0f6b44; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .primary, .actions .secondary { width: auto; flex: 1; margin-top: 0; }
dialog { width: min(760px, 94vw); max-height: 92dvh; overflow: auto; border: 0; border-radius: 16px; padding: 22px; color: #172039; }
dialog::backdrop { background: #09142d99; }
.close { float: right; padding: 10px 12px; background: #eef0f8; border: 0; border-radius: 8px; font: 16px var(--font); cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.photo-grid img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; }
.report-data { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.report-data div { padding: 10px; background: #f4f5fa; border-radius: 8px; overflow-wrap: anywhere; }
.report-data small { display: block; font-size: 13px; color: #586176; }
.protected { white-space: pre-wrap; overflow-wrap: anywhere; background: #eef0f8; padding: 12px; border-radius: 8px; margin-top: 8px; }
.empty { padding: 35px 20px; color: #566078; text-align: center; }
.ops #message { white-space: pre-wrap; min-height: 1.2em; }

/* ── Login ── */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 26px 22px; box-shadow: 0 18px 40px #17204b14; }
.login-card .brand-logo { margin: 0 auto 10px; width: 210px; height: 76px; }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card > p { text-align: center; margin-bottom: 8px; }

@media (max-width: 600px) {
  .toolbar { flex-direction: column; }
  .toolbar select { max-width: none; }
  .report-data { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .ops { padding: 14px; }
  dialog { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics.three { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 430px) {
  main { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 0 10px; }
  .brand-logo { width: 128px; height: 50px; }
  .current-section { font-size: 14px; max-width: 110px; }
  .menu-toggle { padding: 9px 10px; }
  .aim-card { grid-template-columns: 116px 1fr; padding: 13px; gap: 12px; }
  .compass { width: 112px; height: 112px; }
  .align-actions, .terrain-point { grid-template-columns: 1fr; }
  #linkMap { height: 260px; }
}
@media (max-width: 360px) {
  .coord-grid { grid-template-columns: 1fr; }
  .brand-logo { width: 108px; }
  .current-section { max-width: 80px; }
}
