/* Monitorización, ficha de equipo, Clientes, ficha de cliente y Mantenimiento. */
.mo, .cl, .up { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.mo .page-head, .cl .page-head, .up .page-head { margin-bottom: 0; }
.mo .page-sub .ex-tag { margin-left: 4px; vertical-align: 1px; }

/* ---------- Resumen en cifras ---------- */
.mo-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; }
.mo-sum.two { grid-template-columns: minmax(0, 1fr); }
.mo-cell { display: grid; gap: 3px; align-content: start; padding: 13px 14px; min-width: 0; }
.mo-sum:not(.two) .mo-cell:nth-child(even) { box-shadow: inset 1px 0 0 var(--line); }
.mo-sum:not(.two) .mo-cell:nth-child(n + 3), .mo-sum.two .mo-cell + .mo-cell { border-top: 1px solid var(--line); }
.mo-l { font-size: 12.5px; font-weight: 500; color: var(--fg2); line-height: 1.3; }
.mo-v { font: 850 26px/1.1 var(--display); font-stretch: 106%; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mo-v.is-bad { color: var(--red); }
.mo-v.is-warn { color: var(--warn); }
.mo-cell small { font-size: 12px; color: var(--fg3); line-height: 1.35; }
@media (min-width: 760px) {
  .mo-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mo-sum.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mo-cell { padding: 15px 18px 16px; }
  .mo-sum:not(.two) .mo-cell:nth-child(n + 3), .mo-sum.two .mo-cell + .mo-cell { border-top: 0; }
  .mo-sum .mo-cell + .mo-cell { box-shadow: inset 1px 0 0 var(--line); }
  .mo-v { font-size: 30px; }
}

/* ---------- Alerta de equipo sin conexión ---------- */
.mo-alert {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px 12px; align-items: start; padding: 13px 14px;
  border-radius: var(--r-l); background: rgba(240, 113, 122, .1); box-shadow: inset 0 0 0 1px rgba(240, 113, 122, .35);
}
.mo-alert-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-m); background: rgba(240, 113, 122, .18); color: var(--red); }
.mo-alert-ic .i { width: 20px; height: 20px; }
.mo-alert-t h2 { font-size: 14.5px; font-weight: 700; }
.mo-alert-t p { margin-top: 2px; color: var(--fg2); font-size: 13px; }
.mo-alert-t .num { font-size: 13.5px; }
.mo-alert-a { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mo-told { height: 30px; padding: 0 10px; color: var(--fg1); }
@media (max-width: 759px) { .mo-alert-a .btn { flex: 1; height: 40px; } }
@media (min-width: 760px) {
  .mo-alert { grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; padding: 12px 16px; }
  .mo-alert-a { grid-column: auto; justify-content: flex-end; }
}

/* ---------- Lista de equipos ---------- */
.mo-panel-h { padding-bottom: 10px; flex-wrap: wrap; }
.mo-panel .panel-m { white-space: normal; }
.mo-cols { display: none; }
.mo-row {
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 10px; padding: 12px 14px; align-items: center;
  border-top: 1px solid var(--line); transition: background-color .12s;
}
.mo-row:hover { background: rgba(255, 255, 255, .025); }
.mo-row.is-off { background: rgba(240, 113, 122, .05); }
.mo-open { position: absolute; inset: 0; z-index: 0; }
.mo-open:focus-visible { outline-offset: -2px; }
.mo-row > *:not(.mo-open) { pointer-events: none; }
.mo-who { grid-column: 1 / span 2; grid-row: 1; min-width: 0; }
.mo-who b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.mo-who small { display: block; color: var(--fg3); font-size: 12.5px; line-height: 1.35; }
.mo-read { display: inline-flex !important; align-items: center; gap: 4px; margin-top: 2px; color: var(--blue) !important; }
.mo-read .i { width: 12px; height: 12px; }
.mo-st { grid-column: 3; grid-row: 1; justify-self: end; }
.mo-stat { min-width: 0; }
.mo-stat small { display: block; font-size: 11.5px; color: var(--fg3); line-height: 1.3; }
.mo-stat .num { font-size: 13px; white-space: nowrap; }
.mo-spark { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 1px; height: 24px; }
.mo-spark i { display: block; border-radius: 1px; background: var(--accent); transform-origin: 50% 100%; }
.mo-spark i.todo { background: var(--fg3); opacity: .35; }
.mo-spark.off i:not(.todo) { background: var(--fg3); }
.mo-go { display: none; color: var(--fg3); width: 13px; height: 13px; transition: transform .16s var(--ease-out); }
.mo-row:hover .mo-go { transform: translateX(2px); }
@media (min-width: 1000px) {
  .mo-cols, .mo-row { grid-template-columns: minmax(0, 1.6fr) 118px 104px 100px 90px minmax(92px, 150px) 14px; gap: 14px; padding-inline: 16px; }
  .mo-cols { display: grid; padding-block: 8px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--fg3); }
  .mo-cols span { white-space: nowrap; }
  .mo-row { padding-block: 10px; }
  .mo-who, .mo-st { grid-column: auto; grid-row: auto; justify-self: start; }
  .mo-stat small { display: none; }
  .mo-spark { grid-column: auto; height: 26px; }
  .mo-go { display: block; }
}

