*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#0f172a;color:#e5e7eb}a{color:inherit}.sidebar{position:fixed;left:0;top:0;width:230px;height:100vh;background:#020617;border-right:1px solid #1e293b;padding:22px}.brand{font-size:20px;font-weight:700;margin-bottom:28px}.sidebar a{display:block;padding:12px 14px;margin-bottom:8px;border-radius:10px;text-decoration:none;color:#94a3b8}.sidebar a:hover,.sidebar a.active{background:#1e293b;color:#fff}.main{margin-left:230px;padding:28px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:24px}.topbar h1{margin:0 0 6px 0;font-size:30px}.topbar p{margin:0;color:#94a3b8}.card{background:#111827;border:1px solid #1f2937;border-radius:16px;padding:20px;margin-bottom:20px}.card-header{display:flex;justify-content:space-between;align-items:center}.stats-grid{display:grid;grid-template-columns:repeat(6,minmax(140px,1fr));gap:14px;margin-bottom:20px}.stat-card{background:#111827;border:1px solid #1f2937;border-radius:16px;padding:18px}.stat-card strong{display:block;font-size:28px;margin-top:8px}.badge{display:inline-block;padding:5px 10px;border-radius:999px;font-size:12px;font-weight:700;background:#334155}.badge-online,.badge-ok{background:#065f46;color:#d1fae5}.badge-offline,.badge-error,.badge-alarm{background:#7f1d1d;color:#fee2e2}.badge-reconnecting,.badge-warn{background:#854d0e;color:#fef3c7}.badge-disarmed{background:#334155;color:#e2e8f0}.badge-armed{background:#1d4ed8;color:#dbeafe}.btn{border:0;padding:10px 14px;border-radius:10px;background:#334155;color:#fff;cursor:pointer;text-decoration:none;display:inline-block}.btn:hover{opacity:.9}.btn-primary{background:#2563eb}.btn-danger{background:#dc2626}.btn-small{padding:7px 10px;font-size:12px}.actions{display:flex;gap:8px}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse}th,td{padding:13px 10px;border-bottom:1px solid #1f2937;text-align:left}th{color:#94a3b8;font-size:13px}.grid-two{display:grid;grid-template-columns:1fr 1fr;gap:18px}.info-list div{display:flex;justify-content:space-between;border-bottom:1px solid #1f2937;padding:10px 0;gap:12px}.info-list span:first-child{color:#94a3b8}.sector-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}.sector-card{border:1px solid #1f2937;background:#0b1120;border-radius:14px;padding:14px}.sector-card h3{margin:0 0 10px 0}.event-item{padding:14px 0;border-bottom:1px solid #1f2937}.event-title{font-weight:700}.event-meta{color:#94a3b8;font-size:13px;margin-top:5px}.message{padding:12px 14px;border-radius:10px;margin-bottom:18px;background:#1e293b}.message.error{background:#7f1d1d}.event-critical{border-left:4px solid #dc2626;padding-left:12px;background:rgba(127,29,29,.18)}.flash-update{animation:flashUpdate 1.2s ease-out}@keyframes flashUpdate{from{outline:2px solid rgba(34,197,94,.9)}to{outline:0 solid transparent}}.operational-alarm-panel{position:fixed;right:22px;bottom:22px;width:min(520px,calc(100vw - 44px));max-height:60vh;overflow-y:auto;z-index:9999;border-radius:18px;border:2px solid #dc2626;background:#450a0a;color:#fff;box-shadow:0 18px 50px rgba(0,0,0,.45)}.operational-alarm-panel.hidden{display:none}.operational-alarm-panel.active{animation:alarmPulse 1s infinite}.alarm-panel-header{position:sticky;top:0;background:#7f1d1d;display:flex;justify-content:space-between;gap:12px;align-items:center;padding:14px;border-bottom:1px solid rgba(255,255,255,.18)}.alarm-panel-header strong{display:block;font-size:16px}.alarm-panel-header span{display:block;margin-top:4px;font-size:12px;opacity:.85}.alarm-panel-list{padding:12px}.alarm-panel-item{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.15)}.alarm-panel-item small{display:block;margin-top:5px;color:#fecaca}@keyframes alarmPulse{0%{box-shadow:0 0 0 0 rgba(220,38,38,.75)}70%{box-shadow:0 0 0 14px rgba(220,38,38,0)}100%{box-shadow:0 0 0 0 rgba(220,38,38,0)}}@media(max-width:900px){.sidebar{position:relative;width:100%;height:auto}.main{margin-left:0}.topbar,.grid-two{grid-template-columns:1fr;display:block}.stats-grid{grid-template-columns:repeat(2,1fr)}.actions{margin-top:14px}.operational-alarm-panel{right:12px;bottom:12px;width:calc(100vw - 24px)}.alarm-panel-header,.alarm-panel-item{flex-direction:column;align-items:stretch}}
.alarm-audio-notice{
  background:#facc15;
  color:#422006;
  font-weight:700;
  padding:10px 14px;
  border-bottom:1px solid rgba(255,255,255,.18);
}

