/* map.css — ecrã «Hospital map» (cartão do mapa, controlos, painel Try it, portas, movimentos, plano de leitores).
   Destino: css/views-map.css (T4), tal e qual. */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-5); align-items: start; }
.map-col { display: grid; gap: var(--sp-5); min-width: 0; }
.map-card { position: relative; overflow: hidden; padding: 0; }
.map-stage { position: relative; height: clamp(460px, calc(100vh - 230px), 720px); background: #050A13; }
.map-ui { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.map-ui > * { pointer-events: auto; }
.map-title {
  position: absolute; top: 16px; left: 16px; max-width: min(420px, calc(100% - 32px));
  padding: 12px 14px; border-radius: 14px; background: rgba(7, 12, 22, .78);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(150, 200, 230, .2); box-shadow: var(--shadow-2);
}
.map-title h2 { font-size: 14.5px; }
.map-title p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text); }
.legend i { box-shadow: 0 0 8px rgba(91, 228, 242, .25); }
.legend i { width: 18px; height: 4px; border-radius: 4px; display: inline-block; }
.legend i.dot { width: 10px; height: 10px; border-radius: 50%; }
.map-tools { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.map-tools .stack { display: grid; gap: 6px; }
.plan-host.is-2d ~ .map-ui .map-tools .stack, .plan-host.is-2d ~ .map-ui .map-hint { display: none; }
.map-caption { padding: 10px 16px; font-family: var(--mono); font-size: 11px; letter-spacing: .03em; color: var(--faint); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.map-hint {
  position: absolute; right: 16px; bottom: 16px;
  font-size: 12px; color: var(--muted); background: rgba(7, 12, 22, .78); border: 1px solid var(--line); padding: 5px 12px; border-radius: var(--r-pill);
  white-space: nowrap;
}
.map-ticker {
  position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 10px; border-radius: 12px; background: rgba(7, 12, 22, .86); border: 1px solid rgba(150, 200, 230, .2); color: #fff; font-size: 13px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2); max-width: calc(100% - 32px);
}
.map-ticker .live { width: 8px; height: 8px; border-radius: 50%; background: var(--c-mint); box-shadow: 0 0 0 0 rgba(126, 240, 184, .6); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 9px rgba(126, 240, 184, 0); } 100% { box-shadow: 0 0 0 0 rgba(126, 240, 184, 0); } }

/* painel lateral "Try it" */
.side { display: grid; gap: var(--sp-4); }
.try { display: grid; gap: var(--sp-3); }
.try-step { display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.try-step header { display: flex; align-items: center; gap: 10px; }
.step-no { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--c-cyan); background: rgba(91, 228, 242, .1); box-shadow: inset 0 0 0 1px rgba(91, 228, 242, .35); flex: 0 0 24px; }
.try-step h3 { font-size: 14px; }
.try-step p { font-size: 12.5px; color: var(--muted); }
.try-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.door-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.door-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: var(--r-pill);
  border: 1px solid rgba(255, 181, 74, .38); background: rgba(255, 181, 74, .06); color: var(--alert-700); font-weight: 600; font-size: 13px; cursor: pointer;
}
.door-chip b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--alert); color: #1A0F00; font-family: var(--mono); font-weight: 500; font-size: 11.5px; }
.door-chip:hover { background: var(--alert-100); }

.doors-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.doors-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 10px; }
.doors-list li:hover { background: var(--surface-2); }
.dl-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 500; font-size: 12.5px; color: var(--c-on-light); }
.dl-no.exit { background: transparent; color: var(--alert); box-shadow: inset 0 0 0 2px var(--alert); }
.dl-no.route { background: var(--door-route); }
.dl-no.ward { background: var(--door-ward); }
.dl-no.count { background: var(--door-count); color: #fff; box-shadow: inset 0 0 0 2px var(--c-cyan), 0 0 12px rgba(91, 228, 242, .3); }
.dl-name { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.dl-role { font-size: 12px; color: var(--muted); }

.feed { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--faint); font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.feed .n { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; color: #fff; }

.arch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.arch-item { display: grid; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.arch-item .doors { display: flex; gap: 4px; }
.arch-item .doors b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font-family: var(--mono); font-weight: 500; font-size: 11.5px; color: var(--c-on-light); }
.arch-item .doors b[style*="navy"] { color: #fff; box-shadow: inset 0 0 0 1px rgba(91, 228, 242, .4); }
.arch-item h3 { margin-top: 6px; }
.arch-item p { font-size: 12.5px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .map-ticker .live { animation: none; }
}
@media (max-width: 1180px) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .arch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .side { grid-template-columns: minmax(0, 1fr); }
  /* telemóvel: mapa → Try it → números → portas → feed → plano de leitores */
  .map-layout { display: flex; flex-direction: column; gap: var(--sp-4); }
  .map-col, .side { display: contents; }
  .map-card { order: 1; } .map-try { order: 2; } .kpis { order: 3; }
  .map-doors { order: 4; } .map-feed { order: 5; } .map-reader { order: 6; }
  .arch { grid-template-columns: minmax(0, 1fr); }
  .map-stage { height: 62vh; min-height: 400px; }
  .map-hint, .map-ticker { display: none; }
  .map-title { top: auto; bottom: 10px; left: 10px; right: 10px; max-width: none; padding: 8px 10px; }
  .map-title h2 { display: none; }
  .map-title .legend { margin-top: 0; gap: 4px 10px; }
  .map-tools { top: 10px; right: 10px; flex-direction: row; align-items: center; }
  .map-tools .stack { display: flex; }
  .map-tools .zoom-btn { display: none; }
  .map-caption span:last-child { display: none; }
}

/* lista das portas: badge e botão empilhados, para o nome não ser esmagado */
.dl-alert { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dl-alert .btn-sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; }