/* ---------- Ficha de equipo ---------- */
.mo-off { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; margin-bottom: 12px; padding: 12px 13px; border-radius: var(--r-m); background: rgba(240, 113, 122, .1); box-shadow: inset 0 0 0 1px rgba(240, 113, 122, .35); }
.mo-off > .i { width: 20px; height: 20px; color: var(--red); margin-top: 1px; }
.mo-off b { font-weight: 600; }
.mo-off p { margin: 2px 0 8px; color: var(--fg2); font-size: 13px; }
.mo-off .chip, .mo-off .btn { justify-self: start; }
.mo-chart-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mo-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 14px; }
.mo-figs dt { font-size: 12px; color: var(--fg3); line-height: 1.3; }
.mo-figs dd { font-size: 16px; font-weight: 600; color: var(--fg1); white-space: nowrap; }
.mo-figs dd small { display: block; font: 500 12px/1.3 var(--mono); color: var(--fg3); word-spacing: 0; }
.mo-chart-n { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--fg3); font-size: 12.5px; }
.mo-live { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--green); animation: mo-live 2s ease-in-out infinite; }
@keyframes mo-live { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.82); } }
#device .dr-body > .card + .card, #drawer .dr-body > .card + .card { margin-top: 12px; }

/* ---------- Clientes ---------- */
.cl-filters { display: grid; gap: 10px; padding: 12px 14px; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cl-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--fg2); white-space: nowrap;
  background: var(--n3); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .12s, color .12s, transform .16s var(--ease-out);
}
.cl-chip .num { font-size: 11.5px; color: var(--fg3); }
.cl-chip:hover { color: var(--fg1); background: var(--n4); }
.cl-chip:active { transform: scale(.97); }
.cl-chip[aria-pressed="true"] { color: var(--fg1); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cl-search { flex: 1 1 100%; }
.cl-search input { height: 36px; }
.cl-sel { flex: 1 1 140px; min-width: 0; }
.cl-sel .select { width: 100%; height: 36px; font-size: 13px; border-radius: var(--r-m); }
.cl-tools .btn { height: 36px; }
.cl-count { margin-left: auto; color: var(--fg3); font-size: 12.5px; white-space: nowrap; }
.cl-th-use { display: inline-flex; align-items: center; gap: 6px; }
.panel.flush .cl-table { min-width: 960px; }
.cl-table .row-name small { font-size: 12.5px; }
.cl-table .c-sector { color: var(--fg2); }
@media (min-width: 760px) {
  .cl-search { flex: 0 1 300px; }
  .cl-search input { height: 30px; }
  .cl-sel { flex: 0 1 190px; }
  .cl-sel .select { height: 30px; font-size: 12.5px; }
  .cl-tools .btn { height: 30px; }
}
@media (max-width: 759px) {
  .cl-chip { height: 36px; }
  .cl-sel .select, .cl-search input, .cl-tools .btn { height: 40px; }
  .panel.flush .cl-table { min-width: 0; display: block; }
  .cl-table thead { display: none; }
  .cl-table tbody { display: block; }
  .cl-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .cl-table tr:last-child { border-bottom: 0; }
  .panel .cl-table td, .panel .cl-table td:first-child, .panel .cl-table td:last-child { display: none; padding: 0; border: 0; background: none; white-space: normal; }
  .panel .cl-table td.c-name { display: block; grid-column: 1; grid-row: 1; }
  .panel .cl-table td.c-kw { display: block; grid-column: 2; grid-row: 1; text-align: right; }
  .panel .cl-table td.c-st { display: block; grid-column: 1 / -1; grid-row: 2; }
  .cl-table .row-name { white-space: normal; }
}

/* ---------- Ficha de cliente ---------- */
.cl-note { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; margin-bottom: 12px; padding: 11px 12px; border-radius: var(--r-m); background: rgba(242, 184, 75, .1); box-shadow: inset 0 0 0 1px rgba(242, 184, 75, .3); font-size: 13px; }
.cl-note .i { color: var(--warn); margin-top: 1px; }
.cl-journey { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; margin-top: 12px; }
.cl-journey li { display: grid; gap: 5px; min-width: 0; }
.cl-journey i { display: block; height: 4px; border-radius: 2px; background: var(--n4); }
.cl-journey .done i { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.cl-journey .cur i { background: var(--accent); }
.cl-journey span { font-size: 10.5px; line-height: 1.2; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-journey .cur span { color: var(--fg1); font-weight: 600; }
@media (max-width: 479px) {
  .cl-journey span { display: none; }
  .cl-journey .cur span { display: block; overflow: visible; }
}
.cl-cups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cl-cups code { font: 500 12.5px/1.3 var(--mono); overflow-wrap: anywhere; }
.cl-chart { margin-top: 12px; }
.cl-noeq { display: flex; align-items: center; gap: 10px; padding: 16px 14px; border-radius: var(--r-l); background: var(--n2); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg2); }
.cl-noeq b { color: var(--fg1); font-weight: 600; }
.cl-body > .card h3 { font-size: 14px; }

/* ---------- Mantenimiento ---------- */
.up-block { padding-bottom: 2px; }
.up-list { margin-top: 10px; }
.up .renew:first-child { border-top: 1px solid var(--line); }
.up .renew.is-soon { background: rgba(242, 184, 75, .045); }
.up .renew-days.soon .renew-num b { color: var(--warn); }
.up .renew-days.soon .renew-bar i { background: linear-gradient(90deg, color-mix(in srgb, var(--warn) 58%, transparent), var(--warn)); }
.up .renew-act .chip { white-space: nowrap; }
@media (max-width: 759px) {
  .up .renew-act .btn { height: 40px; }
  .up .renew-t b { font-size: 13.5px; }
}
@media (max-width: 439px) {
  .up .renew { grid-template-columns: minmax(0, 1fr); }
  .up .renew-t { grid-row: 1; }
  .up .renew-days { grid-row: 2; }
  .up .renew-act { grid-column: 1; grid-row: 3; }
  .up .renew-act .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { .mo-live { animation: none; } }
