/* The team email builder ("Customize email" in Team settings). Own file, like switch.css: only
   pages rendering `#adminModal` draw it. Every selector uses the `eb-` prefix and reuses existing
   components (`.pref-row`, `.a-btn`, `.a-input`, `.a-select`, `.a-eyebrow`, `.a-hint`, `.switch-check`, `.rt-composer`): the
   chrome is the shared specification (DS-69, DS-73, DS-77, DS-78), only the preview paper is this file's own. */

/* The only fixed colours in this file. The preview pictures an email, which clients render on a light
   ground in any theme, so the paper stays light while the chrome around `.eb-paper` follows tokens.
     --eb-paper #fff sheet; --eb-ink #1f2933 body text (15.6:1); --eb-dim #5b6875 footer/eyebrow (5.4:1);
     --eb-rule #e3e8ee hairline (1.2:1, decorative only, never a control edge) */
:root{
  --eb-paper:#ffffff;
  --eb-ink:#1f2933;
  --eb-dim:#5b6875;
  --eb-rule:#e3e8ee;
}

/* ---------- the section ----------
   Two columns where there is room, one below 880px. The dialog's active pane is the
   one scroller — nothing here sets a height, so the preview grows into it. */
.eb-grid{
  display:grid; grid-template-columns:minmax(0, 1fr); gap:16px; margin-top:10px;
}
@media (min-width:880px){
  .eb-grid{ grid-template-columns:minmax(0, 1fr) minmax(0, 300px); }
}

/* A grid child is the width it is given only if it is allowed to shrink. */
.eb-col{ min-width:0; }

/* ---------- a labelled field ----------
   Stacked rather than in a label/control row: the fields here carry a hint under them, and a
   two-column field row puts the hint under the control where it reads as a validation message. */
.eb-field{ display:flex; flex-direction:column; gap:4px; margin-bottom:12px; min-width:0; }
/* The label above a field is `.a-eyebrow` and the hint under it is `.a-hint` (set in the markup); only the error tone is this file's. */
.eb-hint.eb-err{ color:var(--a-red); }

/* Width is layout, so it belongs on the instance; the field itself is the shared `.a-input` / `.a-select`. */
.eb-input{ width:100%; max-width:100%; min-width:0; }
.eb-input.eb-sm{ width:120px; max-width:100%; }

/* ---------- the token buttons ----------
   Each one inserts at the caret of whichever field was last focused. They are real buttons, so
   Tab reaches them and Enter and Space press them — the keyboard equivalent comes with the
   element rather than being added to a div. */
.eb-tokens{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.eb-token{ font-variant-numeric:tabular-nums; }
.eb-token-legend{
  display:grid; grid-template-columns:auto minmax(0, 1fr); gap:2px 8px;
  margin-top:6px; font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-ui); color:var(--a-faint);
}
.eb-token-legend b{ color:var(--a-dim); font-weight:var(--a-fw-ctl); white-space:nowrap; }

/* ---------- images ----------
   A row per image: the address, what it is called, and where it sits. Below 640px it stacks,
   because three controls and a Remove button on one line inside a dialog is where the 320px
   width starts pushing a right edge past the viewport. */
.eb-img-row{
  display:grid; gap:6px; align-items:start; margin-bottom:8px;
  grid-template-columns:minmax(0, 1fr);
}
@media (min-width:640px){
  .eb-img-row{ grid-template-columns:minmax(0, 2fr) minmax(0, 1fr) auto auto; align-items:center; }
}

/* ---------- accent and font ----------
   The swatch is one ladder step square (--a-ctl) so it lines up with the hex field beside it. Colour is never the only cue: the hex field
   says the same thing in characters, for anyone who cannot judge the square. */
.eb-brand-row{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.eb-swatch{
  width:var(--a-ctl); height:var(--a-ctl); flex:0 0 auto; padding:0;
  border:1px solid var(--a-ctl-edge); border-radius:var(--a-r-sm);
  background:var(--a-field-bg); cursor:pointer;
}
.eb-swatch:focus-visible{
  outline:var(--a-focus); outline-offset:var(--a-focus-offset); border-radius:inherit;
}

/* ---------- the preview ----------
   `position:sticky` only where there is a second column to be sticky beside; in the stacked
   layout it would pin the email over the form it belongs to. */
.eb-preview{ min-width:0; }
@media (min-width:880px){
  .eb-preview{ position:sticky; top:0; }
}

/* The tab pair over the preview. Two states, and the current one is not signalled by colour
   alone — it carries `aria-pressed`, and it is the only one with a filled ground. */
.eb-tabs{ display:flex; gap:4px; margin-bottom:8px; }
.eb-tab[aria-pressed="true"]{
  background:var(--a-blue-soft); border-color:var(--a-blue); color:var(--a-blue-text);
}

.eb-frame{
  border:1px solid var(--a-line); border-radius:var(--a-r);
  background:var(--a-raised); padding:10px; min-width:0; overflow:hidden;
}
.eb-frame-note{ font-size:var(--a-fs-ctl-sm); color:var(--a-faint); line-height:var(--a-lh-ui); margin-bottom:8px; }

/* THE PAPER. A fixed light sheet, deliberately — see the token block at the top of this file.
   Its own type stack is set inline by the renderer from the chosen font, which is why no
   font-family appears here: two answers to "what face is this" is exactly the drift this
   section exists to show the administrator. */
.eb-paper{
  background:var(--eb-paper); color:var(--eb-ink);
  border:1px solid var(--eb-rule); border-radius:var(--radius-sm);
  padding:16px; min-width:0; overflow-wrap:anywhere; font-size:13px; line-height:1.6;
}
.eb-paper-head{
  display:flex; align-items:center; gap:8px;
  padding-bottom:10px; margin-bottom:12px; border-bottom:1px solid var(--eb-rule);
}
.eb-paper-mark{ width:30px; height:28px; flex:0 0 auto; }
.eb-paper-team{ font-size:14px; font-weight:600; color:var(--eb-ink); min-width:0; }
.eb-paper-meta{ font-size:11px; color:var(--eb-dim); line-height:1.45; margin-bottom:10px; }
.eb-paper-subject{ font-size:16px; font-weight:600; line-height:1.25; margin-bottom:10px; }
.eb-paper-body p{ margin:0 0 10px 0; }
.eb-paper-body p:last-child{ margin-bottom:0; }
.eb-paper-body a{ color:inherit; }
.eb-paper-img{ display:block; max-width:100%; height:auto; margin:0 0 12px 0; }
.eb-paper-foot{
  margin-top:14px; padding-top:10px; border-top:1px solid var(--eb-rule);
  font-size:11px; line-height:1.45; color:var(--eb-dim);
}

/* A remote image, not the image: `img-src 'self' data: blob:` would refuse it and
   log a CSP violation here, though it arrives fine in the mail client. A labelled
   stand-in says the image is in the email and why it is not on this screen. */
.eb-paper-remote{
  display:flex; align-items:center; gap:8px;
  padding:10px; margin:0 0 12px 0;
  border:1px dashed var(--eb-rule); border-radius:var(--radius-sm);
  font-size:11px; line-height:1.45; color:var(--eb-dim); word-break:break-all;
}

/* The stand-in for wording nobody has customised. The standard invitation text lives in exactly
   one place — MESSAGES in the Edge Function — so this section never carries a copy of it to
   preview; it says what will be there instead. */
.eb-paper-standard{
  padding:10px; border:1px dashed var(--eb-rule); border-radius:var(--radius-sm);
  font-size:12px; line-height:1.5; color:var(--eb-dim);
}

/* ---------- the actions ---------- */
.eb-actions{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:12px; }
