/* ── Automation Settings — FornoCloud Phase 7.4-I ── */

#automation-panel {
  background: var(--graphite-mid);
  border: 1px solid var(--graphite-lt);
  border-radius: 16px;
  padding: 24px;
  display: none;
}
#automation-panel.atm-visible { display: block; }

.atm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.atm-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--white);
}
.atm-subtitle {
  font-size: 12px;
  color: var(--ash);
  margin-top: 2px;
}

/* Emergency Banner */
.atm-em-banner {
  display: none;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, #991b1b, #7f1d1d);
  border: 1px solid #ef4444;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fca5a5;
}
.atm-em-banner.atm-em-active { display: flex; }
.atm-em-icon { font-size: 18px; }

/* Master OFF button */
.atm-master-off {
  padding: 8px 18px;
  background: rgba(239,68,68,0.12);
  border: 1.5px solid rgba(239,68,68,0.5);
  border-radius: 8px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .3px;
  transition: background .15s;
  white-space: nowrap;
}
.atm-master-off:hover { background: rgba(239,68,68,0.22); }

/* Group tabs */
.atm-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--graphite-lt);
}
.atm-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  color: var(--ash);
  background: transparent;
  font-family: inherit;
  transition: all .15s;
}
.atm-tab:hover { color: var(--white); border-color: var(--graphite-lt); }
.atm-tab.atm-tab-active {
  background: #E8671A;
  color: #fff;
  border-color: #E8671A;
}

/* Group panel */
.atm-group { display: none; }
.atm-group.atm-group-active { display: block; }
.atm-group-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 12px;
}

/* Toggle row */
.atm-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.atm-row:last-child { border-bottom: none; }
.atm-row-left { flex: 1; min-width: 0; }
.atm-row-right { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

.atm-toggle-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 3px;
}
.atm-toggle-desc {
  font-size: 11px;
  color: var(--ash);
  line-height: 1.5;
  margin-bottom: 6px;
}
.atm-toggle-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Risk badge */
.atm-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .4px;
}
.atm-badge-SAFE    { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3);  }
.atm-badge-GUARDED { background: rgba(245,158,11,.12); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.atm-badge-DANGER  { background: rgba(239,68,68,.12);  color: #f87171; border: 1px solid rgba(239,68,68,.3);  }

/* Emergency stop chip */
.atm-em-chip {
  font-size: 10px;
  color: #888;
  padding: 2px 7px;
  border: 1px solid #3D3D45;
  border-radius: 4px;
}
.atm-em-chip.atm-em-yes { color: #f87171; border-color: rgba(239,68,68,.4); }

/* Updated by */
.atm-updated {
  font-size: 10px;
  color: #555;
}

/* Toggle switch */
.atm-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.atm-switch input { opacity: 0; width: 0; height: 0; }
.atm-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #3D3D45;
  border-radius: 22px;
  transition: background .2s;
}
.atm-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #888;
  left: 3px;
  top: 3px;
  transition: all .2s;
}
.atm-switch input:checked + .atm-slider { background: #E8671A; }
.atm-switch input:checked + .atm-slider::before {
  transform: translateX(18px);
  background: #fff;
}
.atm-switch input:disabled + .atm-slider { opacity: .5; cursor: not-allowed; }

/* Loading / empty states */
.atm-loading {
  text-align: center;
  padding: 40px;
  color: var(--ash);
  font-size: 13px;
}
.atm-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 8px;
  padding: 12px 16px;
  color: #f87171;
  font-size: 12px;
  margin-bottom: 16px;
}

/* Danger confirmation modal */
#atm-danger-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#atm-danger-modal.atm-modal-open { display: flex; }
.atm-modal-box {
  background: #1A1A1F;
  border: 1.5px solid rgba(239,68,68,.5);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
}
.atm-modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #f87171;
  margin-bottom: 8px;
}
.atm-modal-desc {
  font-size: 13px;
  color: var(--ash);
  margin-bottom: 20px;
  line-height: 1.6;
}
.atm-modal-input-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.atm-modal-input {
  width: 100%;
  background: #0D0D0F;
  border: 1.5px solid #3D3D45;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  outline: none;
  box-sizing: border-box;
  letter-spacing: 1px;
  margin-bottom: 16px;
  font-family: monospace;
}
.atm-modal-input:focus { border-color: #ef4444; }
.atm-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.atm-modal-cancel {
  padding: 9px 20px;
  background: #2A2A30;
  border: 1px solid #3D3D45;
  border-radius: 8px;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.atm-modal-confirm {
  padding: 9px 20px;
  background: rgba(239,68,68,.15);
  border: 1.5px solid rgba(239,68,68,.5);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.atm-modal-confirm:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.atm-modal-confirm:disabled { opacity: .4; cursor: not-allowed; }

/* Log table */
.atm-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.atm-log-table th {
  text-align: left;
  padding: 6px 8px;
  color: #555;
  font-weight: 700;
  border-bottom: 1px solid #2A2A30;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.atm-log-table td {
  padding: 7px 8px;
  color: var(--ash);
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: top;
}
.atm-log-result-success { color: #4ade80; }
.atm-log-result-error   { color: #f87171; }
