/* ============================================================
   TAB 7 — COMUNICAZIONI
   ============================================================ */

/* Nav interna */
.tab7-wrap { padding: 0; }
.tab7-nav { display: flex; gap: 4px; border-bottom: 1px solid #e0e0e0; margin-bottom: 24px; }
.tab7-nav-btn {
  background: none; border: none; padding: 10px 18px;
  font-size: 14px; cursor: pointer; color: #666;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab7-nav-btn:hover { color: #333; }
.tab7-nav-btn.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 500; }

/* Header sezione */
.tab7-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tab7-section-header h3 { margin: 0; font-size: 16px; font-weight: 600; }

/* Hint */
.tab7-hint { font-size: 13px; color: #888; margin: 0 0 20px; }
.tab7-hint-inline { font-size: 12px; color: #aaa; font-weight: 400; }

/* Gruppi template */
.tab7-group-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: #999; margin: 20px 0 8px;
}
.tab7-template-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }

/* Card template */
.tab7-template-card {
  background: #fff; border: 1px solid #e8e8e8;
  border-radius: 8px; padding: 12px 16px;
  transition: box-shadow 0.15s;
}
.tab7-template-card:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tab7-template-card.disabled { opacity: 0.55; }
.tab7-template-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tab7-template-nome { font-size: 14px; font-weight: 500; margin-right: 8px; }
.tab7-template-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tab7-template-oggetto { font-size: 12px; color: #666; margin-top: 6px; }
.tab7-template-vars { font-size: 12px; color: #888; margin-top: 4px; }
.tab7-template-vars code { background: #f4f4f4; border-radius: 3px; padding: 1px 4px; font-size: 11px; }

/* Badge */
.tab7-badge {
  display: inline-block; font-size: 11px; padding: 2px 7px;
  border-radius: 10px; font-weight: 500; margin-left: 4px;
}
.badge-canale-email { background: #e8f0fe; color: #1a56a0; }
.badge-canale-sms { background: #fce8d5; color: #b45309; }
.badge-canale-entrambi { background: #e8f5e9; color: #2e7d32; }
.badge-default { background: #f3f3f3; color: #888; }
.badge-off { background: #fdecea; color: #c62828; }
.badge-on { background: #e8f5e9; color: #2e7d32; }
.badge-stato-inviato { background: #e8f5e9; color: #2e7d32; }
.badge-stato-errore { background: #fdecea; color: #c62828; }
.badge-stato-in_attesa { background: #fff8e1; color: #b45309; }

/* Bottoni */
.btn-primary {
  background: #1a73e8; color: #fff; border: none;
  padding: 8px 16px; border-radius: 6px; font-size: 13px;
  cursor: pointer; font-weight: 500;
}
.btn-primary:hover { background: #1558c0; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-secondary {
  background: #f5f5f5; color: #333; border: 1px solid #ddd;
  padding: 7px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
}
.btn-secondary:hover { background: #e8e8e8; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-link { background: none; border: none; color: #1a73e8; cursor: pointer; font-size: 13px; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #c62828; }

/* Tabella */
.tab7-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tab7-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #e0e0e0; font-weight: 600; color: #555; font-size: 12px; }
.tab7-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.tab7-table .row-disabled td { opacity: 0.5; }
.tab7-table .row-error-detail td { background: #fff8f8; font-size: 12px; color: #c62828; padding: 4px 12px 8px; }
.tab7-empty { color: #aaa; font-style: italic; text-align: center; padding: 24px 0; }
.tab7-actions-cell { white-space: nowrap; display: flex; gap: 8px; }
.tab7-storico-count { font-size: 13px; color: #888; }
.tab7-destinatario { font-size: 12px; color: #555; }

/* Invio manuale */
.tab7-invio-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tab7-invio-col {}
.tab7-filtro-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tab7-filtro-bar select { flex: 1; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.tab7-sel-count { font-size: 12px; color: #888; white-space: nowrap; }
.tab7-clienti-list {
  max-height: 380px; overflow-y: auto;
  border: 1px solid #e8e8e8; border-radius: 8px; padding: 8px;
}
.tab7-cliente-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.tab7-cliente-row:hover { background: #f5f7ff; }
.tab7-cliente-nome { font-weight: 500; flex: 1; }
.tab7-cliente-contact { font-size: 12px; color: #888; }
.tab7-invio-actions-bottom { display: flex; gap: 8px; margin-top: 10px; }

/* Anteprima */
.tab7-anteprima {
  border: 1px solid #e8e8e8; border-radius: 8px;
  padding: 16px; min-height: 180px; margin-top: 12px; background: #fafafa;
}
.tab7-anteprima-inner { display: flex; flex-direction: column; gap: 16px; }
.tab7-anteprima-block {}
.tab7-anteprima-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #999; margin-bottom: 4px; }
.tab7-anteprima-oggetto { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.tab7-anteprima-corpo {
  font-size: 12px; line-height: 1.6; background: #fff;
  border: 1px solid #e8e8e8; border-radius: 6px; padding: 10px;
  white-space: pre-wrap; word-break: break-word; margin: 0; font-family: inherit;
}
.tab7-anteprima-corpo.sms { background: #fffde7; }
.tab7-anteprima-chars { font-size: 11px; color: #aaa; margin-top: 4px; text-align: right; }
.tab7-invio-submit { margin-top: 16px; }

/* Form */
.tab7-form-group { margin-bottom: 14px; }
.tab7-form-group label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.tab7-form-group input, .tab7-form-group select, .tab7-form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ddd;
  border-radius: 6px; font-size: 13px; box-sizing: border-box; font-family: inherit;
}
.tab7-form-group textarea { resize: vertical; }
.tab7-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Paginazione */
.tab7-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; font-size: 13px; color: #666; }

/* Modal (riutilizza lo stile esistente del progetto — qui solo override specifici) */
#modal-template .modal, #modal-regola .modal { max-width: 620px; width: 95vw; }
