/* Admin → Emails (admin/emails.php, admin/email.php; campaigns.php). The forms look: sections with a title line,
   plain options with a dot, underlined fields; the preview on the right; lists like the other admin lists. */

.em-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 20px; align-items: start; margin-bottom: 34px; }
.em-form { display: grid; gap: 14px; min-width: 0; }

/* one card per section: a bold title, a short muted line, a thin divider (the forms look) */
.em-sec { display: grid; gap: 16px; padding: 20px 22px 22px; min-width: 0; }
.em-sec-h { display: block; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.em-sec-h h2 { margin: 0 0 3px; font: 700 15.5px/1.3 var(--head); color: var(--text); }
.em-sec-h p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.em-sec-h p a { font-weight: 600; }
.em-sec .hint { margin: 0; font-size: 12.5px; color: var(--text-3); }
.em-grid { row-gap: 18px; }
.em-c4 { grid-column: 1 / -1; min-width: 0; }

/* choices: plain options with a dot, no boxes */
.em-opts { display: grid; gap: 10px 22px; }
.em-row { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.em-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.em-aud { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.em-opt { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 2px 0; cursor: pointer; }
.em-opt input { position: absolute; opacity: 0; pointer-events: none; }
.em-dot { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border); transition: border-color .15s ease; }
.em-opt > span:last-child { display: grid; gap: 1px; min-width: 0; }
.em-opt b { font-weight: 600; font-size: 14px; color: var(--text-2); }
.em-opt small { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.em-opt:hover .em-dot { border-color: var(--text-3); }
.em-opt:has(input:checked) b { color: var(--text); }
.em-opt:has(input:checked) .em-dot { border-color: var(--gold); background: radial-gradient(circle, var(--gold) 0 42%, transparent 48%); }
.em-opt:has(input:focus-visible) .em-dot { box-shadow: var(--focus); }
/* what opens under a choice: the angle, a ready-made email, the look */
.em-more { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.em-form select { width: 100%; min-height: 42px; padding: 8px 22px 9px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; font-size: 14.5px; color: var(--text); appearance: none; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239EA18C' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 2px center / 12px 8px no-repeat; text-overflow: ellipsis; }
.em-form select option { background: var(--surface); color: var(--text); }
.em-form select:focus { outline: none; border-color: var(--gold); box-shadow: 0 1px 0 0 var(--gold); }
.em-to[hidden], .em-form [data-em-only][hidden] { display: none; }

/* underlined fields; the message keeps a light box so long text is easy to write */
.em-form .field { gap: 2px; }
.em-form .field label { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.em-form .field input { min-height: 42px; padding: 8px 0 9px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; }
.em-form .field input:focus { border-color: var(--gold); box-shadow: 0 1px 0 0 var(--gold); }
.em-form .field.has-error input { border-color: var(--err); }
.em-form .field textarea { margin-top: 6px; min-height: 140px; border-radius: 10px; background: var(--surface-2); }
.em-form .field-row { gap: 14px 24px; }
.em-warn { margin-top: -6px; }
.em-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.em-acts .btn .ic { margin-right: 6px; }
.em-acts .btn-gold { min-width: 200px; }

/* the preview */
.em-prev { position: sticky; top: 16px; overflow: hidden; padding: 0; }
.em-prev-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.em-prev-h b { font-weight: 600; color: var(--text); }
.em-prev-h span { font-size: 12.5px; color: var(--text-3); }
.em-prev iframe { display: block; width: 100%; height: 860px; border: 0; background: #F1F2E8; }

/* sent emails */
.em-h2 { margin: 0 0 12px; font: 700 17px/1.3 var(--head); color: var(--text); }
.rows.em-list > li { grid-template-columns: minmax(0, 1fr) 220px 120px 120px 150px; gap: 16px; }
.rows.em-people > li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 110px; gap: 16px; }

/* one email being sent */
.em-run { display: grid; gap: 16px; margin-bottom: 20px; }
.em-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.em-stats > div { display: grid; gap: 3px; padding: 14px 18px; border-left: 1px solid var(--border); min-width: 0; }
.em-stats > div:first-child { border-left: 0; }
.em-stats span { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.em-stats b { font: 800 22px/1.2 var(--head); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-stats small { font-size: 12px; color: var(--text-3); }
.em-bar { width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-2); appearance: none; }
.em-bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.em-bar::-webkit-progress-value { background: var(--gold); border-radius: 999px; transition: width .3s ease; }
.em-bar::-moz-progress-bar { background: var(--gold); border-radius: 999px; }
.em-run-f { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; }
.em-run-f p { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--text-2); }
.em-run-f p .ic { color: var(--gold); }
.em-run-f form { display: flex; gap: 8px; }
.em-run-f [hidden] { display: none; }
.em-done { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--text-2); }
.em-done .ic { color: var(--ok); }

@media (max-width: 1180px) {
  .em-split { grid-template-columns: minmax(0, 1fr); }
  .em-prev { position: static; }
  .em-prev iframe { height: 720px; }
}
@media (max-width: 640px) {
  .em-2 { grid-template-columns: minmax(0, 1fr); }
  .em-aud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-sec { padding: 18px 16px; }
  .em-acts { justify-content: stretch; }
  .em-acts .btn { flex: 1 1 100%; }
  .em-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-stats > div:nth-child(3) { border-left: 0; }
  .em-stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .rows.em-people > li { grid-template-columns: minmax(0, 1fr) auto; }
  .rows.em-list > li { grid-template-columns: minmax(0, 1fr) auto; }
  .rows.em-list > li > div:nth-child(2), .rows.em-list > li > div:nth-child(3) { display: none; }
}

/* "One person": the about-their-order tick; the Leads list picker */
.em-personal { margin-top: 12px; font-size: 13.5px; }
.em-to + .em-to { margin-top: -4px; }

/* Admin → Emails → Leads (admin/leads.php) */
.ld-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; margin-bottom: 26px; }
.ld-add .em-set { border-bottom: 0; padding-bottom: 0; }
.ld-add .check { font-size: 13.5px; line-height: 1.5; }
.ld-add .check.has-error span { color: var(--err); }
.ld-facts { display: grid; gap: 16px; }
.ld-facts > div { display: grid; gap: 3px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.ld-facts span { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.ld-facts b { font: 800 26px/1.15 var(--head); color: var(--text); }
.ld-facts small { font-size: 12.5px; color: var(--text-3); }
.ld-facts .hint { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.rows.ld-list > li { grid-template-columns: minmax(0, 1fr) 190px 120px 130px 70px; gap: 16px; }
.ld-del { font-size: 13px; font-weight: 600; color: var(--err); }
.ld-drop { display: flex; justify-content: flex-end; margin-top: 14px; }
@media (max-width: 1000px) { .ld-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .rows.ld-list > li { grid-template-columns: minmax(0, 1fr) auto; } }

/* your own message: plain letter or our email look */
.em-look { display: grid; gap: 10px; margin-top: 4px; }
.em-sub { margin: 0; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.em-form [data-em-look-pick][hidden], .em-form [data-em-one-note][hidden], .em-form [data-em-letter][hidden], .em-form [data-em-heading][hidden] { display: none; }

/* ready-made emails (em_templates()): two columns of choices in the same look as the options below */
.em-tpls .em-sub { margin-bottom: 10px; }
.em-tpls .em-sub a { margin-left: 6px; font-weight: 600; }
.em-tpl-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.em-tpl { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit;
  transition: border-color .15s ease, background-color .15s ease; }
.em-tpl b { font-weight: 600; font-size: 14px; color: var(--text); }
.em-tpl span { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.em-tpl small { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); font-size: 11.5px; color: var(--text-2); }
.em-tpl:hover { border-color: var(--text-3); }
.em-tpl.on { border-color: var(--gold); background: var(--gold-soft); }
.em-tpl.on b { color: var(--gold); }
.em-tpl-note { display: flex; gap: 6px; align-items: center; margin: 10px 0 0; color: var(--warn); }
@media (max-width: 640px) {
  .em-tpl-list { grid-template-columns: minmax(0, 1fr); }
}

/* the tradelines email: which month and BNB update it's built from; an old update in the warning colour */
.em-angles .em-src, .em-angles .em-stale { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; }
.em-angles .em-stale { color: var(--warn); }
.em-angles .em-stale .ic { vertical-align: -2px; }
.em-angles .em-stale a { font-weight: 600; }

/* emails that stopped part-way, at the top of the Send page */
.em-unfinished { display: grid; gap: 4px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--warn) 9%, transparent); font-size: 13.5px; color: var(--text-2); }
.em-unfinished > b { display: flex; align-items: center; gap: 6px; color: var(--text); }
.em-unfinished > b .ic { color: var(--warn); }
.em-unfinished ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.em-unfinished li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.em-unfinished li a { font-weight: 600; }
.em-unfinished li span { font-size: 12.5px; color: var(--text-3); }
/* "Recently sent" under the form */
.em-recent-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 12px; }
.em-recent-h .em-h2 { margin: 0; }
.em-recent-h a { font-size: 13.5px; font-weight: 600; }
.em-open-help { margin: 0 0 12px; }
@media (max-width: 1280px) { .rows.em-list > li { grid-template-columns: minmax(0, 1fr) 190px 110px 110px 130px; } }
/* Leads → Add leads: a fieldset with a title line */
.em-set { display: grid; gap: 14px; margin: 0; padding: 0 0 22px; border: 0; border-bottom: 1px solid var(--border); min-width: 0; }
.em-set legend { float: left; width: 100%; margin: 0 0 14px; padding: 0; font: 700 15px/1.3 var(--head); color: var(--text); }
.em-set legend + * { clear: both; }
.em-set .hint { margin: 0; font-size: 12.5px; color: var(--text-3); }
/* the angle list: groups, and the chosen angle's subject under it */
.em-form select optgroup { background: var(--surface); color: var(--text-3); font-style: normal; font-weight: 700; }
.em-subj { margin: 8px 0 0 !important; line-height: 1.5; }
.em-subj b { font-weight: 600; color: var(--text-2); }
.em-sec-h p [hidden] { display: none; }
