/* BK EMS Cloud — complementos sobre el sistema visual del EMS (/ems/styles.css). */
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }
.plant-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform 150ms, box-shadow 150ms; }
.plant-card:hover { transform: translateY(-2px); box-shadow: 0 22px 46px rgba(22,40,58,.12); }
.plant-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.plant-card .name { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.plant-card .org { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.live-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.live-kpis .mini { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.live-kpis .mini .l { font-size: 12px; color: var(--text-tertiary); }
.live-kpis .mini .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-kpis .mini .v small { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; }
@media (max-width: 1100px) { .live-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.live-strip { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-secondary); padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.live-strip b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.live-strip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.stat-row .mini .v small { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.plant-card .foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 12px; color: var(--text-tertiary);
  border-top: 1px solid var(--separator); padding-top: 10px; flex-wrap: wrap; }
.kind-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.kind-ic svg { width: 22px; height: 22px; }
.plant-map { height: 360px; border-radius: 16px; overflow: hidden; z-index: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { min-width: 0; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 75; background: rgba(11,26,36,.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.3); width: min(980px, 100%); max-height: calc(100vh - 32px);
  overflow: auto; padding: 26px; }
.modal-card h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.02em; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.type-card { text-align: left; border: 1.5px solid var(--separator); background: var(--surface); border-radius: 16px; padding: 14px 16px; cursor: pointer;
  font: inherit; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.type-card:hover { border-color: var(--brand); }
.type-card.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(18,164,104,.15); }
.type-card .t { font-weight: 700; font-size: 14.5px; display: flex; gap: 10px; align-items: center; }
.type-card .d { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.req { display: flex; gap: 5px; flex-wrap: wrap; }
.req span { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-tertiary); }
.req span.si { background: rgba(18,164,104,.12); color: #0d8a57; } .req span.op { background: rgba(45,108,223,.10); color: #2457b8; }

/* pasos del wizard */
.steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.step { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 13px; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface); flex-shrink: 0; }
.step.ok .n { background: var(--brand); color: #fff; } .step.warn .n { background: var(--warn); color: #fff; } .step.bad .n { background: var(--bad); color: #fff; }
.step .s { font-size: 11px; color: var(--text-tertiary); }
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 12px; font-size: 13px; background: var(--surface-2); }
.issue.error { background: rgba(214,69,69,.10); } .issue.aviso { background: rgba(212,129,29,.10); }
.leaflet-container { font-family: inherit; }
a.step { color: inherit; transition: background 150ms; } a.step:hover { background: var(--surface-3); }

/* ruta de la planta */
.route { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; position: relative; }
.route-step { position: relative; padding: 12px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.route-step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface); color: var(--text-tertiary); border: 2px solid var(--separator); }
.route-step .dot svg { width: 16px; height: 16px; }
.route-step .nm { font-weight: 700; font-size: 13px; }
.route-step .dt { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.4; }
.route-step.hecho .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.route-step.actual { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand) inset; }
.route-step.actual .dot { border-color: var(--brand); color: var(--brand); }
.route-step.actual .dt { color: var(--text-secondary); }
.route-step .btn { margin-top: auto; padding: .4rem .6rem; font-size: 12px; white-space: normal; line-height: 1.25; text-align: center; max-width: 100%; }
.route-step.pendiente { opacity: .7; }
@media (max-width: 1300px) { .route { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .route { grid-template-columns: 1fr; } }

/* asistente */
.wiz { display: grid; grid-template-columns: 240px minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.wiz-steps { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 2px; }
.wiz-step { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; font-size: 13px; color: var(--text-secondary); }
.wiz-step:hover { background: var(--surface-2); }
.wiz-step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-2); flex-shrink: 0; }
.wiz-step.ok .n { background: rgba(18,164,104,.14); color: #0d8a57; } .wiz-step.warn .n { background: rgba(212,129,29,.16); color: #a15c00; } .wiz-step.bad .n { background: rgba(214,69,69,.14); color: #c03636; }
.wiz-step.on { background: var(--brand-soft); color: var(--text-primary); font-weight: 700; } .wiz-step.on .n { background: var(--brand); color: #fff; }
.wiz-main { min-height: 520px; display: flex; flex-direction: column; }
.wiz-head { border-bottom: 1px solid var(--separator); padding-bottom: 14px; margin-bottom: 18px; }
.wiz-body { flex: 1; }
.wiz-foot { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--separator); padding-top: 14px; margin-top: 22px; flex-wrap: wrap; }
.wiz-side { position: sticky; top: 96px; }
.surface.flat { box-shadow: none; border: 1px solid var(--separator); }
.list-ed { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.icon-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-tertiary); padding: 2px 8px; border-radius: 8px; }
.icon-x:hover { color: var(--bad); background: rgba(214,69,69,.10); }
.pkg { background: #0f1e2b; color: #d8e6df; border-radius: 14px; padding: 14px; font-size: 11.5px; max-height: 420px; overflow: auto; margin-top: 14px; }
/* cartera: mapa de España, emplazamientos y parques */
.cart-kpis .kpi-v small { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
@media (max-width: 640px) {  /* móvil: cifras compactas en dos columnas para ver el mapa sin bajar tanto */
  .cart-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .cart-kpis .surface.tight { padding: 12px 12px; }
  .cart-kpis .kpi-ic { display: none; }
  .cart-kpis .kpi-v { font-size: 20px; }
  .cart-kpis .kpi-l { font-size: 11.5px; }
  .cart-kpis .kpi-d { font-size: 11px; line-height: 1.35; }
  .site-card .sc-kpis b { font-size: 14px; }
  .es-pt .lbl { font-size: 17px; }
  .toolbar .btn { flex: 1; justify-content: center; }
}
.cart-main { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1150px) { .cart-main { grid-template-columns: 1fr; } }
.map-card { position: sticky; top: 96px; }
@media (max-width: 1150px) { .map-card { position: static; } }
.map-wrap { position: relative; }
.es-map { width: 100%; height: auto; display: block; }
.es-map .esp { fill: var(--surface-2); stroke: color-mix(in srgb, var(--brand) 35%, var(--separator)); stroke-width: 1.2; stroke-linejoin: round; }
.es-map .ctx { fill: color-mix(in srgb, var(--surface-2) 45%, transparent); stroke: var(--separator); stroke-width: .8; }
.es-map .can-box { fill: none; stroke: var(--separator); stroke-dasharray: 5 4; }
.es-map .can-lbl { font-size: 13px; fill: var(--text-tertiary); font-weight: 600; }
.es-pt { cursor: pointer; }
.es-pt circle { stroke: #fff; stroke-width: 2.5; transition: r 150ms; }
.es-pt .halo { opacity: .18; stroke: none; }
.es-pt .n { font-size: 12px; font-weight: 700; fill: #fff; text-anchor: middle; pointer-events: none; }
.es-pt .lbl { font-size: 13.5px; font-weight: 700; fill: var(--text-primary); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.es-pt:hover .halo, .es-pt.hl .halo { opacity: .35; }
.es-tip { position: absolute; z-index: 5; width: 220px; background: var(--surface); border-radius: 14px; box-shadow: 0 16px 40px rgba(22,40,58,.18); padding: 10px 12px; font-size: 12.5px; pointer-events: none; }
.es-tip .tt-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.es-tip .tt-row span { color: var(--text-tertiary); }
.site-list { display: grid; gap: 12px; }
.site-card { display: block; color: inherit; text-decoration: none; transition: transform 150ms, box-shadow 150ms; }
.site-card:hover, .site-card.hl { transform: translateY(-2px); box-shadow: 0 22px 46px rgba(22,40,58,.12); }
.sc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sc-top .name, .inst .name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.sc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
@media (max-width: 560px) { .sc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sc-kpis div, .it-now div, .it-day { display: flex; flex-direction: column; gap: 2px; }
.sc-kpis span, .it-now span, .it-day span { font-size: 11px; color: var(--text-tertiary); }
.sc-kpis b { font-size: 15px; font-variant-numeric: tabular-nums; }
.sc-reg { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--separator); }
.hbar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); margin-top: 6px; }
.hbar.sm { height: 7px; }
.hbar .real { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c-bess); border-radius: 99px 0 0 99px; }
.hbar .prev { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(18,164,104,.5) 0 5px, rgba(18,164,104,.2) 5px 10px); }
.hbar i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; }
.hbar i.u { background: var(--bad); } .hbar i.m { background: #7a5af8; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.inst { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; padding: 16px 16px 14px; transition: transform 150ms, box-shadow 150ms; }
.inst:hover { transform: translateY(-2px); box-shadow: 0 22px 46px rgba(22,40,58,.12); }
.it-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.it-now { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 12px; align-items: end; }
.it-now.off { display: block; }
.it-now b { font-size: 18px; font-variant-numeric: tabular-nums; } .it-now b small { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.it-now .soc { gap: 5px; }
.it-day { flex-direction: row; align-items: baseline; gap: 10px; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--separator); }
.it-day b:last-child { margin-left: auto; color: var(--brand); }
.it-al { font-size: 11.5px; color: #a15c00; background: rgba(212,129,29,.10); border-radius: 10px; padding: 6px 8px; line-height: 1.35; }
/* altas en curso (tablero) y entrega */
.entrega { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: var(--surface-2); border-radius: 16px; padding: 10px; display: grid; gap: 8px; min-height: 120px; }
.kb-h { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; padding: 2px 4px 4px; }
.kb-n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 11px; }
.kb-card { background: var(--surface); border-radius: 12px; padding: 10px 12px; box-shadow: 0 4px 14px rgba(22,40,58,.06); display: grid; gap: 4px; }
.kb-card a.b { color: inherit; } .kb-card a { color: var(--brand); }
.kb-d { color: var(--text-secondary); line-height: 1.35; }
.kb-f { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.kb-f .input { padding: .3rem .5rem; font-size: 12px; flex: 1; min-width: 0; } .kb-f .btn { padding: .35rem .7rem; font-size: 12px; }
.kb-empty { text-align: center; padding: 10px; }

/* puesta en marcha desde el móvil */
.pm-tabs { display: flex; overflow-x: auto; max-width: 100%; }
.pm-tabs > * { white-space: nowrap; }
.pm-dev { border-left: 4px solid var(--ok); } .pm-dev.bad { border-left-color: var(--bad); }
.pm-vals { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pm-vals i { font-style: normal; color: var(--text-tertiary); margin-right: 4px; font-size: 11px; }
.pm-auto { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--separator); }
.pm-auto .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--idle); }
.pm-auto .dot.ok { background: var(--ok); } .pm-auto .dot.bad { background: var(--bad); }
.pm-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--separator); }
.pm-item.saving { opacity: .5; }
.pm-btns { display: flex; gap: 6px; flex-shrink: 0; }
.pm-b { min-width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--separator); background: var(--surface); font: inherit; font-weight: 700; cursor: pointer; color: var(--text-secondary); }
.pm-b.ok.on { background: var(--ok); border-color: var(--ok); color: #fff; } .pm-b.ko.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.pm-b.na.on { background: var(--idle); border-color: var(--idle); color: #fff; }
.pm-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; } .pm-val small { font-size: 12px; color: var(--text-secondary); }
@media (max-width: 560px) { .pm-item { flex-direction: column; align-items: stretch; } .pm-btns { justify-content: flex-end; } }

