.regab-mail-attachments {
  margin: 16px 0 4px;
  padding: 15px;
  display: grid;
  gap: 11px;
  color: #25384a;
  background: #f6f9fc;
  border: 1px dashed #b9c9da;
  border-radius: 13px;
  transition: border-color .16s ease, background .16s ease;
}

.regab-mail-attachments.is-dragging {
  background: #eef5ff;
  border-color: #3977ed;
}

.regab-mail-attachments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.regab-mail-attachments-head > div,
.regab-mail-file-row > span,
.regab-mail-template-heading,
.regab-mail-signature-controls {
  display: grid;
  gap: 3px;
}

.regab-mail-attachments-head strong { font-size: 13px; }
.regab-mail-attachments-head span,
.regab-mail-attachments > small,
.regab-mail-file-row small,
.regab-mail-template-heading span,
.regab-mail-signature-controls small {
  color: #748394;
  font-size: 11px;
  line-height: 1.45;
}

.regab-mail-file-button,
.regab-mail-signature-upload {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px !important;
  cursor: pointer;
  white-space: nowrap;
}

.regab-mail-file-button input,
.regab-mail-signature-upload input { display: none; }

.regab-mail-file-list { display: grid; gap: 7px; }
.regab-mail-file-list:empty { display: none; }

.regab-mail-file-row {
  min-height: 43px;
  padding: 7px 8px 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: white;
  border: 1px solid #dbe3ea;
  border-radius: 9px;
}

.regab-mail-file-row strong {
  max-width: min(680px, 70vw);
  overflow: hidden;
  color: #25384a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.regab-mail-file-row .icon-button {
  min-width: 32px;
  width: 32px;
  height: 32px;
  font-size: 20px;
}

.regab-mail-attachment-status.is-error,
.regab-mail-defaults-message.is-error { color: #c83246 !important; font-weight: 800; }
.regab-mail-defaults-message.is-success { color: #178c5b !important; font-weight: 800; }

.regab-mail-card-icon {
  display: grid !important;
  place-items: center;
  font-size: 22px;
}

.regab-mail-defaults-modal {
  width: min(1120px, calc(100vw - 44px));
  max-height: min(900px, calc(100vh - 44px));
  overflow: auto;
}

.regab-mail-defaults-loading { padding: 30px; color: #748394; font-weight: 700; }
.regab-mail-defaults-form { display: grid; gap: 16px; }

.regab-mail-template-section {
  padding: 16px;
  display: grid;
  gap: 13px;
  background: #f8fafc;
  border: 1px solid #e0e8f0;
  border-radius: 13px;
}

.regab-mail-template-heading strong { color: #25384a; font-size: 15px; }
.regab-mail-defaults-form label {
  display: grid;
  gap: 7px;
  color: #4a5b6c;
  font-size: 11px;
  font-weight: 800;
}

.regab-mail-defaults-form input:not([type=file]),
.regab-mail-defaults-form textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 12px;
  color: #25384a;
  background: white;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  outline: none;
  font: 13px "DM Sans", system-ui, sans-serif;
}

.regab-mail-defaults-form input:not([type=file]) { min-height: 42px; }
.regab-mail-defaults-form textarea { resize: vertical; line-height: 1.5; }
.regab-mail-defaults-form input:focus,
.regab-mail-defaults-form textarea:focus { border-color: #3977ed; box-shadow: 0 0 0 3px rgba(57, 119, 237, .12); }

.regab-mail-signature-image-row {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(280px, 1.2fr);
  gap: 14px;
  align-items: stretch;
}

.regab-mail-signature-preview {
  min-height: 150px;
  padding: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #8a97a5;
  background: white;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.regab-mail-signature-preview img {
  display: block;
  max-width: 100%;
  max-height: 190px;
  object-fit: contain;
}

.regab-mail-signature-controls { align-content: start; gap: 9px; }
.regab-mail-signature-controls .secondary-button { width: 100%; }

.regab-mail-placeholder-help {
  padding: 12px 14px;
  display: grid;
  gap: 5px;
  color: #4a5b6c;
  background: #eef5ff;
  border: 1px solid #cadcf8;
  border-radius: 10px;
  font-size: 11px;
}
.regab-mail-placeholder-help span { overflow-wrap: anywhere; line-height: 1.55; }
.regab-mail-defaults-message { min-height: 18px; margin: 0; color: #748394; font-size: 12px; }

body.force-dark .regab-mail-attachments,
html[data-theme="dark"] .regab-mail-attachments,
body.force-dark .regab-mail-template-section,
html[data-theme="dark"] .regab-mail-template-section {
  color: #e9f2fb;
  background: #10283d;
  border-color: #31516d;
}

body.force-dark .regab-mail-file-row,
html[data-theme="dark"] .regab-mail-file-row,
body.force-dark .regab-mail-signature-preview,
html[data-theme="dark"] .regab-mail-signature-preview,
body.force-dark .regab-mail-defaults-form input:not([type=file]),
html[data-theme="dark"] .regab-mail-defaults-form input:not([type=file]),
body.force-dark .regab-mail-defaults-form textarea,
html[data-theme="dark"] .regab-mail-defaults-form textarea {
  color: #edf6ff;
  background: #071a29;
  border-color: #31516d;
}

body.force-dark .regab-mail-file-row strong,
html[data-theme="dark"] .regab-mail-file-row strong,
body.force-dark .regab-mail-template-heading strong,
html[data-theme="dark"] .regab-mail-template-heading strong,
body.force-dark .regab-mail-defaults-form label,
html[data-theme="dark"] .regab-mail-defaults-form label { color: #edf6ff; }

body.force-dark .regab-mail-placeholder-help,
html[data-theme="dark"] .regab-mail-placeholder-help {
  color: #c9dbec;
  background: #0b2235;
  border-color: #31516d;
}

@media (max-width: 720px) {
  .regab-mail-attachments-head { align-items: stretch; flex-direction: column; }
  .regab-mail-file-button { width: 100%; }
  .regab-mail-signature-image-row { grid-template-columns: 1fr; }
  .regab-mail-defaults-modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
}
