.communication-settings {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.communication-settings > *,
.communication-editor,
.communication-editor-body,
.communication-editor-body > *,
.communication-form-grid {
  min-width: 0;
  max-width: 100%;
}

.communication-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  border-radius: 6px;
}

.communication-summary strong,
.communication-channel-name {
  color: var(--text);
  font-weight: 600;
}

.communication-summary small,
.communication-muted {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.communication-actions,
.communication-form-actions,
.communication-type-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.communication-channel-list {
  border: 1px solid var(--border2);
  border-radius: 6px;
  overflow: hidden;
}

.communication-channel-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.communication-channel-row:last-child { border-bottom: 0; }
.communication-channel-row:hover { background: var(--surface2); }

.communication-channel-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.communication-channel-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--accent);
  background: var(--surface2);
  font-weight: 600;
}

.communication-channel-name,
.communication-channel-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.communication-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--text-muted);
  font-size: 11px;
}

.communication-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}

.communication-status.is-active::before { background: #00a67d; }
.communication-status.is-error::before { background: var(--danger); }

.communication-editor {
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.communication-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.communication-editor-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
  letter-spacing: 0;
}

.communication-editor-body {
  display: grid;
  gap: 16px;
  padding: 14px;
}

.communication-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.communication-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.communication-field.is-wide { grid-column: 1 / -1; }

.communication-field label,
.communication-section-title {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.communication-field input,
.communication-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--input-border);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

.communication-field input:focus,
.communication-field select:focus {
  outline: none;
  border-color: var(--input-border-focus);
}

.communication-secret-note {
  padding: 9px 10px;
  border-left: 3px solid var(--info);
  background: var(--brand-blue-muted);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.55;
}

.communication-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.communication-toggle-row:last-child { border-bottom: 0; }

.communication-toggle-copy { min-width: 0; }
.communication-toggle-copy strong { display: block; font-size: 12px; }

.communication-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 36px;
}

.communication-switch input { position: absolute; opacity: 0; }
.communication-switch span {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--surface3);
  cursor: pointer;
}
.communication-switch span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform .16s ease;
}
.communication-switch input:checked + span { background: var(--accent); }
.communication-switch input:checked + span::after { transform: translateX(16px); background: #fff; }

.communication-access-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.communication-access-table th,
.communication-access-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.communication-access-table th { color: var(--text-muted); font-weight: 600; }
.communication-access-table td:last-child,
.communication-access-table th:last-child { text-align: right; }

.communication-access-control {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border2);
  border-radius: 5px;
  background: var(--surface2);
}
.communication-access-control label { cursor: pointer; }
.communication-access-control input { position: absolute; opacity: 0; }
.communication-access-control span {
  display: block;
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--text-muted);
  white-space: nowrap;
}
.communication-access-control input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border2);
}

.communication-scope-details {
  grid-column: 1 / -1;
  display: none;
  padding: 8px 0 2px 20px;
}
.communication-scope-row.is-enabled .communication-scope-details { display: block; }
.communication-resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: 8px;
}
.communication-resource-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.communication-empty,
.communication-loading,
.communication-error {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-muted);
}
.communication-error { color: var(--danger); }

@media (max-width: 760px) {
  .communication-channel-row { grid-template-columns: minmax(0, 1fr) auto; }
  .communication-channel-address { grid-column: 1; }
  .communication-form-grid,
  .communication-resource-list { grid-template-columns: 1fr; }
  .communication-summary,
  .communication-editor-head { align-items: stretch; flex-direction: column; }
  .communication-access-table,
  .communication-access-table tbody,
  .communication-access-table tr,
  .communication-access-table td { display: block; width: 100%; box-sizing: border-box; }
  .communication-access-table thead { display: none; }
  .communication-access-table tr { padding: 9px 0; border-bottom: 1px solid var(--border); }
  .communication-access-table td { padding: 3px 0; border: 0; text-align: left; }
  .communication-access-table td:last-child { text-align: left; }
  .communication-access-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    box-sizing: border-box;
    width: 100%;
  }
  .communication-access-control label { min-width: 0; text-align: center; }
  .communication-access-control span {
    min-height: 100%;
    padding: 5px 4px;
    font-size: 10px;
    white-space: normal;
  }
}
