/* Church Communications Hub — shared theme.
 *
 * Brand pulled from dsbc.church (Desert Springs Bible Church): warm neutrals,
 * a calm sage-green accent, a deep-sage brand bar carrying the white logo, and
 * Montserrat / Lato type. One stylesheet drives the app, the brand page, and the
 * login screen so they stay consistent. Class names from the original markup are
 * preserved so the existing vanilla-JS keeps working.
 */

:root {
  color-scheme: light dark;
  --bg: #f4f3f0;
  --panel: #ffffff;
  --panel-soft: #faf9f7;
  --ink: #2f3031;
  --muted: #6b6862;
  --line: #e5e2dc;
  --brand: #57585a;
  --brand-strong: #3a3b3d;
  --brand-bar: #2f3031;
  --tint: #ecebe8;
  --on-brand: #ffffff;
  --ok: #2f7d5b; --ok-bg: #e7f2ec;
  --warn: #93641c; --warn-bg: #faf0dc;
  --err: #b3392b; --err-bg: #fbeae7;
  --info: #3f6b8a; --info-bg: #e9f1f6;
  --shadow: 0 1px 2px rgb(47 48 49 / .05), 0 6px 20px rgb(47 48 49 / .05);
  --radius: 12px;
  --font-head: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1b19;
    --panel: #232420;
    --panel-soft: #1f201d;
    --ink: #ece9e2;
    --muted: #a29d93;
    --line: #34352f;
    --brand: #b4b3af;
    --brand-strong: #cbcac6;
    --brand-bar: #1c1d1d;
    --tint: #2b2b29;
    --on-brand: #1b1c1c;
    --ok: #5cc493; --ok-bg: #172a20;
    --warn: #d9ab5e; --warn-bg: #2c2416;
    --err: #ef8a7c; --err-bg: #2e1a17;
    --info: #86b3d1; --info-bg: #172630;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.6 var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- brand bar */

.brandbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.4rem;
  background: var(--brand-bar);
  color: #fff;
}
.brandbar img.logo { height: 30px; width: auto; display: block; }
.brandbar .wordmark { font: 600 1.05rem/1 var(--font-head); letter-spacing: .01em; color: #fff; }
.brandbar .spacer { flex: 1; }
.brandbar a, .brandbar .barlink {
  color: rgb(255 255 255 / .85); text-decoration: none; font-size: .85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: .35rem;
}
.brandbar a:hover, .brandbar .barlink:hover { color: #fff; }
.brandbar form { margin: 0; }
.brandbar .barbtn {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  background: rgb(255 255 255 / .12); color: #fff; border: 1px solid rgb(255 255 255 / .2);
  padding: .35rem .7rem; border-radius: 8px;
}
.brandbar .barbtn:hover { background: rgb(255 255 255 / .2); }

/* ------------------------------------------------------------------- tabnav */

.tabnav {
  display: flex; gap: .25rem; padding: 0 1.4rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  overflow-x: auto;
}
.tabnav button {
  font: 600 .9rem/1 var(--font-head); color: var(--muted);
  background: none; border: 0; border-bottom: 2.5px solid transparent;
  padding: .95rem .8rem; cursor: pointer; white-space: nowrap;
}
.tabnav button:hover { color: var(--ink); }
.tabnav button.active { color: var(--brand-strong); border-bottom-color: var(--brand); }

/* -------------------------------------------------------------------- layout */

main { max-width: 1120px; margin: 0 auto; padding: 1.5rem 1.4rem 3rem; display: grid; gap: 1.25rem; }
.tabpage { display: grid; gap: 1.25rem; }
.tabpage[hidden] { display: none; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
}
.panel > h2 {
  font: 700 1.15rem/1.2 var(--font-head); margin: 0 0 .25rem; color: var(--ink);
  letter-spacing: -.01em;
}
.panel > p.lede { margin: 0 0 1.1rem; font-size: .9rem; color: var(--muted); }
h3.sub { font: 600 1rem/1.3 var(--font-head); margin: 1.5rem 0 .6rem; }

/* -------------------------------------------------------------------- forms */

label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .35rem; color: var(--ink); }
textarea, input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select {
  width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel-soft); color: inherit;
}
textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); background: var(--panel);
}
textarea { resize: vertical; min-height: 130px; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.channels { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: .4rem; }
.channels label { display: flex; align-items: center; gap: .45rem; font-weight: 500; margin: 0; cursor: pointer; }

/* ------------------------------------------------------------------ buttons */

button {
  font: 600 .92rem var(--font-body); padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
button.primary:hover { opacity: .9; }
button.link { border: 0; background: none; color: var(--brand-strong); padding: .2rem 0; font-size: .85rem; font-weight: 700; }
button.link:hover { text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; align-items: center; }

/* link styled as a button, for new-tab quick links */
a.btn {
  display: inline-flex; align-items: center; gap: .4rem; text-decoration: none;
  font: 700 .9rem var(--font-body); padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--brand-strong); background: var(--brand-strong); color: var(--on-brand);
}
a.btn:hover { opacity: .9; }
a.btn.ghost { background: transparent; color: var(--brand-strong); }
a.btn.ghost:hover { background: var(--tint); }
a.btn .ext { font-size: .78em; opacity: .8; }

/* ---------------------------------------------------------------- callouts */

.note { font-size: .85rem; color: var(--muted); }
.callout {
  display: flex; gap: .6rem; padding: .8rem .95rem; border-radius: 10px;
  font-size: .88rem; line-height: 1.5; margin: .9rem 0; border: 1px solid transparent;
}
.callout .ic { flex: 0 0 auto; font-size: 1rem; line-height: 1.4; }
.callout.tip  { background: var(--tint);    color: var(--ink);  border-color: var(--brand); }
.callout.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.callout.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.callout strong { font-weight: 700; }

.banner { padding: .75rem .95rem; border-radius: 10px; font-size: .9rem; margin-bottom: 1rem; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok   { background: var(--ok-bg);   color: var(--ok); }
.banner.err  { background: var(--err-bg);  color: var(--err); }
.banner ul { margin: .4rem 0 0; padding-left: 1.1rem; }

/* --------------------------------------------------------- channel accordions */

/* clip, not hidden: keeps the rounded corners without breaking the editor's sticky toolbar */
.ch { border: 1px solid var(--line); border-radius: 11px; margin-bottom: 1rem; overflow: clip; background: var(--panel); }
.ch > summary {
  padding: .75rem 1rem; cursor: pointer; font: 600 .95rem var(--font-head);
  display: flex; align-items: center; gap: .6rem; list-style: none;
}
.ch > summary::-webkit-details-marker { display: none; }
.ch[open] > summary { border-bottom: 1px solid var(--line); }
.ch > div { padding: 1rem; }
.count { margin-left: auto; font-weight: 600; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--err); }
.manual {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--warn); background: var(--warn-bg); padding: .15rem .5rem; border-radius: 5px;
}

