/*
 * Voltify Mailer, in the Voltify brand (shared with Voltify Onboarding):
 * FK Grotesk / FK Grotesk Mono, Black #141414, Primary #0040FF, Secondary
 * #BCC5CC, Tertiary #F8F9FA, chevron motif.
 * No inline styles in the app's own markup: the CSP forbids them (the
 * campaign editor alone allows style="" attributes, for the email's content).
 */

@font-face {
  font-family: "FK Grotesk";
  src: url("fonts/FKGrotesk-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FK Grotesk";
  src: url("fonts/FKGrotesk-Medium.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FK Grotesk Mono";
  src: url("fonts/FKGroteskMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #141414;
  --ink: #151619;
  --white: #ffffff;
  --primary: #0040ff;
  --primary-600: #0033cc;
  --primary-700: #002aa6;
  --primary-50: #f5f6fa;
  --primary-100: #eaedf6;
  --primary-200: #c9d2ed;
  --primary-300: #aac8f3;
  --secondary: #bcc5cc;
  --tertiary: #f8f9fa;
  --n100: #f4f4f6;
  --n200: #e3e4e8;
  --n300: #cfd1d8;
  --n400: #9a9fac;
  --n500: #676d7e;
  --n600: #494e5a;
  --success: #136c46;
  --success-tint: #e1f4ec;
  --warn: #6c4513;
  --warn-tint: #f4ece1;
  --danger: #c4231b;
  --danger-tint: #fdecea;

  --font: "FK Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "FK Grotesk Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font: 400 15px/1.55 var(--font);
  color: var(--ink);
  background: var(--tertiary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); text-decoration: underline; }

h1, h2, h3 { font-weight: 500; }
h1 { font-size: 40px; line-height: 1.1; letter-spacing: -1.2px; margin: 0 0 6px; }
h2 { font-size: 20px; line-height: 1.25; letter-spacing: -0.3px; margin: 0 0 14px; }
/* Section labels (card sub-heads): the site's mono ticker style. */
h3 {
  font: 400 12px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--n500);
  margin: 22px 0 8px;
}

.eyebrow {
  font: 400 12px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--n500);
}
.muted { color: var(--n500); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none; }

/* ------------------------------------------------------------ header */
.topbar { background: var(--black); color: var(--white); }
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--white); }
.brand:hover { text-decoration: none; color: var(--white); }
.brand img { height: 16px; width: auto; display: block; }
.brand span {
  font: 400 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--n400);
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}
/* One line always: the bar is a fixed 64px, so wrapping would push links out of view. */
.nav { display: flex; gap: 22px; flex: 1; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  padding: 22px 0 20px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--white); text-decoration: none; }
.nav a.active { color: var(--white); border-bottom-color: var(--primary); }
.whoami { display: flex; align-items: center; gap: 14px; font: 400 12px var(--mono); color: var(--n400); white-space: nowrap; }
/* Narrower screens: drop the email, keep the role and Sign out. */
@media (max-width: 1380px) { .whoami .whoami-email { display: none; } }
.whoami form { margin: 0; }
.whoami .badge { background: rgba(255, 255, 255, 0.08); color: var(--white); border-color: rgba(255, 255, 255, 0.16); }
.topbar button, .topbar .btn {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.35);
}
.topbar button:hover, .topbar .btn:hover { background: var(--white); color: var(--black); }

