/* Brand palette: charcoal / gold / cream */
:root {
  --charcoal: #272727;       /* header band, headings (was navy) */
  --charcoal-soft: #3a3a3a;
  --gold: #d1ad73;           /* gold lines / accents (was #b8923f) */
  --gold-dark: #b8924f;      /* darker gold for hover/contrast */
  --cream: #faf7f0;
  --ink: #222;
  --muted: #6b6b6b;
  --line: #e3ddcf;
  --error: #b3261e;
  --success: #2e7d32;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; } /* belt-and-braces: never allow sideways scroll on mobile / in an iframe */

body {
  margin: 0;
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  padding: 24px 16px 64px;
}

/* The card is fluid: max-width caps it on desktop, but it shrinks to fit any
   narrower container (e.g. an iframe in myService) with no fixed width to
   overflow. */
.card {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(39, 39, 39, 0.08);
  overflow: hidden;
}

.card-head {
  background: var(--charcoal);
  color: #fff;
  padding: 24px 28px;
  border-bottom: 4px solid var(--gold);
}
.card-head h1 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 700; }
/* The route line ("source → destination • date") can be long — let it wrap rather
   than overflow on narrow screens. */
.card-head .route { margin: 0; color: #d8d8d8; font-size: 0.9rem; overflow-wrap: anywhere; }

section, .card-head { padding-left: 28px; padding-right: 28px; }
section { padding-top: 8px; padding-bottom: 28px; }

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--charcoal);
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.details { margin: 0; }
.details .row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.details dt { flex: 0 0 200px; color: var(--muted); font-weight: 600; }
/* min-width:0 lets the value shrink inside the flex row; overflow-wrap breaks
   long values (e.g. "Name on behalf of LongCompany") instead of overflowing. */
.details dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* Narrow screens: stack each label above its value so long account-holder lines
   (and the "X on behalf of Y" line) never get cramped into a tight column or
   force horizontal scrolling. */
@media (max-width: 520px) {
  .details .row { flex-direction: column; gap: 2px; padding: 10px 0; }
  .details dt { flex: none; font-size: 0.85rem; }
  .details dd { font-weight: 600; }
}

.statement {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  background: var(--cream);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 16px;
  margin: 0;
  font-size: 0.95rem;
  color: #333;
}

.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }

.sig-wrap {
  border: 2px dashed var(--gold);
  border-radius: 8px;
  background: #fffdf8;
  padding: 4px;
  touch-action: none;
}
#sigCanvas { width: 100%; height: 200px; display: block; border-radius: 6px; cursor: crosshair; }

.field { margin: 20px 0 8px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--charcoal); }
.field input {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(209,173,115,0.30); }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 24px;
  cursor: pointer;
  font-size: 0.95rem;
}
.checkbox input { margin-top: 3px; width: 18px; height: 18px; }

button, .btn-primary, .btn-ghost { font-size: 1rem; font-family: inherit; }

.btn-primary {
  display: inline-block;
  background: var(--gold);
  color: var(--charcoal);
  border: none;
  padding: 13px 22px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary:hover { background: var(--gold-dark); color: #fff; }
.btn-primary:disabled { background: #e7dcc4; color: #9a9079; cursor: not-allowed; }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--charcoal);
  border: 1px solid var(--charcoal);
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
}
.btn-ghost:hover { background: var(--charcoal); color: #fff; }

/* The author rule above would otherwise override the [hidden] attribute's
   display:none. Keep hidden actually hidden. */
[hidden] { display: none !important; }

/* ===== State screens (post-send confirmation + success) ================== */
.state-screen {
  text-align: center;
  padding-top: 28px;
}
.state-icon {
  width: 64px;
  height: 64px;
  line-height: 64px;
  margin: 8px auto 14px;
  font-size: 30px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--gold);
}
.state-icon-success {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
  font-weight: 700;
}
.state-title {
  color: var(--charcoal);
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  margin: 0 0 12px;
  padding: 0;
}
.state-lead { font-size: 1rem; color: #333; margin: 0 auto 18px; max-width: 46ch; }
.state-note { text-align: left; }
.state-help { font-weight: 600; color: var(--charcoal); margin: 22px 0 8px; }
.state-subhelp { margin-top: 10px; }
.state-screen .btn-primary { width: 100%; max-width: 320px; }

.banner { padding: 12px 14px; border-radius: 8px; margin: 16px 0; font-size: 0.95rem; }
.banner-error { background: #fdecea; color: var(--error); border: 1px solid #f5c6c2; }
.banner-success { background: #eaf5ea; color: var(--success); border: 1px solid #c3e2c4; }
.banner-warn { background: #fdf3e7; color: #8a5a00; border: 1px solid #f0d8ad; font-weight: 600; }
