/* =====================================================================
   ITSM tntinfor.com · estilos (adaptable móvil / escritorio / impresión)
   ===================================================================== */
:root {
  --navy: #0f2742;
  --navy-2: #173a5e;
  --accent: #0b7285;
  --accent-2: #1098ad;
  --accent-soft: #e3f6f9;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #62707f;
  --line: #dde3ea;
  --line-2: #eef1f5;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --ok: #2b8a3e;
  --ok-soft: #ebfbee;
  --warn: #e67700;
  --warn-soft: #fff4e6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 2px 8px rgba(16, 32, 56, .05);
  --shadow-lg: 0 10px 40px rgba(16, 32, 56, .22);
  --sidebar: 240px;
  --topbar: 58px;
  --bottombar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ Boot / login */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy) 0%, #0b4a5e 100%); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 30px 26px; box-shadow: var(--shadow-lg); }
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.logo { width: 42px; height: 42px; border-radius: 11px; background: var(--navy); display: grid; place-items: center; color: #66d9e8; flex: none; }
.login-card h1 { font-size: 1.3rem; }

/* ------------------------------------------------------------ Estructura */
.shell { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar); background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.topbar .app-title { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar .app-title .logo { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.08); }
.ent-btn {
  flex: 1; min-width: 0; max-width: 420px; margin-left: 6px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); color: #fff; border-radius: 10px;
  height: 40px; padding: 0 12px; cursor: pointer; text-align: left;
}
.ent-btn .lbl { font-size: .7rem; opacity: .7; display: block; line-height: 1; }
.ent-btn .nm { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(127,127,127,.14); }
.topbar .icon-btn { color: #fff; }

.sidebar {
  position: fixed; top: var(--topbar); left: 0; bottom: 0; width: var(--sidebar); background: var(--card);
  border-right: 1px solid var(--line); padding: 12px 10px; overflow-y: auto; z-index: 30;
}
.nav a, .nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text);
  font-weight: 500; border: 0; background: none; cursor: pointer; text-decoration: none; text-align: left;
}
.nav a:hover, .nav button:hover { background: var(--line-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.nav .who { padding: 8px 12px 4px; font-size: .8rem; color: var(--muted); }

.main { padding: 18px 18px 40px; margin-left: var(--sidebar); max-width: calc(1280px + var(--sidebar)); }
.bottombar { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px 12px calc(var(--bottombar) + 24px + var(--safe-b)); }
  .topbar .app-title span { display: none; }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--bottombar) + var(--safe-b));
    padding-bottom: var(--safe-b); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.04);
  }
  .bottombar a, .bottombar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .72rem;
    color: var(--muted); border: 0; background: none; cursor: pointer; text-decoration: none; font-weight: 600;
  }
  .bottombar a.active { color: var(--accent); }
  .bottombar svg.i { width: 23px; height: 23px; }
}