/* ------------------------------------------------------------ layout */
.page { max-width: 1240px; margin: 0 auto; padding: 40px 32px 80px; }
.page.narrow { max-width: 780px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-head .muted { font-size: 16px; margin: 4px 0 0; }
.page-head .eyebrow { margin-bottom: 10px; }
/* The site's two-tone headline: statement in ink, follow-up in grey. */
h1 .muted, .page-head h1 .muted { color: var(--n400); font-size: inherit; margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--white);
  border: 1px solid var(--n200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.card > h2:first-child { margin-top: 0; }
.stat { position: relative; overflow: hidden; }
.stat .value { font-size: 44px; font-weight: 500; letter-spacing: -1.5px; line-height: 1.05; }
.stat .label { font: 400 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--n500); margin-top: 8px; }
.stat.alert .value { color: var(--danger); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 0; }
dl.facts dt { color: var(--n500); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

/* ------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--n200); vertical-align: top; }
th {
  font: 400 11px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--n500);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--primary-50); }
td select { width: auto; height: 34px; padding: 4px 32px 4px 8px; font-size: 13px; background-position: right 10px center; }

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font: 400 11px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--n100);
  color: var(--n600);
  border: 1px solid var(--n200);
  white-space: nowrap;
}
.badge.success { background: var(--success-tint); color: var(--success); border-color: #c3e8d8; }
.badge.warn { background: var(--warn-tint); color: var(--warn); border-color: #e8d6bd; }
.badge.danger { background: var(--danger-tint); color: var(--danger); border-color: #f6c4c0; }
.badge.blue { background: var(--primary-100); color: var(--primary-700); border-color: var(--primary-200); }

/* ------------------------------------------------------------ forms */
form.stack { display: grid; gap: 18px; }
/* Cards inside a form stack their fields with even spacing. */
form .card, section.card.stack { display: grid; gap: 22px; }
form .card > h2, section.card.stack > h2 { margin: 0; }
form .card > .hidden { display: none; }
/* Fields keep label, control and hint packed at the top, so controls in the
   same row line up even when a neighbour has a hint or an error. */
.field { display: grid; gap: 7px; align-content: start; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field .label { font-weight: 500; font-size: 14px; line-height: 1.3; padding: 0; }
/* <legend> sits outside the fieldset's grid, so it gets the gap as margin. */
fieldset.field > legend { margin-bottom: 7px; }
.field .hint { color: var(--n500); font-size: 13px; line-height: 1.4; }
.field .error { color: var(--danger); font-size: 13px; line-height: 1.4; }
.row { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); align-items: start; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local],
input[type=number], input[type=url], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: inherit;
  padding: 10px 12px;
  border: 1px solid var(--n300);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.12s, box-shadow 0.12s;
}
/* One height for every single-line control, native selects included. */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=datetime-local],
input[type=number], input[type=url], select { height: 44px; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background: var(--white) url("brand/select-arrow.svg") no-repeat right 14px center / 12px 8px;
  cursor: pointer;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 64, 255, 0.15);
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Checkbox lists: a grid. Radio groups: one line, like segmented options. */
.choices { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choices.inline { display: flex; flex-wrap: wrap; gap: 10px 22px; min-height: 44px; align-items: center; }
.choices label { font-weight: 400; display: flex; gap: 10px; align-items: center; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; flex: none; }
.required::after { content: " *"; color: var(--primary); }
input.code { font: 400 30px var(--mono); letter-spacing: 0.4em; text-align: center; max-width: 280px; height: 56px; }
.filters select { width: auto; min-width: 180px; }

/* ------------------------------------------------------------ buttons */
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 500 15px/1.2 var(--font);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--n300);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover, button:hover { background: var(--n100); color: var(--ink); text-decoration: none; }
.btn.primary, button.primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn.primary:hover, button.primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: var(--white); }
.btn.dark, button.dark { background: var(--black); border-color: var(--black); color: var(--white); }
.btn.dark:hover, button.dark:hover { background: #2a2a2a; color: var(--white); }
.btn.danger, button.danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.btn.danger:hover, button.danger:hover { background: #a51d16; color: var(--white); }
.btn.small, button.small { padding: 6px 11px; font-size: 13px; }
button.link { border: none; background: none; color: var(--primary); padding: 0; font-weight: 400; }
button.link:hover { text-decoration: underline; background: none; }
.inline { display: inline; margin: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ flash */
.flash {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border: 1px solid;
  border-left-width: 3px;
}
.flash.info { background: var(--primary-50); border-color: var(--primary-200); border-left-color: var(--primary); color: var(--primary-700); }
.flash.warning { background: var(--warn-tint); border-color: #e8d6bd; border-left-color: #bd7c28; color: var(--warn); }
.flash.error { background: var(--danger-tint); border-color: #f6c4c0; border-left-color: var(--danger); color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #141414;
  color: var(--white);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

progress {
  width: 100%;
  height: 6px;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--n200);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--n200); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }

/* ------------------------------------------------------------ sub-navigation, paging */
.subnav { display: flex; gap: 24px; margin: 0 0 24px; border-bottom: 1px solid var(--n200); }
.subnav a {
  color: var(--n500);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  padding: 10px 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--primary); }
.pager { margin-top: 14px; justify-content: flex-end; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--n100); padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------ confirmation pages */
.confirm .danger-zone {
  border: 1px solid #f6c4c0;
  background: var(--danger-tint);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 18px 0;
}
/* Sign-in and the other signed-out pages. */
.login-box { max-width: 440px; margin: 9vh auto; text-align: left; padding: 36px; }
.login-box img { height: 22px; width: auto; display: block; margin-bottom: 30px; }
.login-box h1 { font-size: 34px; margin-top: 12px; }
.login-box .btn { width: 100%; padding: 13px 16px; margin-top: 8px; }
.login-box .eyebrow { margin-top: 22px; }

footer.foot {
  text-align: center;
  color: var(--n500);
  font: 400 11px/1.6 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 28px;
}

@media (max-width: 760px) {
  .topbar-inner { height: auto; padding: 14px 20px; flex-wrap: wrap; gap: 14px; }
  .nav { flex-wrap: wrap; flex-basis: 100%; overflow: visible; }
  .nav a { padding: 6px 0; }
  .page { padding: 28px 20px 60px; }
  h1 { font-size: 32px; }
}

/* ------------------------------------------------------------ mailer */
.page.wide { max-width: 1480px; }
.grid.six { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat .value { font-size: 38px; }
.stat.highlight { border-color: var(--primary-200); background: var(--primary-50); }
.stat.highlight .value { color: var(--primary); }
.muted-value { color: var(--n400); }
.break { overflow-wrap: anywhere; }
.grow { flex: 1; min-width: 0; }
.btn-row.spread { justify-content: space-between; align-items: center; }
.btn-row.justify-end { justify-content: flex-end; }
.btn-row input[type=text], .btn-row input[type=email] { width: auto; min-width: 240px; }
.btn-row input.grow { flex: 1; }
.spaced { margin-top: 18px; }
label.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
ul.problems { margin: 8px 0 0; padding-left: 20px; }
table.compact th, table.compact td { padding: 8px 10px; }
details.card > summary { cursor: pointer; }
.schedule-form input[type=datetime-local] { width: auto; }
.page-head .eyebrow .badge { margin-left: 6px; }

/* Visits per day / month. */
.chart { width: 100%; height: auto; display: block; }
.chart rect { fill: var(--primary); }
.chart rect:hover { fill: var(--primary-700); }
.chart .axis { stroke: var(--n200); stroke-width: 1; }
.chart .tick { font: 400 11px var(--mono); fill: var(--n500); }
.chart .tick.end { text-anchor: end; }

/* Campaign editor: form on the left, live preview on the right. */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); gap: 20px; align-items: start; }
.editor-main { display: grid; gap: 0; }
.editor-main > .btn-row { margin: 4px 0 40px; }
.editor-preview { position: sticky; top: 16px; }
.preview-card { display: grid; gap: 10px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.preview-head h2 { margin: 0; }
.preview-frame { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--n200); border-radius: var(--radius-sm); background: var(--white); }
.preview-frame.tall { height: 640px; }
@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
}

