@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/f/assets/fonts/dm-sans-latin-var.woff2?v=3a76f22e7bf79183") format("woff2");
}
@font-face {
  font-family: "DM Serif Display";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/f/assets/fonts/dm-serif-display-latin-400.woff2?v=e24ade279be0c4bd") format("woff2");
}

/* Design tokens: the Smartly Done brand. Spacing is a 4 px scale; type is 12, 14, 16, 18 and 24 px.
   Champagne, Baby Blue Ice and Burgundy are never fills: Burgundy is text and outlines on light,
   Champagne on dark only, Baby Blue Ice a 1px container stroke. Neutrals are Ice to Steel. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 24px;

  --prussian: #001f3d;
  --egyptian: #00378f;
  --champagne: #d9bc82;
  --baby-blue-ice: #8fbce6;
  --burgundy: #7b0a27;

  /* Neutrals: Ice, Cloud, Mist, Fog and Steel, then Prussian-tinted text grays (AA on Mist). */
  --gray-0: #ffffff;
  --gray-25: #fafbfc;
  --gray-50: #f5f8fa;
  --gray-100: #ebf0f4;
  --gray-200: #dfe6ed;
  --gray-300: #ced8e2;
  --gray-400: #b4c1ce;
  --gray-500: #4a5f75;
  --gray-600: #34495f;
  --gray-700: #1f3650;
  --gray-900: var(--prussian);

  --accent: var(--egyptian);
  --accent-hover: var(--prussian);
  --accent-soft: #eaf0f8;
  --accent-line: var(--baby-blue-ice);
  --link: var(--burgundy);
  --link-hover: var(--prussian);
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --danger-line: #f5c2bd;
  --warn: #8a4b07;
  --warn-soft: #fff7e6;
  --warn-line: #f5d9a8;
  --ok: #0f6b3d;
  --ok-soft: #ebf8f0;
  --ok-line: #b5e3c8;

  --bg: var(--gray-50);
  --surface: var(--gray-0);
  --text: var(--gray-900);
  --muted: var(--gray-500);
  --placeholder: #5f7287;
  /* Quiet icons and sketch marks: 3:1 or more on white, Ice and Cloud. */
  --icon: #6b7f94;
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --stroke: var(--baby-blue-ice);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(0 31 61 / 6%);
  --shadow-lg: 0 20px 48px rgb(0 31 61 / 14%), 0 2px 6px rgb(0 31 61 / 8%);
  /* Focus: a solid Egyptian ring with a white gap, clearly visible on every light surface. */
  --ring: 0 0 0 2px var(--gray-0), 0 0 0 4px var(--accent);

  --font:
    "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --fast: 0ms;
  }

  *,
  *::before,
  *::after {
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion has to win everywhere */
    animation-duration: 0ms !important;
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion has to win everywhere */
    transition-duration: 0ms !important;
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion has to win everywhere */
    scroll-behavior: auto !important;
  }
}

* {
  box-sizing: border-box;
}

/* A display rule on a class must never show an element that is hidden. */
[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: hidden has to win over component display rules */
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: var(--text-md) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Links on light are Burgundy text, underlined. */
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

/* H1 is DM Serif Display, regular, 24 px and up. Everything else is DM Sans. */
h1 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

/* Native ticks, dots and sliders take the accent. */
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: var(--accent);
}

