/* Alinha o espaçamento e a superfície do card programado ao padrão do painel. */
#spike-page-autocargo .container {
  padding-bottom: 0;
}

#spike-page-autocargo .timed-roles-card-standard {
  margin-top: 0;
  background: linear-gradient(180deg, #111715 0%, #0d1310 100%);
  border-color: #303a35;
}

@media (max-width: 640px) {
  #spike-page-autocargo .timed-roles-card-standard {
    margin-bottom: calc(124px + env(safe-area-inset-bottom));
  }

  #spike-page-autocargo.autocargo-react-page.has-pending-changes .container {
    padding-bottom: 0;
  }
}

/* Controls compactos e chips discretos, usando os tokens aprovados do painel. */
#spike-page-autocargo .timed-selection-box {
  min-height: 48px;
  padding: 10px;
  margin: 12px 0;
  border-color: rgba(255, 255, 255, .12);
  background: #0d1310;
}

#spike-page-autocargo .timed-card-tag,
#spike-page-autocargo .timed-rule-tag {
  padding: 6px 10px;
  border: 1px solid rgba(0, 240, 138, .18);
  border-radius: 9px;
  background: #0d1310;
  color: #d7e7de;
  font-size: 12px;
  line-height: 1.2;
}

#spike-page-autocargo .timed-card-tag button {
  color: #aebbb2;
}

#spike-page-autocargo .timed-form-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center !important;
  gap: 8px;
  margin: 12px 0;
}

#spike-page-autocargo .timed-card-days {
  box-sizing: border-box;
  flex: 0 0 64px;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  height: 44px;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 10px;
  background: #0a0e0b;
  color: #f4faf6;
  font-size: 13px;
}

#spike-page-autocargo .timed-form-row .spike-generic-select-trigger {
  box-sizing: border-box;
  flex: 0 0 84px;
  width: 84px;
  min-width: 84px;
  max-width: 84px;
  height: 44px;
  min-height: 44px;
  padding: 6px 28px 6px 10px !important;
  border-radius: 10px;
  font-size: 12px !important;
}

#spike-page-autocargo .timed-message-button {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(0, 240, 138, .22);
  border-radius: 10px;
  background: #0d1310;
  color: #d7e7de;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

#spike-page-autocargo .timed-message-button:hover {
  border-color: rgba(0, 240, 138, .45);
  background: rgba(0, 240, 138, .06);
  color: #f4faf6;
}

#spike-page-autocargo .timed-add-group {
  background: linear-gradient(135deg, #00ff88 0%, #00c96f 100%);
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule {
  margin-top: 12px;
  padding: 14px;
  border-color: #303a35;
  background: linear-gradient(180deg, #111715 0%, #0d1310 100%);
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-color: rgba(255, 255, 255, .12);
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule-actions {
  gap: 8px;
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule-action {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, .09);
  background: #0a0e0b;
  color: #f4faf6;
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule-action:hover {
  border-color: rgba(0, 240, 138, .35);
  color: #9fffc5;
}

#spike-page-autocargo .timed-roles-card-standard .timed-rule-action.remove {
  border: 1px solid rgba(255, 93, 114, .2);
  background: rgba(255, 93, 114, .07);
  color: #ff9aa8;
}

@media (max-width: 380px) {
  #spike-page-autocargo .timed-card-days {
    flex-basis: 58px;
    width: 58px;
    min-width: 58px;
    max-width: 58px;
  }

  #spike-page-autocargo .timed-form-row .spike-generic-select-trigger {
    flex-basis: 76px;
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    padding-left: 8px !important;
  }

  #spike-page-autocargo .timed-message-button {
    padding: 0 6px;
    font-size: 10px;
  }
}

/* Editor de mensagem do Auto cargo: controles enxutos e prévia Discord padronizada. */
#spike-page-autocargo .timed-message-editor {
  width: min(560px, 100%);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

#spike-page-autocargo .timed-message-editor .timed-editor-head {
  margin-bottom: 14px;
}

#spike-page-autocargo .timed-message-type-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

#spike-page-autocargo .timed-message-type {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: #0d1310;
  color: #aebbb2;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

#spike-page-autocargo .timed-message-type:hover {
  border-color: rgba(0, 240, 138, .35);
  color: #e6eee9;
}

#spike-page-autocargo .timed-message-type.selected {
  border-color: rgba(0, 240, 138, .42);
  background: rgba(0, 240, 138, .08);
  color: #9fffc5;
}

#spike-page-autocargo .timed-message-field {
  margin-bottom: 14px;
}

#spike-page-autocargo .timed-message-field label {
  display: block;
  margin-bottom: 7px;
  color: #cbd5ce;
  font-size: 12px;
  font-weight: 650;
}