.informational-event-toast{
  position:fixed;
  right:22px;
  top:22px;
  width:min(420px,calc(100vw - 44px));
  z-index:9998;
  border-radius:16px;
  border:1px solid #1d4ed8;
  background:#0f172a;
  color:#e5e7eb;
  box-shadow:0 12px 34px rgba(0,0,0,.35);
  padding:14px;
}

.informational-event-toast.hidden{
  display:none;
}

.informational-event-toast.active{
  animation:flashUpdate 1.2s ease-out;
}

.info-toast-title{
  font-weight:700;
  color:#bfdbfe;
  margin-bottom:6px;
}

.info-toast-body{
  font-size:14px;
}

.info-toast-meta{
  color:#94a3b8;
  font-size:12px;
  margin-top:6px;
}

/* v1.3.6: animação mais leve para não pesar navegação após disparo */
.operational-alarm-panel.active{
  animation:alarmPulseLight 1.1s infinite;
}

@keyframes alarmPulseLight{
  0%{outline:2px solid rgba(220,38,38,.95);}
  50%{outline:6px solid rgba(220,38,38,.25);}
  100%{outline:2px solid rgba(220,38,38,.95);}
}

.operation-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) 340px;
  gap:20px;
}

.operation-left{
  min-width:0;
}

.operation-right{
  min-width:0;
}

.critical-card{
  border-color:#7f1d1d;
}

.critical-queue{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.critical-item{
  display:flex;
  justify-content:space-between;
  gap:14px;
  border:1px solid rgba(220,38,38,.45);
  background:rgba(127,29,29,.20);
  border-radius:14px;
  padding:14px;
}

.critical-title{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.critical-main{
  min-width:0;
}

.critical-actions{
  display:flex;
  align-items:center;
}

.operation-event-item{
  padding:13px;
  border-bottom:1px solid #1f2937;
  border-left:4px solid #334155;
  background:#0b1120;
  margin-bottom:8px;
  border-radius:10px;
}

.operation-event-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.priority-badge{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  margin-right:6px;
}

.priority-alto{
  background:#7f1d1d;
  color:#fee2e2;
}

.priority-medio{
  background:#854d0e;
  color:#fef3c7;
}

.priority-normal{
  background:#1d4ed8;
  color:#dbeafe;
}

.priority-baixo{
  background:#334155;
  color:#e2e8f0;
}

.priority-row-alto{
  border-left-color:#dc2626;
}

.priority-row-medio{
  border-left-color:#f59e0b;
}

.priority-row-normal{
  border-left-color:#2563eb;
}

.priority-row-baixo{
  border-left-color:#64748b;
}

.filter-label{
  display:block;
  color:#94a3b8;
  font-size:13px;
  margin:14px 0 6px;
}

.input{
  width:100%;
  border:1px solid #334155;
  background:#020617;
  color:#e5e7eb;
  border-radius:10px;
  padding:10px 12px;
}

.filter-actions{
  margin-top:14px;
}

.filter-note{
  color:#94a3b8;
  font-size:12px;
  line-height:1.45;
}

.priority-legend{
  display:flex;
  flex-direction:column;
  gap:10px;
  color:#cbd5e1;
  font-size:13px;
}

.priority-dot{
  width:10px;
  height:10px;
  display:inline-block;
  border-radius:999px;
  margin-right:8px;
}

.empty-state{
  color:#94a3b8;
  padding:16px 0;
}

.compact-events .event-meta{
  font-size:12px;
}

@media(max-width:1100px){
  .operation-layout{
    grid-template-columns:1fr;
  }
}

.brand-logo{
  margin-bottom:24px;
  text-align:center;
}

.brand-logo img{
  max-width:170px;
  width:100%;
  height:auto;
  display:block;
  margin:0 auto;
}

.central-row-alarm{
  background:rgba(127,29,29,.22);
  outline:1px solid rgba(220,38,38,.35);
}

.central-row-alarm td:first-child{
  border-left:4px solid #dc2626;
}

.row-alert-badge{
  margin-left:8px;
}

.compact-events .event-item{
  padding:10px 0;
}

.compact-events .event-title{
  font-size:14px;
}

.compact-events .event-meta{
  font-size:12px;
}


/* v1.6 - Prévia de eventos da tela inicial compacta */
#latest-events-preview{
  max-height: 245px;
  overflow-y: auto;
  padding-right: 8px;
}

#latest-events-preview .event-item{
  padding: 8px 0;
}