/* ------------------------------------------------------------ Componentes */
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { flex: 1; min-width: 180px; }
.page-head .sub { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.card-h h2, .card-h h3 { flex: 1; }
.card-b { padding: 14px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #09606f; }
.btn.danger { color: var(--danger); border-color: #f1c0c0; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { height: 34px; padding: 0 11px; font-size: .88rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-plus {
  width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px dashed var(--accent-2); background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; cursor: pointer; font-weight: 700;
}
.btn-plus:hover { background: #d0eff4; }
.fab {
  display: none; position: fixed; right: 16px; bottom: calc(var(--bottombar) + 16px + var(--safe-b)); width: 58px; height: 58px;
  border-radius: 18px; border: 0; background: var(--accent); color: #fff; box-shadow: var(--shadow-lg); z-index: 35; cursor: pointer;
  place-items: center;
}
@media (max-width: 899px) { .fab { display: grid; } .hide-m { display: none !important; } }
@media (min-width: 900px) { .hide-d { display: none !important; } }

/* Formularios */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.fld label, .fld > .lbl { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.fld label .req { color: var(--danger); }
.inp, select.inp, textarea.inp {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid #cbd3dc; border-radius: 10px; background: #fff;
  font-size: 16px; /* evita el zoom en iOS */ outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.inp { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
select.inp { padding-right: 34px; appearance: none; -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2362707f' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center; }
.inp:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(16,152,173,.18); }
.inp-row { display: flex; gap: 8px; align-items: stretch; }
.inp-row > .inp, .inp-row > .picker { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid #cbd3dc; border-radius: 10px; overflow: hidden; height: 44px; background: #fff; }
.seg label { margin: 0 !important; display: flex; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; padding: 0 16px; min-width: 56px; cursor: pointer; font-weight: 600; color: var(--muted); border-right: 1px solid #e2e7ed; font-size: .95rem; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.picker {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 1px solid #cbd3dc; border-radius: 10px;
  background: #fff; cursor: pointer; text-align: left; width: 100%;
}
.picker .ph { color: #9aa5b1; }
.picker .x { margin-left: auto; color: var(--muted); padding: 4px; border-radius: 6px; }
.picker .x:hover { background: var(--line-2); }
.sect-title { grid-column: 1 / -1; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.sect-title:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.repeat-row { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; align-items: end; }
.repeat-row + .repeat-row { margin-top: 8px; }
.repeat-row.disk { grid-template-columns: 1fr 1fr 1fr auto; }
.repeat-row.conn { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
@media (max-width: 700px) {
  .repeat-row.disk, .repeat-row.conn { grid-template-columns: 1fr 1fr; }
  .repeat-row .span2 { grid-column: 1 / -1; }
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--line-2);
  border: 1px solid var(--line); font-size: .88rem; max-width: 100%;
}
.chip button { border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted); display: grid; }
.form-actions {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; justify-content: flex-end; padding: 12px 14px;
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); backdrop-filter: blur(6px);
}
@media (max-width: 899px) {
  .form-actions { bottom: calc(var(--bottombar) + var(--safe-b)); margin: 0 -1px -1px; }
  .form-actions .btn { flex: 1; }
}

/* Filtros tipo "píldora" desplazables */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 8px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--text); white-space: nowrap;
}
.pill .n { font-size: .75rem; background: var(--line-2); color: var(--muted); border-radius: 999px; padding: 1px 7px; }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill.on .n { background: rgba(255,255,255,.2); color: #fff; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.searchbar { position: relative; flex: 1; min-width: 200px; }
.searchbar .inp { padding-left: 38px; }
.searchbar svg { position: absolute; left: 12px; top: 12px; color: var(--muted); }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--text); cursor: pointer;
}
.li:last-child { border-bottom: 0; }
.li:hover { background: #f8fafc; text-decoration: none; }
.li .t { font-weight: 600; }
.li .s { font-size: .84rem; color: var(--muted); }
.ticon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.ticon svg.i { width: 20px; height: 20px; }
.ticon.sm { width: 28px; height: 28px; border-radius: 7px; }
.ticon.sm svg.i { width: 15px; height: 15px; }
.ticon.xl { width: 54px; height: 54px; border-radius: 14px; }
.ticon.xl svg.i { width: 28px; height: 28px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.nuevo { background: #e7f5ff; color: #1864ab; }
.badge.revisado { background: #f3f0ff; color: #5f3dc4; }
.badge.programado { background: #fff4e6; color: #d9480f; }
.badge.en_espera { background: #fff9db; color: #946800; }
.badge.solucionado { background: var(--ok-soft); color: var(--ok); }
.badge.cerrado { background: #e9ecef; color: #6c757d; }
.badge.p-critica { background: #c92a2a; color: #fff; }
.badge.p-alta { background: #ffe3e3; color: #c92a2a; }
.badge.p-media { background: #e9ecef; color: #495057; }
.badge.p-baja { background: #f1f3f5; color: #868e96; }
.badge.yes { background: var(--ok-soft); color: var(--ok); }
.badge.no { background: #f1f3f5; color: #868e96; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.tbl th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: #fafbfc; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl.plain tbody tr { cursor: default; }
.tbl-wrap { overflow-x: auto; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty svg.i { width: 36px; height: 36px; opacity: .45; display: block; margin: 0 auto 8px; }

/* Detalle */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; }
.kv > div { padding: 10px 14px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.kv .k { font-size: .76rem; color: var(--muted); font-weight: 600; }
.kv .v { font-weight: 500; word-break: break-word; }
.kv .v.pre { white-space: pre-wrap; }
.kv > div.full { grid-column: 1 / -1; }
.secret { display: inline-flex; align-items: center; gap: 6px; }
.secret .mask { letter-spacing: 2px; }
.secret button { border: 0; background: var(--line-2); border-radius: 6px; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; }
.crumbs .sepr { color: #adb5bd; }
.hero { display: flex; gap: 14px; align-items: center; padding: 16px; }
.hero h1 { font-size: 1.3rem; word-break: break-word; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline li.estado::before { background: #adb5bd; }
.timeline li:last-child { border-left-color: transparent; }
.timeline .meta { font-size: .78rem; color: var(--muted); }
.timeline .body { white-space: pre-wrap; margin-top: 2px; }

/* Panel */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--text); }
.stat:hover { border-color: var(--accent-2); text-decoration: none; }
.stat .n { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.stat .l { font-size: .78rem; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.kpi .n { font-size: 1.6rem; font-weight: 800; }
.kpi .l { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* Tipo de asset: selector en cuadrícula */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.type-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 600; font-size: .88rem; }
.type-grid button:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.type-grid .grp { grid-column: 1 / -1; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-top: 4px; }

/* Modales (hoja inferior en móvil) */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 25, 40, .5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s; }
.modal {
  background: var(--card); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; animation: pop .18s ease-out;
}
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; font-size: 1.05rem; }
.modal-b { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: #fafbfc; }
@media (max-width: 640px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; animation: up .2s ease-out; }
  .modal-f { padding-bottom: calc(12px + var(--safe-b)); }
  .modal-f .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.pick-list .li { padding: 10px 12px; }
.pick-grp { position: sticky; top: -16px; background: #f5f7fa; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 12px; margin: 0 -16px; z-index: 1; border-bottom: 1px solid var(--line-2); }

/* Avisos */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 24px); max-width: 480px; }
@media (max-width: 899px) { #toasts { bottom: calc(var(--bottombar) + 14px + var(--safe-b)); } }
.toast { background: #1f2d3d; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: up .2s; pointer-events: auto; max-width: 100%; }
.toast.err { background: var(--danger); }
.toast.ok { background: #237032; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: #0b5563; font-size: .9rem; }
.note.warn { background: var(--warn-soft); color: #a14a00; }
.note.err { background: var(--danger-soft); color: var(--danger); }

/* Entidades */
.tree .li { padding-left: calc(14px + var(--d, 0) * 20px); }
.tree .li .tw { width: 16px; color: #adb5bd; flex: none; }

/* Mapas */
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.map-tools select.inp { width: auto; min-width: 150px; height: 38px; font-size: 14px; }
.map-tools label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); padding: 0 6px; }
.map-box { position: relative; height: calc(100vh - var(--topbar) - 190px); min-height: 420px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background-image: radial-gradient(#e6ebf1 1px, transparent 1px); background-size: 22px 22px; }
@media (max-width: 899px) { .map-box { height: calc(100vh - var(--topbar) - var(--bottombar) - 210px); } }
#mapnet { position: absolute; inset: 0; }
.map-info { position: absolute; right: 10px; top: 10px; width: 270px; max-width: calc(100% - 20px); background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; z-index: 5; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend b { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }

/* Upload */
.upload { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; padding: 12px 14px; background: #fafbfc; border-top: 1px solid var(--line-2); }
@media (max-width: 700px) { .upload { grid-template-columns: 1fr; } }
.file-inp { font-size: 14px; }

/* ------------------------------------------------------------ Impresión */
#print-area { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .sidebar, .bottombar, .fab, .form-actions, .no-print, #toasts, .modal-bg, .map-tools, .upload, .actions { display: none !important; }
  .main { margin: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  a { color: inherit; }
  body.print-map #app { display: none; }
  body.print-map #print-area { display: block; }
}
#print-area:not(.rep-area) h1 { font-size: 18px; margin-bottom: 2px; }
#print-area:not(.rep-area) .pmeta { color: #555; margin-bottom: 8px; }
#print-area:not(.rep-area) img { width: 100%; max-height: 175mm; object-fit: contain; border: 1px solid #ccc; border-radius: 6px; }
#print-area:not(.rep-area) table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 10px; page-break-inside: auto; }
#print-area:not(.rep-area) th, #print-area:not(.rep-area) td { border: 1px solid #ccc; padding: 3px 6px; text-align: left; }
#print-area:not(.rep-area) th { background: #eef1f5; }
#print-area:not(.rep-area) h2 { font-size: 13px; margin-top: 14px; page-break-before: always; }

/* ------------------------------------------------------------ v2: tareas, proyectos, calendario */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.task .chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #b8c2cc; background: #fff; display: grid; place-items: center; cursor: pointer; flex: none; margin-top: 1px; color: #fff; padding: 0; }
.task .chk.on { background: var(--ok); border-color: var(--ok); }
.task .chk:disabled { cursor: default; }
.task.done .desc { text-decoration: line-through; color: var(--muted); }
.task .desc { white-space: pre-wrap; word-break: break-word; }
.task .meta { font-size: .82rem; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.task .meta .chip { padding: 2px 8px; font-size: .78rem; }
.task .acts { display: flex; gap: 2px; flex: none; }
.task .acts .icon-btn { width: 34px; height: 34px; }
.task.overdue .when { color: var(--danger); font-weight: 600; }

.meter { height: 10px; border-radius: 999px; background: #d0ebff; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: #2a78d6; }
.meter.over { background: #ffe3e3; }
.meter.over > span { background: var(--danger); }
.meter.sm { height: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .l { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tile .n { font-size: 1.45rem; font-weight: 700; margin-top: 2px; }
.tile .s { font-size: .8rem; color: var(--muted); }
.badge.st-en_plazo, .badge.st-finalizado { background: var(--ok-soft); color: var(--ok); }
.badge.st-retrasado { background: #ffe3e3; color: var(--danger); }
.badge.st-excedido { background: var(--warn-soft); color: #a14a00; }
.badge.planificado { background: #f3f0ff; color: #5f3dc4; }
.badge.en_curso { background: #fff4e6; color: #d9480f; }
.badge.finalizado { background: var(--ok-soft); color: var(--ok); }
.plazo { display: flex; gap: 12px; align-items: flex-start; }
.plazo .msg { font-size: .92rem; }

/* Calendario semanal */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head .ttl { font-weight: 700; font-size: 1.05rem; flex: 1; min-width: 180px; }
.cal-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.cal { --row: 24px; display: grid; grid-template-columns: 50px repeat(5, minmax(0, 2fr)) repeat(2, minmax(0, 1fr)); min-width: 760px; position: relative; }
.cal .dh { position: sticky; top: 0; z-index: 3; background: #fafbfc; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line-2); padding: 7px 6px; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); line-height: 1.2; }
.cal .dh b { display: block; font-size: 1.05rem; color: var(--text); }
.cal .dh.today { color: var(--accent); background: var(--accent-soft); }
.cal .dh.today b { color: var(--accent); }
.cal .corner { position: sticky; left: 0; top: 0; z-index: 4; background: #fafbfc; border-bottom: 1px solid var(--line); }
.cal .times { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.cal .times div { height: calc(var(--row) * 2); font-size: .72rem; color: var(--muted); text-align: right; padding: 0 6px; transform: translateY(-7px); }
.cal .times div:first-child { transform: none; }
.cal .col { position: relative; height: calc(var(--row) * 32); border-left: 1px solid var(--line-2); cursor: default;
  background-image: repeating-linear-gradient(to bottom, #e9edf2 0 1px, transparent 1px calc(var(--row) * 2)),
                    repeating-linear-gradient(to bottom, #f4f6f9 0 1px, transparent 1px var(--row)); }
.cal .col.can { cursor: copy; }
.cal .col.we { background-color: #fafbfc; }
.cal .col.today { background-color: #f3fbfc; }
.cal .now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal .now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.ev { position: absolute; border-radius: 6px; padding: 2px 5px; overflow: hidden; font-size: .72rem; line-height: 1.25; cursor: pointer; z-index: 1;
  box-shadow: 0 0 0 1.5px #fff; text-decoration: none !important; display: block; }
.ev.sched { background: #ffa94d; color: #3d1d00; border-left: 3px solid #e8590c; }
.ev.done { background: var(--navy); color: #fff; border-left: 3px solid #66d9e8; }
.ev.done.cerr { background: #868e96; border-left-color: #ced4da; }
.ev .l1 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev b { font-weight: 800; }
.ev .tt { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.tall .tt.wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ev .hr { opacity: .8; }
.ev:hover { filter: brightness(1.05); z-index: 5; box-shadow: 0 0 0 2px #fff, 0 4px 14px rgba(0,0,0,.2); }
.ev .clip { position: absolute; right: 3px; font-size: .7rem; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 10px; }
.cal-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* Gráfico de proyecto */
.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.chart-tip { position: absolute; pointer-events: none; background: #1f2d3d; color: #fff; border-radius: 8px; padding: 8px 10px; font-size: .8rem; max-width: 260px; box-shadow: var(--shadow-lg); z-index: 5; }
.chart-tip .k { color: #c3ccd6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .84rem; color: var(--muted); margin: 4px 0 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend svg { width: 26px; height: 10px; }

@media print {
  .cal-wrap { overflow: visible; border: 0; }
  .cal { min-width: 0; --row: 17px; }
  .cal .dh, .cal .corner, .cal .times { position: static; }
  .cal-head .btn, .cal-head .pills { display: none !important; }
  .ev { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cal .col { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-chart #app { display: none; }
  body.print-chart #print-area { display: block; }
}

#print-area .chart-box svg { max-height: 120mm; }

/* v3: horas de técnicos y tickets que vienen de tareas */
.badge.fromtask { background: #f3f0ff; color: #5f3dc4; }
.fromtask-card { border-left: 4px solid #7048e8; }
.timebox .tb-form { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 8px; margin-top: 10px; align-items: center; }
.timebox .tb-form input[name=note] { grid-column: 1 / 3; }
.timebox .tb-form .inp { height: 40px; }
.timebox .tb-total { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 12px; font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line-2); }
.timebox .tb-total b { color: var(--text); }
@media (max-width: 700px) { .timebox .tb-form { grid-template-columns: 1fr 1fr; } .timebox .tb-form input[name=date] { grid-column: 1 / -1; } .timebox .tb-form input[name=note], .timebox .tb-form .btn { grid-column: 1 / -1; } }
.task .meta .chip { white-space: nowrap; }

/* v4: usuario conectado en la barra superior */
.who-top { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none !important; padding: 4px 10px 4px 4px; border-radius: 10px; min-width: 0; flex: none; max-width: 260px; }
.who-top:hover { background: rgba(255,255,255,.1); }
.who-top .av { width: 34px; height: 34px; border-radius: 50%; background: #1098ad; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; letter-spacing: .5px; }
.who-top .wt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.who-top .wt b { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-top .wt small { font-size: .74rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ent-btn { max-width: 380px; }
.topbar .grow-sp { flex: 1; }
@media (max-width: 760px) { .who-top .wt { display: none; } .who-top { padding: 4px; } }

/* v4: informe de proyecto (A4 vertical) */
@media print {
  body.print-report #app, body.print-report #modals { display: none !important; }
  body.print-report #print-area { display: block; }
  body.print-report { background: #fff; }
}
.rep { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #1c2733; font-size: 9.5pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rep .muted { color: #62707f; }
.rep-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #0f2742; padding-bottom: 8px; margin-bottom: 14px; }
.rep-head .brand { display: flex; gap: 10px; align-items: center; font-size: 11pt; }
.rep-head .mark { width: 34px; height: 34px; border-radius: 8px; background: #0f2742; color: #66d9e8; display: grid; place-items: center; }
.rep-head .meta { text-align: right; font-size: 8pt; color: #62707f; }
.rep-title .no { font-size: 8.5pt; color: #62707f; font-family: ui-monospace, Consolas, monospace; }
.rep-title h1 { font-size: 19pt; margin: 2px 0 6px; line-height: 1.15; }
.rep .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.rep .tag { border: 1px solid #cbd3dc; border-radius: 999px; padding: 1px 9px; font-size: 8pt; font-weight: 600; }
.rep .tag.en_plazo, .rep .tag.finalizado { border-color: #8ce99a; background: #ebfbee; color: #2b8a3e; }
.rep .tag.retrasado { border-color: #ffa8a8; background: #fff0f0; color: #c92a2a; }
.rep .tag.excedido { border-color: #ffc078; background: #fff4e6; color: #a14a00; }
.rep h2 { font-size: 11.5pt; color: #0f2742; margin: 18px 0 8px; padding-bottom: 3px; border-bottom: 1px solid #dde3ea; break-after: avoid; page-break-after: avoid; }
.rep h2 .cnt { font-weight: 400; color: #62707f; font-size: 9pt; margin-left: 6px; }
.rep h3 { font-size: 10pt; margin: 12px 0 5px; }
.rep-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.rk { border: 1px solid #dde3ea; border-radius: 7px; padding: 7px 10px; break-inside: avoid; }
.rk .l { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .04em; color: #62707f; font-weight: 700; }
.rk .v { font-size: 14pt; font-weight: 700; margin-top: 1px; }
.rk .s { font-size: 7.5pt; color: #62707f; }
.rk.bad .v { color: #c92a2a; } .rk.good .v { color: #2b8a3e; }
.rep-meter { margin-top: 10px; }
.rep-meter .bar { height: 9px; background: #e9eef4; border-radius: 99px; overflow: hidden; display: flex; }
.rep-meter .bar span { display: block; height: 100%; }
.rep-meter .real, .rep-meter i.real { background: #2a78d6; }
.rep-meter .pend, .rep-meter i.pend { background: #9ec5f4; }
.rep-meter .lbl { display: flex; gap: 16px; font-size: 8pt; color: #62707f; margin-top: 4px; }
.rep-meter .lbl i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.rep-box { border-left: 4px solid #adb5bd; background: #f5f7fa; padding: 8px 12px; border-radius: 0 6px 6px 0; break-inside: avoid; }
.rep-box.en_plazo, .rep-box.finalizado { border-color: #2b8a3e; background: #f1fbf3; }
.rep-box.retrasado { border-color: #c92a2a; background: #fff5f5; }
.rep-box.excedido { border-color: #e67700; background: #fff8ef; }
.rep-list { margin: 8px 0 0; padding-left: 18px; }
.rep-list li { margin: 3px 0; }
.rep-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 8pt; color: #62707f; margin-bottom: 4px; }
.rep-legend span { display: inline-flex; align-items: center; gap: 5px; }
.rep-chart { break-inside: avoid; border: 1px solid #eef1f5; border-radius: 6px; padding: 4px 2px 0; }
.rep-chart svg { width: 100%; height: auto; display: block; }
.rep-note { font-size: 8pt; color: #4a5663; background: #f8fafc; border-radius: 6px; padding: 7px 10px; margin-top: 6px; break-inside: avoid; }
.rep-tbl { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.rep-tbl.narrow { width: 75%; }
.rep-tbl th { text-align: left; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .03em; color: #62707f; border-bottom: 1.5px solid #cbd3dc; padding: 4px 5px; }
.rep-tbl td { border-bottom: 1px solid #eef1f5; padding: 4px 5px; vertical-align: top; }
.rep-tbl tr { break-inside: avoid; page-break-inside: avoid; }
.rep-tbl tfoot td { border-top: 1.5px solid #cbd3dc; border-bottom: 0; font-weight: 600; }
.rep-tbl .r, .rep-tbl th.r { text-align: right; white-space: nowrap; }
.rep-tbl .nw { white-space: nowrap; }
.rep-tbl .n { color: #868e96; width: 18px; }
.rep-tbl tr.ok td { color: #495057; }
.rep-tbl .sub, .rep-plain .sub { font-size: 7.5pt; color: #868e96; }
.rep-tbl .bad { color: #c92a2a; font-weight: 600; }
.rep-tbl.log td { font-size: 8pt; }
.rep .hbar { height: 7px; background: #eef1f5; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.rep .hbar span { display: block; height: 100%; background: #2a78d6; }
.rep-kv { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.rep-kv th { text-align: left; color: #62707f; font-weight: 600; width: 18%; padding: 3px 6px 3px 0; vertical-align: top; }
.rep-kv td { padding: 3px 12px 3px 0; vertical-align: top; }
.rep-desc { margin-top: 8px; white-space: pre-wrap; background: #f8fafc; border-radius: 6px; padding: 7px 10px; break-inside: avoid; }
.rep-desc.ok { background: #f1fbf3; }
.rep-desc .k { font-size: 7.5pt; text-transform: uppercase; color: #62707f; font-weight: 700; white-space: normal; margin-bottom: 2px; }
.rep-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rep-plain { list-style: none; margin: 0; padding: 0; }
.rep-plain li { padding: 3px 0; border-bottom: 1px solid #eef1f5; break-inside: avoid; }
.rep-foot { margin-top: 18px; font-size: 7.5pt; color: #62707f; border-top: 1px solid #dde3ea; padding-top: 6px; }
.rep-keep { break-inside: avoid; page-break-inside: avoid; }

/* v5: listado de assets agrupado por tipo */
.asset-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.asset-tools .searchbar { flex: 1 1 320px; }
.asset-tools .first-sel { display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.asset-tools .first-sel select { width: auto; min-width: 190px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); }
.tbl-grouped tr.grp-row td { border-top: 7px solid #dfe3e8; background: #fafbfc; padding: 8px 12px 6px; cursor: default; }
.tbl-grouped tr.grp-row.first td { border-top: 0; }
.tbl-grouped tbody tr.grp-row:hover { background: #fafbfc; }
.grp-name { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.grp-n { font-size: .72rem; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 1px 7px; margin-left: 8px; font-weight: 600; }
.grp-sep { border-top: 7px solid #dfe3e8; background: #fafbfc; padding: 8px 14px 6px; }
.grp-sep.first { border-top: 0; }
/* v5.1: assets sin uso y tickets terminados en gris */
.tbl tr.inactive td, .tbl tr.inactive td *:not(.ticon):not(.ticon *) { color: #b5bcc4 !important; }
.tbl tr.inactive td b { font-weight: 600; }
.tbl tr.inactive .ticon { opacity: .45; }
.li.inactive, .li.inactive .t, .li.inactive .s, .li.inactive .badge { color: #b5bcc4 !important; }
.tbl tr.inactive .badge, .li.inactive .badge { background: #f1f3f5 !important; }
.li.inactive .ticon { opacity: .45; }
.li.done-t .t, .li.done-t .s, .li.done-t > svg.i { color: #adb5bd; }
.li.done-t .badge { opacity: .7; }
.list .grp-sep { display: flex; align-items: center; }
.closing-cerr { background: #f1f3f5 !important; }
@media (max-width: 640px) { .asset-tools .first-sel { width: 100%; } .asset-tools .first-sel select { flex: 1; min-width: 0; } }

/* v5: redes Wi-Fi de los puntos de acceso */
.repeat-row.wifi { grid-template-columns: 1.3fr 1.5fr 1.5fr .7fr auto; }
.repeat-row.wifi + .repeat-row.wifi { margin-top: 8px; }
.wifi-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wifi-tbl th, .wifi-tbl td:first-child, .wifi-tbl td:last-child { white-space: nowrap; }
@media (max-width: 760px) { .repeat-row.wifi { grid-template-columns: 1fr; } .repeat-row.wifi > .btn { justify-self: end; } }
.wifi-tbl { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: 2px; }
.wifi-tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); }
.wifi-tbl td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: middle; }

/* v6: mapas diseñados con IA */
.aim-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: start; }
.aim-side .card + .card { margin-top: 14px; }
.aim-side .list .li { cursor: pointer; align-items: flex-start; }
.aim-side .list .li > svg.i { color: #7048e8; margin-top: 2px; }
.aim-side .list .li.on { background: #f3f0ff; box-shadow: inset 3px 0 0 #7048e8; }
.aim-bar { gap: 6px; flex-wrap: wrap; }
.aim-bar h2 { min-width: 0; flex: 1 1 200px; }
.aim-canvas { overflow: auto; background: #eef1f5; padding: 14px; max-height: calc(100vh - var(--topbar) - 170px); min-height: 360px; }
.aim-canvas > svg { display: block; width: 100%; height: auto; background: #fff; border-radius: 10px; box-shadow: 0 2px 10px rgba(15, 39, 66, .12); }
.aim-canvas.zoom > svg { width: auto; max-width: none; }
.aim-canvas .empty { background: transparent; }
.aim-wait { display: flex; gap: 12px; align-items: center; background: #f3f0ff; border-radius: 10px; padding: 10px 12px; }
.aim-wait .spinner { width: 26px; height: 26px; flex: none; }
.aim-off { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.aim-off svg.i { color: var(--warn); flex: none; margin-top: 2px; }
.aim-help ol { margin: 6px 0 8px 18px; padding: 0; font-size: .92rem; }
.aim-help li { margin: 3px 0; }
.btn svg.i + .hide-m:empty { display: none; }
#print-area.aim-print img { width: 100%; max-height: 190mm; object-fit: contain; }
@media (max-width: 1100px) { .aim-grid { grid-template-columns: 1fr; } .aim-view { order: -1; } .aim-canvas { max-height: none; } }