#spike-page-autocargo .timed-message-field textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  outline: 0;
  background: #0a0e0b;
  color: #f4faf6;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

#spike-page-autocargo .timed-message-field textarea:focus {
  border-color: rgba(0, 240, 138, .48);
  box-shadow: 0 0 0 3px rgba(0, 240, 138, .08);
}

#spike-page-autocargo .timed-message-field small {
  display: block;
  margin-top: 5px;
  color: #88958d;
  font-size: 10px;
}

#spike-page-autocargo .timed-message-preview-shell {
  overflow: hidden;
  border: 1px solid #252a33;
  border-radius: 12px;
  background: #111318;
}

#spike-page-autocargo .timed-message-preview-top {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border-bottom: 1px solid #242831;
  background: #151820;
}

#spike-page-autocargo .timed-message-preview-top strong {
  color: #e7e9ed;
  font-size: 11px;
}

#spike-page-autocargo .timed-message-preview-top span {
  color: #8e96a3;
  font-size: 10px;
}

#spike-page-autocargo .timed-message-preview-discord {
  min-height: 104px;
  padding: 14px;
  background: #313338;
  color: #dbdee1;
  font-family: "gg sans", "Noto Sans", Arial, sans-serif;
}

#spike-page-autocargo .timed-message-preview-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#spike-page-autocargo .timed-message-preview-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c979, #087a52);
  color: #f2fff8;
  font-size: 14px;
  font-weight: 800;
}

#spike-page-autocargo .timed-message-preview-content {
  min-width: 0;
  flex: 1;
}

#spike-page-autocargo .timed-message-preview-botline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  color: #f2f3f5;
  font-size: 12px;
  font-weight: 700;
}

#spike-page-autocargo .timed-message-preview-botline span {
  padding: 2px 4px;
  border-radius: 3px;
  background: #5865f2;
  color: #fff;
  font-size: 8px;
  line-height: 1;
}

#spike-page-autocargo .timed-message-preview-botline small {
  color: #949ba4;
  font-size: 9px;
  font-weight: 400;
}

#spike-page-autocargo .timed-message-preview-plain,
#spike-page-autocargo .timed-message-preview-embed > div {
  color: #dbdee1;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#spike-page-autocargo .timed-message-preview-plain.placeholder,
#spike-page-autocargo .timed-message-preview-embed > div:empty {
  color: #a0a5ad;
}

#spike-page-autocargo .timed-message-preview-embed {
  max-width: 100%;
  padding: 10px 12px;
  border-left: 3px solid #00d982;
  border-radius: 4px;
  background: #2b2d31;
}

#spike-page-autocargo .timed-message-preview-embed strong {
  display: block;
  margin-bottom: 5px;
  color: #f2f3f5;
  font-size: 12px;
  font-weight: 700;
}

#spike-page-autocargo .timed-message-actions {
  margin-top: 12px;
}

@media (max-width: 380px) {
  #spike-page-autocargo .timed-message-editor {
    padding: 13px;
  }

  #spike-page-autocargo .timed-message-preview-discord {
    padding: 11px;
  }
}

/* Prévia persistente no card e edição completa da regra programada. */
#spike-page-autocargo .timed-message-preview-inline {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #2c4039;
  border-radius: 12px;
  background: #0e1713;
  color: #c9d9d1;
}

#spike-page-autocargo .timed-message-preview-inline strong {
  display: block;
  margin-bottom: 5px;
  color: #8de8b0;
  font-size: 11px;
}

#spike-page-autocargo .timed-message-preview-inline p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#spike-page-autocargo .timed-message-preview-inline.is-empty p {
  color: #82958c;
}

#spike-page-autocargo .timed-rule-message {
  display: block;
  margin-top: 8px;
  color: #9db4aa;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#spike-page-autocargo .timed-selection .timed-role-remove {
  margin-left: 5px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #ff9494;
  font-size: 14px;
  cursor: pointer;
}

#spike-page-autocargo .timed-modal-period {
  display: flex;
  gap: 8px;
  align-items: center;
}

#spike-page-autocargo .timed-modal-period .timed-card-days {
  flex: 1;
  width: auto;
}

#spike-page-autocargo .timed-modal-period .timed-card-unit {
  flex: 1;
}

#spike-page-autocargo .timed-edit-message-button {
  width: 100%;
  margin-top: 14px;
}

/* Prévia Discord no grupo e no modal de edição; seletor do editor igual ao de criação. */
#spike-page-autocargo .timed-editor-role-select { width: 100%; margin: 0 0 12px; }
#spike-page-autocargo .timed-rule-message-preview { margin: 12px 0 0; }
#spike-page-autocargo .timed-editor-message-preview { margin-top: 14px; }
#spike-page-autocargo .timed-create-message-preview { margin-top: 12px; }