.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }
.url-status.ok { color: var(--success); }
.url-status.bad { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  font: 400 13px/1.3 var(--font);
  color: var(--primary-700);
  background: var(--primary-50);
  border: 1px dashed var(--primary-200);
  cursor: grab;
  user-select: none;
}
.chip:hover { background: var(--primary-100); color: var(--primary-700); }
.chip:active { cursor: grabbing; }
.chip.chip-link { background: var(--primary); border: 1px solid var(--primary); color: var(--white); }
.chip.chip-link:hover { background: var(--primary-600); color: var(--white); }
.chip.chip-custom { border-style: dotted; color: var(--n600); background: var(--n100); border-color: var(--n300); }

.editor-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.editor-tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--n300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.editor-tabs .tab:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.rich-editor { border: 1px solid var(--n300); border-radius: var(--radius-sm); overflow: hidden; background: var(--white); }
.rich-editor.hidden, .html-source.hidden { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border-bottom: 1px solid var(--n200); background: var(--tertiary); }
.toolbar button { padding: 5px 9px; font-size: 13px; font-weight: 500; border-color: transparent; background: transparent; }
.toolbar button:hover { background: var(--white); border-color: var(--n300); }
.toolbar .sep { width: 1px; height: 20px; background: var(--n300); margin: 0 4px; }
.rich-surface {
  min-height: 360px;
  padding: 18px 20px;
  font: 400 15px/1.6 Arial, Helvetica, sans-serif;
  color: var(--black);
  outline: none;
}
.rich-surface:focus { box-shadow: inset 0 0 0 2px rgba(0, 64, 255, 0.15); }
.rich-surface p { margin: 0 0 14px; }
.rich-surface h1 { font-size: 26px; letter-spacing: 0; margin: 0 0 16px; font-weight: 600; }
.rich-surface h2 { font-size: 20px; letter-spacing: 0; margin: 0 0 12px; font-weight: 600; }
.rich-surface img { max-width: 100%; height: auto; }
.rich-surface a { color: var(--primary); }
textarea.html-source { min-height: 420px; font: 400 13px/1.5 var(--mono); white-space: pre; tab-size: 2; }
