/* Harbor › Email (public/harbor-email.mjs). Same Voyage look as Website and Tests (site-studio.css: white cards,
   sticker chips, Anton numbers). Phone first: one column, 16px gutters, 44px targets; the editors get their preview
   beside them from 1100px. */

.em { display: grid; gap: 16px; min-width: 0; }
.em .ss-head { margin-bottom: 0; }
.em-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.em-tabs::-webkit-scrollbar { display: none; }
.em-tabs .ss-tab { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.em-body, .em-view { display: grid; gap: 16px; min-width: 0; }
.em-body > *, .em-view > * { min-width: 0; }
.em h2 { margin: 0; font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.em-h3 { margin: 14px 0 8px; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.em-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-width: 0; }
.em-row > h2 { flex: 1 1 200px; min-width: 0; }
.em-top { display: flex; flex-wrap: wrap; gap: 8px; }
.em-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.em-card { align-content: start; }
.em fieldset { margin: 0; min-width: 0; }
.em fieldset.ss-card { border: 2px solid var(--ss-ink); }
.em legend { font-weight: 800; font-size: 16px; padding: 0 6px; }
.em-field { margin-bottom: 0; }
.em .field-hint { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2, rgb(22 19 10 / 72%)); line-height: 1.4; }
.em-check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; font-size: 15px; line-height: 1.35; cursor: pointer; }
.em-check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--ss-ink); }
.em-two { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.em-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; }
.em-inline .input { width: auto; min-width: 0; }
.em-num { width: 84px !important; }
.em-title-input { flex: 1 1 220px; }
.em-title-input .input { font-size: 18px; font-weight: 800; }

/* Readiness */
.em-ready { background: var(--ss-sun-soft); }
.em-ready.is-ready { background: var(--ss-green-soft); }
.em-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.em-checks li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 600; }
.em-checks li > span:nth-child(2) { flex: 1 1 200px; }
.em-tick { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; background: #fff; box-shadow: inset 0 0 0 2px var(--ss-ink); flex: none; }
.em-checks li.is-ok .em-tick { background: var(--ss-ink); color: var(--ss-cream); }

/* Overview */
.em-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.em-stats-wide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.em-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.em-bars li { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.em-bar { height: 10px; border-radius: 999px; background: #f1eee2; overflow: hidden; display: block; }
.em-bar > span { display: block; height: 100%; background: var(--ss-ink); border-radius: inherit; }
.em-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.em-list li { display: grid; gap: 2px; }
.em-list a { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ss-ink); text-decoration: none; min-height: 44px; }
.em-list a:hover strong { text-decoration: underline; }

/* People */
.em-people { display: grid; gap: 12px; }
.em-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.em-search { flex: 1 1 240px; }
.em-filters { flex-wrap: wrap; border-radius: 22px; justify-self: start; }
.em-people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.em-person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--ss-card); color: var(--ss-ink); text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--ss-line); min-height: 56px; }
.em-person:hover { box-shadow: inset 0 0 0 2px var(--ss-ink); }
.em-person-main { flex: 1 1 220px; display: grid; gap: 2px; min-width: 0; }
.em-person-main strong { overflow-wrap: anywhere; }
.em-person-main span { font-size: 13px; color: var(--ink-2, rgb(22 19 10 / 72%)); }
.em-kvs { margin: 0; display: grid; gap: 0; }
.em-kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px 0; border-top: 1px solid var(--ss-line); }
.em-kv dt { font-size: 12.5px; font-weight: 700; color: var(--ink-3, rgb(22 19 10 / 60%)); }
.em-kv dd { margin: 0; overflow-wrap: anywhere; }
.em-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.em-timeline li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.em-timeline time { color: var(--ink-3, rgb(22 19 10 / 60%)); font-size: 13px; }

