:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1b1d1f;
  --ink-2: #4a4f55;
  --ink-3: #80868d;
  --line: #e2e0d8;
  --line-2: #cfccc1;
  --side: #16191c;
  --side-ink: #b9bec4;
  --accent: #e8a317;
  --accent-ink: #1b1d1f;
  --accent-soft: #fbf0d4;
  --ok: #1f7a3f;
  --ok-soft: #e3f2e7;
  --warn: #9a5b00;
  --warn-soft: #fdf0d9;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --radius: 8px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; transition: grid-template-columns .15s; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 600; letter-spacing: .2px; }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 9px; background: url(/logo.svg) center / contain no-repeat; }
.login .brand-mark, .public .brand-mark { width: 52px; height: 52px; border-radius: 13px; }
.brand small { display: block; font-weight: 400; color: var(--side-ink); font-size: 11.5px; }
.nav a .k { margin-left: auto; font-size: 11px; color: #6c737a; }
.app > div { min-width: 0; }
.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.2px; }
.page-head .sub { color: var(--ink-3); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 14px; margin: 0 0 12px; font-weight: 600; }
.card h2 .muted { font-weight: 400; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
table.t td code { white-space: nowrap; }
table.t th.n { text-align: right; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { color: var(--ink-3); font-size: 12px; }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.kpi .s { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi.alert .v { color: var(--bad); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.96); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { resize: vertical; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label.f { min-width: 150px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: none; }
table.t tr.group td { background: var(--surface-2); font-weight: 600; font-size: 12.5px; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 10px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: #eeede7; color: var(--ink-2); white-space: nowrap; }
.tag.recepcion { background: #e3effc; color: #1d5ea8; }
.tag.salida { background: var(--accent-soft); color: #7a5300; }
.tag.devolucion { background: var(--ok-soft); color: var(--ok); }
.tag.traspaso { background: #ece9fb; color: #4b3cb3; }
.tag.ajuste { background: #eeede7; color: var(--ink-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

.bar { height: 8px; background: #eeede7; border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.bar.warn > span { background: var(--accent); }
.bar.bad > span { background: var(--bad); }

/* Movement lines */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface-2); }
.line-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.line-head .title { font-weight: 600; }
.line-head .avail { margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.line-body { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.line-body label.f { min-width: 130px; }
.serial-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; max-height: 220px; overflow-y: auto; padding: 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 100%; }
.reel-rows { display: flex; flex-direction: column; gap: 6px; }
.reel-rows .rr { display: flex; gap: 6px; }
.add-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.add-line label.f { flex: 1; min-width: 220px; }
.scan { background: #fffdf5; }
.submit-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 22, 24, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 90; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; width: min(640px, 100%); padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { width: min(980px, 100%); }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
.toast.err { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--side); padding: 16px; }
.login form { background: var(--surface); padding: 28px; border-radius: 12px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 20px; }
.login-card { background: var(--surface); padding: 28px; border-radius: 12px; width: min(380px, 100%); }
.login-card form { padding: 0; width: 100%; background: none; }
.login .stack { display: flex; flex-direction: column; gap: 12px; }
.login .stack p { margin: 0; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart .tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; z-index: 70; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; }
.print-only { display: none; }
.show-m { display: none; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.qr-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.qr-box img { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }
.secret { display: inline-block; font-size: 14px; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; }
.rec-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.rec-codes code { font-size: 15px; }

body.tech .staff { display: none !important; }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.bad { background: var(--bad-soft); border-color: #f1c2be; }
.banner.warn { background: var(--warn-soft); border-color: #f0d9a8; }
.banner.ok { background: var(--ok-soft); border-color: #bfe0c8; }
.banner.accent { background: var(--accent-soft); border-color: #f1d79a; }
td.voided code { text-decoration: line-through; color: var(--ink-3); }
.sig-wrap { position: relative; border: 1px dashed var(--line-2); border-radius: 8px; background: #fff; }
.sig-wrap canvas { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.sig-hint[hidden] { display: none; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); pointer-events: none; font-size: 15px; }
.sig-img { max-width: 100%; height: 110px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; margin-bottom: 6px; }
.side-user { margin-top: 18px; padding: 12px 10px 4px; border-top: 1px solid #2a3035; display: flex; align-items: center; gap: 8px; }
.side-user a { flex: 1; min-width: 0; text-decoration: none; color: #fff; }
.side-user a small { display: block; color: var(--side-ink); font-size: 11.5px; }
.side-user .btn { background: transparent; color: var(--side-ink); border-color: #3a4147; }
.count-row.done td { background: var(--ok-soft); }
.count-row.diff td { background: var(--warn-soft); }

table.pdf-rev tr.off td { opacity: .55; }
table.pdf-rev td { vertical-align: middle; }
.pdf-mode { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.line { position: relative; }

/* Estructura de fibras del cable */
.cable-colors { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0 6px; }
.cable-colors > div > div { margin-bottom: 4px; }
.cchip { display: inline-flex; flex-direction: column; align-items: center; margin-right: 4px; font-size: 10px; color: var(--ink-3); }
.cchip .fchip { width: 18px; height: 18px; margin: 0; }

/* Mapa de red */
body.map-mode .main { padding: 0; }
.mapwrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.maptools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.maptools select, .maptools input { padding: 6px 8px; font-size: 13px; }
.findbox { position: relative; flex: 1 1 240px; max-width: 380px; min-width: 0; }
.findbox input { width: 100%; }
.find-res { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1200; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 60vh; overflow-y: auto; padding: 4px; }
.find-res[hidden] { display: none; }
.fr { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.fr:hover, .fr.hi { background: var(--surface-2); }
.fr small { display: block; color: var(--ink-3); font-size: 11.5px; }
.fr-t { width: 18px; text-align: center; color: var(--ink-3); flex: none; }
.tool-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tool-row select { max-width: 190px; }
.mapbody { position: relative; flex: 1; display: flex; min-height: 0; }
#map { flex: 1; position: relative; z-index: 0; background: #e8e6df; }
.mappanel { width: 370px; flex: none; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; z-index: 1; }
.mappanel[hidden] { display: none; }
.mappanel > * { flex-shrink: 0; }
.mappanel h4 { margin: 6px 0 0; font-size: 13px; }
.mp-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mp-name { font-size: 16px; font-weight: 600; border-color: transparent; padding: 4px 6px; margin-left: -6px; width: 100%; }
.mp-name:hover, .mp-name:focus { border-color: var(--line-2); }
.mp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv2 { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv2 span { color: var(--ink-3); }
.kv2 strong { text-align: right; font-variant-numeric: tabular-nums; }
.plist { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.spl-list .tag a { text-decoration: none; margin-left: 4px; }
.nb { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 10px/1 var(--sans); color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.nb-cto { background: conic-gradient(#b3261e var(--occ, 0%), #e8a317 0); color: #1b1d1f; }
.nb-cto[data-full="1"] { background: #b3261e; color: #fff; }
.nb-empalme { background: #1b1d1f; }
.nb-cabecera { background: #6250d6; font-size: 8px; }
.nb.sel, .nm.sel, .np.sel { outline: 3px solid #ff1aa8; outline-offset: 1px; }
.nm { width: 12px; height: 12px; background: #fff; border: 2.5px solid #4a4f55; border-radius: 2px; margin: 1px; }
.np { width: 10px; height: 10px; background: #0f9d58; border: 2px solid #fff; border-radius: 50%; margin: 2px; box-shadow: 0 0 0 1px #0b6b3c; }
.mylocbtn { width: 30px; height: 30px; line-height: 30px; text-align: center; font-size: 18px; background: #fff; color: #333; text-decoration: none; }
.mylocbtn.on { color: #2a78d6; } .mylocbtn.following { background: #2a78d6; color: #fff; }
/* estado de obra en los símbolos */
.nb[data-st="proyectado"], .nm[data-st="proyectado"], .np[data-st="proyectado"] { opacity: .72; border-style: dashed; }
.nb[data-st="en_obra"] { box-shadow: 0 0 0 3px #e8a317, 0 1px 4px rgba(0,0,0,.45); }
.nb[data-st="incidencia"], .nm[data-st="incidencia"], .np[data-st="incidencia"] { box-shadow: 0 0 0 3px #dc2626, 0 1px 4px rgba(0,0,0,.45); }
/* etiquetas */
.nlabel-w { pointer-events: none !important; }
.nlabel { position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap; font: 600 11px/1.2 var(--sans); color: #1b1d1f; text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; }
.nlabel.lb-box { transform: translate(-50%, 15px); }
.nlabel.lb-box small { font-weight: 500; color: #b3261e; }
.nlabel.lb-cable { transform: translate(-50%, -140%); color: #1e3a8a; font-size: 10.5px; }
.nlabel.lb-small { transform: translate(8px, -50%); font-weight: 500; font-size: 10px; color: #374151; }
.nlabel.lb-home { transform: translate(7px, -50%); font-weight: 500; font-size: 9.5px; color: #4b5563; }
.nlabel.lb-measure, .nlabel.lb-find { transform: translate(-50%, -150%); background: #ff1aa8; color: #fff; text-shadow: none; padding: 3px 7px; border-radius: 10px; font-size: 12px; }
.nlabel.lb-find { background: #1b1d1f; }
/* leyenda */
.map-legend { background: rgba(255,255,255,.94); border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.25); font-size: 11px; max-width: 210px; }
.lg-toggle { display: block; width: 100%; border: 0; background: none; font: 600 12px var(--sans); padding: 7px 10px; cursor: pointer; text-align: left; }
.map-legend .lg-body { display: none; padding: 0 10px 8px; max-height: 42vh; overflow-y: auto; }
.map-legend.open .lg-body { display: block; }
.lg-sec { margin-top: 6px; } .lg-sec strong { display: block; margin-bottom: 2px; }
.lg-row { display: flex; align-items: center; gap: 6px; padding: 0; line-height: 1.45; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.lg-nb { width: 18px !important; height: 18px !important; font-size: 7px !important; border-width: 1.5px !important; flex: none; }
.lg-nm, .lg-np { display: inline-block; margin: 0 2px; flex: none; }
/* ficha: estado, fotos, ocupación */
.st-seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.st-seg button { border: 0; border-left: 1px solid var(--line); background: var(--surface); font: 600 12px var(--sans); padding: 8px 4px; cursor: pointer; color: var(--ink-2); }
.st-seg button:first-child { border-left: 0; }
.st-seg button.on { background: var(--c); color: #fff; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.ph { border: 0; padding: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; aspect-ratio: 1; cursor: pointer; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-view { text-align: center; background: #111; border-radius: 8px; }
.ph-view img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
.occ-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.occ-bar span { display: block; height: 100%; background: #16a34a; }
.occ-bar.high span { background: #e8a317; } .occ-bar.full span { background: #b3261e; }
td .occ-bar { display: inline-block; width: 70px; vertical-align: middle; margin-right: 6px; }
.dot-st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: 1px; }
.mp-grip { display: none; }
.add-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.add-opt { flex-direction: column; gap: 4px; padding: 12px 6px; justify-content: center; text-align: center; font-size: 13px; }
.add-opt span { font-size: 18px; line-height: 1; font-weight: 700; }
.exp-list { display: grid; gap: 8px; }
.exp-list .btn { flex-direction: column; align-items: flex-start; gap: 2px; text-decoration: none; text-align: left; }
.exp-list small { color: var(--ink-3); font-weight: 400; }
/* estructura de fibras (artículos y tipos de cable) */
.struct-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.struct-box form { margin-top: 10px; }
.tube-prev { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.tp-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 2px; }
.tp-tube { display: inline-flex; align-items: center; gap: 4px; min-width: 112px; font-size: 11px; color: var(--ink-2); padding-top: 3px; }
.tp-tube .fchip { width: 16px; height: 16px; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 6px; }
.code-grid label { display: flex; align-items: center; gap: 4px; }
.code-grid small { width: 18px; text-align: right; color: var(--ink-3); }
.code-grid select { flex: 1; min-width: 0; padding: 5px; font-size: 12.5px; }
/* plano imprimible */
.plan-deco { position: absolute; inset: 0; pointer-events: none; z-index: 800; }
.plan-north { position: absolute; top: 10px; right: 54px; background: rgba(255,255,255,.92); border: 1.5px solid #111; border-radius: 50%; width: 38px; height: 38px; text-align: center; font: 700 11px/1.1 var(--sans); padding-top: 4px; }
.plan-legend { position: absolute; left: 10px; bottom: 34px; background: rgba(255,255,255,.95); border: 1px solid #111; border-radius: 4px; padding: 6px 8px; font-size: 10px; max-width: 200px; }
.plan-legend .lg-row { padding: 0; }
.plan-title { position: absolute; right: 10px; bottom: 22px; width: 360px; background: #fff; border: 1.5px solid #111; font-size: 10.5px; }
.pt-co { padding: 6px 8px; border-bottom: 1px solid #111; }
.pt-main { padding: 6px 8px; font: 700 14px var(--sans); border-bottom: 1px solid #111; }
.pt-grid { display: grid; grid-template-columns: 80px 1fr 80px 1fr; gap: 2px 8px; padding: 6px 8px; }
.pt-grid span { color: #555; } .pt-grid strong { font-weight: 600; }
.plan-bar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3000; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); flex-wrap: wrap; max-width: calc(100% - 20px); }
.plan-summary { display: none; }
body.printing-plan .maptools, body.printing-plan .mappanel, body.printing-plan .leaflet-control-zoom, body.printing-plan .leaflet-control-layers, body.printing-plan .mylocbtn, body.printing-plan .map-legend { display: none !important; }
body.printing-plan .mapbody { overflow: auto; background: #6b7280; padding: 60px 10px 10px; justify-content: center; align-items: flex-start; }
body.printing-plan #map { box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.editbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 8px; display: flex; gap: 8px; align-items: center; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.3); max-width: calc(100% - 20px); flex-wrap: wrap; }
.fchip { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); vertical-align: -2px; margin-right: 2px; }
.fchip.marked { background-image: repeating-linear-gradient(45deg, transparent 0 3px, #000 3px 5px) !important; }
table.fibers tr.tube-start td { border-top: 2px solid var(--line-2); }
.splice-form { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.splice-form select { width: 100%; }
.splice-form .inline { margin-top: 6px; }
.splice-form .inline input { width: 50%; }
.splice-form .arrow { font-size: 20px; padding-bottom: 8px; color: var(--ink-3); }
.tia-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.fprev { display: flex; flex-wrap: wrap; gap: 6px; }
.fprev span { display: inline-flex; flex-direction: column; align-items: center; font-size: 10px; }
.leaflet-container { font-family: var(--sans); }
.leaflet-draw-tooltip { font-size: 12px; }
@media (max-width: 900px) {
  .mapwrap { height: calc(100dvh - 56px - env(safe-area-inset-top)); }
  .maptools { padding: 6px 8px; }
  .maptools #mf-obra { flex: 1 1 140px; max-width: 48%; }
  .maptools #mf-find { min-width: 0; flex: 1 1 140px; }
  .draw-bar { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
  .draw-bar .btn { flex: none; }
  .mappanel { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 58%; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.18); padding-bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 2; }
  .mappanel { padding-top: 4px; transition: max-height .2s; }
  .mappanel.expanded { max-height: 92%; }
  .mp-grip { display: block; width: 100%; height: 18px; border: 0; background: none; flex: none; cursor: pointer; position: relative; }
  .mp-grip::after { content: ''; position: absolute; left: 50%; top: 7px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--line-2); }
  .findbox { flex: 1 1 140px; max-width: none; }
  .tool-row { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .tool-row > * { flex: none; }
  .tool-row select { font-size: 14px; padding: 6px 8px; }
  .maptools .btn.sm { padding: 8px 11px; }
  .st-seg button { padding: 11px 2px; font-size: 12.5px; }
  .map-legend { max-width: 190px; }
  .leaflet-bar a, .mylocbtn { width: 36px !important; height: 36px !important; line-height: 36px !important; }
  .add-grid { grid-template-columns: repeat(2, 1fr); }
  .splice-form { grid-template-columns: 1fr; }
  .splice-form .arrow { display: none; }
}

/* Escáner con cámara */
.cam-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 10px; }
.inline { display: flex; gap: 6px; }
.inline input { flex: 1; }
.code-big { font-family: var(--mono); font-size: 18px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; margin-bottom: 10px; }
body.no-scroll { overflow: hidden; }
.scanner { position: fixed; inset: 0; z-index: 80; background: #0d0f11; color: #fff; display: flex; flex-direction: column; overflow-x: hidden; width: 100vw; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); overflow-y: auto; }
.sc-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.sc-top strong { font-size: 16px; }
.sc-sum { margin-left: auto; color: #9aa1a8; font-size: 13px; }
.sc-view { position: relative; margin: 0 12px; min-width: 0; flex: none; border-radius: 12px; overflow: hidden; background: #000; min-height: 240px; border: 3px solid transparent; transition: border-color .25s; }
.sc-view.hit-ok { animation: hitok .6s; }
.sc-view.hit-bad { animation: hitbad .8s; }
@keyframes hitok { 0% { border-color: #2fbf5b; } 100% { border-color: transparent; } }
@keyframes hitbad { 0% { border-color: #e5484d; } 100% { border-color: transparent; } }
#sc-video { width: 100%; height: auto; display: block; max-height: 56vh; object-fit: cover; background: #000; }
.sc-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 16px 0; }
.sc-tools select { background: #1b1f23; color: #fff; border-color: #33393f; max-width: 100%; flex: 1 1 200px; font-size: 14px; }
.sc-tools .btn { background: #1b1f23; color: #fff; border-color: #33393f; }
.sc-tools .btn.primary { background: var(--accent); color: var(--accent-ink); }
.sc-diag { padding: 0 16px 16px; font-size: 11px; color: #6c737a; font-family: var(--mono); }
.sc-frame { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }
.sc-frame span { width: 90%; height: 45%; border: 2px solid rgba(232,163,23,.9); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,.28); }
.sc-msg { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; padding: 0 12px; }
.sc-zoom { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #9aa1a8; flex: 1 1 180px; }
.sc-zoom[hidden] { display: none; }
.sc-zoom input { flex: 1; accent-color: var(--accent); }
.sc-status { padding: 12px 16px 0; font-size: 13.5px; color: #d6dade; line-height: 1.5; }
.sc-status .btn { margin-left: 6px; }
.sc-manual { display: flex; gap: 8px; padding: 12px 16px 0; }
.sc-manual input { flex: 1; background: #1b1f23; color: #fff; border-color: #33393f; }
.sc-log { list-style: none; margin: 10px 16px 16px; padding: 0; font-size: 14px; }
.sc-log li { padding: 8px 10px; border-radius: 6px; margin-bottom: 5px; background: #1b1f23; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.sc-log li.ok { border-left: 3px solid #2fbf5b; }
.sc-log li.bad { border-left: 3px solid #e5484d; color: #ffb4b4; }
.side-shade { display: none; }
.nav a svg { flex: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; height: auto; width: 270px; transform: translateX(-100%); transition: transform .2s; padding-top: calc(18px + env(safe-area-inset-top)); }
  body.menu-open .side { transform: none; }
  body.menu-open .side-shade { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 44; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--side); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar strong { margin-right: auto; font-size: 15px; }
  .topbar .btn { padding: 7px 10px; }
  .main { padding: 14px 12px calc(24px + env(safe-area-inset-bottom)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g2, .g3, .g12 { grid-template-columns: 1fr; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 19px; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { width: 100%; }
  .card { padding: 12px; overflow-x: auto; }
  /* iOS hace zoom en campos con letra < 16px */
  input, select, textarea { font-size: 16px; padding: 9px 10px; }
  .btn { padding: 9px 13px; }
  .btn.sm { padding: 6px 10px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  label.f input, label.f select, label.f textarea { width: 100%; }
  .form-grid > label.f:has(select), .form-grid .wide { grid-column: 1 / -1; }
  .filters label.f { min-width: calc(50% - 5px); flex: 1; }
  .line { padding: 10px; }
  .line-head { flex-wrap: wrap; gap: 6px 8px; }
  .line-head .avail { margin-left: 0; width: 100%; order: 3; }
  .line-head { padding-right: 34px; }
  .line-head [data-act=del] { position: absolute; top: 6px; right: 6px; }
  .hide-m { display: none; }
  .show-m { display: revert; }
  .submit-bar .btn.show-m { display: inline-flex; flex: none; padding: 12px; }
  .line-body { gap: 10px; }
  .line-body > label.f { flex: 1 1 130px; min-width: 0; }
  .line-body > .btn { width: 100%; justify-content: center; }
  .serial-box { grid-template-columns: 1fr; max-height: 260px; }
  .serial-box .check { padding: 6px 0; font-size: 15px; }
  .serial-box input[type=checkbox] { width: 20px; height: 20px; }
  .add-line { padding: 10px; }
  .add-line label.f { min-width: 100%; }
  .submit-bar { position: sticky; bottom: 0; background: var(--surface); margin: 12px -12px -12px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
  .submit-bar .btn { flex: 1; justify-content: center; padding: 12px; }
  .submit-bar #totals { white-space: nowrap; }
  table.t th, table.t td { padding: 7px 8px; }
  .modal-bg { padding: 12px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .modal { padding: 16px; }
  .modal .foot { flex-wrap: wrap; }
  .modal .foot .btn { flex: 1; justify-content: center; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media print {
  body { background: #fff; font-size: 11px; }
  body.printing-plan .plan-bar, body.printing-plan .leaflet-control-attribution { display: none !important; }
  body.printing-plan .mapwrap { height: auto; display: block; }
  body.printing-plan .mapbody { display: block; padding: 0; background: none; overflow: visible; }
  body.printing-plan #map { box-shadow: none; border: 1px solid #111; }
  body.printing-plan .plan-summary { display: block; break-before: page; padding: 4mm 0; font-size: 10.5px; }
  .plan-summary h2 { font-size: 15px; margin: 0 0 8px; } .plan-summary h3 { font-size: 12px; margin: 10px 0 4px; }
  .ps-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .scanner, .cam-btn, .side, .topbar, .no-print, .actions, .filters, .tabs { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .card { border: none; padding: 0; margin-bottom: 14px; }
  .print-only { display: block; }
  table.t th { position: static; }
  table.t td, table.t th { padding: 4px 6px; }
  .kpi { border-color: #ccc; }
}

/* Clientes, RADIUS y OLT */
.on-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c4c8cc; vertical-align: 0; box-shadow: 0 0 0 2px rgba(0,0,0,.04); }
.on-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.posc { color: #15803d; } .warnc { color: #b45309; }
.svc { margin-bottom: 12px; }
.svc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.svc-kv { max-width: 560px; }
pre.code { background: #16191c; color: #e5e7eb; padding: 12px 14px; border-radius: 8px; overflow: auto; font: 12.5px/1.5 var(--mono, ui-monospace, monospace); white-space: pre; max-height: 52vh; margin: 8px 0; }
pre.code.term { min-height: 160px; }
.mono, textarea.mono { font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
ol.steps li.done { color: var(--ink-3); }
ol.steps li.done::marker { content: '✓  '; color: #16a34a; }
a.olt-card { color: inherit; text-decoration: none; display: block; }
a.olt-card:hover { border-color: var(--line-2); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
a.kpi { color: inherit; text-decoration: none; }
.spark { width: 100%; height: auto; display: block; }
.pick-list { max-height: 50vh; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.pick-list .fr small { display: block; }
/* Inicio ISP */
.card.setup { border-left: 4px solid var(--accent); }
.card.setup ol.steps a { color: inherit; }
.kpi.warnk { border-color: #f2c76b; }
.kpi .v small { font-size: 55%; font-weight: 500; color: var(--ink-3); }
ul.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.alerts li { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; border-left: 3px solid #e8a317; background: #fdf6e7; }
ul.alerts li.bad { border-left-color: #dc2626; background: #fdecec; }
ul.alerts li a { color: inherit; text-decoration: none; display: block; }
a.store-card { color: inherit; text-decoration: none; display: block; }
.bar.good span { background: #16a34a; }

/* ---------- Menú con desplegables e iconos ---------- */
.ico { flex: none; display: block; }
.brand { position: relative; }
.brand-t { flex: 1; min-width: 0; }
.side-min { background: none; border: 0; color: #6c737a; padding: 4px; border-radius: 6px; cursor: pointer; }
.side-min:hover { color: #fff; background: #22272b; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-g { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--side-ink); font: inherit; font-size: 14px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.nav a span, .nav-g span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover, .nav-g:hover { background: #22272b; color: #fff; }
.nav a.active { background: #2a3036; color: #fff; }
.nav a.active .ico { color: var(--accent); }
.nav-g { color: #d5d9dd; font-weight: 500; margin-top: 6px; }
.nav-g .chev { display: flex; color: #6c737a; transition: transform .15s; }
.nav-sec.open > .nav-g .chev { transform: rotate(180deg); }
.nav-items { display: none; flex-direction: column; gap: 1px; margin: 2px 0 4px 14px; padding-left: 8px; border-left: 1px solid #2c3237; }
.nav-sec.open > .nav-items { display: flex; }
.nav-items a { padding: 6px 10px; font-size: 13.5px; }
.nav-items a .ico { width: 16px; height: 16px; opacity: .85; }
.side { display: flex; flex-direction: column; }
.side .nav { flex: 1; }
.side-user { margin-top: 12px; }
.side-user a { display: flex; align-items: center; gap: 10px; }
.side-user .who { min-width: 0; } .side-user .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12.5px; }
.side-user .btn.ghost { border: 0; padding: 6px; }
@media (min-width: 901px) {
  body.side-mini .app { grid-template-columns: 68px 1fr; }
  body.side-mini .side { padding: 18px 10px; }
  body.side-mini .brand { flex-direction: column; padding: 4px 0 14px; }
  body.side-mini .brand-t, body.side-mini .nav a span, body.side-mini .nav-g span, body.side-mini .nav-g .chev, body.side-mini .side-user .who { display: none; }
  body.side-mini .nav a, body.side-mini .nav-g { justify-content: center; padding: 10px 0; }
  body.side-mini .nav-items { margin: 0; padding: 0; border: 0; }
  body.side-mini .nav-sec > .nav-items { display: none; }
  body.side-mini .nav-sec.has-active > .nav-g { background: #2a3036; color: #fff; }
  body.side-mini .side-user { flex-direction: column; padding: 10px 0 0; }
}

/* ---------- Barra inferior (móvil) ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 10.5px; color: var(--ink-3); text-decoration: none; }
  .tabbar a.active { color: var(--ink); } .tabbar a.active .ico { color: var(--accent); }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.map-mode .tabbar { display: none; }
  #toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ---------- Ayuda plegable ---------- */
.hint { margin: 4px 0; }
.hint > p { display: none; margin: 6px 0 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; border-left: 3px solid var(--line-2); }
.hint.open > p { display: block; }
.hint-b { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 2px 4px 2px 0; color: var(--ink-3); font: inherit; font-size: 12.5px; cursor: pointer; }
.hint-b:hover, .hint.open .hint-b { color: var(--ink); }

/* ---------- Desplegable «Más» ---------- */
.dd { position: relative; display: inline-flex; }
.dd-b { gap: 6px; }
.dd-m { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; flex-direction: column; gap: 2px; }
.dd.open .dd-m { display: flex; }
.dd-m .dd-i { justify-content: flex-start; width: 100%; border: 0; background: none; text-align: left; border-radius: 6px; padding: 9px 10px; }
.dd-m .dd-i:hover { background: var(--surface-2); }

/* ---------- Indicadores más visuales ---------- */
.kpi { position: relative; transition: border-color .12s, box-shadow .12s; }
a.kpi:hover { border-color: var(--line-2); box-shadow: 0 2px 12px rgba(0,0,0,.05); }
.kpi > .l { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.kpi-i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); flex: none; }
.kpi.alert .kpi-i { background: #fdecec; color: #c62828; }
.kpi.warnk .kpi-i { background: #fdf3dd; color: #b26b00; }
.kpi .v { font-size: 26px; margin-top: 8px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.nav-sec.has-active > .nav-g > .ico { color: var(--accent); }
.page-head h1 { display: flex; align-items: center; gap: 6px; }
.h1-i { padding: 2px; }
.page-head .sub.sub-fold { display: none; }
@media (max-width: 900px) { .side-min { display: none; } }

/* ---------- Facturación ---------- */
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-h h2 { margin: 0; }
.warnbox { background: #fff6e0; border-color: #f0d48a; }
.mi-lines { display: grid; gap: 6px; margin: 10px 0 6px; }
.mi-row { display: flex; gap: 6px; }
.mi-row input[name=d] { flex: 1; min-width: 0; }
.inv-prev { overflow: auto; }
.inv { color: #1d2125; max-width: 780px; margin: 0 auto; font-size: 13px; }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.inv-from { line-height: 1.45; }
.inv-from strong { font-size: 15px; display: block; }
.inv-logo { height: 34px; display: block; margin-bottom: 8px; }
.inv-qr { text-align: center; width: 38mm; flex-shrink: 0; }
.inv-qr svg { width: 32mm; height: 32mm; display: block; margin: 2px auto; }
.inv-qr .qr-t { font-size: 10px; text-align: left; }
.inv-qr .qr-b { font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.inv-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 18px 0 12px; border-bottom: 2px solid #1d2125; padding-bottom: 8px; flex-wrap: wrap; }
.inv-title h1 { font-size: 20px; margin: 0; letter-spacing: .02em; }
.inv-to { border: 1px solid #d9d8d0; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; max-width: 360px; }
.inv-l { width: 100%; border-collapse: collapse; }
.inv-l th { text-align: left; font-size: 11.5px; color: #6b7178; border-bottom: 1px solid #d9d8d0; padding: 6px 4px; }
.inv-l td { padding: 7px 4px; border-bottom: 1px solid #eceae3; vertical-align: top; }
.inv-l .n, .inv-tot .n { text-align: right; white-space: nowrap; }
.inv-tot { display: flex; justify-content: flex-end; margin-top: 10px; }
.inv-tot table { border-collapse: collapse; min-width: 240px; }
.inv-tot td { padding: 3px 4px; }
.inv-tot .big td { font-size: 16px; font-weight: 700; border-top: 2px solid #1d2125; padding-top: 6px; }
.inv-foot { margin-top: 18px; display: grid; gap: 4px; color: #3b4045; }

/* ---------- Servicio técnico ---------- */
.tag.info { background: #e4eefb; color: var(--info); }
.diag-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
ul.hints { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
ul.hints li { padding: 6px 10px; border-radius: 6px; font-size: 13px; background: #f1f0ea; }
ul.hints li.bad { background: var(--bad-soft); color: var(--bad); }
ul.hints li.warn { background: var(--warn-soft); color: var(--warn); }
ul.hints li.ok { background: var(--ok-soft); color: var(--ok); }
.diag-s { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; display: grid; gap: 4px; }
ol.timeline { list-style: none; padding: 0 0 0 14px; margin: 0; border-left: 2px solid var(--line); display: grid; gap: 12px; }
ol.timeline li { position: relative; }
ol.timeline li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); border: 2px solid var(--bg); }
ol.timeline li.nota::before { background: var(--accent); }
ol.timeline li.estado::before, ol.timeline li.asignacion::before { background: var(--info); }
.inline-sel { font: inherit; padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; max-width: 100%; }
.wo-next { margin: 0 0 14px; }
.btn.big { width: 100%; min-height: 54px; font-size: 17px; }
@media (min-width: 761px) { .btn.big { width: auto; padding: 0 34px; } }
.checks { display: grid; gap: 2px; }
label.chk { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
label.chk:last-child { border-bottom: 0; }
label.chk input { width: 20px; height: 20px; accent-color: var(--ok); flex-shrink: 0; }
.checks label.chk input:checked + span { color: var(--ink-3); text-decoration: line-through; }
.mats { display: grid; gap: 6px; margin-bottom: 6px; }
.mat input[name=mn] { flex: 1; min-width: 0; }
.ph-grid .ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.ph-grid { margin-bottom: 10px; }
h3.sec-t { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.wo-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
a.wo-card { display: flex; gap: 12px; text-decoration: none; color: inherit; align-items: flex-start; }
a.wo-card:hover { border-color: var(--accent); }
.wo-time { font-weight: 700; font-size: 17px; min-width: 54px; text-align: center; line-height: 1.1; }
.wo-time small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.wo-main { display: grid; gap: 3px; min-width: 0; }
.agenda-wrap { padding: 0; overflow-x: auto; }
.agenda { display: grid; min-width: 980px; }
.ag-h { padding: 8px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--line); background: #faf9f5; position: sticky; top: 0; }
.ag-h.today { color: var(--accent-ink); background: var(--accent-soft); }
.ag-t { padding: 8px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: #faf9f5; }
.ag-c { min-height: 74px; padding: 4px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.ag-c.today { background: #fffdf5; }
.ag-c.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
.ag-card { display: block; font-size: 12px; line-height: 1.3; padding: 5px 7px; border-radius: 6px; background: #e4eefb; color: var(--ink); text-decoration: none; border-left: 3px solid var(--info); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; }
.ag-card small { display: block; color: var(--ink-3); }
.ag-card.pendiente { background: var(--warn-soft); border-left-color: var(--warn); }
.ag-card.en_curso, .ag-card.en_camino { background: var(--accent-soft); border-left-color: var(--accent); }
.ag-card.finalizada { background: var(--ok-soft); border-left-color: var(--ok); opacity: .8; }
.ag-card.cancelada { background: #eee; border-left-color: #999; text-decoration: line-through; opacity: .6; }
.ag-pend { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-pend .ag-card { max-width: 260px; }
a.kpi { text-decoration: none; color: inherit; }

#ev textarea { width: 100%; }

/* =====================================================================
   FiberOps 2.5 · identidad visual «hilo de luz»
   Papel frío, noche azul en la barra lateral, ámbar de señal (el del logo)
   y los 12 colores de fibra TIA-598 como acentos de categoría.
   ===================================================================== */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #0f1a24;
  --ink-2: #3d4a57;
  --ink-3: #6f7c89;
  --line: #dfe4ea;
  --line-2: #c9d1da;
  --side: #0d1722;
  --side-ink: #a9b6c3;
  --accent: #f5a623;
  --accent-ink: #1c1405;
  --accent-soft: #fff1d6;
  --ok: #0e8f60;
  --ok-soft: #dcf5ea;
  --warn: #a35f00;
  --warn-soft: #fff0d6;
  --bad: #d23439;
  --bad-soft: #fde4e4;
  --info: #2f6fed;
  --series-1: #2f6fed;
  --series-2: #f08a24;
  --radius: 12px;
  --display: "Sora", "IBM Plex Sans", system-ui, sans-serif;
  /* TIA-598: azul, naranja, verde, marrón, gris, blanco, rojo, negro, amarillo, violeta, rosa, aguamarina */
  --f1: #1e6fd9; --f2: #f08a24; --f3: #1fa463; --f4: #8b5a2b; --f5: #8a96a3; --f6: #e9edf2;
  --f7: #e23b3b; --f8: #2a2f36; --f9: #f2c230; --f10: #8b5cf6; --f11: #f472b6; --f12: #22c3c3;
}
body { background: var(--bg); }

/* Títulos con la tipografía de marca */
.page-head h1, .card h2, .kpi .v, .login h1, .public h1, .hero h1 { font-family: var(--display); }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -.4px; }
.card h2 { font-size: 15px; font-weight: 600; letter-spacing: -.1px; }

/* Barra lateral: noche con el hilo activo iluminado */
.side { background: linear-gradient(180deg, #0d1722 0%, #0a121b 100%); }
.nav a, .nav-g { border-radius: 9px; }
.nav a.active { background: rgba(245, 166, 35, .12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active svg { color: var(--accent); }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }

/* Superficies */
.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 26, 36, .04); }
.btn { border-radius: 9px; }
.btn.primary { box-shadow: 0 1px 0 rgba(0, 0, 0, .08), inset 0 -1px 0 rgba(0, 0, 0, .08); }
.tabs { border-bottom-color: var(--line-2); }
.tabs a.active { border-bottom-width: 3px; }

/* Tablas más limpias: cabecera en minúsculas, filas con más aire */
table.t th { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; color: var(--ink-3); background: var(--surface-2); padding: 9px 12px; }
table.t td { padding: 11px 12px; border-bottom-color: #edf0f4; vertical-align: middle; }
table.t tr.click:hover td { background: #f3f7fd; }

/* Estados: píldora con punto de color */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; font-weight: 500; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag.info { background: #e4edfd; color: var(--info); }

/* KPI: cada uno con su hilo de color (orden TIA) */
.kpi { position: relative; border-radius: 14px; padding: 16px 18px 15px 20px; overflow: hidden; border-color: var(--line); }
.kpi::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--strand, var(--f1)); }
.grid > .kpi:nth-child(12n+1), .grid > a.kpi:nth-child(12n+1) { --strand: var(--f1); }
.grid > .kpi:nth-child(12n+2) { --strand: var(--f2); }
.grid > .kpi:nth-child(12n+3) { --strand: var(--f3); }
.grid > .kpi:nth-child(12n+4) { --strand: var(--f4); }
.grid > .kpi:nth-child(12n+5) { --strand: var(--f5); }
.grid > .kpi:nth-child(12n+6) { --strand: var(--f12); }
.grid + .grid > .kpi:nth-child(12n+1) { --strand: var(--f7); }
.grid + .grid > .kpi:nth-child(12n+2) { --strand: var(--f9); }
.grid + .grid > .kpi:nth-child(12n+3) { --strand: var(--f10); }
.grid + .grid > .kpi:nth-child(12n+4) { --strand: var(--f11); }
.kpi .v { font-size: 28px; font-weight: 600; letter-spacing: -.6px; }
.kpi .l { font-size: 12.5px; color: var(--ink-2); }
a.kpi:hover { border-color: var(--line-2); }
.kpi.alert { --strand: var(--bad); background: linear-gradient(90deg, #fff6f6, #fff 60%); }
.kpi.warnk { --strand: var(--accent); background: linear-gradient(90deg, #fffaf0, #fff 60%); border-color: var(--line); }

/* Avatar con iniciales (clientes, técnicos) */
.av { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font: 600 11.5px var(--display); color: #fff; flex: none; letter-spacing: .2px; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- Portada del inicio: el hilo de luz ---------- */
.hero { position: relative; overflow: hidden; border-radius: 18px; background: radial-gradient(120% 140% at 85% 0%, #1b3350 0%, #0d1722 55%, #0a1119 100%); color: #e8eef5; padding: 26px 28px 24px; margin-bottom: 18px; isolation: isolate; }
.hero svg.strands { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero .strand { fill: none; stroke-width: 1.4; opacity: .55; }
.hero .pulse { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 26 1600; animation: travel 6.5s linear infinite; filter: drop-shadow(0 0 4px currentColor); }
@keyframes travel { from { stroke-dashoffset: 1626; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .hero .pulse { animation: none; opacity: 0; } }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.6px; color: #fff; }
.hero .sub { color: #9fb0c2; margin-top: 4px; }
.hero .actions .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; backdrop-filter: blur(4px); }
.hero .actions .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.hstat { display: block; text-decoration: none; color: inherit; padding: 14px 16px; border-radius: 14px; background: rgba(8, 15, 23, .55); border: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(6px); }
.hstat:hover { border-color: rgba(245, 166, 35, .5); }
.hstat .l { font-size: 12.5px; color: #9fb0c2; display: flex; align-items: center; gap: 7px; }
.hstat .l i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }
.hstat .v { font: 600 34px/1.1 var(--display); letter-spacing: -1px; color: #fff; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hstat .v small { font-size: 15px; color: #9fb0c2; font-weight: 500; letter-spacing: 0; }
.hstat .s { font-size: 12.5px; color: #9fb0c2; margin-top: 3px; }
.hstat .s .neg { color: #ff8f8f; }
.hstat .meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); margin-top: 10px; overflow: hidden; }
.hstat .meter span { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--accent)); }
@media (max-width: 900px) { .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .hero { border-radius: 0; margin: -16px -16px 16px; padding: 22px 16px 18px; } .hero h1 { font-size: 24px; } .hstat .v { font-size: 27px; } .hero .actions { width: 100%; } }

/* Gráfica de área (conectados 24 h) */
.area svg { width: 100%; height: auto; display: block; }
.area .ax { font: 10.5px var(--sans); fill: var(--ink-3); }
.area .tip { position: fixed; }

/* Listas de alertas con icono de color */
ul.alerts li { border-radius: 10px; }

/* ---------- Chat ---------- */
.nbadge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font: 600 11px/1 var(--sans); margin-left: auto; }
.tabbar a { position: relative; }
.tabbar a .nbadge { position: absolute; top: 3px; left: 54%; margin: 0; }
body.chat-mode .main { padding: 0; }
.chat-app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100vh; background: var(--surface); }
.ch-list { border-right: 1px solid var(--line); overflow-y: auto; background: #f8fafc; }
.ch-list-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.ch-list-h h1 { margin: 0; font: 600 22px var(--display); }
.ch-sec { padding: 4px 8px 10px; }
.ch-sec-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: default; }
details.ch-sec summary { cursor: pointer; list-style: none; }
.ch-room { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-decoration: none; color: inherit; }
.ch-room:hover { background: #eef2f7; }
.ch-room.on { background: #fff; box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--accent); }
.ch-room.closed { opacity: .65; }
.ch-hash { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #e6ebf2; color: var(--ink-2); font: 600 16px var(--display); flex: none; }
.ch-hash.big { width: 36px; height: 36px; }
.ch-r-main { flex: 1; min-width: 0; display: grid; }
.ch-r-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-r-last { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-r-side { display: grid; justify-items: end; gap: 3px; }
.ch-r-side .nbadge { margin: 0; }
.ch-empty { padding: 4px 10px; }
.ch-conv { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ch-placeholder { margin: auto; text-align: center; max-width: 360px; color: var(--ink-3); padding: 20px; }
.ch-placeholder h2 { color: var(--ink); font: 600 18px var(--display); }
.ch-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ch-head-t { flex: 1; min-width: 160px; }
.ch-head-t strong { font: 600 16px var(--display); }
.ch-back { display: none; }
.ch-hints { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 18px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; background: linear-gradient(180deg, #f6f8fb, #fff 140px); }
.ch-day { text-align: center; margin: 14px 0 8px; } .ch-day span { font-size: 12px; color: var(--ink-3); background: #eef1f5; padding: 3px 10px; border-radius: 999px; }
.ch-sys { align-self: center; font-size: 12.5px; color: var(--ink-3); background: #fff8e6; border: 1px solid #f3dca7; border-radius: 10px; padding: 5px 10px; margin: 6px 0; max-width: 80%; text-align: center; }
.ch-msg { display: grid; max-width: min(72%, 560px); margin-top: 8px; }
.ch-msg.cont { margin-top: 1px; }
.ch-msg.mine { align-self: flex-end; justify-items: end; }
.ch-who { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 3px 4px; }
.ch-bubble { background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 7px 11px 5px; white-space: pre-wrap; word-wrap: break-word; position: relative; }
.ch-msg.cont .ch-bubble { border-radius: 14px; }
.ch-msg.client .ch-bubble { background: #eef4ff; border-color: #d5e3fb; }
.ch-msg.mine .ch-bubble { background: #fff1d6; border-color: #f6dca6; border-radius: 14px 4px 14px 14px; }
.ch-bubble img { display: block; max-width: 260px; max-height: 260px; border-radius: 9px; margin: 2px 0 4px; }
.ch-bubble time { display: block; text-align: right; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.ch-empty-conv { margin: auto; }
.ch-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; }
.ch-compose textarea { flex: 1; resize: none; font: inherit; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; max-height: 140px; }
.ch-compose .btn { height: 42px; }
.ch-img { width: 42px; justify-content: center; padding: 0; }
.ch-users { display: grid; gap: 4px; max-height: 60vh; overflow-y: auto; }
.ch-user { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; border-radius: 10px; font: inherit; text-align: left; cursor: pointer; }
.ch-user:hover { background: #f1f4f8; }
@media (max-width: 900px) {
  body.chat-mode:has(.chat-app.has-room) .tabbar { display: none; }
  body.chat-mode .main { padding-bottom: 0; }
  .chat-app { grid-template-columns: 1fr; height: calc(100dvh - 58px - 62px - env(safe-area-inset-bottom)); }
  .chat-app.has-room { height: calc(100dvh - 58px); }
  .chat-app.has-room .ch-list { display: none; }
  .chat-app:not(.has-room) .ch-conv { display: none; }
  .ch-back { display: inline-flex; }
  .ch-head { padding: 10px 12px; } .ch-head .actions { width: 100%; }
  .ch-msg { max-width: 86%; }
  .ch-compose { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
.nav a .nbadge { flex: none; width: auto; min-width: 19px; margin-left: auto; color: #fff; }
body.side-mini .nav a .nbadge { position: absolute; margin: 0; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; }
.nav a { position: relative; }
body.side-mini .nav a .nbadge { display: inline-grid; }

/* ---------- Averías masivas y consumo ---------- */
a.outage-card { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; border-color: #f2c2c2; background: linear-gradient(90deg, #fff4f4, #fff 55%); }
.oc-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 rgba(210, 52, 57, .5); animation: ocp 1.6s infinite; flex: none; }
@keyframes ocp { 70% { box-shadow: 0 0 0 12px rgba(210, 52, 57, 0); } 100% { box-shadow: 0 0 0 0 rgba(210, 52, 57, 0); } }
@media (prefers-reduced-motion: reduce) { .oc-pulse { animation: none; } }
.oc-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.oc-main strong { font: 600 16px var(--display); }
.oc-n { text-align: right; } .oc-n b { display: block; font: 700 30px/1 var(--display); color: var(--bad); } .oc-n small { color: var(--ink-3); }
.outage-ok { display: flex; gap: 14px; align-items: flex-start; }
.oc-ok-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px rgba(14, 143, 96, .5); margin-top: 4px; flex: none; }
.seg-btns { display: inline-flex; gap: 4px; }
.seg-btns .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#tch svg, #tt svg { max-height: 240px; display: block; margin: 0 auto; }
.push-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-color: #f3dca7; background: #fffaf0; } .push-banner > div { flex: 1; min-width: 220px; }

/* Marca de la empresa */
.brand-mark.own { background-color: #fff; background-size: 84%; background-position: center; background-repeat: no-repeat; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.brand-t small { display: block; font-size: 10.5px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; color: #7f93a8; margin-top: 1px; }
.brand-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login .brand-mark.own { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 0 0 1px var(--line, #d9e0e8); }
.brand-prev { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.brand-logo-box { width: 220px; height: 96px; border: 1px dashed #c9d1da; border-radius: 12px; display: grid; place-items: center; background: repeating-conic-gradient(#f3f5f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; padding: 10px; }
.brand-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
