:root{--bg:#07111d;--panel:#0d1b2a;--panel2:#102235;--line:#21354a;--text:#eef4f8;--muted:#93a4b7;--primary:#0f766e;--accent:#22c55e;--danger:#dc2626;--warning:#f59e0b;--blue:#2563eb;--radius:16px;--sidebar:250px}
*{box-sizing:border-box}body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:#eef2f6;color:#172033}a{text-decoration:none;color:inherit}button,input,select,textarea{font:inherit}.hidden{display:none!important}
.auth-page{min-height:100vh;background:radial-gradient(circle at 20% 10%,#153858 0,#07111d 42%,#030912 100%);display:grid;place-items:center;padding:24px}.auth-card{width:min(440px,100%);background:#fff;border-radius:22px;padding:34px;box-shadow:0 24px 70px #0008}.brand{display:flex;gap:14px;align-items:center}.brand-mark{width:46px;height:46px;border-radius:14px;background:linear-gradient(145deg,#e11d48,#b91c1c);display:grid;place-items:center;color:#fff;font-size:23px}.auth-card h1{margin:22px 0 6px;font-size:26px}.auth-card p{color:#64748b;margin-top:0}.field{margin:16px 0}.field label{display:block;font-size:13px;font-weight:700;margin-bottom:7px}.field input,.field select,.field textarea{width:100%;border:1px solid #d7dee7;border-radius:10px;padding:12px 13px;background:#fff}.btn{border:0;border-radius:10px;padding:11px 16px;font-weight:700;cursor:pointer}.btn-primary{background:#0f766e;color:#fff}.btn-danger{background:#b91c1c;color:#fff}.btn-soft{background:#e8eef5;color:#274056}.btn-block{width:100%}.auth-links{display:flex;justify-content:space-between;margin-top:16px;font-size:13px;color:#0f766e}.msg{padding:10px 12px;border-radius:9px;font-size:13px;margin:12px 0}.msg.err{background:#fee2e2;color:#991b1b}.msg.ok{background:#dcfce7;color:#166534}
.app{display:grid;grid-template-columns:var(--sidebar) 1fr;min-height:100vh}.sidebar{background:linear-gradient(180deg,#07111d,#0a1724);color:#dce8f3;padding:18px 14px;position:fixed;width:var(--sidebar);height:100vh;overflow:auto}.sidebar .brand{padding:6px 8px 20px;border-bottom:1px solid #1c2d3f}.sidebar .brand strong{font-size:14px}.sidebar nav{margin-top:18px}.nav-title{font-size:10px;letter-spacing:.14em;color:#647b91;padding:15px 12px 6px}.nav-item{display:flex;align-items:center;gap:11px;padding:11px 12px;border-radius:10px;margin:3px 0;color:#c9d8e6;font-size:13px}.nav-item:hover,.nav-item.active{background:#16293b;color:#fff}.nav-item.active{box-shadow:inset 3px 0 #22c55e}.sidebar-foot{position:absolute;left:14px;right:14px;bottom:16px;background:#102235;border:1px solid #20364b;padding:12px;border-radius:12px;font-size:12px}.main{grid-column:2;padding:0 24px 30px}.topbar{height:72px;display:flex;align-items:center;justify-content:space-between;background:#fff;margin:0 -24px 22px;padding:0 24px;border-bottom:1px solid #dce4ec;position:sticky;top:0;z-index:20}.building-select{min-width:270px;border:1px solid #d5dee8;border-radius:10px;padding:10px 12px;background:#fff}.userbox{text-align:right;font-size:12px}.userbox strong{display:block}.page-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:18px}.page-head h1{font-size:24px;margin:0 0 5px}.page-head p{margin:0;color:#64748b;font-size:13px}.grid{display:grid;gap:16px}.kpis{grid-template-columns:repeat(6,minmax(130px,1fr))}.card{background:#fff;border:1px solid #dfe6ed;border-radius:var(--radius);padding:18px;box-shadow:0 8px 30px #1720330b}.kpi .label{font-size:12px;color:#64748b}.kpi .value{font-size:27px;font-weight:800;margin-top:8px}.kpi .sub{font-size:11px;color:#94a3b8;margin-top:4px}.dashboard-main{grid-template-columns:1.6fr 1fr}.emergency-card{background:linear-gradient(135deg,#7f1d1d,#b91c1c);color:#fff;border:none}.emergency-card.none{background:linear-gradient(135deg,#064e3b,#0f766e)}.emergency-title{display:flex;justify-content:space-between;align-items:center}.status-pill{font-size:11px;padding:5px 9px;border-radius:999px;background:#ffffff22}.floor-list{display:grid;grid-template-columns:repeat(6,1fr);gap:9px}.floor-chip{border:1px solid #dce5ee;border-radius:10px;padding:11px;text-align:center;background:#f8fafc}.floor-chip strong{display:block;font-size:18px}.table-wrap{overflow:auto}.data-table{width:100%;border-collapse:collapse;font-size:12px}.data-table th{background:#f4f7fa;color:#526477;text-align:left;padding:11px;border-bottom:1px solid #dae3eb;white-space:nowrap}.data-table td{padding:11px;border-bottom:1px solid #edf1f5;white-space:nowrap}.badge{padding:4px 8px;border-radius:999px;font-size:10px;font-weight:700}.b-ok{background:#dcfce7;color:#166534}.b-warn{background:#fef3c7;color:#92400e}.b-danger{background:#fee2e2;color:#991b1b}.b-info{background:#dbeafe;color:#1e40af}.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.toolbar input,.toolbar select{border:1px solid #d8e1ea;border-radius:9px;padding:9px 10px;background:#fff}.modal{position:fixed;inset:0;background:#07111dbb;display:grid;place-items:center;z-index:50;padding:20px}.modal-box{background:#fff;border-radius:18px;width:min(680px,100%);max-height:90vh;overflow:auto;padding:22px}.modal-head{display:flex;justify-content:space-between;align-items:center}.modal-head h2{margin:0}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.form-grid .full{grid-column:1/-1}.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}.alert-strip{padding:13px 16px;border-radius:12px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;font-size:13px}.person-state{display:flex;gap:8px;align-items:center}.dot{width:9px;height:9px;border-radius:50%}.dot.red{background:#ef4444}.dot.green{background:#22c55e}.dot.blue{background:#3b82f6}.dot.gray{background:#94a3b8}.dot.orange{background:#f59e0b}.two-col{grid-template-columns:1fr 1fr}.plan-placeholder{height:280px;border:2px dashed #cbd5e1;border-radius:14px;display:grid;place-items:center;background:#f8fafc;color:#64748b;text-align:center;padding:20px}.section-title{font-size:15px;margin:0 0 14px}.muted{color:#64748b}.small{font-size:12px}
@media(max-width:1180px){.kpis{grid-template-columns:repeat(3,1fr)}.dashboard-main{grid-template-columns:1fr}.floor-list{grid-template-columns:repeat(4,1fr)}}@media(max-width:800px){:root{--sidebar:0px}.sidebar{display:none}.app{display:block}.main{padding:0 14px 24px}.topbar{margin:0 -14px 18px;padding:0 14px}.building-select{min-width:160px;max-width:48vw}.kpis{grid-template-columns:repeat(2,1fr)}.form-grid,.two-col{grid-template-columns:1fr}.floor-list{grid-template-columns:repeat(3,1fr)}}

/* RC2.2 · Portal móvil del residente */
.resident-page{margin:0;min-height:100vh;background:#07111d;color:#172033}.resident-shell{width:min(520px,100%);min-height:100vh;margin:0 auto;background:#f1f5f9;box-shadow:0 0 60px #0008}.resident-center-card{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:32px;background:#07111d;color:#fff}.resident-center-card p{color:#a8b6c7}.resident-spinner{width:46px;height:46px;border:4px solid #ffffff24;border-top-color:#fff;border-radius:50%;animation:residentSpin .8s linear infinite}.resident-icon{width:58px;height:58px;border-radius:50%;display:grid;place-items:center;font-weight:900;font-size:28px}.resident-icon-muted{background:#334155;color:#fff}@keyframes residentSpin{to{transform:rotate(360deg)}}
.resident-header{min-height:74px;background:#07111d;color:#fff;padding:14px 18px;display:flex;justify-content:space-between;gap:12px;align-items:center}.resident-brand{display:flex;align-items:center;gap:11px}.resident-brand strong{font-size:12px;display:block}.resident-brand span{font-size:11px;color:#a8b6c7;display:block;margin-top:2px}.resident-shield{width:35px;height:40px;background:#b91c1c;clip-path:polygon(50% 0,92% 15%,86% 72%,50% 100%,14% 72%,8% 15%);display:grid;place-items:center;font-weight:900}.resident-severity{padding:5px 8px;border-radius:999px;background:#7f1d1d;font-size:9px;font-weight:900;letter-spacing:.08em}
.resident-alert{background:linear-gradient(145deg,#991b1b,#dc2626);color:#fff;text-align:center;padding:30px 24px 28px}.resident-alert-icon{width:62px;height:62px;border:3px solid #fff;border-radius:20px;transform:rotate(45deg);display:grid;place-items:center;margin:0 auto 22px;font-size:30px;font-weight:900}.resident-alert-icon::first-letter{transform:rotate(-45deg)}.resident-eyebrow{font-size:11px;font-weight:900;letter-spacing:.14em;opacity:.85}.resident-alert h1{font-size:28px;line-height:1.05;margin:8px 0 13px}.resident-alert p{line-height:1.5;margin:0 auto;max-width:390px;font-size:14px}.resident-event-time{margin-top:15px;font-size:11px;opacity:.8}
.resident-identity{margin:14px;background:#fff;border:1px solid #dfe6ed;border-radius:16px;padding:15px 16px;display:flex;justify-content:space-between;gap:15px;box-shadow:0 6px 24px #1720330b}.resident-identity span{display:block;color:#64748b;font-size:10px;margin-bottom:4px}.resident-identity strong{font-size:14px}.resident-unit{text-align:right}.resident-status-section,.resident-location-card{margin:14px;background:#fff;border:1px solid #dfe6ed;border-radius:16px;padding:16px;box-shadow:0 6px 24px #1720330b}.resident-section-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:13px}.resident-section-head>div{display:flex;align-items:center;gap:8px}.resident-section-head small{color:#64748b;font-size:10px}.resident-step{width:24px;height:24px;border-radius:50%;background:#0f766e;color:#fff;display:grid;place-items:center;font-size:11px;font-weight:900}.resident-status-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.resident-status{min-height:112px;border:0;border-radius:14px;color:#fff;padding:13px 10px;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:inset 0 -2px #0002;transition:transform .1s,filter .1s}.resident-status:active{transform:scale(.98)}.resident-status:disabled{filter:grayscale(.35);opacity:.65;cursor:wait}.resident-status>span{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#ffffff22;font-size:20px;font-weight:900;margin-bottom:6px}.resident-status strong{font-size:14px}.resident-status small{font-size:10px;margin-top:3px;opacity:.86}.resident-ok{background:#16a34a}.resident-evacuated{background:#2563eb}.resident-outside{background:#0891b2}.resident-help{background:#dc2626}.resident-status.is-current{outline:4px solid #0f172a;outline-offset:2px}
.resident-location-card p{color:#64748b;font-size:12px;line-height:1.45}.resident-location-state{font-size:10px;padding:5px 8px;border-radius:999px;background:#e2e8f0;color:#475569}.resident-location-state.ok{background:#dcfce7;color:#166534}.resident-location-state.warn{background:#fef3c7;color:#92400e}.resident-location-detail{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px;font-size:11px;color:#475569;margin:10px 0}.resident-location-button{width:100%;border:1px solid #cbd5e1;background:#fff;border-radius:10px;padding:11px;font-weight:800;color:#334155;cursor:pointer}.resident-result{margin:14px;border-radius:14px;padding:15px;text-align:center;font-size:13px;font-weight:700}.resident-result.ok{display:block!important;background:#dcfce7;color:#166534;border:1px solid #bbf7d0}.resident-result.err{display:block!important;background:#fee2e2;color:#991b1b;border:1px solid #fecaca}.resident-footer{text-align:center;padding:14px 20px 28px;color:#64748b}.resident-footer strong,.resident-footer span,.resident-footer small{display:block}.resident-footer strong{font-size:11px}.resident-footer span{font-size:11px;margin:5px 0}.resident-footer small{font-size:10px}
@media(max-width:380px){.resident-status-grid{grid-template-columns:1fr}.resident-status{min-height:85px}.resident-identity{display:block}.resident-unit{text-align:left;margin-top:10px}}
/* RC2.3 - fotos y localización operacional */
.person-avatar{width:38px;height:38px;border-radius:50%;object-fit:cover;border:2px solid #fff;box-shadow:0 0 0 1px #dbe4ed}.person-avatar-empty{display:grid;place-items:center;background:#dbe4ed;color:#64748b;font-weight:800}.photo-field{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.person-photo-preview,.person-photo-placeholder{width:82px;height:82px;border-radius:14px;object-fit:cover;border:1px solid #d8e0e8}.person-photo-placeholder{display:grid;place-items:center;background:#eef2f6;color:#64748b;font-size:12px}
.emergency-layout-grid{display:grid;grid-template-columns:260px 1fr;gap:16px;margin-top:16px}.building-stack{display:flex;flex-direction:column;gap:7px}.building-floor{border:1px solid #dce5ee;border-radius:10px;padding:9px 11px;background:#f8fafc;display:flex;justify-content:space-between;align-items:center;cursor:pointer}.building-floor.active{border-color:#0f766e;background:#ecfdf5}.floor-counts{display:flex;gap:5px;align-items:center}.floor-count-dot{width:9px;height:9px;border-radius:50%}.floor-count-dot.help{background:#dc2626}.floor-count-dot.warn{background:#f59e0b}.floor-count-dot.ok{background:#16a34a}.floor-plan-stage{position:relative;min-height:460px;border:1px solid #dce5ee;border-radius:14px;overflow:hidden;background:#e9eff5 center/contain no-repeat}.floor-plan-grid{position:absolute;inset:0;display:grid;grid-template-columns:repeat(4,1fr);grid-auto-rows:120px;gap:10px;padding:18px}.floor-unit{position:relative;border:1px solid #8294a8;background:#ffffffdc;border-radius:10px;min-width:80px;min-height:70px;padding:7px;box-shadow:0 4px 14px #33415518}.floor-unit.manual{position:absolute}.floor-unit-title{font-weight:800;font-size:12px}.unit-occupants{display:flex;flex-wrap:wrap;gap:4px;margin-top:7px}.occupant-marker{width:34px;height:34px;border-radius:50%;border:3px solid #94a3b8;background:#cbd5e1;object-fit:cover;display:grid;place-items:center;font-size:11px;font-weight:800;color:#0f172a;cursor:pointer}.occupant-marker.NEED_HELP{border-color:#dc2626;box-shadow:0 0 0 3px #fee2e2}.occupant-marker.NO_REPORT{border-color:#f59e0b}.occupant-marker.OK{border-color:#16a34a}.occupant-marker.EVACUATED{border-color:#2563eb}.occupant-marker.OUTSIDE{border-color:#0891b2}.occupant-marker.PRESENT{border-color:#7c3aed}.location-chip{display:inline-flex;gap:5px;align-items:center;font-size:11px;background:#e0f2fe;color:#075985;padding:4px 7px;border-radius:999px}.occupant-popover{position:absolute;z-index:5;width:260px;background:#081827;color:#fff;border-radius:12px;padding:12px;box-shadow:0 14px 40px #0006;display:none}.occupant-popover.open{display:block}.occupant-popover .muted{color:#a8b9c9}.gps-coords{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px}.resident-photo-mobile{width:48px;height:48px;border-radius:50%;object-fit:cover;border:2px solid #fff;box-shadow:0 0 0 1px #cad5df;margin-right:9px}
@media(max-width:1000px){.emergency-layout-grid{grid-template-columns:1fr}.building-stack{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr))}.floor-plan-stage{min-height:400px}}


/* RC2.3.1 - Dashboard de rescate visual */
.emergency-kpis .kpi{position:relative;overflow:hidden;border:1px solid #dbe4ee}.emergency-kpis .kpi:before{content:"";position:absolute;left:0;right:0;top:0;height:5px}.kpi-total:before{background:#334155}.kpi-no-report:before{background:#f59e0b}.kpi-ok:before{background:#16a34a}.kpi-evacuated:before{background:#2563eb}.kpi-outside:before{background:#0891b2}.kpi-help{background:#fff1f2!important;border-color:#fecdd3!important}.kpi-help:before{background:#dc2626}.kpi-help .value{color:#b91c1c}.kpi-no-report .value{color:#b45309}.kpi-ok .value{color:#15803d}.kpi-evacuated .value{color:#1d4ed8}.kpi-outside .value{color:#0e7490}
.floor-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.floor-toolbar>div:first-child>span,.rescue-section-head>div>span{font-size:10px;font-weight:800;letter-spacing:.11em;color:#64748b}.floor-toolbar h3,.rescue-section-head h3{margin:2px 0 0}.floor-toolbar-count{display:flex;gap:7px;align-items:baseline;color:#64748b}.floor-toolbar-count b{font-size:22px;color:#0f172a}.floor-toolbar-count span{font-size:11px}
.floor-plan-grid{grid-template-columns:repeat(3,minmax(230px,1fr));grid-auto-rows:minmax(190px,auto);gap:14px}.floor-unit{padding:0;border:2px solid #cbd5e1;overflow:hidden;background:#fff;min-height:180px}.floor-unit-head{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;background:#f8fafc;border-bottom:1px solid #e2e8f0}.floor-unit-head>div{display:flex;gap:6px;align-items:baseline}.floor-unit-head span{font-size:10px;color:#64748b}.floor-unit-head b{font-size:15px}.unit-count{background:#e2e8f0;border-radius:999px;padding:3px 7px}.unit-state-NEED_HELP{border-color:#dc2626;box-shadow:0 0 0 3px #fee2e2}.unit-state-NEED_HELP .floor-unit-head{background:#fee2e2}.unit-state-NO_REPORT{border-color:#f59e0b}.unit-state-NO_REPORT .floor-unit-head{background:#fef3c7}.unit-state-OK{border-color:#16a34a}.unit-state-OK .floor-unit-head{background:#dcfce7}.unit-state-EVACUATED{border-color:#2563eb}.unit-state-EVACUATED .floor-unit-head{background:#dbeafe}.unit-state-OUTSIDE{border-color:#0891b2}.unit-state-OUTSIDE .floor-unit-head{background:#cffafe}.unit-occupants{display:flex;flex-direction:column;gap:8px;padding:10px;margin:0}.unit-empty{padding:20px;text-align:center;color:#94a3b8;font-size:11px}
.occupant-card{width:100%;border:0;border-radius:12px;padding:8px;display:grid;grid-template-columns:58px 1fr auto;gap:9px;align-items:center;text-align:left;cursor:pointer;color:#0f172a}.occupant-card-photo{width:58px;height:58px;border-radius:12px;object-fit:cover;border:2px solid #fff;box-shadow:0 0 0 1px #cbd5e1}.occupant-card-initials{display:grid;place-items:center;background:#e2e8f0;font-weight:900}.occupant-card-data{min-width:0;display:flex;flex-direction:column}.occupant-card-data b{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.occupant-card-data small{font-size:10px;color:#475569;line-height:1.45}.occupant-gps{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.occupant-card-status{font-size:10px;font-weight:900;border-radius:999px;padding:5px 7px;white-space:nowrap}.occupant-card.state-NEED_HELP{background:#fee2e2}.occupant-card.state-NEED_HELP .occupant-card-status{background:#dc2626;color:#fff}.occupant-card.state-NO_REPORT{background:#fef3c7}.occupant-card.state-NO_REPORT .occupant-card-status{background:#f59e0b;color:#fff}.occupant-card.state-OK{background:#dcfce7}.occupant-card.state-OK .occupant-card-status{background:#16a34a;color:#fff}.occupant-card.state-EVACUATED{background:#dbeafe}.occupant-card.state-EVACUATED .occupant-card-status{background:#2563eb;color:#fff}.occupant-card.state-OUTSIDE{background:#cffafe}.occupant-card.state-OUTSIDE .occupant-card-status{background:#0891b2;color:#fff}.occupant-card.state-PRESENT{background:#ede9fe}.occupant-card.state-PRESENT .occupant-card-status{background:#7c3aed;color:#fff}
.rescue-section{padding:16px}.rescue-section-head{display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:14px}.rescue-person-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(360px,1fr));gap:14px}.rescue-person-card{border:2px solid #cbd5e1;border-radius:16px;overflow:hidden;background:#fff}.rescue-card-top{display:grid;grid-template-columns:84px 1fr auto;gap:14px;padding:15px;align-items:center}.rescue-card-photo{width:84px;height:84px;border-radius:16px;object-fit:cover;border:3px solid #fff;box-shadow:0 0 0 1px #cbd5e1}.rescue-card-initials{display:grid;place-items:center;background:#e2e8f0;font-size:24px;font-weight:900}.rescue-kind{font-size:9px;font-weight:900;letter-spacing:.12em;color:#64748b}.rescue-card-main h3{font-size:16px;margin:4px 0 8px}.rescue-location{display:flex;gap:7px}.rescue-location b{font-size:11px;background:#f1f5f9;padding:4px 7px;border-radius:7px}.rescue-state{min-width:105px;border-radius:12px;padding:10px;text-align:center}.rescue-state span{display:block;font-size:26px;font-weight:900}.rescue-state b{display:block;font-size:10px;margin-top:2px}.rescue-card-bottom{display:grid;grid-template-columns:1.4fr 1fr auto;gap:10px;border-top:1px solid #e2e8f0;padding:10px 14px;background:#f8fafc;align-items:center}.rescue-card-bottom>div{min-width:0}.rescue-card-bottom span{display:block;font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:#64748b}.rescue-card-bottom b{display:block;font-size:11px;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rescue-qr{white-space:nowrap}.rescue-person-card.state-NEED_HELP{border-color:#dc2626;box-shadow:0 0 0 3px #fee2e2}.rescue-person-card.state-NEED_HELP .rescue-card-top{background:#fff1f2}.rescue-person-card.state-NEED_HELP .rescue-state{background:#dc2626;color:#fff}.rescue-person-card.state-NO_REPORT{border-color:#f59e0b}.rescue-person-card.state-NO_REPORT .rescue-card-top{background:#fffbeb}.rescue-person-card.state-NO_REPORT .rescue-state{background:#f59e0b;color:#fff}.rescue-person-card.state-OK{border-color:#16a34a}.rescue-person-card.state-OK .rescue-card-top{background:#f0fdf4}.rescue-person-card.state-OK .rescue-state{background:#16a34a;color:#fff}.rescue-person-card.state-EVACUATED{border-color:#2563eb}.rescue-person-card.state-EVACUATED .rescue-card-top{background:#eff6ff}.rescue-person-card.state-EVACUATED .rescue-state{background:#2563eb;color:#fff}.rescue-person-card.state-OUTSIDE{border-color:#0891b2}.rescue-person-card.state-OUTSIDE .rescue-card-top{background:#ecfeff}.rescue-person-card.state-OUTSIDE .rescue-state{background:#0891b2;color:#fff}
.occupant-popover{width:330px}.rescue-pop-head{display:grid;grid-template-columns:72px 1fr;gap:12px;align-items:center}.rescue-pop-photo{width:72px;height:72px;border-radius:14px;object-fit:cover}.rescue-pop-initials{display:grid;place-items:center;background:#334155;font-weight:900}.rescue-pop-head small{font-size:9px;color:#94a3b8;letter-spacing:.1em}.rescue-pop-head h3{margin:3px 0;font-size:17px}.rescue-pop-status{display:inline-flex;margin-top:12px;border-radius:999px;padding:6px 9px;font-size:11px;font-weight:900}.rescue-pop-status.state-NEED_HELP{background:#dc2626}.rescue-pop-status.state-NO_REPORT{background:#f59e0b}.rescue-pop-status.state-OK{background:#16a34a}.rescue-pop-status.state-EVACUATED{background:#2563eb}.rescue-pop-status.state-OUTSIDE{background:#0891b2}.rescue-pop-status.state-PRESENT{background:#7c3aed}.rescue-pop-grid{display:grid;grid-template-columns:1fr;gap:8px;margin-top:10px}.rescue-pop-grid span{display:block;font-size:9px;color:#94a3b8;text-transform:uppercase}.rescue-pop-grid b{display:block;font-size:11px;margin-top:2px}
@media(max-width:1200px){.floor-plan-grid{grid-template-columns:repeat(2,minmax(220px,1fr))}.rescue-person-grid{grid-template-columns:1fr}}@media(max-width:700px){.rescue-card-top{grid-template-columns:72px 1fr}.rescue-card-photo{width:72px;height:72px}.rescue-state{grid-column:1/-1}.rescue-card-bottom{grid-template-columns:1fr}.floor-plan-grid{grid-template-columns:1fr}.occupant-card{grid-template-columns:52px 1fr}.occupant-card-photo{width:52px;height:52px}.occupant-card-status{grid-column:1/-1;text-align:center}}


.rescue-actions{display:flex;gap:7px;align-items:center;justify-content:flex-end;flex-wrap:wrap}.rescue-message{position:relative;white-space:nowrap}
.message-unread{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 5px;margin-left:3px;border-radius:999px;background:#dc2626;color:#fff;font-size:9px}
.message-template-row{display:flex;gap:7px;flex-wrap:wrap;margin:14px 0}.message-template{border:1px solid #cbd5e1;background:#f8fafc;border-radius:999px;padding:7px 10px;font-size:11px;font-weight:700;color:#334155;cursor:pointer}.message-template:hover{border-color:#0f766e;background:#ecfdf5;color:#065f46}
.message-channel-note{font-size:11px;color:#64748b;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:10px 12px;margin-top:12px}
.message-send-ok,.message-send-error{padding:10px 12px;border-radius:10px;font-size:12px;font-weight:700;margin-top:10px}.message-send-ok{background:#dcfce7;color:#166534;border:1px solid #86efac}.message-send-error{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.message-history{margin-top:18px;border-top:1px solid #e2e8f0;padding-top:14px}.message-history h3{font-size:13px;margin:0 0 9px}.message-history-item{display:grid;grid-template-columns:1fr auto;gap:10px;border-left:4px solid #0f766e;background:#f8fafc;padding:9px 10px;border-radius:9px;margin-bottom:7px}.message-history-item.priority-IMPORTANT{border-left-color:#f59e0b;background:#fffbeb}.message-history-item.priority-URGENT{border-left-color:#dc2626;background:#fff1f2}.message-history-item b,.message-history-item span{display:block;font-size:11px}.message-history-item span{color:#475569;margin-top:3px}.message-history-item small,.message-history-item em{display:block;text-align:right;font-size:9px;color:#64748b}.message-history-item em{font-style:normal;font-weight:800;margin-top:4px}
.empty-state.compact{padding:10px;font-size:11px}
@media(max-width:700px){.rescue-actions{justify-content:stretch}.rescue-actions .btn{flex:1}.message-history-item{grid-template-columns:1fr}.message-history-item small,.message-history-item em{text-align:left}}

/* ==========================================================
   RC2.6 - Standby / enrolamiento / editor visual por pisos
   ========================================================== */
.resident-enroll-cell{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.enrollment-modal-grid{display:grid;grid-template-columns:260px 1fr;gap:20px;align-items:center}
.enrollment-qr img{display:block;width:250px;max-width:100%;height:auto;border:1px solid #dbe3ea;border-radius:16px;padding:8px;background:#fff}

.floor-admin-layout{display:grid;grid-template-columns:250px minmax(0,1fr);gap:16px}
.floor-editor-card{min-width:0}
.floor-editor-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-end;margin-bottom:10px}
.floor-editor-head h2{margin:2px 0 0}
.floor-editor-actions{display:flex;gap:8px;flex-wrap:wrap}
.floor-upload-label{cursor:pointer}
.floor-editor-help{font-size:11px;color:#64748b;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:9px 11px;margin-bottom:10px}
.visual-floor-stage{position:relative;min-height:620px;border:2px solid #cbd5e1;border-radius:16px;overflow:hidden;background:#edf2f7 center/contain no-repeat}
.visual-floor-empty{position:absolute;inset:0;display:grid;place-content:center;text-align:center;gap:5px;color:#64748b;padding:30px;background:repeating-linear-gradient(45deg,#f8fafc,#f8fafc 12px,#f1f5f9 12px,#f1f5f9 24px)}
.visual-floor-empty span{font-size:11px}
.unit-editor-box{position:absolute;z-index:2;min-width:90px;min-height:70px;background:rgba(255,255,255,.94);border:2px solid #334155;border-radius:12px;overflow:hidden;box-shadow:0 5px 18px rgba(15,23,42,.16)}
.unit-editor-box.dragging{z-index:20;border-color:#2563eb;box-shadow:0 8px 26px rgba(37,99,235,.28)}
.unit-editor-drag{display:flex;justify-content:space-between;align-items:center;gap:5px;background:#0f172a;color:#fff;padding:7px 9px;cursor:grab;touch-action:none;user-select:none}
.unit-editor-drag:active{cursor:grabbing}
.unit-editor-drag small{display:block;font-size:8px;opacity:.72}
.unit-editor-drag b{font-size:13px}
.unit-editor-drag>span{font-size:10px;background:#334155;padding:3px 6px;border-radius:999px}
.unit-editor-residents{display:flex;align-items:center;gap:4px;padding:7px;min-height:38px}
.unit-editor-residents img,.unit-editor-residents>span{width:28px;height:28px;border-radius:50%;object-fit:cover;border:2px solid #fff;box-shadow:0 0 0 1px #cbd5e1}
.unit-editor-residents>span{display:grid;place-items:center;font-size:8px;font-weight:900;background:#e2e8f0}
.unit-editor-residents small{font-size:9px;color:#94a3b8}
.unit-editor-edit{position:absolute;right:5px;bottom:5px;border:0;border-radius:7px;background:#e2e8f0;width:28px;height:28px;cursor:pointer}
.floor-editor-legend{display:flex;gap:18px;flex-wrap:wrap;margin-top:9px;font-size:11px;color:#64748b}
.floor-editor-legend i{display:inline-block;width:8px;height:8px;border-radius:2px;background:#334155;margin-right:5px}
.emergency-resend-strip{margin-top:12px;border:1px solid #fecaca;background:#fff1f2;border-radius:12px;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.emergency-resend-strip div{display:flex;flex-direction:column}.emergency-resend-strip span{font-size:10px;color:#64748b;margin-top:2px}
.ack-ok{color:#15803d!important}.ack-pending{color:#b45309!important}
.occupant-card.state-EVACUATING{background:#e0f2fe}.occupant-card.state-EVACUATING .occupant-card-status{background:#0284c7;color:#fff}
.rescue-person-card.state-EVACUATING{border-color:#0284c7}.rescue-person-card.state-EVACUATING .rescue-card-top{background:#f0f9ff}.rescue-person-card.state-EVACUATING .rescue-state{background:#0284c7;color:#fff}
.unit-state-EVACUATING{border-color:#0284c7}.unit-state-EVACUATING .floor-unit-head{background:#e0f2fe}
@media(max-width:900px){.floor-admin-layout{grid-template-columns:1fr}.visual-floor-stage{min-height:500px}.enrollment-modal-grid{grid-template-columns:1fr}.enrollment-qr{display:grid;place-items:center}}

/* ==========================================================
   RC2.7 - Shell persistente / frame principal
   ========================================================== */
.shell-body{margin:0;overflow:hidden}
.shell-app{height:100vh;min-height:0}
.shell-main{height:100vh;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.shell-topbar{flex:0 0 auto}
.shell-top-left{display:flex;align-items:center;gap:8px}
.shell-menu-toggle{display:none;width:40px;height:40px;border:1px solid #dbe3ea;border-radius:10px;background:#fff;font-size:19px}
.main-frame-wrap{flex:1;min-height:0;overflow:hidden;background:#f4f7fa}
.main-frame{display:block;width:100%;height:100%;border:0;background:#f4f7fa}
.frame-body{margin:0;background:#f4f7fa;overflow:auto}
.frame-page{padding:20px 22px 32px;min-height:100%;box-sizing:border-box}
.frame-page .page-head{margin-top:0}
.clone-floor-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:8px}
.clone-floor-option{display:flex;gap:9px;align-items:center;border:1px solid #dbe3ea;border-radius:10px;padding:9px;background:#fff;cursor:pointer}
.clone-floor-option input{width:18px;height:18px}
.clone-floor-option span{display:flex;flex-direction:column}.clone-floor-option small{font-size:9px;color:#64748b;margin-top:2px}
.clone-plan-check{display:flex;align-items:center;gap:9px;min-height:44px;border:1px solid #dbe3ea;border-radius:10px;padding:0 12px}
.clone-plan-check input{width:18px;height:18px}
.layout-preview-note{font-size:11px;color:#475569;background:#eff6ff;border:1px solid #bfdbfe;padding:9px 11px;border-radius:10px;margin-top:12px}
@media(max-width:760px){
  .shell-menu-toggle{display:block}
  .shell-sidebar{position:fixed!important;z-index:100;left:-290px;top:0;bottom:0;width:270px!important;transition:left .2s ease}
  .shell-menu-open .shell-sidebar{left:0}
  .shell-main{margin-left:0!important;width:100%!important}
  .shell-topbar{padding-left:10px}
  .frame-page{padding:14px 12px 28px}
}

/* RC2.7.1 - Frame fix / eliminar layout */
.floor-editor-actions .btn-danger{white-space:nowrap}
.frame-body .sidebar,
.frame-body .topbar{display:none!important}
.frame-body .app{display:block!important;min-height:0!important}

/* RC2.7.2 - Residentes sin departamento */
.field small{display:block;margin-top:5px;font-size:10px;color:#64748b;line-height:1.35}
[data-resident-unassign]{white-space:nowrap}

/* ==========================================================
   RC2.8 - Floor Layout Designer
   ========================================================== */
.designer-shell{display:grid;grid-template-columns:230px minmax(0,1fr);gap:14px}
.designer-left{display:flex;flex-direction:column;gap:12px}
.designer-floor-list{padding:12px}.designer-panel-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.designer-floors{display:flex;flex-direction:column}.designer-floor-row{display:flex;justify-content:space-between;text-align:left;border:1px solid #dbe3ea;border-bottom:0;background:#fff;padding:11px 12px;cursor:pointer;min-height:58px}.designer-floor-row:first-child{border-radius:10px 10px 0 0}.designer-floor-row:last-child{border-bottom:1px solid #dbe3ea;border-radius:0 0 10px 10px}.designer-floor-row.active{background:#e8faf5;border:1px solid #16a085;border-radius:10px}.designer-floor-row span:first-child{display:flex;flex-direction:column}.designer-floor-row small{font-size:9px;color:#64748b;margin-top:3px}.floor-row-handle{color:#94a3b8}
.floor-actions-card,.designer-tip{padding:13px;display:flex;flex-direction:column;gap:8px}.designer-tip{font-size:11px;color:#475569}.designer-tip b{color:#2563eb}.designer-tip p{margin:0;line-height:1.45}
.btn-danger-soft{background:#fff1f2;color:#b91c1c;border:1px solid #fecaca}.btn-danger-soft:hover{background:#ffe4e6}
.designer-main{padding:14px;min-width:0}.designer-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.designer-head h2{margin:2px 0 0}.designer-head-actions{display:flex;gap:8px}
.designer-toolbar{display:flex;align-items:center;gap:4px;flex-wrap:wrap;margin-top:12px;padding:5px;border:1px solid #dbe3ea;border-radius:9px;background:#fff}.tool-btn{border:0;background:transparent;border-radius:7px;padding:7px 8px;font-size:10px;cursor:pointer;color:#334155}.tool-btn span{margin-right:4px}.tool-btn.active{background:#dff7ef;color:#065f46;font-weight:800}.tool-btn:hover{background:#f1f5f9}
.designer-instruction{font-size:10px;color:#64748b;padding:9px 3px}
.designer-work-area{display:grid;grid-template-columns:minmax(0,1fr) 250px;gap:10px;align-items:stretch}.designer-canvas-column{position:relative;min-width:0}.designer-properties{border:1px solid #dbe3ea;border-radius:10px;background:#fff;min-width:0;overflow:hidden}
.floor-designer-stage{position:relative;min-height:620px;border:1px solid #cbd5e1;border-radius:11px;background:#eef3f7 center/contain no-repeat;overflow:hidden;touch-action:none}.floor-designer-stage.preview .resize-handle{display:none}.designer-grid-bg{position:absolute;inset:0;background-image:linear-gradient(#dbe3ea 1px,transparent 1px),linear-gradient(90deg,#dbe3ea 1px,transparent 1px);background-size:4% 4%;opacity:.45}
.designer-canvas-tools{position:absolute;z-index:80;left:9px;top:9px;display:flex;flex-direction:column}.designer-canvas-tools button{width:30px;height:30px;border:1px solid #cbd5e1;background:#fff;font-weight:900}.designer-canvas-tools button:first-child{border-radius:7px 7px 0 0}.designer-canvas-tools button:last-child{border-radius:0 0 7px 7px}
.layout-unit{position:absolute;box-sizing:border-box;border-style:solid;transform-origin:center;background:rgba(255,255,255,.94);cursor:move;min-width:34px;min-height:30px}.layout-unit.selected{outline:2px solid #3b82f6;outline-offset:2px}.layout-unit-card{position:absolute;left:8%;top:8%;min-width:82px;max-width:86%;background:rgba(255,255,255,.96);border:1px solid #94a3b8;border-radius:10px;padding:7px 8px;box-shadow:0 3px 10px rgba(15,23,42,.08);display:grid;grid-template-columns:1fr auto;gap:3px;transform:rotate(0deg)}.layout-unit-card b{font-size:12px}.layout-unit-card small{display:block;font-size:8px;color:#475569}.resident-live-dot{width:7px;height:7px;border-radius:50%;background:#10b981;margin-top:3px}.layout-faces{grid-column:1/-1;display:flex;gap:3px;margin-top:3px}.layout-faces img,.layout-faces span{width:21px;height:21px;border-radius:50%;object-fit:cover;display:grid;place-items:center;background:#e2e8f0;font-size:7px;font-weight:800}
.resize-handle{position:absolute;width:9px;height:9px;background:#60a5fa;border:1px solid #fff;border-radius:50%;z-index:90}.resize-handle.nw{left:-5px;top:-5px;cursor:nwse-resize}.resize-handle.n{left:50%;top:-5px;cursor:ns-resize}.resize-handle.ne{right:-5px;top:-5px;cursor:nesw-resize}.resize-handle.e{right:-5px;top:50%;cursor:ew-resize}.resize-handle.se{right:-5px;bottom:-5px;cursor:nwse-resize}.resize-handle.s{left:50%;bottom:-5px;cursor:ns-resize}.resize-handle.sw{left:-5px;bottom:-5px;cursor:nesw-resize}.resize-handle.w{left:-5px;top:50%;cursor:ew-resize}
.layout-element{position:absolute;display:grid;place-items:center;cursor:move;transform-origin:center;min-width:14px;min-height:14px}.layout-element.selected{outline:2px solid #3b82f6;outline-offset:2px;border-radius:4px}.layout-element-glyph{font-size:clamp(13px,1.5vw,24px);font-weight:900;line-height:1}.layout-element.type-WINDOW .layout-element-glyph{width:100%;height:4px;background:currentColor;font-size:0}.layout-element.type-DOOR{border:2px solid currentColor;border-left:0;border-bottom:0;border-radius:0 100% 0 0}.layout-element.type-DOOR .layout-element-glyph{display:none}.layout-element.type-EMERGENCY_EXIT{background:#059669;color:#fff!important;border-radius:3px}.layout-element.type-POWER_OUTLET{background:#fff8db;border:1px solid #f59e0b;border-radius:4px}.layout-element.type-ELEVATOR{border:2px solid #64748b;background:#e2e8f0}.layout-element.type-STAIR{border:1px solid #64748b;background:repeating-linear-gradient(0deg,#e2e8f0,#e2e8f0 5px,#64748b 6px,#64748b 7px)}
.designer-bottom-legend{display:flex;gap:10px;flex-wrap:wrap;padding:8px 2px;font-size:8px;color:#64748b}.designer-footer{display:flex;justify-content:space-between;gap:12px;align-items:center;border-top:1px solid #e2e8f0;margin-top:5px;padding-top:9px}.designer-footer>div{display:flex;gap:16px;align-items:center}.designer-footer span{font-size:9px;color:#64748b}
.properties-empty{padding:16px;color:#64748b;font-size:11px}.properties-empty p{line-height:1.45}.properties-head{display:flex;justify-content:space-between;align-items:center;padding:12px;border-bottom:1px solid #e2e8f0}.properties-head>div{display:flex;gap:5px}.icon-btn{border:1px solid #dbe3ea;background:#f8fafc;border-radius:7px;width:30px;height:30px;cursor:pointer}.icon-btn.danger{color:#dc2626}.properties-section{padding:12px;border-bottom:1px solid #e2e8f0}.properties-section>b{font-size:10px;display:block;margin-bottom:8px}.properties-section-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.prop-field{display:block;margin-bottom:8px}.prop-field span{display:block;font-size:8px;color:#64748b;margin-bottom:3px}.prop-field input{width:100%;height:32px;border:1px solid #dbe3ea;border-radius:6px;padding:5px 7px;font-size:10px;box-sizing:border-box}.prop-field input[type=color]{padding:3px}.prop-two{display:grid;grid-template-columns:1fr 1fr;gap:7px}.prop-residents{display:flex;flex-direction:column;gap:7px}.prop-residents>div{display:flex;align-items:center;gap:7px}.prop-residents img,.prop-residents span{width:24px;height:24px;border-radius:50%;object-fit:cover;display:grid;place-items:center;background:#e2e8f0;font-size:7px}.prop-residents b{font-size:9px}.prop-residents small{font-size:9px;color:#94a3b8}
.more-tools-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.more-tool{border:1px solid #dbe3ea;border-radius:9px;background:#fff;padding:14px 8px;display:flex;flex-direction:column;gap:5px;align-items:center;cursor:pointer}.more-tool b{font-size:22px}.more-tool span{font-size:10px}
@media(max-width:1150px){.designer-shell{grid-template-columns:190px minmax(0,1fr)}.designer-work-area{grid-template-columns:minmax(0,1fr) 215px}.floor-designer-stage{min-height:520px}}
@media(max-width:900px){.designer-shell{grid-template-columns:1fr}.designer-left{display:grid;grid-template-columns:1fr 1fr}.designer-tip{display:none}.designer-work-area{grid-template-columns:1fr}.designer-properties{order:-1}.floor-designer-stage{min-height:520px}}
@media(max-width:600px){.designer-left{grid-template-columns:1fr}.designer-head{align-items:flex-start;flex-direction:column}.designer-toolbar{overflow-x:auto;flex-wrap:nowrap}.tool-btn{white-space:nowrap}.designer-footer{flex-direction:column;align-items:flex-start}.floor-designer-stage{min-height:430px}.prop-two{grid-template-columns:1fr}}

/* ==========================================================
   RC2.8.2 - Paredes y estructura del piso
   ========================================================== */
.tool-btn[data-tool="WALL"]{font-weight:800}
.layout-element.type-WALL{
  min-width:8px;
  min-height:3px;
  border-radius:1px;
  box-shadow:0 0 0 1px rgba(15,23,42,.06);
}
.layout-element.type-WALL .layout-element-glyph{display:none}
.layout-element.type-WALL.selected{outline-offset:4px}
.wall-draft{
  position:absolute;
  z-index:100;
  min-height:4px;
  background:#ef4444;
  border:1px solid #dc2626;
  transform-origin:center;
  pointer-events:none;
  opacity:.9;
}
.wall-property-help{
  margin-top:7px;
  padding:8px;
  border-radius:7px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  font-size:9px;
  color:#64748b;
  line-height:1.4;
}

/* RC2.8.3 - Movimiento libre real */
.layout-unit.is-dragging,
.layout-element.is-dragging{
  cursor:grabbing!important;
  box-shadow:0 8px 24px rgba(37,99,235,.20);
}
.layout-unit,
.layout-element{
  user-select:none;
  -webkit-user-select:none;
}
.floor-designer-stage{
  overscroll-behavior:contain;
}

/* RC2.8.4 - Resize estable */
.layout-unit.is-resizing,
.layout-element.is-resizing{
  outline:2px solid #2563eb;
  outline-offset:3px;
}

/* ==========================================================
   RC2.8.5 - Layout operacional idéntico al diseñador
   ========================================================== */

/* Misma proporción geométrica en edición y operación.
   Los objetos usan porcentajes, por lo que compartir aspect-ratio evita
   que un departamento cambie de forma entre vistas. */
.floor-designer-stage,
.emergency-operational-stage{
  aspect-ratio:16 / 10;
  min-height:0!important;
}

.emergency-operational-stage{
  position:relative;
  width:100%;
  overflow:hidden;
  border:1px solid #cbd5e1;
  border-radius:12px;
  background:#eef3f7 center/contain no-repeat;
}

.em-operational-grid-bg{
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(#dbe3ea 1px,transparent 1px),
    linear-gradient(90deg,#dbe3ea 1px,transparent 1px);
  background-size:4% 4%;
  opacity:.45;
  pointer-events:none;
}

.em-operational-unit{
  position:absolute;
  box-sizing:border-box;
  border-style:solid;
  border-color:var(--configured-border,#1e293b);
  transform-origin:center;
  min-width:18px;
  min-height:18px;
  box-shadow:none;
}

.em-unit-summary{
  position:absolute;
  left:7%;
  top:7%;
  min-width:76px;
  max-width:88%;
  padding:6px 7px;
  box-sizing:border-box;
  display:grid;
  grid-template-columns:1fr auto;
  gap:2px 5px;
  background:rgba(255,255,255,.95);
  border:1px solid #94a3b8;
  border-radius:9px;
  box-shadow:0 3px 10px rgba(15,23,42,.08);
  transform:rotate(0deg);
  color:#0f172a;
}

.em-unit-summary b{font-size:11px}
.em-unit-summary small{display:block;font-size:7px;color:#64748b}
.em-unit-summary>i{
  width:7px;height:7px;border-radius:50%;
  background:#10b981;margin-top:3px
}

.operational-occupants{
  grid-column:1/-1;
  display:flex;
  align-items:center;
  gap:3px;
  margin-top:3px;
}
.operational-person{
  width:23px;height:23px;
  padding:0;border:2px solid #94a3b8;border-radius:50%;
  background:#e2e8f0;
  overflow:hidden;
  cursor:pointer;
}
.operational-person img{
  display:block;width:100%;height:100%;object-fit:cover
}
.operational-person>span{
  display:grid;place-items:center;width:100%;height:100%;
  font-size:7px;font-weight:900
}
.operational-person.state-NEED_HELP{border-color:#dc2626;box-shadow:0 0 0 2px #fee2e2}
.operational-person.state-NO_REPORT{border-color:#f59e0b}
.operational-person.state-EVACUATING{border-color:#0284c7}
.operational-person.state-OK{border-color:#16a34a}
.operational-person.state-EVACUATED{border-color:#2563eb}
.operational-person.state-OUTSIDE{border-color:#0891b2}
.operational-person.state-PRESENT{border-color:#7c3aed}
.operational-more{
  display:grid;place-items:center;
  min-width:23px;height:23px;border-radius:50%;
  background:#334155;color:#fff;font-size:7px;font-weight:900
}

/* Estado operacional sin destruir la geometría/estilo configurado. */
.em-operational-unit.unit-state-NEED_HELP{outline:3px solid #dc2626;outline-offset:2px}
.em-operational-unit.unit-state-NO_REPORT{outline:2px solid #f59e0b;outline-offset:1px}
.em-operational-unit.unit-state-EVACUATING{outline:2px solid #0284c7;outline-offset:1px}
.em-operational-unit.unit-state-OK{outline:2px solid #16a34a;outline-offset:1px}
.em-operational-unit.unit-state-EVACUATED{outline:2px solid #2563eb;outline-offset:1px}
.em-operational-unit.unit-state-OUTSIDE{outline:2px solid #0891b2;outline-offset:1px}

/* Elementos estructurales: mismas reglas visuales del diseñador. */
.em-layout-element{
  position:absolute;
  display:grid;
  place-items:center;
  transform-origin:center;
  min-width:8px;
  min-height:8px;
  pointer-events:none;
}
.em-layout-element>span{
  font-size:clamp(11px,1.4vw,22px);
  font-weight:900;
  line-height:1;
}
.em-layout-element.type-WALL{
  min-width:8px;min-height:3px;border-radius:1px
}
.em-layout-element.type-WINDOW>span{
  width:100%;height:4px;background:currentColor;font-size:0
}
.em-layout-element.type-DOOR{
  border:2px solid currentColor;
  border-left:0;border-bottom:0;
  border-radius:0 100% 0 0
}
.em-layout-element.type-DOOR>span{display:none}
.em-layout-element.type-EMERGENCY_EXIT{
  background:#059669;color:#fff!important;border-radius:3px
}
.em-layout-element.type-POWER_OUTLET{
  background:#fff8db;border:1px solid #f59e0b;border-radius:4px
}
.em-layout-element.type-ELEVATOR{
  border:2px solid #64748b;background:#e2e8f0
}
.em-layout-element.type-STAIR{
  border:1px solid #64748b;
  background:repeating-linear-gradient(0deg,#e2e8f0,#e2e8f0 5px,#64748b 6px,#64748b 7px)
}

@media(max-width:900px){
  .emergency-operational-stage{min-height:0!important}
  .em-unit-summary{min-width:60px;padding:4px 5px}
  .em-unit-summary b{font-size:9px}
  .operational-person{width:19px;height:19px}
}

/* RC2.8.7 - Escala 1:1 y ficha GPS */
:root{--floor-layout-canvas-width:1120px;--floor-layout-canvas-height:700px}
.designer-canvas-scroll,.emergency-operational-scroll{width:100%;overflow:auto;overscroll-behavior:contain;border-radius:12px}
.floor-designer-stage,.emergency-operational-stage{
  width:var(--floor-layout-canvas-width)!important;
  height:var(--floor-layout-canvas-height)!important;
  min-width:var(--floor-layout-canvas-width)!important;
  min-height:var(--floor-layout-canvas-height)!important;
  max-width:none!important;
  aspect-ratio:auto!important;
  flex:0 0 auto
}
.em-unit-summary{z-index:300}
.operational-occupants{position:relative;z-index:350}
.em-layout-element.type-WALL{z-index:5!important}
.occupant-popover{
  position:fixed!important;
  z-index:2147483000!important;
  max-width:calc(100vw - 24px);
  max-height:calc(100vh - 24px);
  overflow:auto;
  background:#081827;
  color:#fff;
  border:1px solid #20374a;
  border-radius:14px;
  padding:14px;
  box-sizing:border-box;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
  display:none
}
.occupant-popover.open{display:block!important}
.occupant-pop-close{position:absolute;right:9px;top:9px;width:30px;height:30px;border:1px solid #365166;border-radius:8px;background:#10283b;color:#fff;cursor:pointer;font-size:18px}
.occupant-phone{display:inline-flex;margin-top:3px;color:#7dd3fc;font-size:13px;font-weight:900;text-decoration:none}
.gps-accuracy{display:block;margin-top:3px;color:#a8b9c9;font-size:9px}
.occupant-map-button{display:flex;align-items:center;justify-content:center;width:100%;margin-top:12px;min-height:42px;background:#0f766e;border-color:#0f766e;color:#fff!important;text-decoration:none}
.occupant-no-map{margin-top:12px;padding:9px 10px;border:1px solid #365166;border-radius:8px;color:#a8b9c9;font-size:10px}
.rescue-phone{margin-top:4px;color:#475569;font-size:10px;font-weight:700}

/* ==========================================================
   RC2.8.8 - Geocerca + dashboard compacto
   ========================================================== */
.emergency-kpi-strip{
  display:grid;
  grid-template-columns:repeat(8,minmax(118px,1fr));
  gap:10px;
  overflow-x:auto;
  padding-bottom:4px;
  margin-bottom:12px;
}
.emergency-kpi-strip .kpi{
  min-width:118px;
  min-height:76px;
  padding:12px 14px;
}
.kpi-false-alarm{
  border-top:4px solid #7c3aed!important;
  background:#faf5ff!important;
}
.kpi-false-alarm .value{color:#6d28d9!important}

.compact-emergency-card{padding:16px 18px!important}
.compact-emergency-card .emergency-title{margin-bottom:8px}
.compact-emergency-card h2{margin:3px 0 0}
.compact-emergency-card p{margin:8px 0;max-width:none}
.emergency-context{font-weight:900;letter-spacing:.06em;text-transform:uppercase}
.emergency-card-actions{display:flex;gap:8px;margin-top:10px}

.emergency-operational-scroll{
  min-height:0!important;
}
.emergency-layout-grid>.card:nth-child(2){
  padding-bottom:10px!important;
}

.rescue-person-grid.compact-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:7px;
}
.compact-rescue-section{padding:12px 14px!important}
.compact-rescue-section .rescue-section-head{margin-bottom:8px}
.compact-rescue-section .rescue-section-head h3{margin:2px 0 0}

.rescue-person-card.compact{
  min-height:0!important;
  padding:0!important;
  border-width:1px!important;
}
.rescue-compact-main{
  display:grid;
  grid-template-columns:52px minmax(190px,1.3fr) minmax(250px,1fr) 125px auto;
  align-items:center;
  gap:10px;
  padding:8px 10px;
}
.rescue-person-card.compact .rescue-card-photo{
  width:48px!important;height:48px!important;border-radius:10px!important
}
.rescue-person-card.compact .rescue-card-main h3{
  margin:1px 0 3px;font-size:13px
}
.rescue-person-card.compact .rescue-kind{font-size:8px}
.rescue-person-card.compact .rescue-location{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:9px
}
.rescue-person-card.compact .rescue-location a{
  color:#0f766e;text-decoration:none;font-weight:800
}
.rescue-compact-meta{
  display:flex;gap:14px;align-items:center;flex-wrap:wrap;
  font-size:8px;color:#64748b
}
.rescue-compact-meta span{display:flex;flex-direction:column}
.rescue-compact-meta b{color:#0f172a;font-size:9px;margin-top:2px}
.rescue-person-card.compact .rescue-state{
  min-height:42px!important;padding:6px 9px!important
}
.compact-actions{display:flex!important;gap:5px!important}
.compact-actions .btn{min-width:42px!important;padding:7px 8px!important}

.b-false-alarm{background:#f3e8ff!important;color:#6d28d9!important}
.state-POSSIBLE_FALSE_ALARM{border-color:#7c3aed!important}
.operational-person.state-POSSIBLE_FALSE_ALARM{
  border-color:#7c3aed!important;
  box-shadow:0 0 0 3px #ede9fe!important
}
.em-operational-unit.unit-state-POSSIBLE_FALSE_ALARM{
  outline:3px dashed #7c3aed!important;outline-offset:2px
}
.rescue-pop-status.state-POSSIBLE_FALSE_ALARM{
  background:#6d28d9!important;color:#fff!important
}
.false-alarm-warning{
  margin:10px 0;
  padding:10px;
  border:1px solid #c4b5fd;
  background:#f5f3ff;
  color:#4c1d95;
  border-radius:9px;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.false-alarm-warning b{font-size:12px}
.false-alarm-warning span{font-size:10px}
.false-alarm-warning small{font-size:9px;color:#6d28d9}

.occupant-whatsapp,.mini-whatsapp{
  display:inline-flex!important;
  align-items:center;
  gap:5px;
  color:#16a34a!important;
  font-weight:900!important;
  text-decoration:none!important;
}
.occupant-whatsapp{
  margin-top:7px;
  padding:6px 8px;
  border:1px solid #166534;
  background:#052e16;
  border-radius:7px;
}
.occupant-whatsapp i,.mini-whatsapp i{
  display:grid;
  place-items:center;
  width:17px;height:17px;
  border-radius:50%;
  background:#22c55e;
  color:#fff;
  font-style:normal;
  font-size:10px;
}

.alert-context-preview{
  display:flex;
  gap:10px;
  align-items:center;
  padding:9px 11px;
  margin-bottom:12px;
  border:1px solid #bae6fd;
  background:#f0f9ff;
  border-radius:9px;
  font-size:11px;
}
.alert-context-preview b{color:#0369a1}
.alert-context-preview span{color:#334155}

@media(max-width:1100px){
  .rescue-compact-main{
    grid-template-columns:48px minmax(170px,1fr) minmax(210px,1fr) 110px auto
  }
}
@media(max-width:800px){
  .rescue-compact-main{
    grid-template-columns:48px 1fr auto;
  }
  .rescue-compact-meta{
    grid-column:2/-1;
  }
  .compact-actions{grid-column:2/-1}
}

/* ==========================================================
   RC2.8.9 - Dashboard 3 columnas / plano fit / menu colapsable
   ========================================================== */

/* Hamburguesa disponible también en escritorio */
.shell-menu-toggle{
  display:grid!important;
  place-items:center;
  flex:0 0 40px;
}
.shell-sidebar-hidden .shell-sidebar{
  transform:translateX(-105%);
  pointer-events:none;
}
.shell-sidebar{
  transition:transform .2s ease,left .2s ease;
}
.shell-sidebar-hidden .shell-app{
  grid-template-columns:0 1fr!important;
}
.shell-sidebar-hidden .shell-main{
  grid-column:1/-1!important;
  width:100%!important;
}
.shell-sidebar-hidden .main-frame-wrap{
  width:100%;
}

/* Plano operacional: ajusta al espacio. Sin scroll interno. */
.emergency-operational-scroll{
  width:100%!important;
  height:auto!important;
  overflow:hidden!important;
  border-radius:12px;
}
.emergency-operational-scroll .emergency-operational-stage{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  aspect-ratio:1120 / 700!important;
}
.emergency-layout-grid{
  align-items:start;
}
.emergency-layout-grid>.card{
  overflow:hidden;
}

/* Residentes: 3 tarjetas por fila */
.rescue-person-grid.compact-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:10px!important;
}
.resident-tile{
  min-width:0;
  padding:10px!important;
  border-radius:12px!important;
}
.resident-tile-top{
  display:grid;
  grid-template-columns:46px minmax(0,1fr) auto;
  gap:8px;
  align-items:center;
}
.resident-tile .rescue-card-photo{
  width:44px!important;
  height:44px!important;
  border-radius:9px!important;
}
.resident-tile-main{
  min-width:0;
}
.resident-tile-main h3{
  margin:1px 0 4px!important;
  font-size:11px!important;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.resident-tile-location{
  display:flex;
  gap:5px;
  flex-wrap:wrap;
}
.resident-tile-location span{
  background:#f1f5f9;
  border-radius:6px;
  padding:3px 5px;
  font-size:8px;
  font-weight:800;
}
.resident-tile-state{
  min-width:66px;
  min-height:44px;
  border-radius:8px;
  padding:5px 6px;
  background:#0e7490;
  color:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:900;
  text-align:center;
}
.resident-tile-state span{
  font-size:7px;
  margin-top:2px;
}
.resident-tile-contact{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:7px;
  min-height:22px;
}
.resident-tile-contact>a,
.resident-tile-contact>span{
  font-size:8px;
  font-weight:800;
  color:#0f172a;
  text-decoration:none;
}
.mini-whatsapp.icon-only,
.occupant-whatsapp.icon-only{
  display:inline-grid!important;
  place-items:center;
  width:28px!important;
  height:28px!important;
  min-width:28px!important;
  padding:0!important;
  border-radius:50%!important;
  background:#22c55e!important;
  border:0!important;
  color:#fff!important;
  font-size:16px!important;
}
.mini-whatsapp.icon-only i,
.occupant-whatsapp.icon-only i{
  width:auto!important;
  height:auto!important;
  background:transparent!important;
  font-size:16px!important;
}
.resident-tile-meta{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:5px;
  margin-top:7px;
  padding-top:7px;
  border-top:1px solid #e2e8f0;
}
.resident-tile-meta span{
  min-width:0;
  display:flex;
  flex-direction:column;
}
.resident-tile-meta small{
  font-size:7px;
  color:#64748b;
}
.resident-tile-meta b{
  margin-top:2px;
  font-size:8px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.resident-tile-actions{
  display:flex;
  justify-content:flex-end;
  gap:5px;
  margin-top:7px;
}
.resident-tile-actions .btn{
  padding:6px 8px!important;
  min-width:34px!important;
}

/* Configuración de edificios */
.building-config-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  margin-bottom:16px;
}
.building-config-card{
  background:#fff;
  border:1px solid #dfe6ed;
  border-radius:14px;
  padding:14px;
  box-shadow:0 8px 30px #1720330b;
}
.building-config-card.active{
  border-color:#0f766e;
  box-shadow:0 0 0 2px rgba(15,118,110,.12);
}
.building-config-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.building-config-head h3{
  margin:2px 0 0;
  font-size:15px;
}
.building-config-meta{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:12px 0;
  color:#64748b;
  font-size:10px;
}
.building-config-meta i{
  width:15px;
  color:#0f766e;
}
.building-config-actions{
  display:flex;
  gap:7px;
}
.building-config-actions .btn{
  flex:1;
}
.building-current-card{
  margin-top:10px;
}
.building-current-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.building-current-head h2{
  margin:2px 0 0;
}
.building-current-info{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-top:14px;
}
.building-current-info>div{
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:9px;
  padding:10px;
  display:flex;
  flex-direction:column;
}
.building-current-info span{
  font-size:8px;
  color:#64748b;
}
.building-current-info b{
  margin-top:3px;
  font-size:10px;
}

@media(max-width:1150px){
  .rescue-person-grid.compact-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .building-config-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  .rescue-person-grid.compact-grid{grid-template-columns:1fr!important}
  .building-config-grid{grid-template-columns:1fr}
  .building-current-info{grid-template-columns:1fr 1fr}
  .shell-sidebar-hidden .shell-sidebar{transform:none}
}

/* ==========================================================
   RC2.9.0 - Emergency Command UI approved
   ========================================================== */

/* Main emergency banner */
.command-emergency-banner{
  display:grid;
  grid-template-columns:48px minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  min-height:82px;
  padding:14px 16px;
  margin-bottom:12px;
  border-radius:12px;
  background:linear-gradient(105deg,#b5161c,#d01018);
  color:#fff;
  box-shadow:0 8px 24px rgba(185,28,28,.16);
}
.command-emergency-icon{
  width:44px;height:44px;
  display:grid;place-items:center;
  font-size:29px;
}
.command-emergency-copy>span{
  font-size:9px;font-weight:900;letter-spacing:.1em;
}
.command-emergency-line{
  display:flex;align-items:center;gap:12px;margin-top:2px;
}
.command-emergency-line h2{
  margin:0;font-size:22px;line-height:1.05;
}
.command-emergency-line>i{
  display:block;width:1px;height:24px;background:rgba(255,255,255,.75)
}
.command-emergency-line>b{
  font-size:10px;letter-spacing:.02em
}
.command-emergency-copy p{
  margin:6px 0 0;
  font-size:10px;
  opacity:.9;
}
.command-emergency-actions{
  display:flex;gap:7px;
}
.command-emergency-actions .btn{
  min-height:40px;
  background:#fff!important;
  color:#991b1b!important;
  border-color:#fee2e2!important;
  font-weight:800;
}

/* KPI row matching approved mockup */
.command-kpis{
  display:grid!important;
  grid-template-columns:repeat(8,minmax(118px,1fr))!important;
  gap:8px!important;
  margin-bottom:12px!important;
}
.command-kpi{
  display:grid!important;
  grid-template-columns:34px 1fr;
  align-items:center;
  gap:8px;
  min-height:70px!important;
  padding:10px 11px!important;
  border:1px solid #e2e8f0!important;
  border-top:0!important;
  background:#fff!important;
}
.command-kpi>i{
  font-size:22px;
  text-align:center;
}
.command-kpi>div{
  display:flex;
  flex-direction:column;
}
.command-kpi span{
  font-size:8px;color:#64748b;
}
.command-kpi b{
  margin-top:2px;font-size:21px;color:#0f172a;
}
.command-kpi.kpi-total>i{color:#2563eb}
.command-kpi.kpi-alerted>i{color:#f59e0b}
.command-kpi.kpi-ok>i{color:#16a34a}
.command-kpi.kpi-evacuating>i{color:#2563eb}
.command-kpi.kpi-help>i{color:#dc2626}
.command-kpi.kpi-no-report>i{color:#fb923c}
.command-kpi.kpi-safe>i{color:#22c55e}
.command-kpi.kpi-false-alarm>i{color:#9333ea}

/* Operational plan: crop blank bottom without modifying geometry */
.emergency-operational-scroll{
  position:relative;
  overflow:hidden!important;
  transition:height .15s ease;
}
.emergency-operational-stage{
  transform-origin:top left;
}
.emergency-layout-grid{
  grid-template-columns:205px minmax(0,1fr)!important;
  gap:10px!important;
}
.emergency-layout-grid>.card{
  padding:12px!important;
}
.emergency-layout-grid .section-title{
  margin:0 0 8px!important;
  font-size:13px!important;
}
.floor-toolbar{
  margin-bottom:5px!important;
}
.floor-toolbar h3{
  margin:2px 0 0!important;
  font-size:16px!important;
}

/* Residents section */
.command-residents-section{
  padding:12px!important;
}
.command-residents-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:9px;
}
.command-residents-head h3{
  margin:0;
  font-size:15px;
}
.command-residents-head>div:first-child>span{
  display:block;
  margin-top:4px;
  color:#64748b;
  font-size:8px;
}
.command-view-toggle{
  display:flex;
  align-items:center;
  gap:5px;
  color:#64748b;
  font-size:8px;
}
.command-view-toggle button{
  width:30px;height:30px;
  display:grid;place-items:center;
  padding:0;
  border:1px solid #dbe3ea;
  border-radius:7px;
  background:#fff;
  color:#475569;
}
.command-view-toggle button.active{
  background:#10283b;color:#fff;border-color:#10283b;
}

.resident-command-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.resident-command-card{
  position:relative;
  display:flex;
  flex-direction:column;
  min-width:0;
  border:1.5px solid #22c55e;
  border-radius:11px;
  background:#fff;
  overflow:hidden;
  box-shadow:0 3px 12px rgba(15,23,42,.04);
}
.resident-command-card.state-evacuating{border-color:#3b82f6}
.resident-command-card.state-false-alarm{border-color:#a855f7}
.resident-command-card.state-need-help{border-color:#ef4444}
.resident-command-card.state-no-report{border-color:#f59e0b}

.resident-command-top{
  display:grid;
  grid-template-columns:62px minmax(0,1fr);
  gap:10px;
  padding:12px 12px 7px;
}
.resident-avatar-wrap{
  position:relative;
  width:58px;height:58px;
}
.resident-command-avatar{
  width:58px;height:58px;
  object-fit:cover;
  border-radius:50%;
  border:1px solid #cbd5e1;
  background:#eef2f7;
}
.resident-command-initials{
  display:grid;place-items:center;
  font-size:22px;font-weight:800;color:#64748b;
}
.resident-online-dot{
  position:absolute;
  right:1px;top:1px;
  width:10px;height:10px;
  border-radius:50%;
  background:#10b981;
  border:2px solid #fff;
}
.resident-command-name{
  min-width:0;
}
.resident-command-name h3{
  margin:1px 0 5px;
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.resident-command-tags{
  display:flex;gap:5px;flex-wrap:wrap;
}
.resident-command-tags span{
  padding:3px 6px;
  border-radius:6px;
  background:#f1f5f9;
  font-size:8px;font-weight:800;
}
.resident-command-status{
  display:inline-flex;
  align-items:center;
  gap:4px;
  margin-top:7px;
  padding:4px 8px;
  width:max-content;
  max-width:100%;
  border-radius:999px;
  background:#059669;color:#fff;
  font-size:8px;font-weight:900;
}
.resident-command-status.status-evacuating{background:#2563eb}
.resident-command-status.status-false-alarm{background:#9333ea}
.resident-command-status.status-need-help{background:#dc2626}
.resident-command-status.status-no-report{background:#d97706}

.resident-command-contact{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:32px;
  padding:0 12px 8px;
}
.resident-command-contact>a,
.resident-command-contact>span{
  display:inline-flex;align-items:center;gap:6px;
  color:#0f172a;
  text-decoration:none;
  font-size:9px;
}
.resident-command-contact .resident-wa{
  width:26px;height:26px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#16a34a;
  color:#fff;
  font-size:15px;
}

.resident-command-footer{
  margin-top:auto;
  display:grid;
  grid-template-columns:1fr 1fr 1fr auto;
  gap:7px;
  align-items:center;
  padding:8px 10px;
  border-top:1px solid #e2e8f0;
  background:#fbfdff;
}
.resident-command-footer>div:not(.resident-command-buttons){
  min-width:0;
  display:flex;
  flex-direction:column;
}
.resident-command-footer span{
  font-size:7px;color:#94a3b8;
}
.resident-command-footer b{
  margin-top:2px;
  font-size:9px;
  color:#0f172a;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.resident-command-footer b.ok{color:#059669}
.resident-command-footer b.danger{color:#dc2626}
.resident-command-buttons{
  display:flex;gap:5px;
}
.resident-icon-btn{
  width:34px;height:34px;
  display:grid;place-items:center;
  border:0;
  border-radius:8px;
  cursor:pointer;
  font-weight:900;
}
.resident-icon-btn.mail{
  background:#0f8b8d;color:#fff;
}
.resident-icon-btn.qr{
  background:#edf2f7;color:#0f172a;
}

/* Hide legacy styles that previously made cards too tall */
.command-residents-section .compact-grid,
.command-residents-section .rescue-person-card{
  all:unset;
}

@media(max-width:1180px){
  .command-kpis{grid-template-columns:repeat(4,minmax(118px,1fr))!important}
  .resident-command-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  .command-emergency-banner{grid-template-columns:42px 1fr}
  .command-emergency-actions{grid-column:1/-1}
  .command-kpis{grid-template-columns:repeat(2,minmax(118px,1fr))!important}
  .emergency-layout-grid{grid-template-columns:1fr!important}
  .resident-command-grid{grid-template-columns:1fr}
  .resident-command-footer{grid-template-columns:1fr 1fr 1fr}
  .resident-command-buttons{grid-column:1/-1;justify-content:flex-end}
}

/* RC2.9.1 - Diseño final aprobado */
.emergency-operational-scroll{position:relative;width:100%;min-height:260px;overflow:hidden!important;border-radius:10px}
.emergency-operational-stage{margin:0!important}
.residents-final-section{padding:14px!important}
.residents-final-head{margin-bottom:14px}.residents-final-head h3{margin:0;color:#0f172a;font-size:18px;line-height:1.15}.residents-final-head span{display:block;margin-top:5px;color:#64748b;font-size:9px}
.residents-final-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:18px!important}
.resident-final-card{display:flex;flex-direction:column;min-width:0;min-height:232px;overflow:hidden;border:2px solid #22c55e;border-radius:14px;background:#fff}.resident-final-card.state-evacuating{border-color:#3b82f6}.resident-final-card.state-false-alarm{border-color:#a855f7}.resident-final-card.state-need-help{border-color:#ef4444}.resident-final-card.state-no-report{border-color:#f59e0b}
.resident-final-main{flex:1;padding:18px 18px 12px}.resident-final-profile{display:grid;grid-template-columns:82px minmax(0,1fr);gap:18px;align-items:start}.resident-final-avatar-wrap{position:relative;width:82px;height:82px}.resident-final-avatar{display:block;width:82px;height:82px;object-fit:cover;border-radius:50%;border:1px solid #cbd5e1;background:#eef2f7}.resident-final-initials{display:grid;place-items:center;color:#64748b;font-size:28px;font-weight:800}.resident-final-online{position:absolute;top:3px;right:3px;width:12px;height:12px;border-radius:50%;background:#10b981;border:3px solid #fff}
.resident-final-info{min-width:0}.resident-final-info h3{margin:5px 0 9px;color:#0f172a;font-size:16px;font-weight:800;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.resident-final-tags{display:flex;gap:7px;flex-wrap:wrap}.resident-final-tags span{padding:5px 9px;border-radius:7px;background:#f1f5f9;color:#0f172a;font-size:10px;font-weight:800}.resident-final-status{display:inline-flex;align-items:center;gap:5px;width:max-content;max-width:100%;margin-top:11px;padding:6px 11px;border-radius:999px;background:#059669;color:#fff;font-size:10px;font-weight:900}.resident-final-status.status-evacuating{background:#2563eb}.resident-final-status.status-false-alarm{background:#9333ea}.resident-final-status.status-need-help{background:#dc2626}.resident-final-status.status-no-report{background:#d97706}
.resident-final-contact{display:flex;align-items:center;gap:10px;margin-top:16px;min-height:40px}.resident-final-phone{display:inline-flex;align-items:center;gap:8px;color:#0f172a;text-decoration:none;font-size:11px}.resident-final-phone b{font-size:11px}.resident-final-action{flex:0 0 38px;width:38px;height:38px;display:grid;place-items:center;padding:0;border:0;border-radius:50%;cursor:pointer;text-decoration:none;font-size:19px}.resident-final-action.whatsapp{background:#16a34a;color:#fff}.resident-final-action.message{background:#0f8b8d;color:#fff}.resident-final-action.qr{background:transparent;color:#111827;font-size:28px}
.resident-final-footer{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:12px 16px 14px;border-top:1px solid #dfe6ed;background:#fbfdff}.resident-final-footer>div{min-width:0;display:flex;flex-direction:column}.resident-final-footer span{color:#94a3b8;font-size:8px}.resident-final-footer b{margin-top:4px;color:#0f172a;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.resident-final-footer b.ok{color:#059669}.resident-final-footer b.danger{color:#dc2626}
@media(max-width:1250px){.residents-final-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}}@media(max-width:760px){.residents-final-grid{grid-template-columns:1fr!important;gap:10px!important}.resident-final-card{min-height:0}.resident-final-main{padding:13px}.resident-final-profile{grid-template-columns:68px minmax(0,1fr);gap:12px}.resident-final-avatar-wrap,.resident-final-avatar{width:68px;height:68px}.resident-final-info h3{font-size:14px}}

/* ==========================================================
   RC2.9.2 - población consistente + recorte definitivo
   ========================================================== */
.emergency-operational-scroll{
  padding-bottom:0!important;
  margin-bottom:0!important;
}
.emergency-operational-stage{
  margin-bottom:0!important;
}
.emergency-layout-grid>.card{
  padding-bottom:10px!important;
}
.em-unit-summary .operational-occupants{
  max-width:130px;
  flex-wrap:wrap;
}
.residents-final-grid:has(.resident-final-card:nth-child(2):last-child){
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
}

/* ==========================================================
   RC2.9.3 - Canvas auto-fit diseñador
   ========================================================== */
.designer-canvas-scroll{
  width:100%;
  min-height:300px;
  overflow:hidden!important;
  border-radius:12px;
  transition:height .14s ease;
}
.designer-canvas-scroll .floor-designer-stage{
  margin:0!important;
}

/* ==========================================================
   RC2.9.4 - Canvas cropped responsively, no unused area
   ========================================================== */

/* The wrapper defines the visible crop with an inline aspect-ratio.
   The logical stage still represents 1120x700, but scales to available width. */
.designer-canvas-scroll{
  width:100%!important;
  min-height:0!important;
  overflow:hidden!important;
  scrollbar-width:none;
}
.designer-canvas-scroll::-webkit-scrollbar{display:none}
.designer-canvas-scroll .floor-designer-stage{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  aspect-ratio:1120 / 700!important;
  margin:0!important;
}

.emergency-operational-scroll{
  width:100%!important;
  min-height:0!important;
  overflow:hidden!important;
}
.emergency-operational-scroll .emergency-operational-stage{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  height:auto!important;
  min-height:0!important;
  aspect-ratio:1120 / 700!important;
  margin:0!important;
}

/* Avoid card padding being interpreted visually as unused plan space. */
.emergency-layout-grid>div.card:nth-child(2){
  padding-bottom:8px!important;
}

/* ==========================================================
   RC2.9.6 - Dashboard status visibility
   ========================================================== */
.b-evacuating{background:#2563eb!important;color:#fff!important}
.b-safe{background:#f97316!important;color:#fff!important}
.b-outside{background:#16a34a!important;color:#fff!important}

/* Resident markers on floor plan */
.operational-person{
  width:32px!important;
  height:32px!important;
  border-width:4px!important;
  box-shadow:0 0 0 3px rgba(15,23,42,.06);
}
.operational-person.state-EVACUATING{
  border-color:#2563eb!important;
  box-shadow:0 0 0 4px #dbeafe!important;
}
.operational-person.state-OK,
.operational-person.state-EVACUATED{
  border-color:#f97316!important;
  box-shadow:0 0 0 4px #ffedd5!important;
}
.operational-person.state-OUTSIDE{
  border-color:#16a34a!important;
  box-shadow:0 0 0 4px #dcfce7!important;
}
.operational-person.state-NEED_HELP{
  width:38px!important;
  height:38px!important;
  border-color:#dc2626!important;
  box-shadow:0 0 0 5px #fee2e2!important;
  animation:emergencyHelpPulse 1s infinite;
  position:relative;
  z-index:999!important;
}

/* Colored dots on floor list: larger and clearly visible */
.floor-count-dot{
  width:14px!important;
  height:14px!important;
  border:2px solid #fff;
  box-shadow:0 0 0 1px rgba(15,23,42,.15);
}
.floor-count-dot.help{
  width:18px!important;
  height:18px!important;
  background:#dc2626!important;
  animation:emergencyHelpPulse 1s infinite;
}
.floor-count-dot.warn{background:#f59e0b!important}
.floor-count-dot.ok{background:#16a34a!important}

/* Unit outlines */
.em-operational-unit.unit-state-EVACUATING{
  outline:4px solid #2563eb!important;
  outline-offset:2px!important;
}
.em-operational-unit.unit-state-OK,
.em-operational-unit.unit-state-EVACUATED{
  outline:4px solid #f97316!important;
  outline-offset:2px!important;
}
.em-operational-unit.unit-state-OUTSIDE{
  outline:4px solid #16a34a!important;
  outline-offset:2px!important;
}
.em-operational-unit.unit-state-NEED_HELP{
  outline:5px solid #dc2626!important;
  outline-offset:3px!important;
  animation:emergencyUnitPulse 1s infinite;
}

/* Resident cards */
.resident-final-card.state-evacuating{border-color:#2563eb!important;border-width:3px!important}
.resident-final-card.state-ok,
.resident-final-card.state-evacuated{border-color:#f97316!important;border-width:3px!important}
.resident-final-card.state-outside{border-color:#16a34a!important;border-width:3px!important}
.resident-final-card.state-need-help{
  border-color:#dc2626!important;
  border-width:4px!important;
  animation:emergencyCardPulse 1s infinite;
}
.resident-final-status.status-evacuating{background:#2563eb!important;color:#fff!important}
.resident-final-status.status-ok,
.resident-final-status.status-evacuated{background:#f97316!important;color:#fff!important}
.resident-final-status.status-outside{background:#16a34a!important;color:#fff!important}
.resident-final-status.status-need-help{
  background:#dc2626!important;
  color:#fff!important;
  animation:emergencyHelpPulse 1s infinite;
}

/* Popover */
.rescue-pop-status.state-EVACUATING{background:#2563eb!important;color:#fff!important}
.rescue-pop-status.state-OK,
.rescue-pop-status.state-EVACUATED{background:#f97316!important;color:#fff!important}
.rescue-pop-status.state-OUTSIDE{background:#16a34a!important;color:#fff!important}
.rescue-pop-status.state-NEED_HELP{
  background:#dc2626!important;
  color:#fff!important;
  animation:emergencyHelpPulse 1s infinite;
}

.command-kpi.kpi-evacuating{border-top:5px solid #2563eb!important}
.command-kpi.kpi-evacuating>i{color:#2563eb!important}
.command-kpi.kpi-safe{border-top:5px solid #f97316!important}
.command-kpi.kpi-safe>i{color:#f97316!important}
.command-kpi.kpi-help{
  border-top:5px solid #dc2626!important;
  background:#fff1f2!important;
}
.command-kpi.kpi-help>i{
  color:#dc2626!important;
  animation:emergencyHelpPulse 1s infinite;
}

@keyframes emergencyHelpPulse{
  0%,100%{transform:scale(1);filter:brightness(1);box-shadow:0 0 0 0 rgba(220,38,38,.38)}
  50%{transform:scale(1.12);filter:brightness(1.15);box-shadow:0 0 0 9px rgba(220,38,38,0)}
}
@keyframes emergencyUnitPulse{
  0%,100%{outline-color:#dc2626}
  50%{outline-color:#fecaca}
}
@keyframes emergencyCardPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,.28)}
  50%{box-shadow:0 0 0 8px rgba(220,38,38,0)}
}
@media(prefers-reduced-motion:reduce){
  .operational-person.state-NEED_HELP,
  .floor-count-dot.help,
  .em-operational-unit.unit-state-NEED_HELP,
  .resident-final-card.state-need-help,
  .resident-final-status.status-need-help,
  .rescue-pop-status.state-NEED_HELP,
  .command-kpi.kpi-help>i{
    animation:none!important;
  }
}

/* ==========================================================
   RC2.9.8 - Modal global aislado del plano
   ========================================================== */
body.modal-open-global{
  overflow:hidden!important;
}

.modal-host-global{
  position:fixed!important;
  inset:0!important;
  z-index:2147483600!important;
  display:grid!important;
  place-items:center!important;
  padding:18px!important;
  box-sizing:border-box!important;
  isolation:isolate!important;
  background:transparent!important;
}

.modal-backdrop-global{
  position:absolute!important;
  inset:0!important;
  z-index:0!important;
  background:rgba(15,23,42,.70)!important;
  backdrop-filter:blur(2px);
}

.modal-box-global{
  position:relative!important;
  z-index:2!important;
  width:min(680px,calc(100vw - 32px))!important;
  max-width:680px!important;
  max-height:calc(100dvh - 36px)!important;
  overflow:auto!important;
  margin:0!important;
  transform:none!important;
  background:#fff!important;
  border-radius:16px!important;
  box-shadow:0 28px 90px rgba(0,0,0,.48)!important;
  isolation:isolate!important;
}

.modal-box-global .modal-head{
  position:sticky!important;
  top:0!important;
  z-index:10!important;
  background:#fff!important;
}

/* El canvas nunca puede competir visualmente con un modal abierto. */
body.modal-open-global .emergency-operational-stage,
body.modal-open-global .floor-designer-stage,
body.modal-open-global .em-layout-element,
body.modal-open-global .em-operational-unit,
body.modal-open-global .occupant-popover{
  z-index:auto!important;
}

@media(max-width:700px){
  .modal-host-global{
    padding:8px!important;
    align-items:end!important;
  }
  .modal-box-global{
    width:100%!important;
    max-width:none!important;
    max-height:92dvh!important;
    border-radius:16px 16px 0 0!important;
  }
}

/* ==========================================================
   RC2.10.2 - Elemento Texto editable
   ========================================================== */
.layout-element.type-TEXT{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:visible!important;
  padding:3px 5px;
  box-sizing:border-box;
}
.layout-text-content{
  width:100%;
  line-height:1.15;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  pointer-events:none;
}
.prop-field textarea,
.prop-field select{
  width:100%;
  box-sizing:border-box;
  border:1px solid #d7e0e8;
  border-radius:7px;
  background:#fff;
  color:#0f172a;
  padding:8px 9px;
  font:inherit;
}
.prop-field textarea{
  resize:vertical;
  min-height:76px;
}

/* RC2.10.4 - Error visible de carga de emergencia */
.emergency-load-error{
  display:flex;
  align-items:flex-start;
  gap:14px;
  max-width:760px;
  margin:18px auto;
  padding:18px!important;
  border:1px solid #fecaca!important;
  background:#fff7f7!important;
}
.emergency-load-error-icon{
  width:44px;height:44px;
  flex:0 0 44px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#b91c1c;
  color:#fff;
  font-size:20px;
}
.emergency-load-error h3{margin:0 0 6px;color:#7f1d1d}
.emergency-load-error p{margin:0 0 12px;color:#475569}

/* ==========================================================
   RC2.10.9 - Simulacros
   ========================================================== */
.btn-simulation{
  background:#f97316!important;
  border-color:#ea580c!important;
  color:#fff!important;
}
.btn-simulation:hover{background:#ea580c!important}
.page-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.command-emergency-banner.is-simulation{
  background:linear-gradient(135deg,#ea580c,#f59e0b)!important;
  border-color:#c2410c!important;
}
.simulation-chip,
.simulation-table-tag{
  display:inline-flex;
  align-items:center;
  padding:3px 7px;
  border-radius:999px;
  background:#fff7ed;
  color:#c2410c;
  font-weight:900;
  font-size:.72em;
}
.simulation-modal-warning{
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin:8px 0 14px;
  padding:12px;
  border:1px solid #fdba74;
  border-radius:10px;
  background:#fff7ed;
  color:#9a3412;
}
.simulation-modal-warning>i{
  margin-top:2px;
  color:#f97316;
  font-size:20px;
}
.simulation-modal-warning>div{
  display:flex;
  flex-direction:column;
  gap:3px;
}
.emergency-card.simulation{
  background:linear-gradient(135deg,#c2410c,#f97316)!important;
}
.emergency-card.simulation .status-pill{
  background:#fff7ed!important;
  color:#c2410c!important;
}

/* ==========================================================
   RC2.10.12 - Bitácora operacional administrativa
   ========================================================== */
.audit-timeline{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:4px 2px 10px;
}
.audit-timeline-item{
  display:flex;
  gap:10px;
  padding:10px;
  border:1px solid #dbe4ec;
  border-radius:10px;
  background:#fff;
}
.audit-timeline-item.dir-ADMIN_TO_RESIDENT{border-left:4px solid #0f766e}
.audit-timeline-item.dir-RESIDENT_TO_ADMIN{border-left:4px solid #2563eb}
.audit-timeline-item.dir-SYSTEM{border-left:4px solid #94a3b8}
.audit-timeline-icon{
  width:35px;height:35px;flex:0 0 35px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#eef2f7;color:#334155;
}
.audit-timeline-body{min-width:0;flex:1}
.audit-timeline-head{
  display:flex;justify-content:space-between;gap:10px;
}
.audit-timeline-head>div{display:flex;flex-direction:column}
.audit-timeline-head b{font-size:12px}
.audit-timeline-head span,.audit-timeline-head time{color:#64748b;font-size:9px}
.audit-timeline-body>strong{display:block;margin-top:6px;font-size:11px}
.audit-timeline-body p{margin:5px 0;color:#334155;font-size:10px;line-height:1.4}
.audit-timeline-meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:5px}
.audit-timeline-meta span,.audit-timeline-meta a{
  padding:3px 6px;border-radius:999px;
  background:#f1f5f9;color:#475569;
  font-size:8px;font-weight:700;text-decoration:none
}
.audit-empty{padding:24px;text-align:center;color:#64748b}
.resident-final-action.audit{background:#475569!important;color:#fff!important}

/* ==========================================================
   RC2.10.13 - Dashboard Operacional Profesional
   ========================================================== */
.ops-normal-banner,.ops-alert-banner{border-radius:14px;margin-bottom:12px;overflow:hidden}
.ops-normal-banner{display:flex;align-items:center;gap:14px;padding:16px 18px;background:linear-gradient(100deg,#073c37,#0f766e);color:#fff}
.ops-normal-icon{width:48px;height:48px;border-radius:12px;background:#ffffff18;display:grid;place-items:center;font-size:24px}
.ops-normal-banner>div:nth-child(2){flex:1}.ops-normal-banner span,.ops-panel-head span{font-size:9px;font-weight:800;letter-spacing:.08em;color:#64748b}.ops-normal-banner span{color:#a7f3d0}.ops-normal-banner h2{margin:3px 0;font-size:19px}.ops-normal-banner p{margin:0;font-size:10px;color:#d1fae5}
.ops-kpi-row,.ops-emergency-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px;margin-bottom:12px}
.ops-emergency-kpis{grid-template-columns:repeat(5,minmax(0,1fr))}
.ops-kpi{min-height:78px;border:1px solid #dbe4ec;border-radius:12px;background:#fff;padding:11px;display:flex;align-items:center;gap:10px;box-shadow:0 3px 12px #0f172a08}
.ops-kpi-icon{width:36px;height:36px;display:grid;place-items:center;border-radius:10px;background:#eef2f7;color:#475569;font-size:16px}
.ops-kpi>div:last-child{display:flex;flex-direction:column;min-width:0}.ops-kpi span{font-size:9px;color:#64748b}.ops-kpi strong{font-size:22px;line-height:1.05;color:#0f172a}.ops-kpi small{font-size:8px;color:#94a3b8}
.ops-kpi.safe .ops-kpi-icon{background:#dcfce7;color:#16a34a}.ops-kpi.inside .ops-kpi-icon{background:#ffedd5;color:#ea580c}.ops-kpi.help .ops-kpi-icon{background:#fee2e2;color:#dc2626}.ops-kpi.confirm .ops-kpi-icon{background:#ede9fe;color:#7c3aed}.ops-kpi.pending .ops-kpi-icon{background:#e2e8f0;color:#64748b}
.ops-alert-banner{min-height:82px;display:grid;grid-template-columns:60px 1fr auto auto minmax(210px,270px);align-items:stretch;background:linear-gradient(100deg,#7f1d1d,#b91c1c);color:#fff;box-shadow:0 8px 24px #991b1b22}
.ops-alert-banner.simulation{background:linear-gradient(100deg,#6d28d9,#7c3aed)}
.ops-alert-mark{display:grid;place-items:center;font-size:25px;background:#00000016}.ops-alert-title{padding:11px 14px;display:flex;flex-direction:column;justify-content:center}.ops-alert-title>span{font-size:8px;font-weight:900}.ops-alert-title h2{margin:2px 0;font-size:18px}.ops-alert-title small{font-size:9px;color:#fecaca}
.ops-alert-detected,.ops-alert-clock{padding:10px 18px;border-left:1px solid #ffffff1f;display:flex;flex-direction:column;justify-content:center;align-items:center}.ops-alert-detected span,.ops-alert-clock span{font-size:8px;color:#fecaca}.ops-alert-detected b{font-size:11px}.ops-alert-clock strong{font-size:22px;font-weight:500;letter-spacing:.04em}
.ops-live-button{margin:10px;display:flex;align-items:center;gap:10px;padding:0 14px;border-radius:9px;background:#fff;color:#991b1b;text-decoration:none}.ops-live-button>span{display:flex;flex:1;flex-direction:column;font-size:10px;font-weight:900}.ops-live-button small{font-size:8px;font-weight:500;color:#64748b}
.ops-command-grid,.ops-grid-normal{display:grid;grid-template-columns:1.45fr .9fr .82fr;gap:10px;align-items:stretch}
.ops-grid-normal{grid-template-columns:repeat(2,minmax(0,1fr))}
.ops-panel{border:1px solid #dbe4ec;border-radius:12px;background:#fff;padding:12px;box-shadow:0 3px 12px #0f172a08;min-width:0}
.ops-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}.ops-panel-head>div{display:flex;flex-direction:column}.ops-panel-head h3{margin:1px 0;font-size:12px;color:#0f172a}.ops-panel-head>a{font-size:8px;text-decoration:none;color:#0f766e;font-weight:800}
.ops-live-building{grid-column:1;grid-row:1}.ops-critical{grid-column:2;grid-row:1}.ops-actions{grid-column:3;grid-row:1 / span 2}.ops-occupancy{grid-column:1;grid-row:2}.ops-updates{grid-column:2;grid-row:2}.ops-activity-panel{grid-column:1 / span 2;grid-row:3}
.ops-floor-live{display:flex;flex-direction:column;gap:8px;max-height:250px;overflow:auto}.ops-floor-live section{border:1px solid #e2e8f0;border-radius:8px;padding:7px}.ops-floor-title{display:flex;justify-content:space-between;margin-bottom:6px;font-size:8px;color:#64748b}.ops-floor-title b{font-size:10px;color:#0f172a}
.ops-unit-live{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}.ops-unit-live>div{height:38px;border:1px solid #e2e8f0;border-radius:6px;display:flex;align-items:center;justify-content:center;gap:4px;font-size:8px;background:#f8fafc}.ops-unit-live>div i{font-size:8px}.ops-unit-live .safe{border-color:#86efac;background:#f0fdf4;color:#15803d}.ops-unit-live .inside{border-color:#fdba74;background:#fff7ed;color:#c2410c}.ops-unit-live .help{border-color:#fca5a5;background:#fef2f2;color:#b91c1c}.ops-unit-live .confirm{border-color:#c4b5fd;background:#f5f3ff;color:#6d28d9}.ops-unit-live .pending{background:#f1f5f9;color:#64748b}
.ops-status-legend{display:flex;gap:12px;margin-top:8px;font-size:8px}.ops-status-legend span:before{content:"";display:inline-block;width:7px;height:7px;border-radius:2px;margin-right:4px}.ops-status-legend .safe:before{background:#22c55e}.ops-status-legend .inside:before{background:#f97316}.ops-status-legend .help:before{background:#ef4444}.ops-status-legend .confirm:before{background:#8b5cf6}.ops-status-legend .pending:before{background:#94a3b8}
.ops-critical-list,.ops-update-list,.ops-activity{display:flex;flex-direction:column}.ops-critical-list>div,.ops-update-list>div,.ops-activity>div{display:flex;align-items:center;gap:8px;padding:7px 2px;border-bottom:1px solid #eef2f7}.ops-critical-list i,.ops-update-list i{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:#f1f5f9}.ops-critical-list i.help,.ops-update-list i.help{background:#fee2e2;color:#dc2626}.ops-critical-list i.safe,.ops-update-list i.safe{background:#dcfce7;color:#16a34a}.ops-critical-list i.confirm,.ops-update-list i.confirm{background:#ede9fe;color:#7c3aed}.ops-critical-list i.inside,.ops-update-list i.inside{background:#ffedd5;color:#ea580c}.ops-critical-list>div>span,.ops-update-list>div>span,.ops-activity>div>span{display:flex;flex:1;min-width:0;flex-direction:column}.ops-critical-list b,.ops-update-list b,.ops-activity b{font-size:9px}.ops-critical-list small,.ops-update-list small,.ops-activity small{font-size:8px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ops-critical-list em{font-size:8px;font-style:normal;font-weight:800}.ops-critical-list time,.ops-update-list time,.ops-activity time{font-size:8px;color:#64748b}
.ops-all-safe{padding:22px!important;flex-direction:column!important;text-align:center;border:0!important}.ops-all-safe i{font-size:22px;color:#16a34a}.ops-all-safe span{font-size:8px;color:#64748b}
.ops-actions>a{display:flex;align-items:center;gap:9px;padding:10px 6px;border-bottom:1px solid #eef2f7;text-decoration:none;color:#0f172a}.ops-actions>a>i:first-child{width:29px;height:29px;display:grid;place-items:center;border-radius:8px;background:#eff6ff;color:#2563eb}.ops-actions>a>span{display:flex;flex:1;flex-direction:column}.ops-actions>a b{font-size:9px}.ops-actions>a small{font-size:8px;color:#64748b}.ops-actions>a>i:last-child{font-size:8px;color:#94a3b8}
.ops-donut{width:130px;height:130px;margin:5px auto 12px;border-radius:50%;background:conic-gradient(#2563eb 0 calc(var(--p1)*1%),#22c55e calc(var(--p1)*1%) calc(var(--p2)*1%),#f59e0b calc(var(--p2)*1%) calc(var(--p3)*1%),#8b5cf6 calc(var(--p3)*1%) 100%);display:grid;place-items:center}.ops-donut:before{content:"";width:82px;height:82px;background:#fff;border-radius:50%;grid-area:1/1}.ops-donut>div{position:relative;grid-area:1/1;display:flex;flex-direction:column;text-align:center}.ops-donut strong{font-size:21px}.ops-donut span{font-size:8px;color:#64748b}.ops-legend{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}.ops-legend span{display:grid;grid-template-columns:8px 1fr auto;align-items:center;gap:5px;font-size:8px;color:#64748b}.ops-legend i{width:7px;height:7px;border-radius:2px}.lg-res{background:#2563eb}.lg-vis{background:#22c55e}.lg-staff{background:#f59e0b}.lg-tech{background:#8b5cf6}
.ops-info-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.ops-info-grid>div{padding:9px;border:1px solid #eef2f7;border-radius:8px;display:flex;flex-direction:column}.ops-info-grid span{font-size:8px;color:#64748b}.ops-info-grid b{font-size:10px}
.ops-floor-panel{grid-column:1 / span 2}.ops-floor-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}.ops-floor-grid>div{padding:10px;text-align:center;border:1px solid #e2e8f0;border-radius:8px;background:#f8fafc;display:flex;flex-direction:column}.ops-floor-grid span,.ops-floor-grid small{font-size:8px;color:#64748b}.ops-floor-grid strong{font-size:17px}
.ops-activity>div>i{font-size:7px;color:#0f766e}.ops-activity>div>em{font-size:8px;font-style:normal;padding:3px 6px;border-radius:99px}.ops-activity>div>em.ok{background:#dcfce7;color:#15803d}.ops-activity>div>em.danger{background:#fee2e2;color:#b91c1c}
@media(max-width:1100px){.ops-kpi-row,.ops-emergency-kpis{grid-template-columns:repeat(3,1fr)}.ops-command-grid{grid-template-columns:1fr 1fr}.ops-actions{grid-column:1 / span 2;grid-row:auto}.ops-activity-panel{grid-column:1 / span 2}.ops-alert-banner{grid-template-columns:50px 1fr auto}.ops-alert-detected{display:none}.ops-alert-clock{border-left:0}.ops-live-button{grid-column:1 / -1;height:45px}.ops-unit-live{grid-template-columns:repeat(4,1fr)}}
@media(max-width:700px){.ops-kpi-row,.ops-emergency-kpis{grid-template-columns:repeat(2,1fr)}.ops-command-grid,.ops-grid-normal{display:block}.ops-panel{margin-bottom:9px}.ops-alert-banner{display:flex;flex-wrap:wrap}.ops-alert-mark{width:50px}.ops-alert-title{flex:1}.ops-alert-clock{width:100px}.ops-live-button{width:100%}.ops-floor-panel{grid-column:auto}.ops-floor-grid{grid-template-columns:repeat(3,1fr)}}

/* RC2.10.14 - Dashboard data fix + comunicación móvil entrante */
.ops-resident-message-alert{
  display:grid;
  grid-template-columns:42px 1fr auto auto;
  gap:10px;
  align-items:center;
  margin:0 0 10px;
  padding:10px 12px;
  border:1px solid #93c5fd;
  border-left:5px solid #2563eb;
  border-radius:10px;
  background:#eff6ff;
}
.ops-rm-icon{
  width:36px;height:36px;border-radius:50%;
  display:grid;place-items:center;
  background:#2563eb;color:#fff;
}
.ops-resident-message-alert>div:nth-child(2){display:flex;flex-direction:column;min-width:0}
.ops-resident-message-alert span{font-size:8px;font-weight:900;color:#1d4ed8;letter-spacing:.06em}
.ops-resident-message-alert b{font-size:10px;color:#0f172a}
.ops-resident-message-alert p{margin:2px 0 0;font-size:9px;color:#334155;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ops-resident-message-alert time{font-size:8px;color:#64748b}
.ops-resident-message-alert a{display:flex;gap:5px;align-items:center;padding:7px 9px;border-radius:7px;background:#2563eb;color:#fff;text-decoration:none;font-size:8px;font-weight:800}
.incoming-resident-panel{
  margin:10px 0;
  border:1px solid #bfdbfe;
  border-radius:12px;
  background:#f8fbff;
  overflow:hidden;
}
.incoming-resident-head{
  display:flex;justify-content:space-between;align-items:center;
  padding:10px 12px;border-bottom:1px solid #dbeafe
}
.incoming-resident-head>div{display:flex;flex-direction:column}
.incoming-resident-head span{font-size:8px;font-weight:900;color:#2563eb;letter-spacing:.06em}
.incoming-resident-head h3{margin:1px 0;font-size:12px}
.incoming-resident-count{
  min-width:24px;height:24px;border-radius:999px;
  display:grid;place-items:center;background:#2563eb;color:#fff!important;
}
.incoming-resident-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:10px}
.incoming-resident-list article{display:flex;gap:8px;padding:9px;border:1px solid #dbeafe;border-radius:9px;background:#fff}
.incoming-resident-avatar{width:28px;height:28px;flex:0 0 28px;border-radius:50%;display:grid;place-items:center;background:#dbeafe;color:#2563eb}
.incoming-resident-list article>div:last-child{min-width:0}
.incoming-resident-list b{font-size:9px}
.incoming-resident-list p{margin:2px 0;font-size:8px;color:#334155;line-height:1.35}
.incoming-resident-list small{font-size:7px;color:#64748b}
@media(max-width:900px){.incoming-resident-list{grid-template-columns:1fr}.ops-resident-message-alert{grid-template-columns:36px 1fr}.ops-resident-message-alert time,.ops-resident-message-alert a{grid-column:2}}

/* RC2.10.15 - Comunicación entrante prioritaria */
.emergency-incoming-resident-host:empty{display:none}
.incoming-resident-panel{
  margin:10px 0 12px!important;
  border:1px solid #60a5fa!important;
  border-left:5px solid #2563eb!important;
  background:linear-gradient(90deg,#eff6ff,#f8fbff)!important;
  box-shadow:0 5px 16px rgba(37,99,235,.10);
}
.incoming-resident-head{
  padding:10px 13px!important;
  background:#eff6ff;
}
.incoming-resident-head>div>span{
  display:flex;
  align-items:center;
  gap:5px;
  color:#1d4ed8!important;
}
.incoming-resident-head>div>small{
  margin-top:2px;
  font-size:8px;
  color:#64748b;
}
.incoming-resident-count{
  width:30px!important;
  height:30px!important;
  font-size:12px!important;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}
.incoming-resident-list{
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
}
.incoming-resident-message-card{
  cursor:pointer;
  transition:.15s ease;
  border:1px solid #bfdbfe!important;
}
.incoming-resident-message-card:hover{
  transform:translateY(-1px);
  border-color:#2563eb!important;
  box-shadow:0 5px 12px rgba(37,99,235,.12);
}
.incoming-resident-message-card.is-recent{
  border-color:#2563eb!important;
  background:#eff6ff!important;
  box-shadow:inset 3px 0 0 #2563eb;
}
.incoming-resident-message-card.is-recent .incoming-resident-avatar{
  animation:incomingPulse 1.4s infinite;
}
@keyframes incomingPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(37,99,235,.28)}
  50%{box-shadow:0 0 0 7px rgba(37,99,235,0)}
}
.incoming-resident-content{flex:1;min-width:0}
.incoming-resident-meta{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
}
.incoming-resident-meta b{font-size:9px}
.incoming-resident-meta time{font-size:7px;color:#64748b;white-space:nowrap}
.incoming-resident-content p{
  margin:4px 0!important;
  font-size:9px!important;
  line-height:1.35!important;
  color:#0f172a!important;
}
.incoming-resident-content>span{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:7px;
  color:#2563eb;
  font-weight:800;
}
@media(max-width:1000px){
  .incoming-resident-list{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:700px){
  .incoming-resident-list{grid-template-columns:1fr!important}
}

/* ==========================================================
   RC2.10.21 - Shell SPA persistente + hamburguesa móvil
   ========================================================== */
.shell-mobile-backdrop{
  display:none;
  position:fixed;
  inset:0;
  z-index:1490;
  border:0;
  padding:0;
  margin:0;
  background:rgba(2,12,23,.55);
  backdrop-filter:blur(1px);
}
.shell-sidebar{
  z-index:1500!important;
}
.shell-menu-toggle{
  position:relative;
  z-index:1510;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.main-frame{
  transition:opacity .08s ease;
}

@media(max-width:760px){
  body.shell-body{
    overflow:hidden!important;
  }

  .shell-app{
    display:block!important;
    width:100%!important;
    height:100dvh!important;
  }

  .shell-main{
    width:100%!important;
    height:100dvh!important;
    margin:0!important;
  }

  .shell-topbar{
    position:relative;
    z-index:1400;
    min-height:58px;
    padding:8px 10px!important;
  }

  .shell-top-left{
    min-width:0;
    width:100%;
  }

  .shell-menu-toggle{
    display:grid!important;
    place-items:center!important;
    width:42px!important;
    height:42px!important;
    flex:0 0 42px!important;
  }

  .building-select{
    min-width:0!important;
    max-width:calc(100vw - 120px)!important;
  }

  .shell-sidebar,
  .shell-sidebar-hidden .shell-sidebar{
    display:flex!important;
    position:fixed!important;
    top:0!important;
    bottom:0!important;
    left:0!important;
    width:min(82vw,290px)!important;
    max-width:290px!important;
    transform:translateX(-105%)!important;
    transition:transform .20s ease!important;
    pointer-events:none!important;
    visibility:hidden;
  }

  .shell-menu-open .shell-sidebar,
  .shell-menu-open.shell-sidebar-hidden .shell-sidebar{
    transform:translateX(0)!important;
    pointer-events:auto!important;
    visibility:visible;
  }

  .shell-menu-open .shell-mobile-backdrop{
    display:block;
  }

  .shell-menu-open{
    overflow:hidden!important;
  }

  .main-frame-wrap{
    width:100%!important;
    min-width:0!important;
  }
}