/* email preview */
.subtabs { display: inline-flex; gap: .2rem; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 9px; padding: .2rem; margin-bottom: .6rem; }
.subtabs button { border: 0; background: none; padding: .35rem .8rem; border-radius: 7px; font-weight: 700; font-size: .82rem; color: var(--muted); }
.subtabs button.active { background: var(--panel); color: var(--brand-strong); box-shadow: var(--shadow); }
.previewframe { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* -------------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
th { font: 700 .74rem var(--font-head); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
pre { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 9px; padding: .75rem; overflow-x: auto; font-size: .8rem; white-space: pre-wrap; }
.hidden { display: none !important; }
.empty { font-size: .9rem; color: var(--muted); font-style: italic; }

/* -------------------------------------------------------------------- status */

.statline { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.statline:last-child { border-bottom: 0; }
.dot { flex: 0 0 auto; width: .6rem; height: .6rem; border-radius: 99px; margin-top: .5rem; }
.dot.on { background: var(--ok); } .dot.off { background: var(--err); }
.statline .txt { flex: 1; }
.statline .txt strong { font: 600 .95rem var(--font-head); }
.statline .txt p { margin: .15rem 0 0; font-size: .86rem; color: var(--muted); }
.state { font-size: .78rem; font-weight: 800; white-space: nowrap; }
.state.on { color: var(--ok); } .state.off { color: var(--err); }

/* quick-link row */
.quicklinks { display: flex; gap: .6rem; flex-wrap: wrap; }

/* -------------------------------------------------------------------- history */

.hist { border: 1px solid var(--line); border-radius: 11px; margin-bottom: .7rem; background: var(--panel); }
.hist > summary { padding: .75rem 1rem; cursor: pointer; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; list-style: none; }
.hist > summary::-webkit-details-marker { display: none; }
.hist .when { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist .snippet { flex: 1 1 260px; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hist > div { padding: 0 1rem 1rem; }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--tint); color: var(--brand-strong); }
.chip.sent { background: var(--ok-bg); color: var(--ok); }
.chip.manual { background: var(--warn-bg); color: var(--warn); }
.chip.failed { background: var(--err-bg); color: var(--err); }

/* per-channel delivery breakdown in History */
.delivery { list-style: none; margin: .2rem 0 .5rem; padding: 0; font-size: .86rem; }
.delivery li { padding: .13rem 0; color: var(--muted); }
.delivery li strong { color: var(--ink); }
.dstat { font-weight: 700; text-transform: capitalize; }
.dstat.ok { color: var(--ok); }
.dstat.err { color: var(--err); }
.dstat.warn { color: var(--warn); }

/* dispatch summary */
.scard { border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px;
         padding: .85rem 1rem; margin-bottom: .7rem; background: var(--panel); }
.scard strong { font: 600 .95rem var(--font-head); }
.scard p { margin: .25rem 0 .5rem; font-size: .88rem; color: var(--muted); }
.scard.ok { border-left-color: var(--ok); }
.scard.manual { border-left-color: var(--warn); }
.scard.bad { border-left-color: var(--err); }
.copybox { width: 100%; min-height: 66px; resize: vertical;
           font-family: var(--font-body); font-size: .95rem; line-height: 1.5; padding: .6rem .7rem; }

/* login screen */
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.loginwrap form { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 2rem; border-radius: var(--radius); width: min(380px, 92vw); }
.loginwrap .brandmark { display: flex; align-items: center; justify-content: center; background: var(--brand-bar); border-radius: 10px; padding: 1rem; margin-bottom: 1.4rem; }
.loginwrap .brandmark img { height: 34px; }
.loginwrap h1 { font: 700 1.1rem var(--font-head); margin: 0 0 1.25rem; text-align: center; }
.loginwrap .err { color: var(--err); font-size: .875rem; margin-bottom: .75rem; }

/* accounts */
.tabnav button[hidden] { display: none; }
.brandbar .whoami { color: rgb(255 255 255 / .8); font-size: .82rem; white-space: nowrap; }
.brandbar .whoami strong { color: #fff; font-weight: 700; }
.postingas { margin: 0; padding: .55rem 0; font-weight: 700; }
.postingas .note { font-weight: 400; }
label.inline { display: flex; align-items: center; gap: .45rem; font-weight: 500; cursor: pointer; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem .9rem; }
.checkgrid label { display: flex; align-items: center; gap: .45rem; font-weight: 500; margin: 0; cursor: pointer; }
.ucard { border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1rem; margin-bottom: .7rem; background: var(--panel); }
.ucard.off { opacity: .65; }
.ucard .uhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.ucard .uhead strong { font: 600 1rem var(--font-head); }
.ucard .uhead .note { font-size: .82rem; }
.ucard .umeta { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }
.ucard .actions { margin-top: .6rem; }
.linkbox { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.linkbox input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.chip.admin { background: var(--info-bg); color: var(--info); }
.chip.muted { background: var(--panel-soft); color: var(--muted); }
@media (max-width: 640px) { .brandbar .whoami { display: none; } }

/* image picker */
.imgpick { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.imgthumb { flex: 0 0 120px; height: 150px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft);
            display: grid; place-items: center; overflow: hidden; font-size: .8rem; color: var(--muted); }
.imgthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgpick-body { flex: 1 1 260px; min-width: 0; }
.imgrecent { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: .4rem; margin-top: .5rem; }
.imgopt { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 5; background: var(--panel-soft); cursor: pointer; }
.imgopt:hover { outline: 2px solid var(--brand); }
.imgopt img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================ email editor */

.ee { --ee-side: 290px; position: relative; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.ee-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .45rem .6rem; border-bottom: 1px solid var(--line);
          position: sticky; top: 46px; z-index: 4; background: var(--panel); border-radius: 11px 11px 0 0; }
.ee-group { display: inline-flex; gap: .15rem; padding-right: .5rem; border-right: 1px solid var(--line); }
.ee-group:last-of-type { border-right: 0; }
.ee-tb { min-width: 2rem; padding: .3rem .5rem; font-size: .88rem; line-height: 1.2; border-radius: 7px; }
.ee-fmt { opacity: .45; transition: opacity .15s; }
.ee.editing-text .ee-fmt { opacity: 1; }
.ee-a { text-decoration: underline 3px; text-decoration-color: #c4572b; font-weight: 800; }
.ee-hint { font-size: .78rem; color: var(--muted); margin-left: auto; }
.ee-hint.flash { color: var(--warn); font-weight: 700; }
.ee-pop { position: absolute; top: 2.9rem; z-index: 6; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
          border-radius: 10px; padding: .6rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; max-width: 330px; }
.ee-pop input[type=url] { flex: 1 1 200px; }
.ee-custom { display: flex; align-items: center; gap: .4rem; font-size: .78rem; margin: .4rem 0 0; }

.ee-body { display: grid; grid-template-columns: minmax(0, 1fr) var(--ee-side); min-height: 420px; }
.ee-stage { overflow: auto; border-right: 1px solid var(--line); }
.ee-canvas { padding: 1.4rem .8rem 2.2rem; min-height: 100%; transition: background .2s; }
.ee-paper { max-width: 600px; margin: 0 auto; color: var(--ee-text); font: 16px/1.6 'Lato', Helvetica, Arial, sans-serif;
            box-shadow: 0 1px 3px rgb(0 0 0 / .08); min-height: 160px; color-scheme: light; }
.ee-paper.serif { font-family: Georgia, 'Times New Roman', serif; }
.ee-paper a { color: var(--ee-link); }
.ee-empty { padding: 3rem 1.5rem; text-align: center; color: #8a867e; font-size: .95rem; border: 2px dashed #dedbd4; margin: 1rem; border-radius: 10px; }

.ee-block { position: relative; outline: 1px solid transparent; outline-offset: -1px; }
.ee-block:hover { outline-color: #c9c5bd; }
.ee-block.sel { outline: 2px solid #3f6b8a; outline-offset: -2px; z-index: 1; }
.ee-block.warn .ee-content { box-shadow: inset 3px 0 0 #c4572b; }
.ee-block.dragging { opacity: .35; }
.ee-bar { position: absolute; left: 0; right: 0; top: -1.55rem; height: 1.55rem; display: none; align-items: center; gap: .4rem;
          font: 600 .7rem/1 var(--font-body); color: #fff; z-index: 2; pointer-events: none; }
.ee-block:hover .ee-bar, .ee-block.sel .ee-bar { display: flex; }
.ee-handle { pointer-events: auto; background: #3f6b8a; padding: .3rem .5rem; border-radius: 6px 6px 0 0; cursor: grab; white-space: nowrap; }
.ee-block:not(.sel) .ee-handle { background: #6b6862; }
.ee-warn { background: #c4572b; padding: .3rem .5rem; border-radius: 6px 6px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ee-acts { pointer-events: auto; margin-left: auto; display: inline-flex; gap: 2px; background: #3f6b8a; border-radius: 6px 6px 0 0; padding: 0 .15rem; }
.ee-block:not(.sel) .ee-acts { background: #6b6862; }
.ee-acts button { background: none; border: 0; color: #fff; padding: .2rem .4rem; font-size: .78rem; border-radius: 4px; }
.ee-acts button:hover { background: rgb(255 255 255 / .2); }
.ee-block:first-child .ee-bar { top: 0; }

.ee-content { padding: 12px 24px; }
.ee-content [contenteditable] { outline: none; min-height: 1.4em; cursor: text; }
.ee-content [contenteditable]:focus { box-shadow: 0 0 0 2px rgb(63 107 138 / .25); border-radius: 3px; }
.ee-h { font-family: 'Montserrat', Helvetica, Arial, sans-serif; font-weight: 700; line-height: 1.25; }
.ee-paper.serif .ee-h { font-family: Georgia, 'Times New Roman', serif; }
.ee-h1 { font-size: 28px; padding: 4px 0; } .ee-h2 { font-size: 22px; } .ee-h3 { font-size: 18px; }
.ee-t p { margin: 0 0 12px; } .ee-t p:last-child { margin-bottom: 0; }
.ee-t ul, .ee-t ol { margin: 0 0 12px; padding-left: 24px; }
.ee-btn { display: inline-block; padding: 14px 28px; border-radius: 8px; font: 700 16px/1.2 'Montserrat', Helvetica, Arial, sans-serif; min-width: 3rem; text-align: center; }
.ee-btn.full { display: block; }
.ee-img { cursor: pointer; }
.ee-img img { display: block; width: 100%; height: auto; }
.ee-ph { background: #ecebe8; color: #8a867e; font: 600 13px Helvetica, Arial, sans-serif; text-align: center; padding: 2.4rem .5rem; border: 2px dashed #d4d0c8; border-radius: 6px; }
.ee-grid { display: grid; gap: 12px; } .ee-grid.c2 { grid-template-columns: 1fr 1fr; } .ee-grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.ee-it { display: flex; gap: 20px; align-items: flex-start; } .ee-it.right { flex-direction: row-reverse; }
.ee-it > .ee-img { flex: 0 0 40%; } .ee-it > .ee-t { flex: 1; min-width: 0; }
.ee-hr { margin: 2px 0; } .ee-space { background: repeating-linear-gradient(45deg, transparent 0 6px, rgb(0 0 0 / .03) 6px 12px); }
.ee-drop { height: 4px; background: #3f6b8a; border-radius: 2px; margin: -2px 12px; box-shadow: 0 0 0 3px rgb(63 107 138 / .2); }

/* The tools stay in view while the email scrolls past: the panel sticks under
   the toolbar and scrolls on its own when it's taller than the window. */
.ee-side { padding: .7rem; min-width: 0; position: sticky; top: calc(46px + var(--ee-top-h, 44px)); align-self: start;
           max-height: calc(100vh - 46px - var(--ee-top-h, 44px)); overflow-y: auto; overscroll-behavior: contain; }
.ee-tabs { display: flex; gap: .2rem; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 9px; padding: .2rem; margin-bottom: .7rem; }
.ee-tabs button { flex: 1; border: 0; background: none; padding: .35rem .3rem; border-radius: 7px; font-size: .76rem; font-weight: 700; color: var(--muted); }
.ee-tabs button.active { background: var(--panel); color: var(--brand-strong); box-shadow: var(--shadow); }
.ee-label { font: 700 .74rem var(--font-head); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .6rem 0 .45rem; }
.ee-l { margin-top: .75rem; font-size: .8rem; }
.ee-note { font-size: .78rem; color: var(--muted); font-weight: 400; }
.ee-status { font-size: .78rem; color: var(--muted); margin: .3rem 0; min-height: 0; }
.ee-status.bad { color: var(--err); font-weight: 700; }
.ee-palette { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.ee-tile { display: flex; align-items: center; gap: .45rem; padding: .5rem .55rem; font-size: .8rem; text-align: left; cursor: grab; }
.ee-ic { width: 1.5rem; height: 1.5rem; display: grid; place-items: center; background: var(--tint); border-radius: 6px; font-weight: 800; flex: 0 0 auto; }
.ee-sections { display: grid; gap: .35rem; }
.ee-sec { display: grid; text-align: left; gap: .1rem; padding: .5rem .6rem; cursor: grab; }
.ee-sec strong { font-size: .82rem; } .ee-sec span { font-size: .74rem; color: var(--muted); font-weight: 400; }
.ee-seg { display: flex; gap: .2rem; flex-wrap: wrap; }
.ee-seg button { flex: 1; padding: .35rem .4rem; font-size: .76rem; }
.ee-seg button.on { background: var(--brand-strong); color: var(--on-brand); border-color: var(--brand-strong); }
.ee-swatches { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.ee-sw { width: 1.45rem; height: 1.45rem; padding: 0; border-radius: 6px; border: 1px solid rgb(0 0 0 / .15); }
.ee-sw.on { outline: 2px solid var(--info); outline-offset: 1px; }
.ee-sw.none { background: var(--panel); color: var(--muted); font-size: .7rem; }
.ee-swatches input[type=color] { width: 1.9rem; height: 1.6rem; padding: 0 .1rem; border: 1px solid var(--line); border-radius: 6px; background: none; }
.ee-imgctl { display: flex; gap: .5rem; align-items: center; }
.ee-thumb { flex: 0 0 64px; height: 64px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: .72rem; color: var(--muted); background: var(--panel-soft); }
.ee-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ee-imgbtns { display: flex; gap: .35rem; flex-wrap: wrap; }
.ee-imgbtns button { padding: .4rem .7rem; font-size: .8rem; }
.ee-side input[type=text] { margin-top: .35rem; font-size: .86rem; padding: .45rem .55rem; }
.ee-recent { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin-top: .45rem; max-height: 180px; overflow: auto; }
.ee-rimg { padding: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.ee-rimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ee-gitems { display: grid; gap: .35rem; margin: .5rem 0; }
.ee-gitem { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; gap: .3rem; align-items: center; }
.ee-gitem img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.ee-gitem input { margin: 0 !important; }
.ee-gitem button { padding: .3rem .45rem; font-size: .75rem; }

@media (max-width: 860px) {
  .ee-body { grid-template-columns: 1fr; }
  .ee-stage { border-right: 0; border-bottom: 1px solid var(--line); max-height: 70vh; }
  .ee-side { position: static; max-height: none; overflow: visible; }
  .ee-hint { display: none; }
  .ee-top { top: 2.9rem; }
}

/* email preview width toggle */
.pv-frame { margin: 0 auto; transition: max-width .2s; }
.pv-frame.mobile { max-width: 390px; }
.sendbox { border: 1px solid var(--line); border-radius: 10px; padding: .85rem 1rem; margin-top: .8rem; background: var(--panel-soft); }
.sendbox label.inline { margin: .25rem 0; }
.sendbox .note { margin: .1rem 0 0 1.6rem; }
.sendbox .note.flush { margin: .35rem 0 0; }
.sendbox .note.flush:empty { display: none; }
.sendbox .sendq { display: block; margin: 0 0 .35rem; font-weight: 700; }
.sendbox select#topic { max-width: 420px; }
#sendArea { margin: 1.1rem 0 .2rem; }
#sendArea #emailSendBox { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.testrow { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .7rem; }
.testrow input { flex: 1 1 220px; width: auto; }

/* confirm dialog */
dialog.confirm { border: 0; border-radius: 14px; padding: 1.4rem 1.5rem; max-width: 440px; width: 92vw; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
dialog.confirm::backdrop { background: rgb(20 20 20 / .45); }
dialog.confirm h3 { font: 700 1.1rem var(--font-head); margin: 0 0 .5rem; }
dialog.confirm p { margin: .3rem 0; font-size: .92rem; }
dialog.confirm .big { font: 700 1.6rem var(--font-head); margin: .6rem 0 .2rem; }

/* ================================================================ history */

.htool { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.htool > div { flex: 1 1 200px; }
.htool input[type=search] { width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); color: inherit; }
.hfilters { display: flex; gap: .3rem; flex-wrap: wrap; }
.hfilters button { padding: .35rem .75rem; font-size: .8rem; border-radius: 99px; }
.hfilters button.on { background: var(--brand-strong); color: var(--on-brand); border-color: var(--brand-strong); }
.hsummary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.hsum { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; }
.hsum b { display: block; font: 700 1.35rem/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.hsum span { font-size: .78rem; color: var(--muted); }
.hcard { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: .8rem; overflow: hidden; }
.hcard .hmain { padding: .9rem 1rem .8rem; cursor: pointer; }
.hcard .hmain:hover { background: var(--panel-soft); }
.hcard .htitle { display: flex; gap: .75rem; align-items: baseline; }
.hcard .htitle strong { font: 600 1rem/1.35 var(--font-head); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard .hwhen { font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hcard .hby { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.hcard .hchips { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .55rem; }
.hstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .7rem; }
.hstat { border: 1px solid var(--line); border-radius: 9px; padding: .45rem .6rem; background: var(--panel-soft); }
.hstat b { display: block; font: 700 1.1rem/1.2 var(--font-head); font-variant-numeric: tabular-nums; }
.hstat span { font-size: .74rem; color: var(--muted); }
.hstat .bar { height: 4px; border-radius: 3px; background: var(--line); margin-top: .35rem; overflow: hidden; }
.hstat .bar i { display: block; height: 100%; background: var(--ok); }
.hnote { margin-top: .6rem; font-size: .84rem; padding: .45rem .7rem; border-radius: 8px; background: var(--panel-soft); border: 1px solid var(--line); }
.hnote.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.hnote.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.hdetail { border-top: 1px solid var(--line); padding: .9rem 1rem 1rem; background: var(--panel); }
.hdetail .subtabs { flex-wrap: wrap; }
.hdetail iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.hgrid { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; font-size: .86rem; margin: .2rem 0 .6rem; }
.hgrid dt { color: var(--muted); } .hgrid dd { margin: 0; }
.hsection-title { display: flex; align-items: baseline; gap: .6rem; }
.hsection-title .note { margin-left: auto; }
@media (max-width: 640px) { .hstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hcard .htitle { flex-wrap: wrap; } }
