/* ============================================================
   TAB 8 — REGOLE OPERATIVE
   Nav interna stile Tab 7
   ============================================================ */

/* ---------- Nav interna ---------- */
.tab8-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 24px;
}

.tab8-nav-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #888;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.tab8-nav-btn:hover { color: #333; }
.tab8-nav-btn.active { color: #14b8a6; border-bottom-color: #14b8a6; font-weight: 600; }

/* ---------- Sezioni ---------- */
.tab8-section { display: none; }
.tab8-section.active { display: block; }

/* ---------- Card ---------- */
.reg-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.reg-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Grid campi ---------- */
.reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.reg-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 700px) {
  .reg-grid, .reg-grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Campi form ---------- */
.reg-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.reg-field label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reg-field input[type="text"],
.reg-field input[type="number"],
.reg-field input[type="time"],
.reg-field select {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 14px;
  color: #1f2937;
  background: #fff;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.reg-field input:focus,
.reg-field select:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20,184,166,0.1);
}

.reg-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

/* ---------- Toggle switch ---------- */
.reg-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.reg-toggle-label {
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  flex: 1;
}

.reg-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.reg-toggle input { opacity: 0; width: 0; height: 0; }

.reg-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background 0.2s;
}

.reg-toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.reg-toggle input:checked + .reg-toggle-slider { background: #14b8a6; }
.reg-toggle input:checked + .reg-toggle-slider:before { transform: translateX(20px); }

/* ---------- Sottosezione disabilitata ---------- */
.reg-subsection {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  background: #f9fafb;
}

.reg-subsection.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Separatore ---------- */
.reg-divider { border: none; border-top: 1px solid #e5e7eb; margin: 16px 0; }

/* ---------- Badge stato CSI ---------- */
.reg-csi-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.reg-csi-status.connected { background: #d1fae5; color: #065f46; }
.reg-csi-status.disconnected { background: #fee2e2; color: #991b1b; }
.reg-csi-status.unknown { background: #f3f4f6; color: #6b7280; }
.reg-csi-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Bottone test ---------- */
.reg-btn-test {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}
.reg-btn-test:hover { background: #e5e7eb; }

/* ---------- Footer salvataggio ---------- */
.reg-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 14px 0 0;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}

.reg-save-msg { font-size: 13px; color: #6b7280; min-height: 20px; }
.reg-save-msg.success { color: #059669; font-weight: 500; }
.reg-save-msg.error { color: #dc2626; font-weight: 500; }

.reg-btn-save {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  background: #14b8a6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.reg-btn-save:hover { background: #0d9488; }
.reg-btn-save:disabled { background: #9ca3af; cursor: not-allowed; }