#latest-events-preview .event-title{
  font-size: 13px;
  line-height: 1.25;
}

#latest-events-preview .event-meta{
  font-size: 11px;
  line-height: 1.35;
}

/* v1.6 - Setores compactos e operacionais */
.sector-grid-compact{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(155px,1fr));
  gap:10px;
}

.sector-card-compact{
  border-radius:12px;
  padding:10px;
  border:1px solid #1f2937;
  background:#0b1120;
  min-height:108px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.sector-topline{
  display:flex;
  justify-content:space-between;
  gap:6px;
  align-items:center;
  margin-bottom:7px;
}

.sector-topline strong{
  font-size:14px;
}

.sector-status-pill{
  font-size:10px;
  font-weight:800;
  border-radius:999px;
  padding:3px 6px;
  background:rgba(255,255,255,.13);
  white-space:nowrap;
}

.sector-mini-flags{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  min-height:22px;
  margin-bottom:8px;
}

.sector-mini-flags span{
  font-size:10px;
  padding:3px 6px;
  border-radius:999px;
  background:rgba(255,255,255,.10);
  color:#e5e7eb;
}

.sector-actions-row{
  display:flex;
  gap:6px;
}

.sector-actions-row .btn{
  flex:1;
  padding:6px 7px;
  font-size:11px;
}

.btn-technical{
  background:#1f2937;
}

.sector-armed{
  border-color:#16a34a;
  background:linear-gradient(180deg,rgba(22,163,74,.22),rgba(11,17,32,.92));
}

.sector-disarmed{
  border-color:#2563eb;
  background:linear-gradient(180deg,rgba(37,99,235,.20),rgba(11,17,32,.92));
}

.sector-bypassed{
  border-color:#64748b;
  background:linear-gradient(180deg,rgba(100,116,139,.30),rgba(11,17,32,.92));
  color:#cbd5e1;
}

.sector-alarm{
  border-color:#dc2626;
  background:linear-gradient(180deg,rgba(220,38,38,.42),rgba(69,10,10,.92));
  animation: sectorAlarmPulse 1s infinite;
}

.sector-memory{
  border-color:#facc15;
  background:linear-gradient(180deg,rgba(250,204,21,.30),rgba(11,17,32,.92));
}

@keyframes sectorAlarmPulse{
  0%{outline:1px solid rgba(220,38,38,.8);}
  50%{outline:5px solid rgba(220,38,38,.20);}
  100%{outline:1px solid rgba(220,38,38,.8);}
}

.sector-legend{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  color:#94a3b8;
  font-size:12px;
  justify-content:flex-end;
}

.sector-legend span{
  display:flex;
  align-items:center;
  gap:5px;
}

.legend-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
}