/* alta del gateway: etiqueta y escáner QR */
.gw-label { width: 86mm; border: 1.5px solid #16283a; border-radius: 10px; padding: 8px 10px; background: #fff; color: #16283a; font-family: "DM Sans", system-ui, sans-serif; }
.gl-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #d9e1dd; padding-bottom: 4px; }
.gl-head img { height: 18px; } .gl-head span { font-size: 8px; letter-spacing: .14em; color: #56677a; font-weight: 700; }
.gl-body { display: grid; grid-template-columns: 30mm 1fr; gap: 8px; align-items: center; margin-top: 6px; }
.gl-qr svg { width: 30mm; height: 30mm; display: block; }
.gl-k { font-size: 8px; color: #56677a; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.gl-v { font-size: 13px; font-weight: 700; } .gl-v.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.gl-foot { font-size: 7.5px; color: #56677a; border-top: 1px solid #d9e1dd; margin-top: 6px; padding-top: 4px; }
.qr-video video { width: 100%; max-height: 300px; border-radius: 14px; background: #000; object-fit: cover; }
.gw-connect { border: 2px dashed color-mix(in srgb, var(--brand) 45%, transparent); }
.it-alta { font-size: 11.5px; color: var(--text-secondary); background: var(--surface-2); border-radius: 10px; padding: 7px 9px; }
.cp-tbl td { padding: 4px 6px 4px 0; } .cp-tbl .input { padding: .35rem .55rem; font-size: 13px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

@media (max-width: 1450px) { .wiz { grid-template-columns: 220px minmax(0, 1fr); } .wiz-side { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; } .wiz-side > .mt { margin-top: 0; } }
@media (max-width: 900px) { .wiz { grid-template-columns: 1fr; } .wiz-steps { position: static; flex-direction: row; overflow-x: auto; } .wiz-step { white-space: nowrap; } }