pre.command,
code,
.mono {
  font-family: var(--mono);
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* One line, ellipsis, full text in `title`. */
.truncate {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:focus-visible {
  /* Transparent outlines still show in forced-colors mode, where shadows are dropped. */
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--ring);
}

/* ---------- app shell ---------- */

body:not(.editor-page) {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 64px;
  padding: 0 var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* "Forms by [Smartly Done]", as on the brand's own pages. */
.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand-name {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-by {
  font-size: var(--text-lg);
  font-weight: 500;
}

.brand-logo {
  display: block;
  width: auto;
  height: 24px;
  margin-left: 2px;
}

.topbar .workspace {
  min-width: 0;
  padding-left: var(--space-5);
  overflow: hidden;
  border-left: 1px solid var(--border);
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  flex: 1;
  gap: var(--space-4);
}

.topbar nav a {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.topbar nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.topbar form {
  margin: 0;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

body:not(.editor-page) > main {
  flex: 1 0 auto;
  width: 100%;
}

main.narrow {
  max-width: 440px;
  padding-top: var(--space-12);
}

/* Containers: white, with the Baby Blue Ice 1px stroke. */
.card {
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
}

.lead {
  margin: calc(-1 * var(--space-2)) 0 var(--space-5);
  color: var(--muted);
}

/* The sign-in page: the lockup over the card, the Prussian band below. */
.hero-brand {
  display: flex;
  justify-content: center;
  padding: var(--space-12) var(--space-6) 0;
}

.hero-brand .brand-logo {
  height: 28px;
}

.hero-brand .brand-name,
.hero-brand .brand-by {
  font-size: 22px;
}

.login-page main.narrow {
  padding-top: var(--space-8);
}

.login-page .card {
  padding: var(--space-8);
}

.login-page .card button[type="submit"] {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-2);
  font-size: var(--text-md);
}

/* The public splash page at `/`: a centered column, one line and one button. */
.home-page main.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 640px;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.home-title {
  margin: 0 0 var(--space-4);
  color: var(--prussian);
  font-size: clamp(40px, 12vw, 64px);
  line-height: 1.1;
}

.home-line {
  margin: 0 0 var(--space-8);
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: 1.5;
}

.home-page a.button.home-cta {
  min-height: 48px;
  padding: 0 var(--space-8);
  font-size: var(--text-md);
}

.site-foot {
  margin-top: var(--space-12);
  background: var(--prussian);
  color: var(--gray-0);
}

.site-foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.site-foot-logo {
  display: block;
  width: auto;
  height: 28px;
}

.site-foot p {
  margin: 0;
  font-size: var(--text-sm);
}

/* On dark, links are Champagne and focus rings turn Champagne too. */
.site-foot p a {
  margin-left: var(--space-2);
  color: var(--champagne);
}

.site-foot p a:hover {
  color: var(--gray-0);
}

.site-foot :focus-visible {
  box-shadow:
    0 0 0 2px var(--prussian),
    0 0 0 4px var(--champagne);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-head h1 {
  margin: 0;
}

/* ---------- form controls ---------- */

label {
  display: block;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: var(--space-1);
  padding: 7px var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.45;
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--gray-400);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 var(--space-4);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

button:hover,
a.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Secondary on light: a Burgundy outline and Burgundy text, never a Burgundy fill. */
button.secondary,
a.button.secondary {
  background: var(--surface);
  border-color: var(--burgundy);
  color: var(--burgundy);
}

button.secondary:hover:not(:disabled),
a.button.secondary:hover {
  background: var(--gray-100);
  border-color: var(--burgundy);
  color: var(--burgundy);
}

button.ghost,
a.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--gray-600);
}

button.ghost:hover:not(:disabled),
a.button.ghost:hover {
  background: var(--gray-100);
  border-color: transparent;
  color: var(--text);
}

button.small,
a.button.small {
  min-height: 28px;
  padding: 0 10px;
  font-size: var(--text-xs);
}

button.icon-only {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

button.danger,
button.secondary.danger {
  border-color: var(--danger-line);
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.svg-icon {
  flex: none;
}

.icon {
  display: inline-flex;
}

.alert {
  margin: 0 0 var(--space-4);
  padding: 10px var(--space-3);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: var(--text-sm);
}

.alert.ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

fieldset {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

legend {
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: var(--space-2) 0;
  font-weight: 400;
}

.choice input {
  margin-top: 5px;
  accent-color: var(--accent);
}

.hint,
.help {
  display: block;
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.filter {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.filter label {
  margin: 0;
}

label.inline > select {
  min-width: 14rem;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 22px;
  padding: 0 var(--space-2);
  overflow: hidden;
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-live {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge-error {
  background: var(--danger);
  color: #fff;
}

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

.site-group {
  margin-bottom: var(--space-5);
  padding: var(--space-5) var(--space-6) var(--space-2);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  text-align: left;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--gray-25);
}

th {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

td.actions a {
  margin-left: var(--space-3);
}

.forms-table {
  table-layout: fixed;
}

.forms-table .col-status {
  width: 13rem;
}

.forms-table .col-count {
  width: 7.5rem;
}

.forms-table .col-updated {
  width: 11rem;
}

.forms-table .col-actions {
  width: 14rem;
}

.forms-table .count-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.count-link {
  display: inline-block;
  min-width: 2.5rem;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}

.count-link:hover {
  background: var(--accent-soft);
}

.forms-table .name-cell a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.forms-table .name-cell a:hover {
  color: var(--accent);
}

.empty-state {
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state p {
  margin: 0 0 var(--space-6);
}

pre.command {
  padding: var(--space-3);
  overflow-x: auto;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: pre-wrap;
}

/* The editor's inbox link and Share drop to their icons before the form name gets cramped. */
@media (max-width: 1279px) {
  .ed-inbox,
  .ed-share,
  .ed-template {
    padding: 0 var(--space-2);
  }

  .ed-inbox-text,
  .ed-share-text,
  .ed-template-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---------- submissions ---------- */

.crumbs ol {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin: 0 0 var(--space-3);
  padding: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  list-style: none;
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 28rem;
}

.crumbs li + li::before {
  flex: none;
  color: var(--icon);
  content: "/";
}

.crumb-link {
  color: var(--gray-600);
  text-decoration: none;
}

.crumb-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.crumbs [aria-current="page"] {
  color: var(--text);
  font-weight: 550;
}

.page-head h1.truncate {
  flex: 1;
}

.head-actions,
.stepper {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.head-title {
  min-width: 0;
}

.head-title p {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.alert.warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}

.inbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.inbox-tabs {
  display: flex;
  gap: var(--space-1);
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: -1px;
  padding: var(--space-2) var(--space-3) 10px;
  border-bottom: 2px solid transparent;
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.tab-link:hover {
  color: var(--text);
}

.tab-link[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.tab-count {
  min-width: 22px;
  padding: 1px 7px;
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tab-link[aria-current="page"] .tab-count {
  background: var(--accent-soft);
  color: var(--accent);
}

.inbox-search {
  display: flex;
  flex: 1 1 16rem;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  max-width: 28rem;
  margin: 0 0 var(--space-2);
}

.inbox-search input {
  margin: 0;
}

.inbox-card {
  padding: 0;
  overflow: hidden;
}

.inbox-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.inbox-summary {
  margin: 6px 0 0;
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 550;
}

.export {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 24rem;
  text-align: right;
}

.export .help {
  margin-top: var(--space-2);
}

.table-scroll {
  overflow-x: auto;
}

.inbox-table {
  min-width: 36rem;
  table-layout: fixed;
}

.inbox-table > * > tr > * {
  padding-right: var(--space-4);
  padding-left: var(--space-4);
}

.inbox-table > * > tr > :first-child {
  padding-left: var(--space-5);
}

.inbox-table .col-when {
  width: 13rem;
  white-space: nowrap;
}

/* The whole row opens the submission. The link stays the one focusable element. */
.inbox-table tbody tr {
  position: relative;
}

.row-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.row-link::after {
  position: absolute;
  inset: 0;
  content: "";
}

.inbox-table tbody tr:hover td {
  background: var(--accent-soft);
}

.row-link:focus-visible {
  box-shadow: none;
}

.inbox-table tbody tr:has(.row-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.inbox-card .empty-state {
  padding: var(--space-12) var(--space-6);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.submission-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  align-items: start;
  gap: var(--space-5);
}

.submission-side {
  display: grid;
  gap: var(--space-5);
}

.subhead {
  margin: var(--space-6) 0 var(--space-1);
  font-size: var(--text-md);
}

.answers {
  margin: 0;
}

.answer {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.answer:last-child {
  border-bottom: 0;
}

.answer dt {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.answer dd {
  margin: 0;
}

.answer-text {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* Uploaded files: a download link per file, with its size and type. */
.file-links {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-meta {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.meta {
  margin: 0;
  font-size: var(--text-sm);
}

.meta > div {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.meta > div:last-child {
  border-bottom: 0;
}

.meta dt {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.meta dd {
  margin: 2px 0 0;
}

.break {
  overflow-wrap: anywhere;
}

.meta .mono {
  font-size: var(--text-xs);
}

.deliveries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.deliveries li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.deliveries li:last-child {
  border-bottom: 0;
}

.delivery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-weight: 550;
}

.badge-fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-zone {
  border-color: var(--danger-line);
}

.danger-zone form {
  margin: var(--space-3) 0 0;
}

.keys-hint {
  margin-top: var(--space-6);
  text-align: center;
}

@media (max-width: 860px) {
  .page-head h1.truncate {
    flex-basis: 100%;
  }

  .submission-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-head {
    flex-wrap: wrap;
  }

  .inbox-search {
    max-width: none;
  }

  .export {
    align-items: flex-start;
    text-align: left;
  }
}

@media (hover: none) {
  .keys-hint {
    display: none;
  }
}

/* ---------- editor shell ---------- */

body.editor-page {
  height: 100vh;
  overflow: hidden;
}

.ed {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.ed-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-4);
  height: 56px;
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.ed-back {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 var(--space-2) 0 var(--space-1);
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
}

.ed-back:hover {
  background: var(--gray-100);
  color: var(--text);
}

.ed-ident {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

input.ed-name {
  flex: 0 1 auto;
  width: 22rem;
  min-width: 6rem;
  max-width: 28rem;
  field-sizing: content;
  margin: 0;
  padding: 5px var(--space-2);
  overflow: hidden;
  background: transparent;
  border-color: transparent;
  font-size: var(--text-md);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input.ed-name:hover {
  border-color: var(--border);
}

input.ed-name:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
}

.ed-site {
  flex: 0 2 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-status {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 550;
  white-space: nowrap;
}

.save-state::before {
  width: 7px;
  height: 7px;
  background: var(--gray-300);
  border-radius: 50%;
  content: "";
}

.save-state[data-tone="ok"]::before {
  background: #2f9e62;
}

.save-state[data-tone="busy"]::before {
  background: var(--accent);
  animation: pulse 1s var(--ease) infinite alternate;
}

.save-state[data-tone="warn"] {
  color: var(--warn);
}

.save-state[data-tone="warn"]::before {
  background: #e3a008;
}

.save-state[data-tone="error"] {
  color: var(--danger);
}

.save-state[data-tone="error"]::before {
  background: var(--danger);
}

/* Shown next to the save state when a save failed and can be tried again now. */
.save-retry {
  flex: none;
}

.save-state:focus {
  outline: none;
}

/* "Published <time>" in the editor bar, on screens wide enough to keep the form name readable. */
.ed-published {
  color: var(--muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.ed-published[hidden],
.ed-status .ed-published {
  display: none;
}

@media (min-width: 1440px) {
  .ed-status .ed-published:not([hidden]) {
    display: inline;
  }
}

@keyframes pulse {
  from {
    opacity: 0.35;
  }

  to {
    opacity: 1;
  }
}

.ed-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
}

.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
}

.seg button {
  min-height: 28px;
  padding: 0 var(--space-3);
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--gray-600);
  font-size: var(--text-xs);
}

.seg button:hover {
  background: transparent;
  color: var(--text);
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.narrow-only {
  display: none;
}

.banner {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: 10px var(--space-4);
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: var(--text-sm);
}

.banner-error {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.banner-ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.banner-text {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.banner .banner-text a {
  color: inherit;
  font-weight: 600;
}

button.banner-close {
  color: inherit;
}

.ed-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.ed-main {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--gray-50);
  scroll-padding: var(--space-12);
}

.canvas {
  padding: var(--space-10) var(--space-6) 30vh;
}

/* ---------- document ---------- */

.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-12) var(--space-8);
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.doc textarea,
.doc input[type="text"] {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 4px;
  resize: none;
  overflow-wrap: anywhere;
}

.doc textarea:focus-visible,
.doc input[type="text"]:focus-visible {
  box-shadow: none;
}

.doc-head {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

/* The form title is the page's H1, so it gets the display face, as on the hosted page. */
.doc textarea.doc-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

.doc textarea.doc-desc {
  margin-top: var(--space-3);
  color: var(--gray-600);
  font-size: var(--text-md);
  line-height: 1.55;
}

.blocks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.block {
  position: relative;
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-1) 0;
  border-radius: var(--radius-md);
  outline: none;
}

.block-gutter {
  position: absolute;
  top: 14px;
  left: -26px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}

.block:hover .block-gutter,
.block:focus-within .block-gutter,
.block.is-selected .block-gutter {
  opacity: 1;
}

.gutter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--icon);
}

button.gutter-btn:hover,
.gutter-btn.grip:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.grip {
  cursor: grab;
}

.block-card {
  position: relative;
  padding: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition:
    background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}

.block:hover .block-card {
  background: var(--gray-25);
}

.block.is-selected .block-card {
  background: var(--surface);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.block.is-selected .block-card::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -1px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  content: "";
}

.block.has-issue .block-card {
  border-color: var(--danger-line);
}

.block.dragging {
  opacity: 0.4;
}

.block.drop-before::before,
.block.drop-after::after {
  position: absolute;
  right: var(--space-4);
  left: var(--space-4);
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  content: "";
}

.block.drop-before::before {
  top: -1px;
}

.block.drop-after::after {
  bottom: -1px;
}

.block-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.title-wrap {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.doc textarea.block-title {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
}

.req-star {
  flex: none;
  padding-top: 2px;
  color: var(--danger);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
}

.block-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  opacity: 0.55;
  transition: opacity var(--fast) var(--ease);
}

.block:hover .block-tools,
.block:focus-within .block-tools,
.block.is-selected .block-tools {
  opacity: 1;
}

button.type-btn {
  min-height: 30px;
  max-width: 11rem;
  padding: 0 var(--space-2) 0 6px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--gray-700);
  font-size: var(--text-xs);
}

button.type-btn:hover {
  background: var(--gray-50);
  border-color: var(--border-strong);
  color: var(--text);
}

.type-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glyph {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--accent-soft);
  border-radius: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.doc textarea.block-desc {
  margin-top: 2px;
  color: var(--gray-600);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.block:not(.is-selected) .block-desc.is-empty {
  display: none;
}

.block-sketch {
  margin-top: var(--space-3);
}

.block-sketch:empty {
  display: none;
}

.sk-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 420px;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--placeholder);
  font-size: var(--text-sm);
}

.sk-textarea {
  align-items: flex-start;
  max-width: none;
  height: 88px;
  padding-top: 10px;
}

.sk-placeholder {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--gray-700);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.sk-box {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px solid var(--icon);
  border-radius: 4px;
}

.sk-hidden {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.sk-hidden > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-hidden-tag {
  flex: none;
  padding: 1px var(--space-2);
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Stage 3 sketches: pills, stars, scale and address. Drawings only, never interactive. */
.sk-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sk-pill {
  min-width: 56px;
  max-width: 14rem;
  padding: 6px var(--space-4);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-stars {
  display: flex;
  gap: 2px;
  color: var(--icon);
  font-size: 26px;
  line-height: 1;
}

.sk-scale {
  max-width: 460px;
}

.sk-cells {
  display: flex;
  gap: 4px;
}

.sk-cell {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
}

.sk-scale-ends {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: var(--text-xs);
}

.sk-scale-ends > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-address {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  max-width: 460px;
}

.sk-address .sk-input {
  height: 34px;
  max-width: none;
  font-size: var(--text-xs);
}

.sk-address .is-wide {
  grid-column: 1 / -1;
}

/* Matrix sketch: a small grid of marks. */
.sk-matrix {
  display: grid;
  gap: var(--space-1);
  max-width: 460px;
  font-size: var(--text-xs);
}

.sk-matrix-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sk-matrix-label {
  flex: 0 0 28%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-matrix-head {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sk-matrix-mark {
  flex: 1 1 0;
  height: 14px;
  min-width: 0;
}

.sk-matrix-mark::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
}

.sk-dot::before {
  border-radius: 50%;
}

.sk-box::before {
  border-radius: 3px;
}

/* Phone sketch: a country box before the number. */
.sk-phone {
  display: flex;
  gap: var(--space-2);
  max-width: 420px;
}

.sk-phone .sk-phone-country {
  flex: 0 0 auto;
  max-width: 55%;
  gap: var(--space-2);
}

.sk-phone .sk-phone-number {
  flex: 1 1 auto;
  min-width: 0;
}

/* Stage 4 sketch: a file question, drawn as the picker and its limits. */
.sk-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  max-width: 460px;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.sk-file-button {
  flex: none;
  padding: 4px var(--space-3);
  background: var(--accent);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
}

.sk-file-hint {
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-xs);
}

/* Sketch of a signature question: a box with a baseline and "Sign here". */
.sk-signature {
  position: relative;
  max-width: 460px;
  height: 84px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.sk-signature-mark {
  position: absolute;
  top: var(--space-2);
  left: var(--space-3);
  color: var(--muted);
  font-size: var(--text-xs);
}

.sk-signature-line {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  border-bottom: 1px solid var(--border-strong);
}

/* Sketch of a calculation: the worked out value, as it will read. */
.sk-calculation {
  font-weight: var(--weight-semibold, 600);
}

.sk-calculation .sk-placeholder {
  color: var(--text);
}

.score-input {
  max-width: 8rem;
}

.hint.hint-warning {
  padding: var(--space-2) var(--space-3);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  color: var(--warn);
}

/* Content blocks: the text box looks like the heading or paragraph it makes. */
.block.block-content > .block-card {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.doc textarea.block-text {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  line-height: 1.45;
}

.doc textarea.block-text-heading {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
}

.doc textarea.block-text-heading.is-small {
  font-size: var(--text-lg);
}

.doc textarea.block-text-paragraph {
  color: var(--gray-600);
  font-size: var(--text-md);
}

.control-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.block-options:empty {
  display: none;
}

.opt-list {
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.sk-radio {
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--icon);
  border-radius: 50%;
}

.sk-num {
  flex: none;
  width: 18px;
  color: var(--icon);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: right;
}

.doc input.opt-input {
  flex: 1;
  min-width: 0;
  padding: 6px var(--space-2);
  margin-left: calc(-1 * var(--space-2));
  font-size: var(--text-sm);
}

.doc input.opt-input:hover {
  background: var(--gray-50);
}

.doc input.opt-input:focus-visible {
  background: var(--gray-50);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

button.opt-remove {
  width: 26px;
  min-height: 26px;
  color: var(--icon);
  opacity: 0;
}

.opt-row:hover button.opt-remove,
.opt-row:focus-within button.opt-remove {
  opacity: 1;
}

button.opt-add {
  margin: var(--space-1) 0 0 22px;
  color: var(--accent);
}

.block-issues {
  margin: var(--space-3) 0 0;
  padding: 0;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 550;
  list-style: none;
}

.block-settings {
  margin-top: var(--space-3);
}

.block:not(.is-selected) .block-settings {
  display: none;
}

.insert-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-2);
  border: 1px dashed transparent;
  border-radius: var(--radius-md);
  color: var(--icon);
}

.insert-line:hover {
  border-color: var(--border);
}

.insert-line:focus-within {
  background: var(--gray-25);
  border-color: var(--accent-line);
  color: var(--accent);
}

.doc .insert-line input[type="text"] {
  flex: 1;
  font-size: var(--text-md);
}

.doc-submit {
  margin-top: var(--space-6);
}

button.submit-sketch {
  min-width: 96px;
  min-height: 42px;
  padding: 0 var(--space-6);
  font-size: var(--text-md);
}

.preview-pane {
  height: 100%;
  padding: var(--space-6);
}

.preview-frame {
  display: block;
  width: 100%;
  max-width: 820px;
  height: 100%;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- settings panel ---------- */

.ed-panel {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 360px;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.panel-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-3) 0 var(--space-2);
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: var(--space-1);
}

button.tab {
  min-height: 48px;
  padding: 0 var(--space-3);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
}

button.tab:hover {
  background: transparent;
  color: var(--text);
}

button.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 11px;
}

.panel-body {
  flex: 1;
  min-height: 0;
  padding: var(--space-2) 0 var(--space-12);
  overflow-y: auto;
}

.panel-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-2);
}

.panel-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-empty {
  padding: var(--space-8) var(--space-5) var(--space-4);
}

.panel-empty-title {
  margin: 0 0 var(--space-1);
  font-weight: 650;
}

.panel-empty .muted {
  margin: 0;
  font-size: var(--text-sm);
}

.panel-subhead {
  margin: var(--space-4) var(--space-5) var(--space-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section {
  border-bottom: 1px solid var(--border);
}

.section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.section > summary::-webkit-details-marker {
  display: none;
}

.section > summary:hover {
  background: var(--gray-25);
}

.section > summary .svg-icon {
  color: var(--icon);
  transform: rotate(-90deg);
  transition: transform var(--fast) var(--ease);
}

.section[open] > summary .svg-icon {
  transform: none;
}

.section-body {
  padding: var(--space-1) var(--space-5) var(--space-4);
}

.control {
  margin-bottom: var(--space-4);
}

.control:last-child {
  margin-bottom: 0;
}

.control > label {
  margin-bottom: 0;
  color: var(--gray-700);
  font-size: var(--text-xs);
}

.control textarea {
  resize: vertical;
}

/* Phone settings: a filterable list of countries to allow. */
.country-list {
  max-height: 12rem;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 6px);
}

.country-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-1) 0;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
}

.country-row[hidden] {
  display: none;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 550;
  cursor: pointer;
}

input.switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin: 0;
  background: var(--gray-300);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease);
  appearance: none;
}

input.switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  content: "";
  transition: transform var(--fast) var(--ease);
}

input.switch:checked {
  background: var(--accent);
}

input.switch:checked::after {
  transform: translateX(14px);
}

input.switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.radio-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 550;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.radio-card input {
  margin: 0;
  accent-color: var(--accent);
}

.error-text {
  margin: var(--space-1) 0 0;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 550;
}

.doc-head .error-text {
  margin-top: var(--space-2);
}

.warning {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) 10px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-size: var(--text-xs);
}

.problems {
  margin: var(--space-3) var(--space-5);
  padding: 10px var(--space-3);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: var(--text-xs);
}

.problems p {
  margin: 2px 0;
}

/* ---------- design panel ---------- */

.panel-intro {
  margin: var(--space-2) var(--space-5) var(--space-1);
}

.color-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

input.swatch {
  flex: none;
  width: 36px;
  height: 34px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input.swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

input.swatch::-webkit-color-swatch {
  border: 1px solid rgb(21 26 36 / 12%);
  border-radius: 4px;
}

input.swatch::-moz-color-swatch {
  border: 1px solid rgb(21 26 36 / 12%);
  border-radius: 4px;
}

.color-row input.hex-input {
  width: 108px;
  margin-top: 0;
  text-transform: lowercase;
}

.contrast-notes {
  margin-top: var(--space-1);
}

.contrast-notes .warning:first-child {
  margin-top: 0;
}

.font-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-2);
}

.font-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: var(--space-2) var(--space-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

.font-card:hover {
  border-color: var(--gray-400);
}

.font-card:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.font-card:has(input:focus-visible) {
  box-shadow: var(--ring);
}

.font-sample {
  font-size: 22px;
  line-height: 1.3;
}

.font-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--gray-600);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.radius-demo {
  flex: none;
  width: 44px;
  height: 30px;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}

input.range {
  flex: 1;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-value {
  flex: none;
  min-width: 44px;
  color: var(--gray-700);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.label-row label {
  margin: 0;
  color: var(--gray-700);
  font-size: var(--text-xs);
}

.css-count {
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.css-count.is-near {
  color: var(--warn);
  font-weight: 600;
}

textarea.css-input {
  min-height: 180px;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.design-actions {
  padding: var(--space-4) var(--space-5) 0;
}

.design-actions .hint {
  margin-top: var(--space-2);
}

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: end;
  margin-bottom: var(--space-3);
}

.option-row .control {
  margin: 0;
}

.option-tools {
  display: flex;
  padding-bottom: 2px;
}

.option-spots {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: var(--space-2);
  align-items: end;
}

.option-spots .control {
  margin: 0;
}

.option-spots .option-closes {
  grid-column: 1 / -1;
}

.option-spots .score-input {
  max-width: none;
}

.option-tools button.icon-only {
  width: 26px;
  min-height: 32px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

button.chip {
  max-width: 100%;
  min-height: 24px;
  padding: 0 var(--space-2);
  overflow: hidden;
  background: var(--gray-50);
  border: 1px solid var(--border);
  color: var(--gray-700);
  font: 11px var(--mono);
  text-overflow: ellipsis;
}

button.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

details.advanced > summary {
  margin-bottom: var(--space-2);
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.panel-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
}

.panel-type {
  flex: none;
}

/* ---------- popups ---------- */

.popup {
  position: fixed;
  z-index: 50;
  width: 300px;
  max-height: min(420px, 60vh);
  padding: var(--space-1);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: pop var(--fast) var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.popup input.popup-search {
  margin: 0 0 var(--space-1);
  border-color: var(--border);
}

.popup-note {
  margin: var(--space-1) var(--space-2) var(--space-2);
  padding: var(--space-2);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-size: var(--text-xs);
}

.popup-group {
  padding: var(--space-2) var(--space-2) var(--space-1);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.popup-item[aria-selected="true"] {
  background: var(--accent-soft);
}

.popup-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.popup-label {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-label mark {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.popup-hint {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-tag {
  flex: none;
  padding: 1px 6px;
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
}

.popup-current {
  display: inline-flex;
  color: var(--accent);
}

.popup-empty {
  padding: var(--space-3) var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
}

.popup-more {
  width: 230px;
}

button.menu-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 var(--space-2);
  background: transparent;
  border: 0;
  color: var(--gray-700);
  font-weight: 500;
}

button.menu-item:hover:not(:disabled),
button.menu-item:focus-visible {
  background: var(--gray-100);
  box-shadow: none;
  color: var(--text);
}

button.menu-item.is-danger {
  color: var(--danger);
}

button.menu-item.is-danger:hover,
button.menu-item.is-danger:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
}

.menu-label {
  flex: 1;
  text-align: left;
}

kbd {
  display: inline-flex;
  align-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--gray-600);
  font: 600 11px var(--font);
}

.menu-item kbd {
  background: transparent;
}

.popover {
  position: fixed;
  z-index: 40;
  width: 340px;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.popover h2 {
  font-size: var(--text-sm);
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  margin: 0;
  font-size: var(--text-sm);
}

.shortcut-list dt {
  display: flex;
  gap: 3px;
}

.shortcut-list dd {
  margin: 0;
  color: var(--gray-600);
}

.shortcut-list.compact {
  padding: 0 var(--space-5);
  font-size: var(--text-xs);
}

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 10px 10px 10px var(--space-4);
  background: var(--gray-900);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: #fff;
  font-size: var(--text-sm);
  transform: translateX(-50%);
  animation: pop var(--fast) var(--ease);
}

button.toast-action {
  min-height: 28px;
  padding: 0 10px;
  background: rgb(255 255 255 / 12%);
  border: 0;
  color: #fff;
}

button.toast-action:hover {
  background: rgb(255 255 255 / 22%);
}

a.toast-action {
  padding: 4px 10px;
  background: rgb(255 255 255 / 12%);
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

a.toast-action:hover {
  background: rgb(255 255 255 / 22%);
  color: #fff;
}

/* ---------- narrow screens: the panel becomes a drawer ---------- */

@media (max-width: 1023px) {
  .narrow-only {
    display: inline-flex;
  }

  .ed-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    width: min(380px, 92vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    visibility: hidden;
    transition:
      transform 200ms var(--ease),
      visibility 0ms linear 200ms;
  }

  .panel-open .ed-panel {
    transform: none;
    visibility: visible;
    transition: transform 200ms var(--ease);
  }

  .panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgb(0 31 61 / 30%);
  }

  .ed-site,
  .ed-back-text {
    display: none;
  }

  .doc {
    padding: var(--space-8) 36px var(--space-6);
  }

  .block-gutter {
    left: -20px;
  }
}

@media (max-width: 720px) {
  .ed-bar {
    gap: var(--space-2);
    padding: 0 var(--space-2);
  }

  #unpublished-badge,
  #live-link,
  #shortcuts-button {
    display: none;
  }

  .canvas {
    padding: var(--space-4) var(--space-2) 30vh;
  }

  .doc {
    padding: var(--space-6) var(--space-5);
    border-radius: var(--radius-md);
  }

  .block {
    margin: 0 calc(-1 * var(--space-3));
  }

  .block-gutter {
    display: none;
  }

  /* Each form becomes a small stacked row: name and status, then the date, then the actions. */
  .site-group {
    padding: var(--space-4) var(--space-4) var(--space-1);
  }

  .forms-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .forms-table,
  .forms-table tbody {
    display: block;
  }

  .forms-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
  }

  .forms-table tbody tr:last-child {
    border-bottom: 0;
  }

  .forms-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .forms-table tbody tr:hover td {
    background: none;
  }

  .forms-table td:nth-child(4) {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: var(--text-xs);
  }

  .forms-table td.actions {
    grid-column: 1 / -1;
    text-align: left;
  }

  .forms-table td.actions a:first-child {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: var(--space-3);
    padding: 0 var(--space-4);
  }

  .topbar .workspace {
    display: none;
  }

  .topbar .brand-name,
  .topbar .brand-by {
    font-size: var(--text-md);
  }

  .topbar .brand-logo {
    height: 20px;
  }

  /* The editor bar takes two rows: the form name, then status and actions, so Publish stays on screen. */
  .ed-bar {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-2);
    row-gap: var(--space-2);
  }

  .ed-ident {
    flex: 1 1 calc(100% - 48px);
  }

  input.ed-name {
    width: 100%;
    max-width: none;
  }

  /* Under about 420 px the actions take a row of their own, and either row wraps before it
     overflows (a failed save adds a Retry button to the status). */
  .ed-status {
    flex-wrap: wrap;
    min-width: 0;
  }

  /* Phones: the type button and more menu move under the title, so titles keep their width. */
  .block-head {
    flex-wrap: wrap;
    row-gap: var(--space-1);
  }

  .title-wrap {
    flex-basis: 100%;
  }

  .ed-actions {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
    margin-left: auto;
  }
}

/* A short line that introduces a group of switches (address parts). */
.section-body > .hint:first-child {
  margin: 0 0 var(--space-2);
}

/* ---------- pages and logic (Stage 5) ---------- */

.page-start,
.break-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--space-2);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-start {
  margin: 0 0 var(--space-2);
}

.page-start[hidden] {
  display: none;
}

/* A page break: a dashed rule across the document with the page it starts. */
.block.block-break {
  margin-top: var(--space-4);
}

.block.block-break > .block-card {
  padding-top: var(--space-5);
  padding-bottom: var(--space-3);
}

.block.block-break > .block-card::after {
  position: absolute;
  top: 0;
  right: var(--space-4);
  left: var(--space-4);
  border-top: 2px dashed var(--border-strong);
  content: "";
}

.block.block-break.is-selected > .block-card::after {
  border-top-color: var(--accent-line);
}

.break-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
}

.doc textarea.break-title {
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.4;
}

button.logic-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 var(--space-2) 0 6px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-pill);
  color: var(--warn);
  font-size: var(--text-xs);
  font-weight: 600;
}

button.logic-badge[hidden] {
  display: none;
}

button.logic-badge:hover {
  background: #ffefcc;
  border-color: #e9c27a;
}

.block.has-logic:not(.is-selected) .block-card {
  border-left: 2px solid var(--warn-line);
}

.logic-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--space-3);
  color: var(--gray-700);
  font-size: var(--text-sm);
}

.logic-lead select.logic-match {
  width: auto;
  min-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: var(--text-sm);
}

.logic-empty {
  margin-bottom: var(--space-3);
}

.cond-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.cond {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  background: var(--gray-25);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.cond-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cond-join {
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cond-head button.cond-remove {
  width: 26px;
  min-height: 26px;
}

.cond select.cond-field,
.cond select.cond-op,
.cond .cond-value {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cond-check {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 6px;
}

.cond-check.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.cond .error-text {
  margin: 0;
}

/* Outcome rules: after-submit rules and email routes. */
.rules-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-sm);
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.rule {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rule-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rule-actions {
  display: flex;
  gap: 2px;
}

/* A modal question, such as "Delete and remove logic?". */
dialog.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

dialog.dialog::backdrop {
  background: rgb(21 26 36 / 40%);
}

dialog.dialog h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  overflow-wrap: anywhere;
}

dialog.dialog p {
  margin: 0 0 var(--space-3);
  color: var(--gray-600);
  font-size: var(--text-sm);
}

.dialog-list {
  max-height: 180px;
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-6);
  overflow-y: auto;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.dialog-list li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Share and embed: the link and snippets, each with Copy. Classes, not tags, beat `dialog.dialog p`. */
dialog.share-dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.share-dialog .share-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
}

.share-dialog .share-draft {
  padding: var(--space-3);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  color: var(--warn);
  font-weight: 600;
}

.share-item {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
}

.share-dialog .share-label {
  margin: 0 0 var(--space-1);
  font-size: var(--text-md);
}

.share-dialog .share-text {
  margin-bottom: var(--space-2);
}

.share-link-row {
  display: flex;
  gap: var(--space-2);
}

.share-url {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
}

.share-snippet {
  margin: 0;
  overflow-wrap: anywhere;
}

.share-copy {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-2);
}

.share-dialog .share-note {
  margin: 0 0 var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.share-toggle {
  color: var(--link);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.share-dialog .share-option {
  margin: var(--space-2) 0 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

button.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.danger-solid:hover:not(:disabled) {
  background: #912018;
  border-color: #912018;
}

/* ---------- webhooks (Stage 8) ---------- */

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.title-row h1 {
  margin: 0;
}

.hook-url {
  margin: var(--space-2) 0 0;
  color: var(--gray-700);
  font-size: var(--text-sm);
}

.test-note {
  margin: calc(-1 * var(--space-4)) 0 var(--space-5);
  text-align: right;
}

.hooks-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  align-items: start;
  gap: var(--space-5);
}

.hooks-main,
.hooks-side {
  display: grid;
  gap: var(--space-5);
  min-width: 0;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  margin-bottom: var(--space-3);
}

.card .card-head h2 {
  margin: 0;
}

.card-head .muted {
  font-size: var(--text-xs);
}

/* Settings forms on a page: a label over each input, help and errors below. */
.field {
  margin-bottom: var(--space-4);
}

.field > label {
  margin-bottom: 0;
}

.field-error {
  margin: var(--space-1) 0 0;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 600;
}

.add-lead {
  margin: calc(-1 * var(--space-1)) 0 var(--space-5);
  font-size: var(--text-sm);
}

/* The form's webhooks: the whole row opens the webhook, the URL stays the one focusable link. */
.hook-list {
  margin: 0 calc(-1 * var(--space-6)) calc(-1 * var(--space-6));
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.hook-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.hook-item:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hook-item:hover {
  background: var(--accent-soft);
}

.hook-item:has(.hook-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.hook-main {
  flex: 1;
  min-width: 0;
}

.hook-link {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.hook-link::after {
  position: absolute;
  inset: 0;
  content: "";
}

.hook-link:focus-visible {
  box-shadow: none;
}

.hook-desc {
  margin: 2px 0 0;
  color: var(--gray-600);
  font-size: var(--text-sm);
}

.hook-item .help {
  margin-top: var(--space-1);
}

.hook-item .badge {
  flex: none;
}

.how-list {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--gray-600);
  font-size: var(--text-sm);
}

.how-list li + li {
  margin-top: var(--space-2);
}

.how-list code,
.help code,
.test-note code {
  font-size: 0.92em;
}

.hook-off {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.alert.hook-off p {
  margin: 0;
}

/* The signing secret stays folded until asked for. */
.secret {
  margin: var(--space-3) 0 0;
}

.card .secret > summary {
  display: inline-block;
  color: var(--link);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.card .secret > summary:hover {
  color: var(--link-hover);
}

.secret-value {
  display: block;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}

.secret-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.secret-actions form {
  margin: 0;
}

/* The delivery log: one disclosure per delivery, so it reads without JavaScript. */
.log-card {
  padding-bottom: 0;
  overflow: hidden;
}

.small-empty {
  padding: var(--space-8) var(--space-4) var(--space-10);
}

.empty-state.small-empty p {
  margin: 0;
}

.hook-log {
  margin: 0 calc(-1 * var(--space-6));
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.card .hook-log > li {
  border-bottom: 1px solid var(--border);
}

.card .hook-log > li:last-child {
  border-bottom: 0;
}

.hook-log .delivery > summary {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  grid-template-areas:
    "status event when"
    "status code tries";
  align-items: center;
  gap: 2px var(--space-4);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  list-style: none;
  cursor: pointer;
}

.hook-log .delivery > summary::-webkit-details-marker {
  display: none;
}

.hook-log .delivery > summary:hover {
  background: var(--accent-soft);
}

.hook-log .delivery > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: none;
}

.hook-log .delivery[open] > summary {
  background: var(--gray-25);
}

.delivery-status {
  grid-area: status;
}

.delivery-event {
  grid-area: event;
  font-weight: 600;
}

.delivery-when {
  grid-area: when;
  color: var(--gray-600);
  text-align: right;
}

.delivery-code {
  grid-area: code;
  font-size: var(--text-xs);
}

.delivery-tries {
  grid-area: tries;
  font-size: var(--text-xs);
  text-align: right;
}

.delivery-body {
  padding: var(--space-2) var(--space-6) var(--space-5);
  background: var(--gray-25);
  border-top: 1px solid var(--border);
}

.delivery-body .subhead {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}

.attempts {
  margin: var(--space-2) 0 0;
  padding: 0;
  font-size: var(--text-sm);
  list-style: none;
}

.delivery-body .attempts li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.delivery-body .attempts li:last-child {
  border-bottom: 0;
}

.attempt-n {
  min-width: 5.5rem;
  font-weight: 600;
}

.attempts time {
  color: var(--gray-600);
}

.ok-text {
  color: var(--ok);
  font-weight: 550;
}

.attempts .error-text,
.attempts .ok-text {
  margin: 0;
  font-size: var(--text-sm);
}

.attempt-error {
  flex-basis: 100%;
  color: var(--gray-600);
  font-size: var(--text-xs);
}

pre.excerpt {
  max-height: 14rem;
  margin: var(--space-2) 0 0;
  padding: var(--space-3);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: var(--text-xs);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.resend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
}

.resend .help {
  margin: 0;
}

/* Webhook deliveries on a submission. */
.delivery-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.delivery-actions form {
  margin: 0;
}

.small-link {
  font-size: var(--text-sm);
}

@media (max-width: 960px) {
  .hooks-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .test-note {
    margin-top: calc(-1 * var(--space-3));
    text-align: left;
  }
}

@media (max-width: 560px) {
  .hook-log .delivery > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "event status"
      "when when"
      "code tries";
  }

  .delivery-when {
    text-align: left;
  }

  .hook-item {
    flex-wrap: wrap;
  }
}

/* ---------- templates: the New form gallery and the Templates page ---------- */
.template-group-title {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.template-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 400;
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--accent);
}

.template-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.template-card:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.template-card input {
  margin-top: 4px;
  accent-color: var(--accent);
}

.template-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.template-card-note {
  color: var(--warn);
  font-size: var(--text-xs);
  font-weight: 600;
}

.push-right {
  margin-left: auto;
}

.template-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
}

.template-main {
  flex: 1 1 260px;
  min-width: 0;
}

.template-item .template-name {
  margin: 0 0 var(--space-1);
  font-size: var(--text-md);
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3);
}

.template-actions form {
  margin: 0;
}

.template-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
}

.template-rename form {
  min-width: 260px;
  padding-top: var(--space-2);
}

/* ---------- integrations (batch 2) ---------- */

.provider-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  margin-block: var(--space-4);
}

.conn-list {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.conn-item {
  align-items: flex-start;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
}

.conn-name {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
}

.conn-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.inline-field {
  display: grid;
  font-weight: 600;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}

.map-list {
  display: grid;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.map-row {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
}

.map-field {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.map-extra {
  display: grid;
  gap: var(--space-2);
}

.refresh-fields {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.col-list {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.col-row {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
}

.col-fields {
  display: grid;
  gap: var(--space-2);
}

.col-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
}

.col-move {
  display: inline-flex;
  gap: var(--space-2);
}

.col-move[hidden] {
  display: none;
}

.header-prompt .prompt-row {
  background: var(--gray-50);
  border-radius: 6px;
  padding: var(--space-2) var(--space-3);
}

.short-link-row {
  margin-top: var(--space-2);
}
.short-link-row .share-url {
  width: 100%;
}