.sector-armed-dot{background:#16a34a;}
.sector-disarmed-dot{background:#2563eb;}
.sector-bypassed-dot{background:#64748b;}
.sector-alarm-dot{background:#dc2626;}
.sector-memory-dot{background:#facc15;}

@media(max-width:900px){
  .sector-grid-compact{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .sector-legend{
    justify-content:flex-start;
    margin-top:10px;
  }
}


/* v1.7 - Tela inicial operacional lado a lado */
body.home-fixed{
  height:100vh;
  overflow:hidden;
}

.main-home{
  height:100vh;
  display:flex;
  flex-direction:column;
  padding:22px;
  overflow:hidden;
}

.home-topbar{
  flex:0 0 auto;
  margin-bottom:16px;
}

.home-topbar h1{
  font-size:28px;
}

.home-operational-layout{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  grid-template-columns:minmax(0, 1fr) 430px;
  gap:18px;
  overflow:hidden;
}

.home-centrals-card,
.home-events-card{
  min-height:0;
  display:flex;
  flex-direction:column;
  margin-bottom:0;
}

.home-centrals-card{
  min-width:0;
}

.home-events-card{
  min-width:0;
}

.home-table-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding-right:4px;
}

.home-table-scroll table{
  min-width:860px;
}

.home-centrals-table thead th{
  position:sticky;
  top:0;
  background:#111827;
  z-index:2;
}

.home-centrals-table td,
.home-centrals-table th{
  padding:10px 9px;
}

.home-events-scroll{
  flex:1 1 auto;
  min-height:0;
  max-height:none !important;
  overflow-y:auto;
  padding-right:6px;
}

.home-event-preview{
  border-left:4px solid #334155;
  border-bottom:1px solid #1f2937;
  padding:10px 8px 10px 11px;
  background:#0b1120;
  border-radius:10px;
  margin-bottom:8px;
}

.home-event-critical{
  border-left-color:#dc2626;
  background:rgba(127,29,29,.20);
}

.home-event-title{
  font-size:13px;
  font-weight:700;
  line-height:1.25;
  margin-bottom:5px;
}

.home-event-meta{
  color:#94a3b8;
  font-size:11px;
  line-height:1.35;
}

.home-event-raw{
  color:#64748b;
  font-size:11px;
  margin-top:4px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

@media(min-width:1800px){
  .home-operational-layout{
    grid-template-columns:minmax(0, 1fr) 480px;
  }

  .main-home{
    padding:24px 28px;
  }

  .home-centrals-table td,
  .home-centrals-table th{
    padding:11px 10px;
  }
}

@media(max-width:1200px){
  body.home-fixed{
    height:auto;
    overflow:auto;
  }

  .main-home{
    height:auto;
    overflow:visible;
  }

  .home-operational-layout{
    grid-template-columns:1fr;
    overflow:visible;
  }

  .home-table-scroll,
  .home-events-scroll{
    max-height:520px;
  }
}


/* v1.8.2 - Lista principal corrigida */
.home-card-header-stacked{display:block;}
.home-card-title-row{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px;}
.home-quick-filter{max-width:360px;}
.refined-home-table{table-layout:fixed;width:100%;min-width:680px !important;}
.refined-home-table th:nth-child(1),.refined-home-table td:nth-child(1){width:30%;}
.refined-home-table th:nth-child(2),.refined-home-table td:nth-child(2){width:22%;}
.refined-home-table th:nth-child(3),.refined-home-table td:nth-child(3){width:28%;}
.refined-home-table th:nth-child(4),.refined-home-table td:nth-child(4){width:20%;}
.refined-home-table td,.refined-home-table th{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.clickable-central-row{cursor:pointer;transition:background .15s ease,transform .08s ease;}
.clickable-central-row:hover{background:#1e293b;}
.clickable-central-row:active{transform:scale(.998);}
.badge-armed-total{background:#166534 !important;color:#dcfce7 !important;}
.badge-armed-partial{background:#a16207 !important;color:#fef9c3 !important;}
.badge-disarmed{background:#1d4ed8 !important;color:#dbeafe !important;}
.badge-alarm{background:#7f1d1d !important;color:#fee2e2 !important;}
@media(min-width:1800px){.home-quick-filter{max-width:440px;}.refined-home-table{min-width:760px !important;}}
@media(max-width:1200px){.home-quick-filter{max-width:100%;}}


/* v1.8.3 - Ajuste fino da tela inicial */
.home-operational-layout{
  grid-template-columns:minmax(0, 1fr) 360px !important;
}

.home-table-scroll{
  overflow-y:auto !important;
  overflow-x:hidden !important;
}

.home-table-scroll table{
  min-width:0 !important;
}

.refined-home-table{
  min-width:0 !important;
  width:100% !important;
  table-layout:fixed !important;
}

.refined-home-table th:nth-child(1),
.refined-home-table td:nth-child(1){
  width:28% !important;
}

.refined-home-table th:nth-child(2),
.refined-home-table td:nth-child(2){
  width:20% !important;
}

.refined-home-table th:nth-child(3),
.refined-home-table td:nth-child(3){
  width:32% !important;
}

.refined-home-table th:nth-child(4),
.refined-home-table td:nth-child(4){
  width:20% !important;
}

.home-events-card{
  max-width:360px;
}

@media(min-width:1800px){
  .home-operational-layout{
    grid-template-columns:minmax(0, 1fr) 390px !important;
  }

  .home-events-card{
    max-width:390px;
  }

  .refined-home-table{
    min-width:0 !important;
  }
}

@media(max-width:1200px){
  .home-operational-layout{
    grid-template-columns:1fr !important;
  }

  .home-events-card{
    max-width:none;
  }
}


/* v1.9 - Modal de edição cadastral */
.modal-overlay{
  position:fixed;
  inset:0;
  z-index:10000;
  background:rgba(2,6,23,.72);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.modal-overlay.hidden{
  display:none;
}

.modal-card{
  width:min(760px,100%);
  max-height:90vh;
  overflow-y:auto;
  background:#111827;
  border:1px solid #334155;
  border-radius:18px;
  padding:20px;
  box-shadow:0 24px 80px rgba(0,0,0,.55);
}

.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
}

.modal-header h2{
  margin:0 0 6px;
}

.modal-header p{
  margin:0;
  color:#94a3b8;
  font-size:13px;
}

.form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.form-grid label{
  color:#cbd5e1;
  font-size:13px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.form-full{
  grid-column:1 / -1;
}

.textarea{
  resize:vertical;
  min-height:90px;
}

.readonly-technical-box{
  margin-top:16px;
  border:1px solid #334155;
  border-radius:12px;
  padding:12px;
  background:#020617;
  color:#94a3b8;
  font-size:13px;
}

.readonly-technical-box strong{
  color:#e5e7eb;
  display:block;
  margin-bottom:5px;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:18px;
}

@media(max-width:760px){
  .form-grid{
    grid-template-columns:1fr;
  }

  .modal-header{
    flex-direction:column;
  }
}


/* v1.10 - Histórico operacional por central */
.central-history-header p{
  margin:4px 0 0;
  color:#94a3b8;
  font-size:13px;
}

.central-history-filters{
  display:grid;
  grid-template-columns:1fr 190px 150px;
  gap:10px;
  margin:14px 0;
}

.history-summary{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:#94a3b8;
  font-size:12px;
  margin-bottom:10px;
}

.history-summary span{
  background:#020617;
  border:1px solid #1f2937;
  border-radius:999px;
  padding:5px 9px;
}

.central-history-list{
  max-height:420px;
  overflow-y:auto;
  padding-right:6px;
}

.central-history-item{
  border-left:4px solid #334155;
  border-bottom:1px solid #1f2937;
  background:#0b1120;
  border-radius:10px;
  padding:11px 12px;
  margin-bottom:8px;
}

.central-history-title{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:4px;
}

.history-badge{
  display:inline-block;
  border-radius:999px;
  padding:3px 8px;
  font-size:11px;
  font-weight:800;
}

.history-badge-critical{
  background:#7f1d1d;
  color:#fee2e2;
}

.history-badge-medium{
  background:#854d0e;
  color:#fef3c7;
}

.history-badge-normal{
  background:#1d4ed8;
  color:#dbeafe;
}

.history-badge-low{
  background:#334155;
  color:#e2e8f0;
}

.history-row-critical,
.history-row-panic{
  border-left-color:#dc2626;
  background:rgba(127,29,29,.18);
}

.history-row-arm,
.history-row-bypass{
  border-left-color:#f59e0b;
}

.history-row-pgm{
  border-left-color:#2563eb;
}

@media(max-width:900px){
  .central-history-filters{
    grid-template-columns:1fr;
  }

  .central-history-list{
    max-height:520px;
  }
}


/* v1.11 - Status de conexão avançado */
.badge-online{
  background:#166534 !important;
  color:#dcfce7 !important;
}

.badge-reconnecting{
  background:#a16207 !important;
  color:#fef9c3 !important;
}

.badge-offline{
  background:#7f1d1d !important;
  color:#fee2e2 !important;
}

.central-row-offline{
  background:rgba(127,29,29,.16);
}

.central-row-reconnecting{
  background:rgba(161,98,7,.14);
}

.central-row-offline td:first-child{
  border-left:4px solid #dc2626;
}

.central-row-reconnecting td:first-child{
  border-left:4px solid #f59e0b;
}

.btn-disabled,
button:disabled{
  opacity:.45;
  cursor:not-allowed;
  filter:grayscale(.35);
}

.badge-offline{
  animation: statusPulseOffline 1.2s infinite;
}

@keyframes statusPulseOffline{
  0%{outline:1px solid rgba(220,38,38,.85);}
  50%{outline:4px solid rgba(220,38,38,.18);}
  100%{outline:1px solid rgba(220,38,38,.85);}
}


/* v1.12 - Eventos com display amigável */
.event-title,
.home-event-title,
.central-history-title strong{
  line-height:1.3;
}

.event-technical-meta{
  color:#64748b;
  font-size:12px;
}


/* v1.13 - Tela de Automação */
.automation-layout{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

.automation-card{
  min-height:420px;
}

.automation-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.automation-item{
  display:flex;
  justify-content:space-between;
  gap:14px;
  border:1px solid #1f2937;
  background:#0b1120;
  border-radius:12px;
  padding:12px;
}

.automation-title{
  font-weight:800;
  margin-bottom:6px;
}

.automation-meta{
  color:#94a3b8;
  font-size:12px;
  line-height:1.45;
}

.automation-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-shrink:0;
}

.group-centrals-selector{
  max-height:340px;
  overflow-y:auto;
  border:1px solid #334155;
  border-radius:12px;
  padding:8px;
  background:#020617;
}

.group-central-option{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:9px;
  border-bottom:1px solid #1f2937;
  cursor:pointer;
}

.group-central-option:last-child{
  border-bottom:none;
}

.group-central-option input{
  margin-top:4px;
}

.group-central-option span{
  display:flex;
  flex-direction:column;
  gap:3px;
}

.group-central-option small{
  color:#94a3b8;
}

.automation-logs{
  max-height:520px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.automation-log-row{
  border:1px solid #1f2937;
  background:#020617;
  border-radius:10px;
  padding:10px;
}

.automation-log-row span{
  color:#94a3b8;
  font-size:12px;
}

.automation-log-row pre{
  white-space:pre-wrap;
  font-size:11px;
  color:#cbd5e1;
  margin:8px 0 0;
  max-height:160px;
  overflow-y:auto;
}

@media(max-width:1100px){
  .automation-layout{
    grid-template-columns:1fr;
  }

  .automation-item{
    flex-direction:column;
  }

  .automation-actions{
    justify-content:flex-end;
  }
}


/* v1.14 - Editor inicial de regra */
.rule-draft-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

.rule-draft-grid label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color:#cbd5e1;
  font-size:13px;
}

.rule-draft-preview{
  margin-top:16px;
  border:1px solid #334155;
  border-radius:12px;
  padding:12px;
  background:#020617;
  color:#cbd5e1;
  font-size:12px;
  white-space:pre-wrap;
  max-height:360px;
  overflow:auto;
}

@media(max-width:760px){
  .rule-draft-grid{
    grid-template-columns:1fr;
  }
}


/* v1.15 - Salvar regra */
.rule-checkbox-label{
  flex-direction:row !important;
  align-items:center;
  gap:10px !important;
  margin-top:23px;
}

.rule-checkbox-label input{
  width:18px;
  height:18px;
}


/* v1.16 - Editar e excluir regras */
.automation-actions{
  flex-wrap:wrap;
  justify-content:flex-end;
}


/* v1.17 - Períodos completos */
.rule-period-extra-fields{
  border:1px solid #334155;
  border-radius:12px;
  padding:12px;
  background:#020617;
}

.rule-period-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.rule-period-grid label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color:#cbd5e1;
  font-size:13px;
}

.rule-period-help{
  color:#94a3b8;
  font-size:12px;
  line-height:1.4;
  margin-top:8px;
}

.weekday-selector{
  display:grid;
  grid-template-columns:repeat(7, minmax(0,1fr));
  gap:6px;
  margin-bottom:12px;
}

.weekday-option{
  display:flex !important;
  flex-direction:row !important;
  align-items:center;
  justify-content:center;
  gap:5px !important;
  border:1px solid #334155;
  background:#0b1120;
  border-radius:10px;
  padding:8px 6px;
  font-size:12px !important;
}

@media(max-width:900px){
  .weekday-selector{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }

  .rule-period-grid{
    grid-template-columns:1fr;
  }
}


/* v1.18 - Múltiplas ações */
.rule-actions-editor{
  border:1px solid #334155;
  border-radius:12px;
  padding:12px;
  background:#020617;
}

.rule-actions-header{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
  margin-bottom:12px;
}

.rule-actions-header p{
  margin:4px 0 0;
  color:#94a3b8;
  font-size:12px;
}

.rule-action-row{
  border:1px solid #1f2937;
  background:#0b1120;
  border-radius:12px;
  padding:12px;
  margin-bottom:10px;
}

.rule-action-row-top{
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
  align-items:end;
  margin-bottom:10px;
}

.rule-action-row label,
.rule-action-fields label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color:#cbd5e1;
  font-size:13px;
}

.rule-action-help{
  color:#94a3b8;
  font-size:12px;
  line-height:1.4;
}

@media(max-width:760px){
  .rule-actions-header,
  .rule-action-row-top{
    grid-template-columns:1fr;
    display:grid;
  }
}


/* v1.19 - Botão de reconexão individual */
.btn-technical-action{
  background:#334155;
  color:#e2e8f0;
  border:1px solid #475569;
}

.btn-technical-action:hover{
  background:#475569;
}

/* v1.20 - Alertas popup da automação */
.automation-alert-container{position:fixed;right:18px;bottom:78px;z-index:20000;width:min(420px,calc(100vw - 36px));display:flex;flex-direction:column;gap:12px;pointer-events:none}
.automation-alert{pointer-events:auto;border-radius:16px;border:1px solid #334155;background:#0b1120;box-shadow:0 20px 70px rgba(0,0,0,.5);padding:14px;animation:automationAlertIn .18s ease-out}
@keyframes automationAlertIn{from{transform:translateY(12px);opacity:0}to{transform:translateY(0);opacity:1}}
.automation-alert-critical{border-color:#dc2626;background:linear-gradient(180deg,rgba(127,29,29,.96),rgba(69,10,10,.96))}
.automation-alert-moderate{border-color:#f59e0b;background:linear-gradient(180deg,rgba(120,53,15,.96),rgba(69,26,3,.96))}
.automation-alert-light{border-color:#2563eb;background:linear-gradient(180deg,rgba(30,58,138,.96),rgba(15,23,42,.96))}
.automation-alert-top{display:flex;justify-content:space-between;gap:10px;margin-bottom:8px;color:#e5e7eb;font-size:12px}.automation-alert-level{font-weight:900;text-transform:uppercase}.automation-alert-message{font-size:15px;font-weight:800;line-height:1.35;color:#fff;margin-bottom:8px}.automation-alert-meta{font-size:12px;color:#cbd5e1;line-height:1.35}.automation-alert-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.automation-alert-history-button{position:fixed;right:18px;bottom:18px;z-index:19999;border:1px solid #334155;background:#111827;color:#e5e7eb;border-radius:999px;padding:10px 14px;box-shadow:0 12px 35px rgba(0,0,0,.35);cursor:pointer}
.automation-alert-history-panel{position:fixed;right:18px;top:78px;bottom:78px;z-index:19998;width:min(460px,calc(100vw - 36px));background:#020617;border:1px solid #334155;border-radius:16px;box-shadow:0 20px 70px rgba(0,0,0,.55);padding:14px;overflow-y:auto}
.automation-alert-history-header{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}.automation-alert-history-item{border:1px solid #1f2937;border-radius:12px;padding:10px;margin-bottom:10px;background:#0b1120}.automation-alert-history-critical{border-left:4px solid #dc2626}.automation-alert-history-moderate{border-left:4px solid #f59e0b}.automation-alert-history-light{border-left:4px solid #2563eb}.automation-alert-history-item span,.automation-alert-history-item small{color:#94a3b8;font-size:12px}.automation-alert-history-item p{margin:8px 0;color:#e5e7eb;font-weight:700;line-height:1.35}


/* v1.20.1 - Alerta crítico operacional */
.automation-critical-overlay{
  position:fixed;
  inset:0;
  z-index:30000;
  background:rgba(2,6,23,.86);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.automation-critical-card{
  width:min(760px,96vw);
  border:2px solid #ef4444;
  border-radius:24px;
  background:linear-gradient(180deg,#7f1d1d,#111827 62%);
  box-shadow:0 28px 110px rgba(0,0,0,.72), 0 0 40px rgba(239,68,68,.35);
  padding:28px;
  color:white;
  animation:criticalAutomationPulse 1.15s infinite;
}

@keyframes criticalAutomationPulse{
  0%{box-shadow:0 28px 110px rgba(0,0,0,.72), 0 0 12px rgba(239,68,68,.35);}
  50%{box-shadow:0 28px 110px rgba(0,0,0,.72), 0 0 44px rgba(239,68,68,.72);}
  100%{box-shadow:0 28px 110px rgba(0,0,0,.72), 0 0 12px rgba(239,68,68,.35);}
}

.automation-critical-header{
  display:flex;
  gap:18px;
  align-items:center;
  margin-bottom:24px;
}

.automation-critical-icon{
  font-size:48px;
}

.automation-critical-header h2{
  margin:0;
  font-size:30px;
  letter-spacing:.02em;
}

.automation-critical-header p{
  margin:6px 0 0;
  color:#fecaca;
}

.automation-critical-message{
  font-size:24px;
  line-height:1.35;
  font-weight:900;
  margin-bottom:18px;
  white-space:pre-wrap;
}

.automation-critical-meta{
  border:1px solid rgba(254,202,202,.25);
  border-radius:14px;
  background:rgba(2,6,23,.35);
  padding:12px;
  color:#fecaca;
  font-size:14px;
  margin-bottom:22px;
}

.automation-critical-actions{
  display:flex;
  justify-content:flex-end;
}

.automation-critical-actions .btn-danger{
  font-size:18px;
  padding:14px 22px;
  border-radius:14px;
}

/* v1.20.2 - Erro local no ACK de alerta crítico */
.automation-critical-error{
  border:1px solid rgba(250,204,21,.5);
  border-radius:12px;
  background:rgba(120,53,15,.65);
  color:#fef3c7;
  padding:10px;
  margin-bottom:16px;
  font-size:13px;
}

/* v1.20.3 */
.automation-critical-actions{
  gap:10px;
}


/* v1.20.4 - Remover histórico flutuante de alertas */
#automation-alert-history-panel,
#automation-alert-history-button{
  display:none !important;
  pointer-events:none !important;
}


/* v1.21 - Ação comando da central */
.rule-command-warning{
  border:1px solid rgba(245,158,11,.65);
  background:rgba(120,53,15,.45);
  color:#fef3c7;
  border-radius:12px;
  padding:12px;
  font-size:13px;
  line-height:1.45;
  margin-top:10px;
}

.rule-command-warning-real{
  border-color:rgba(239,68,68,.8);
  background:rgba(127,29,29,.52);
  color:#fee2e2;
}

.automation-log-command-summary{
  display:flex;
  flex-direction:column;
  gap:3px;
  border:1px solid #334155;
  border-radius:10px;
  background:#0b1120;
  padding:8px;
  margin-top:8px;
  color:#cbd5e1;
  font-size:12px;
}

.automation-log-command-summary strong{
  color:#fff;
  font-size:13px;
}


/* v1.22 - Visibilidade de comandos da automação */
.automation-command-card{
  margin-bottom:18px;
}

.automation-command-events{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:12px;
}

.automation-command-event{
  border:1px solid #334155;
  border-radius:14px;
  padding:12px;
  background:#0b1120;
  border-left-width:5px;
}

.automation-command-event-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  margin-bottom:8px;
}

.automation-command-status{
  font-weight:900;
  text-transform:uppercase;
  font-size:12px;
}

.automation-command-time{
  color:#94a3b8;
  font-size:12px;
}

.automation-command-main{
  color:#fff;
  font-weight:800;
  line-height:1.35;
  margin-bottom:6px;
}

.automation-command-meta,
.automation-command-reason{
  color:#cbd5e1;
  font-size:12px;
  line-height:1.4;
}

.automation-command-reason{
  margin-top:6px;
  color:#fde68a;
}

.command-status-simulation{
  border-left-color:#3b82f6;
}

.command-status-sent{
  border-left-color:#22c55e;
}

.command-status-blocked{
  border-left-color:#f59e0b;
}

.command-status-rejected{
  border-left-color:#ef4444;
}

.automation-log-command-summary.command-status-simulation{
  border-color:#3b82f6;
}

.automation-log-command-summary.command-status-sent{
  border-color:#22c55e;
}

.automation-log-command-summary.command-status-blocked{
  border-color:#f59e0b;
}

.automation-log-command-summary.command-status-rejected{
  border-color:#ef4444;
}


/* v1.23 - Exclusão manual de central */
.btn-danger-outline{
  background:transparent;
  color:#fecaca;
  border:1px solid #ef4444;
}

.btn-danger-outline:hover{
  background:rgba(127,29,29,.45);
  color:#fff;
}

.delete-central-modal-card{
  max-width:680px;
}

.delete-central-warning{
  border:1px solid rgba(239,68,68,.7);
  border-radius:14px;
  background:rgba(127,29,29,.34);
  color:#fee2e2;
  padding:14px;
  margin:14px 0;
  line-height:1.45;
}

.delete-central-warning strong{
  display:block;
  color:#fff;
  font-size:16px;
  margin-bottom:8px;
}

.delete-central-warning p{
  margin:8px 0;
}

.delete-central-warning ul{
  margin:8px 0 8px 22px;
}

.delete-central-confirm-label{
  display:flex;
  flex-direction:column;
  gap:8px;
  color:#e2e8f0;
}

.delete-central-confirm-label .input{
  text-transform:uppercase;
  font-weight:800;
  letter-spacing:.08em;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:16px;
}


/* v1.23.3 - Indicador de áudio operacional */
.alarm-audio-status-control{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:25000;
  border-radius:999px;
  padding:10px 14px;
  border:1px solid #475569;
  box-shadow:0 8px 30px rgba(0,0,0,.35);
  font-weight:800;
  font-size:12px;
  cursor:pointer;
}

.alarm-audio-blocked{
  background:#7f1d1d;
  border-color:#ef4444;
  color:#fff;
  animation:alarmAudioStatusPulse 1.6s infinite;
}

.alarm-audio-active{
  background:#14532d;
  border-color:#22c55e;
  color:#dcfce7;
  opacity:.88;
}

@keyframes alarmAudioStatusPulse{
  0%,100%{box-shadow:0 8px 30px rgba(0,0,0,.35),0 0 0 rgba(239,68,68,0);}
  50%{box-shadow:0 8px 30px rgba(0,0,0,.35),0 0 18px rgba(239,68,68,.5);}
}
