* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  line-height: 1.5;
  background: #f6f6f6;
  color: #202020;
}

.page {
  width: min(860px, calc(100% - 40px));
  margin: 40px auto;
}

.card,
.status-card,
.feedback {
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: white;
}

.status-card {
  border-left: 6px solid #777777;
  background: #eeeeee;
}

.status-card.connected {
  border-left-color: #27833b;
  background: #e5f7e9;
}

.status-card.reconnecting {
  border-left-color: #cc8a00;
  background: #fff5d8;
}

.status-card.disconnected {
  border-left-color: #b42318;
  background: #ffe5e5;
}

.status-detail {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar h2 {
  margin-bottom: 4px;
}

.muted {
  margin: 0;
  color: #666666;
  font-size: 14px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: #1f1f1f;
  color: white;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.message-composer label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.message-composer textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.message-composer textarea:focus {
  outline: 2px solid #1f1f1f;
  outline-offset: 2px;
}

.composer-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  color: #666666;
  font-size: 14px;
}

.character-limit {
  color: #b42318;
  font-weight: 700;
}

.feedback {
  margin-top: 16px;
}

.feedback.success {
  background: #e5f7e9;
}

.feedback.failure {
  background: #ffe5e5;
}

.hidden {
  display: none;
}

#groupsList {
  padding-left: 22px;
}

#groupsList li {
  margin-bottom: 18px;
}

#groupsList .empty {
  margin-left: -22px;
  list-style: none;
}

#groupsList small {
  overflow-wrap: anywhere;
}

#qrCodeImage {
  max-width: 100%;
}

.footer-link {
  margin-top: 20px;
}

.group-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.group-search {
  flex: 1;
  min-width: 220px;
  padding: 11px 13px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font: inherit;
}

.secondary-button {
  background: #eeeeee;
  color: #222222;
}

.selection-summary {
  margin: 12px 0;
  font-size: 14px;
  font-weight: 600;
}

#groupsList {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.group-item {
  margin: 0;
}

.group-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dddddd;
  border-radius: 9px;
  background: #ffffff;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.group-option:hover {
  border-color: #999999;
}

.group-option.selected {
  border-color: #27833b;
  background: #eaf7ed;
}

.group-option input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
}

.group-information {
  min-width: 0;
}

.group-name {
  display: block;
  font-weight: 700;
}

.group-details {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #666666;
  overflow-wrap: anywhere;
}

.send-summary {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.send-summary > div {
  padding: 14px;
  border-radius: 8px;
  background: #f3f3f3;
}

.summary-label {
  display: block;
  margin-bottom: 3px;
  color: #666666;
  font-size: 13px;
}

.send-button {
  width: 100%;
  margin-top: 16px;
  padding: 14px 18px;
  font-size: 16px;
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.send-button-hint {
  margin: 9px 0 0;
  color: #666666;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 600px) {
  .send-summary {
    grid-template-columns: 1fr;
  }
}

.send-feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
}

.send-feedback.sending {
  background: #fff5d8;
}

.send-feedback.success {
  background: #e5f7e9;
}

.send-feedback.failure {
  background: #ffe5e5;
}

.send-results {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #dddddd;
}

.send-results h3 {
  margin-top: 0;
}

.send-results-summary {
  margin-bottom: 14px;
  font-weight: 700;
}

#sendResultsList {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.send-result-item {
  padding: 12px;
  border-radius: 8px;
  background: #f3f3f3;
}

.send-result-item.sent {
  border-left: 5px solid #27833b;
}

.send-result-item.failed {
  border-left: 5px solid #b42318;
}

.send-result-name {
  display: block;
  font-weight: 700;
}

.send-result-detail {
  display: block;
  margin-top: 3px;
  color: #666666;
  font-size: 13px;
  overflow-wrap: anywhere;
}

body.sending .message-composer textarea,
body.sending .group-search,
body.sending .group-checkbox,
body.sending .secondary-button,
body.sending #syncGroupsButton {
  pointer-events: none;
  opacity: 0.65;
}

.send-summary-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.send-summary-grid > div {
  padding: 12px;
  border-radius: 8px;
  background: #f3f3f3;
}

.send-summary-label {
  display: block;
  margin-bottom: 3px;
  color: #666666;
  font-size: 12px;
  font-weight: 400;
}

.send-summary-grid strong {
  font-size: 16px;
}

.image-field {
  margin-top: 18px;
}

.image-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.optional-label {
  color: #777777;
  font-size: 12px;
  font-weight: 400;
}

.image-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font: inherit;
}

.image-field input:focus {
  outline: 2px solid #1f1f1f;
  outline-offset: 2px;
}

.field-help,
.field-feedback {
  margin: 7px 0 0;
  color: #666666;
  font-size: 13px;
}

.field-feedback.failure {
  color: #b42318;
}

.image-preview-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dddddd;
  border-radius: 9px;
  background: #f7f7f7;
}

.image-preview-card img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  background: #eeeeee;
}

@media (max-width: 520px) {
  .image-preview-card {
    flex-direction: column;
  }

  .image-preview-card img {
    width: 100%;
    height: auto;
    max-height: 320px;
  }
}

.offer-link-field {
  margin-top: 18px;
}

.offer-link-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.offer-link-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  font: inherit;
}

.offer-link-field input:focus {
  outline: 2px solid #1f1f1f;
  outline-offset: 2px;
}

.offer-link-field input.invalid {
  border-color: #b42318;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.approval-link {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  background: #1f1f1f;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/*
 * Navegação principal do portal.
 * Mantém os acessos alinhados mesmo quando
 * novos módulos são adicionados.
 */
nav,
.navigation,
.nav-actions,
.main-actions,
.portal-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

a[href="/curation.html"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 48px;
  padding: 0 18px;

  border-radius: 10px;
  background: #202020;
  color: #ffffff;

  font-weight: 800;
  text-decoration: none;
}

a[href="/curation.html"]:hover {
  filter: brightness(1.12);
}