/* Problems */
.em-problems { padding: 12px 14px; border-radius: 16px; background: var(--hot-soft, #ffe1ea); font-size: 14px; }
.em-problems.is-ok { background: var(--ss-green-soft); }
.em-problems ul { margin: 6px 0 0; padding-left: 20px; }
.em-problems-inline { margin: 6px 0; padding-left: 18px; font-size: 13.5px; color: #8a1c3a; }

/* Editors with a preview */
.em-split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.em-editor { display: grid; gap: 16px; min-width: 0; }
.em-preview { position: relative; display: grid; gap: 10px; min-width: 0; }
.em-popup-stage { position: relative; margin: 0 auto; width: 100%; border-radius: 24px; overflow: hidden; background: linear-gradient(160deg, #e9e4d3, #d9d2bb);
  box-shadow: inset 0 0 0 2px var(--ss-ink); }
.em-popup-stage.is-phone { max-width: 360px; height: 640px; }
.em-popup-stage.is-desktop { height: 560px; }
.em-popup-stage .dxf-root.dxf-static { height: 100%; min-height: 0; }
.em-colors .em-field { display: inline-grid; margin-right: 12px; }
.em-color { width: 64px !important; height: 44px; padding: 4px; }

/* Flows */
.em-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.em-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px; border-radius: 16px; background: #faf9f4; box-shadow: inset 0 0 0 1px var(--ss-line); }
.em-step-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--ss-sun); font-size: 18px; box-shadow: inset 0 0 0 2px var(--ss-ink); }
.em-step-wait .em-step-icon { background: #fff; }
.em-step-split .em-step-icon { background: var(--ss-sky-soft); }
.em-step-main { display: grid; gap: 6px; min-width: 0; }
.em-step-title { margin: 0; overflow-wrap: anywhere; }
.em-step-tools { display: inline-flex; gap: 4px; }
.em-step-tools .ss-x { width: 36px; height: 36px; font-size: 16px; }
.em-when { font-size: 12.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3, rgb(22 19 10 / 60%)); }
.em-branches { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.em-branch { padding: 10px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--ss-line); display: grid; gap: 8px; }
.em-branch-label { margin: 0; font-weight: 800; }
.em-branch-yes .em-branch-label::before { content: '✓ '; color: var(--ss-green); }
.em-branch-no .em-branch-label::before { content: '✕ '; color: #b4234d; }
.em-step-empty { font-size: 13.5px; color: var(--ink-3, rgb(22 19 10 / 60%)); padding: 6px 0; }
.em-add { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 10px; padding: 8px 10px; border-radius: 14px; border: 2px dashed var(--ss-line); }
.em-add-label { font-weight: 800; font-size: 13.5px; margin-right: 4px; }

/* Email editor */
.em-format { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); margin-bottom: 12px; }
.em-format-option { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--ss-line); cursor: pointer; background: #fff; }
.em-format-option.is-on, .em-format-option:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ss-ink); background: var(--ss-sun-soft); }
.em-format-option input { position: absolute; opacity: 0; pointer-events: none; }
.em-format-option:focus-within { outline: 2px solid var(--ss-ink); outline-offset: 2px; }
.em-format-option span { font-size: 13.5px; color: var(--ink-2, rgb(22 19 10 / 72%)); }
.em-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 13.5px; font-weight: 700; }
.em-editor[data-em-email-editor] textarea[name="body"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.55; min-height: 320px; }
.em-blocks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.em-block { border-width: 1px !important; padding: 14px !important; }
.em-pick summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.em-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-height: 360px; overflow: auto; padding: 4px; }
.em-pick-item { display: grid; gap: 4px; font-size: 12.5px; cursor: pointer; }
.em-pick-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.em-product-list { margin: 6px 0; padding-left: 18px; }
.em-frame-box { margin: 0 auto; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 2px var(--ss-ink); width: 100%; }
.em-frame-box.is-phone { max-width: 390px; border-radius: 28px; }
.em-frame { display: block; width: 100%; height: 720px; border: 0; background: #fff; }
.em-preview-meta { margin: 0; font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.em-test .em-inline { width: 100%; }
.em-test .em-inline .input { flex: 1 1 200px; }

/* Settings */
.em-settings { display: grid; gap: 16px; }
.em-sticky-save { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); z-index: 2; }
.em-sticky-save .btn { width: 100%; }

/* Segments and campaigns */
.em-groups { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 10px; }
.em-group { border-width: 1px !important; padding: 12px !important; gap: 8px !important; }
.em-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.em-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.em-rule .input { width: auto; flex: 1 1 140px; min-width: 0; }
.em-count { margin: 0; font-weight: 800; font-size: 16px; }
.em-when { border: 0; padding: 0; }
.em-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.em-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.em-table th, .em-table td { padding: 8px 10px; text-align: right; border-top: 1px solid var(--ss-line); white-space: nowrap; }
.em-table th:first-child, .em-table thead th:first-child { text-align: left; white-space: normal; min-width: 140px; }
.em-table small { color: var(--ink-3, rgb(22 19 10 / 60%)); }
.em-weeks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; align-items: end; height: 140px; }
.em-weeks li { display: grid; grid-template-rows: 1fr auto; height: 100%; align-items: end; text-align: center; }
.em-week-bar { display: block; width: 100%; min-height: 2px; background: var(--ss-ink); border-radius: 6px 6px 0 0; }
.em-weeks small { font-size: 10.5px; color: var(--ink-3, rgb(22 19 10 / 60%)); }

@media (min-width: 760px) {
  .em-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-format { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-branches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-kv { grid-template-columns: 220px minmax(0, 1fr); }
  .em-sticky-save { bottom: 16px; }
  .em-sticky-save .btn { width: auto; }
}
@media (min-width: 1100px) {
  .em-split { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
  .em-preview { position: sticky; top: 80px; }
}
@media (max-width: 480px) {
  .em-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .em-timeline li { grid-template-columns: minmax(0, 1fr); }
  .em-popup-stage.is-phone { height: 600px; }
  .em-frame { height: 600px; }
}
