/* Viewcast Mailer. Ink on cool paper, one signal blue, status colours only where they report something. */
:root {
  --ink: #14213d;
  --soft: #55617d;
  --page: #f3f5fa;
  --surface: #ffffff;
  --line: #dce2ee;
  --signal: #2f5bea;
  --signal-dark: #2146c4;
  --sent: #1b7f58;
  --failed: #c9343f;
  --wait: #8a6410;
  --display: Bahnschrift, "DIN Alternate", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--body); line-height: 1.5; }
a { color: var(--signal-dark); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; border-radius: 3px; }

h1, h2, .brand, .solo h1 { font-family: var(--display); font-weight: 600; letter-spacing: 0.01em; line-height: 1.15; }
h1 { font-size: 2.25rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; max-width: 68ch; }
section { margin-top: 2.5rem; }
.lede { color: var(--soft); font-size: 1.0625rem; }
.crumb { margin-bottom: 0.25rem; font-size: 0.875rem; }
.hint { color: var(--soft); font-size: 0.875rem; }
.count { color: var(--soft); font-weight: 400; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.head h1 { margin: 0; }

/* Shell */
.shell { display: grid; grid-template-columns: 14rem 1fr; min-height: 100vh; }
.rail { background: var(--ink); color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.125rem; position: sticky; top: 0; height: 100vh; }
.rail a { color: #c9d2e6; text-decoration: none; padding: 0.5rem 0.75rem; border-radius: 6px; }
.rail a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.rail a[aria-current="page"] { color: #fff; background: var(--signal); }
.rail .brand { color: #fff; font-size: 1.375rem; padding: 0 0.75rem 1.25rem; }
.rail .brand:hover { background: none; }
.brand span, .solo h1 span { font-weight: 300; }
.rail-foot { margin-top: auto; padding: 0 0.75rem; }
.rail .link { color: #c9d2e6; }
main { padding: 2rem 2.5rem 4rem; max-width: 72rem; width: 100%; min-width: 0; }
.shell > * { min-width: 0; }

.mode { background: #fff6dd; border-left: 4px solid #d9a521; color: #5c4306; padding: 0.5rem 0.875rem; max-width: none; border-radius: 0 6px 6px 0; }
.flash { background: #e6f4ee; border-left: 4px solid var(--sent); padding: 0.5rem 0.875rem; max-width: none; border-radius: 0 6px 6px 0; }
.flash.error { background: #fdeced; border-left-color: var(--failed); }

/* Forms */
label { display: block; font-weight: 600; font-size: 0.875rem; margin: 0.875rem 0 0.25rem; }
input, select, textarea, button, .button { font: inherit; color: inherit; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 0.5rem 0.625rem; border: 1px solid #b9c2d6; border-radius: 6px; background: #fff;
}
input[type="file"] { width: 100%; padding: 0.375rem 0; }
input[type="color"] { width: 3rem; height: 2.5rem; padding: 2px; border: 1px solid #b9c2d6; border-radius: 6px; background: #fff; }
textarea { font-family: var(--mono); font-size: 0.8125rem; line-height: 1.55; resize: vertical; }
input.narrow { width: 5rem; }
input.narrow-text { width: 8rem; }
button, .button {
  display: inline-block; padding: 0.5rem 0.875rem; border: 1px solid #b9c2d6; border-radius: 6px; background: #fff;
  cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--ink); }
button.primary, .button.primary, .notice .button:not(.quiet) { background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600; }
button.primary:hover, .button.primary:hover { background: var(--signal-dark); border-color: var(--signal-dark); }
button.link { border: 0; background: none; padding: 0; color: var(--signal-dark); text-decoration: underline; }
button.link.danger { color: var(--failed); }
.row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; margin-top: 0.5rem; }
.row > div { min-width: 0; }
.row .grow { flex: 1 1 14rem; }
.row label { margin-top: 0; }
.row.tight { align-items: center; margin-top: 0; }
.row.add { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.inline { display: inline-flex; gap: 0.5rem; align-items: center; }
.inline select { width: auto; }
.check { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; font-size: 1rem; }
.actions { margin-top: 1rem; }
td.actions { margin: 0; text-align: right; white-space: nowrap; }
td.actions > * { margin-left: 0.75rem; }
.field-error { color: var(--failed); font-size: 0.875rem; margin-top: 0.375rem; }

/* Surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.5rem; }
.notice { border-left: 4px solid var(--signal); }
.empty { color: var(--soft); background: var(--surface); border: 1px dashed #b9c2d6; border-radius: 10px; padding: 1.25rem 1.5rem; max-width: none; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.8125rem; color: var(--soft); font-weight: 600; background: #f8f9fc; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.steps select { width: auto; max-width: 16rem; }

/* Figures on the overview: plain numbers, each a link to the list behind it */
.figures { display: flex; gap: 2.5rem; flex-wrap: wrap; margin: 1.25rem 0 2rem; }
.figures a { color: var(--soft); text-decoration: none; }
.figures strong { display: block; font-family: var(--display); font-size: 2.75rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.figures a:hover strong { color: var(--signal-dark); }
.figures .bad strong { color: var(--failed); }

/* Status */
.status { display: inline-block; font-size: 0.8125rem; font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 999px; text-decoration: none; border: 1px solid transparent; }
.status.scheduled, .status.sending { color: var(--signal-dark); background: #e8eeff; }
.status.sent { color: var(--sent); background: #e3f3ec; }
.status.failed { color: #fff; background: var(--failed); }
.status.skipped, .status.cancelled { color: var(--soft); background: #eceff5; }
.chips { display: flex; gap: 0.375rem; flex-wrap: wrap; margin: 0; }
td.chips { display: table-cell; }
td.chips .status { margin: 0.125rem 0.25rem 0.125rem 0; }
.key { margin-top: 0.75rem; }
.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; max-width: none; }
.tabs a { padding: 0.375rem 0.75rem; border-radius: 6px; text-decoration: none; color: var(--soft); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }

/* Run of emails: the sequence around an event, in the order it happens */
.run { list-style: none; display: flex; margin: 0 0 1.5rem; padding: 1.5rem 1.25rem 1.25rem; background: var(--ink); color: #fff; border-radius: 10px; overflow-x: auto; }
.run li { flex: 1 0 9rem; position: relative; padding-top: 1.75rem; display: flex; flex-direction: column; }
.run li::before { content: ""; position: absolute; top: 0.4375rem; left: 0; right: 0; height: 2px; background: #47557a; }
.run li:last-child::before { right: auto; width: 0.875rem; }
.run .dot { position: absolute; top: 0; left: 0; width: 1rem; height: 1rem; border-radius: 50%; background: var(--ink); border: 2px solid #9fb3ff; }
.run strong { font-family: var(--display); font-weight: 600; font-size: 1.0625rem; }
.run span:not(.dot) { color: #c9d2e6; font-size: 0.875rem; }
.run .live .dot { background: #ff5964; border-color: #ff5964; box-shadow: 0 0 0 4px rgba(255, 89, 100, 0.25); }
.run .live strong { color: #ffb3b8; }

/* Template editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.editor aside { position: sticky; top: 1rem; }
.editor h2 { margin-top: 1.5rem; }
.editor aside h2 { margin-top: 0; }
iframe { width: 100%; height: 38rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
iframe.email { margin-top: 1.5rem; max-width: 42rem; height: 46rem; display: block; }
.subject-preview { font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: 10px 10px 0 0; border-bottom: 0; padding: 0.625rem 0.875rem; margin: 0; max-width: none; min-height: 2.75rem; }
.subject-preview + iframe { border-radius: 0 0 10px 10px; }
.chip { font-family: var(--mono); font-size: 0.8125rem; padding: 0.1875rem 0.5rem; border-radius: 6px; background: #fff; }
.chip.block { background: #e8eeff; border-color: #b7c6fb; }
.banner-preview { display: block; max-width: 100%; width: 28rem; border: 1px solid var(--line); border-radius: 6px; margin: 0.5rem 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.375rem 1.25rem; margin: 1rem 0 1.25rem; }
.facts dt { color: var(--soft); }
.facts dd { margin: 0; }
pre { background: var(--ink); color: #e6ebf7; padding: 1rem 1.25rem; border-radius: 10px; overflow-x: auto; font-size: 0.8125rem; line-height: 1.55; }
code { font-family: var(--mono); font-size: 0.875em; }
.secret { display: block; background: var(--page); border: 1px solid var(--line); padding: 0.625rem 0.875rem; border-radius: 6px; font-size: 1rem; overflow-wrap: anywhere; user-select: all; }

/* Login and the public unsubscribe page */
.solo { max-width: 24rem; margin: 12vh auto 0; padding: 0 1.25rem; --brand: var(--signal); }
.solo.wide { max-width: 34rem; }
.solo h1 { margin-bottom: 1.25rem; }
.solo .panel { margin-bottom: 1rem; }
.solo .primary { margin-top: 1rem; background: var(--brand); border-color: var(--brand); }
.solo .check { margin: 0.5rem 0; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 0.75rem; }
  .rail .brand { width: 100%; padding-bottom: 0.5rem; }
  .rail-foot { margin: 0 0 0 auto; align-self: center; }
  main { padding: 1.25rem 1rem 3rem; }
  .editor { grid-template-columns: 1fr; }
  .editor aside { position: static; }
  table { display: block; overflow-x: auto; }
  h1 { font-size: 1.75rem; }
}

/* Visual designer */
main.wide { max-width: none; padding-right: 1.5rem; }
.head-actions { display: flex; gap: 0.5rem; margin: 0; }
.d-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem 1.5rem; align-items: end; margin-bottom: 1rem; }
.d-bar .d-meta:nth-child(1) { grid-area: 1 / 1; }
.d-bar .d-meta:nth-child(2) { grid-area: 2 / 1 / 3 / 3; }
.d-bar .d-commands { grid-area: 1 / 2; }
.d-meta { display: flex; gap: 0.75rem; align-items: flex-end; min-width: 0; }
.d-meta .grow { flex: 1; min-width: 0; }
.d-meta label { margin-top: 0; }
.d-meta select { width: auto; max-width: 13rem; }
.d-commands { display: flex; gap: 0.5rem; align-items: center; }
.d-status { color: var(--soft); font-size: 0.875rem; min-width: 8.5rem; text-align: right; }
.d-status.bad { color: var(--failed); font-weight: 600; }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:hover { border-color: #b9c2d6; }

.d-work { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) 19rem; gap: 1rem; align-items: start; }
.d-work[hidden], .d-preview[hidden] { display: none; }
.d-palette, .d-inspector { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.d-palette h2, .d-inspector h2 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.d-palette h2:first-child, .d-inspector h2:first-child { margin-top: 0; }
.d-tiles { display: grid; gap: 0.375rem; }
.d-tiles button { text-align: left; white-space: normal; cursor: grab; display: flex; align-items: center; gap: 0.5rem; padding: 0.4375rem 0.625rem; }
.d-tiles button:active { cursor: grabbing; }
.d-cols-icon { display: inline-flex; gap: 2px; width: 1.75rem; height: 1rem; flex: none; }
.d-cols-icon i { flex: 1; border: 1.5px solid var(--soft); border-radius: 2px; }

.d-stage { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 2.25rem 1rem 3rem; min-height: 34rem; overflow-x: auto; }
.d-canvas { width: 600px; margin: 0 auto; box-sizing: content-box; min-height: 12rem; font-family: Arial, Helvetica, sans-serif; color: #14213d; box-shadow: 0 1px 3px rgba(20, 33, 61, 0.12); line-height: 1.5; font-size: 16px; }
.d-start, .d-empty { margin: 0; padding: 1.5rem 1rem; text-align: center; color: var(--soft); border: 1.5px dashed #b9c2d6; border-radius: 6px; font-family: var(--body); font-size: 0.875rem; max-width: none; }
.d-empty { margin: 0.375rem; padding: 1rem 0.5rem; }
.d-row { position: relative; outline: 1px dashed transparent; outline-offset: -1px; }
.d-row:hover, .is-dragging .d-row { outline-color: #b9c2d6; }
.d-row.is-selected { outline: 2px solid var(--ink); }
.d-row-handle { position: absolute; left: -3.25rem; top: 0; width: 3rem; padding: 0.125rem 0; font-family: var(--body); font-size: 0.75rem; cursor: grab; opacity: 0; border-radius: 6px 0 0 6px; background: var(--ink); color: #fff; border-color: var(--ink); }
.d-row:hover .d-row-handle, .d-row.is-selected .d-row-handle, .d-row-handle:focus-visible { opacity: 1; }
.d-cols { display: flex; align-items: flex-start; }
.d-col { flex: 1 1 0; min-width: 0; min-height: 2.5rem; }
.d-block { position: relative; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; }
.d-block:hover { outline-color: #b7c6fb; }
.d-block.is-selected { outline-color: var(--signal); cursor: auto; }
.d-block img { max-width: 100%; }
.d-ready { pointer-events: none; }
.d-ready p { max-width: none; }
.d-edit { outline: none; min-height: 1em; cursor: text; }
.d-rich p, .d-rich ul, .d-rich ol { margin: 0 0 12px; max-width: none; }
.d-rich ul, .d-rich ol { padding-left: 22px; }
.d-rich a { color: var(--link, var(--signal-dark)); }
.d-spacer { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(85, 97, 125, 0.12) 6px 7px); }
.d-placeholder { padding: 1.75rem 1rem; background: #eef1f7; color: var(--soft); border-radius: 6px; font-family: var(--body); font-size: 0.875rem; }
.d-indicator { position: absolute; height: 4px; background: var(--signal); border-radius: 2px; pointer-events: none; z-index: 5; }
.d-indicator[hidden], .d-toolbar[hidden] { display: none; }
.d-toolbar { position: absolute; z-index: 6; display: flex; background: var(--ink); border-radius: 6px; padding: 2px; white-space: nowrap; }
.d-toolbar button { background: none; border: 0; color: #fff; font-size: 0.8125rem; padding: 0.25rem 0.5rem; border-radius: 4px; }
.d-toolbar button:hover { background: rgba(255, 255, 255, 0.16); }
.d-toolbar .d-grip { cursor: grab; border-right: 1px solid #47557a; border-radius: 4px 0 0 4px; margin-right: 2px; }
.d-toolbar .d-bold { font-weight: 700; }
.d-toolbar .d-italic { font-style: italic; font-family: Georgia, serif; }
.d-toolbar .d-danger { color: #ffb3b8; }

.d-field { margin-bottom: 0.875rem; }
.d-field label, .d-label { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.875rem; margin: 0 0 0.25rem; }
.d-field label.check { font-weight: 400; justify-content: flex-start; margin-top: 0.375rem; }
.d-field output { font-weight: 400; color: var(--soft); font-variant-numeric: tabular-nums; }
.d-field input[type="range"] { width: 100%; }
.d-field .hint { margin: 0.25rem 0 0; }
.d-inspector > button { margin-bottom: 0.875rem; white-space: normal; text-align: left; }
.d-choice { display: inline-flex; border: 1px solid #b9c2d6; border-radius: 6px; overflow: hidden; }
.d-choice button { border: 0; border-radius: 0; padding: 0.375rem 0.75rem; border-right: 1px solid #b9c2d6; }
.d-choice button:last-child { border-right: 0; }
.d-choice button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.d-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin-top: 1rem; }

.d-preview-bar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.d-preview-bar .subject-preview { flex: 1; border-radius: 10px; border-bottom: 1px solid var(--line); }
.d-preview-stage { background: #e4e8f1; border-radius: 10px; padding: 1rem; text-align: center; }
.d-preview-stage iframe { height: 44rem; max-width: 100%; border-radius: 6px; }

@media (max-width: 1180px) {
  .d-bar { grid-template-columns: 1fr; }
  .d-bar .d-meta:nth-child(1), .d-bar .d-meta:nth-child(2), .d-bar .d-commands { grid-area: auto; }
  .d-commands { flex-wrap: wrap; }
  .d-work { grid-template-columns: 10rem minmax(0, 1fr); }
  .d-inspector { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 860px) {
  .d-work { grid-template-columns: 1fr; }
  .d-palette { position: static; max-height: none; }
  .d-tiles { grid-template-columns: 1fr 1fr; }
  .d-row-handle { left: 0; top: -1.25rem; border-radius: 6px 6px 0 0; }
}

/* The designer needs the width: on smaller screens the menu moves to the top of the page. */
@media (max-width: 1499px) {
  .shell:has(main.wide) { grid-template-columns: 1fr; }
  .shell:has(main.wide) .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.5rem 1rem; }
  .shell:has(main.wide) .rail .brand { padding: 0 1rem 0 0.25rem; }
  .shell:has(main.wide) .rail-foot { margin: 0 0 0 auto; }
  .shell:has(main.wide) main { padding: 1.25rem 1.5rem 3rem; }
}

/* Designer settings: sections, calendar list, test result */
.d-section { border-top: 1px solid var(--line); padding: 0.625rem 0 0.125rem; }
.d-section > summary { font-family: var(--display); font-weight: 600; font-size: 1rem; cursor: pointer; margin-bottom: 0.625rem; }
.d-section[open] > summary { margin-bottom: 0.75rem; }
.d-section > button { margin-bottom: 0.875rem; white-space: normal; text-align: left; }
.d-section > .hint, .d-inspector > .hint { margin: -0.25rem 0 0.875rem; }
.d-inspector textarea { font-family: var(--body); font-size: 0.875rem; line-height: 1.4; }
.d-inspector input:disabled { opacity: 0.45; }
.d-provider { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.375rem; }
.d-provider input[type="text"] { padding: 0.3125rem 0.5rem; }
.d-result { margin: 0.75rem 0 0; padding: 0.5rem 0.875rem; background: #e6f4ee; border-left: 4px solid var(--sent); border-radius: 0 6px 6px 0; max-width: none; }
.d-result.bad { background: #fdeced; border-left-color: var(--failed); }
.d-result[hidden] { display: none; }
.panel .row > a { align-self: center; }

/* Logo, event sites */
.rail .brand { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0 0.75rem 1.25rem; }
.rail .brand img { height: 2rem; width: auto; display: block; }
.rail .brand span { font-family: var(--display); font-weight: 300; font-size: 1.125rem; line-height: 1; padding-bottom: 0.2rem; color: #c9d2e6; }
.rail .rail-back { font-size: 0.875rem; padding: 0.25rem 0.75rem; }
.rail .rail-back::before { content: "\2039\00a0"; }
.rail-event { color: #fff; font-family: var(--display); font-weight: 600; font-size: 1.0625rem; line-height: 1.25; padding: 0.5rem 0.75rem 0.75rem; margin: 0 0 0.5rem; border-bottom: 1px solid #2c3a5e; overflow-wrap: anywhere; }
.solo-brand { display: flex; align-items: flex-end; gap: 0.625rem; margin: 0 0 1.5rem; }
.solo-brand img { height: 2.5rem; width: auto; display: block; }
.solo-brand span { font-family: var(--display); font-weight: 300; font-size: 1.625rem; line-height: 1; padding-bottom: 0.25rem; color: var(--soft); }
.solo .panel h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
h3 { font-family: var(--display); font-weight: 600; font-size: 1.0625rem; margin: 1.5rem 0 0.5rem; }
input[type="date"], input[type="time"] { padding: 0.5rem 0.625rem; border: 1px solid #b9c2d6; border-radius: 6px; background: #fff; }
@media (max-width: 860px) { .rail-event { width: 100%; } }
@media (max-width: 1499px) { .shell:has(main.wide) .rail-event { border: 0; margin: 0; padding: 0 0.75rem; } }
