:root {
  color-scheme: light only;
  --navy: #0b184a;
  --navy-2: #071033;
  --gold: #dcb46a;
  --gold-2: #b4863f;
  --light: #dde2f6;
  --bg: #f4f5fa;
  --ink: #1c2233;
  --gray: #5a6072;
  --line: #c9cede;
  --ok: #1e7d43;
  --warn: #9b2c2c;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.topbar { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.topbar-inner {
  max-width: 900px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
}
.logo { height: 34px; width: auto; }
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .5px; }
.brand-sub { font-size: 8.5px; letter-spacing: 2.6px; color: var(--light); }
.product {
  margin-left: 6px; padding: 3px 10px; border: 1px solid var(--gold);
  border-radius: 999px; color: var(--gold); font-weight: 700; font-size: 13px;
  letter-spacing: 1px;
}
.content { max-width: 900px; margin: 0 auto; padding: 22px 16px 60px; }
.foot {
  max-width: 900px; margin: 0 auto; padding: 18px 16px 30px;
  color: var(--gray); font-size: 12.5px; text-align: center;
}
.foot a { color: var(--gray); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(11,24,74,.06);
}
h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 17px; margin: 0 0 10px; color: var(--navy); }
.muted { color: var(--gray); font-size: 14px; }

.doc-pages { display: flex; flex-direction: column; gap: 16px; }
.doc-page { margin: 0; }
.doc-pages img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: 6px;
  /* A visible placeholder while the page loads, so a slow image reads as
     "loading" instead of a mysterious gap. */
  background: #fff repeating-linear-gradient(
      -45deg, #f7f8fc 0 12px, #eef1fa 12px 24px);
  box-shadow: 0 1px 4px rgba(11,24,74,.08);
}
.doc-page figcaption {
  margin-top: 5px; text-align: center; font-size: 11.5px; color: var(--gray);
}

.consent {
  display: flex; gap: 10px; align-items: flex-start;
  background: #f8f6ef; border: 1px solid #e5d9bd; border-radius: 8px;
  padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
}
.consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--navy); }

.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--gray);
  padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600;
  font-size: 14px;
}
.tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }

#sig-canvas {
  width: 100%; max-width: 560px; height: 170px; touch-action: none;
  border: 1.5px dashed var(--line); border-radius: 8px; background: #fff;
  cursor: crosshair; display: block;
}
@media (max-width: 640px) {
  #sig-canvas { height: 230px; max-width: none; }
}
.sig-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.linkish { background: none; border: none; color: var(--gray); cursor: pointer;
  text-decoration: underline; font-size: 13.5px; padding: 0; }
#typed-name {
  width: 100%; max-width: 560px; font-size: 17px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
}
#typed-preview {
  margin-top: 10px; height: 90px; display: flex; align-items: center;
  font-family: "Segoe Script", "Brush Script MT", "Snell Roundhand", cursive;
  font-size: 44px; color: var(--navy); overflow: hidden; white-space: nowrap;
}

.btn {
  display: inline-block; border: none; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 16px; padding: 13px 26px; text-decoration: none;
}
.btn-gold { background: var(--gold); color: var(--navy-2); }
.btn-gold:hover { background: var(--gold-2); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.sign-actions { margin-top: 16px; display: flex; align-items: center; gap: 14px; }

.overlay {
  position: fixed; inset: 0; background: rgba(11,24,74,.82); display: none;
  align-items: center; justify-content: center; z-index: 50; color: #fff;
  flex-direction: column; gap: 16px; text-align: center; padding: 24px;
}
.overlay.show { display: flex; }
.spinner {
  width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.25);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bigcheck {
  width: 74px; height: 74px; border-radius: 50%; background: var(--ok);
  color: #fff; font-size: 44px; display: flex; align-items: center;
  justify-content: center; margin: 6px auto 14px;
}

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.list th { color: var(--gray); font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.created { background: #eef1fa; color: var(--gray); border: 1px dashed var(--line); }
.badge.sent { background: var(--light); color: var(--navy); }
.badge.viewed { background: #fdf3dd; color: var(--gold-2); }
.badge.signed, .badge.completed { background: #e0f2e6; color: var(--ok); }
.badge.send_failed { background: #f8dcdc; color: var(--warn); }
.actions a, .actions button { margin-right: 10px; font-size: 13px; }

form.create label { display: block; font-weight: 600; font-size: 13.5px;
  margin: 12px 0 4px; color: var(--navy); }
form.create input[type=text], form.create input[type=email], form.create select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 15px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.flash { background: #e0f2e6; border: 1px solid #b5dfc2; color: var(--ok);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }

/* ---- Sign-in page: the house front-door pattern shared by MGNY internal
   apps (square card, navy lockup band, gold-gradient primary button,
   navy footer band). Button spec per MGNY design tokens. ---- */
.login-wrap {
  min-height: calc(100vh - 190px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}
.login-card {
  width: 100%; max-width: 384px; background: #fff;
  border: 1px solid var(--line);
}
.login-lockup { background: var(--navy); padding: 20px 24px; }
.login-lockup-row { display: flex; align-items: center; gap: 14px; }
.login-divider { height: 56px; width: 1px; background: rgba(255,255,255,.5); }
.login-submark {
  color: #fff; font-weight: 800; font-size: 26px; letter-spacing: 6px;
}
.login-tagline { margin: 8px 0 0; font-size: 12px; color: rgba(255,255,255,.7); }
.login-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login-h1 { font-size: 20px; margin: 0; color: var(--ink); }
.login-copy { margin: 0; font-size: 14px; color: var(--gray); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #C99A48 0%, #9A7130 100%);
  color: #0B184A; font-weight: 700; font-size: 14px;
  border: none; border-radius: 6px; cursor: pointer; text-decoration: none;
  box-shadow: 0 2px 4px rgba(11,24,74,.25),
              inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:active { transform: translateY(1px); }
.login-btn { height: 44px; width: 100%; }

.notice-error {
  background: #f8dcdc; border: 1px solid #e0b0b0; color: var(--warn);
  padding: 10px 14px; font-size: 13.5px;
}

/* ---- signature placement screen ---- */
.place-page { position: relative; cursor: crosshair; }
.place-page img { display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 6px;
  background: #fff repeating-linear-gradient(
      -45deg, #f7f8fc 0 12px, #eef1fa 12px 24px); }
.page-num {
  position: absolute; top: 8px; right: 10px; background: rgba(11,24,74,.75);
  color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px;
}
/* The box must never hide the text it sits on: a dashed outline, a barely
   tinted fill, and the label parked outside the box on its baseline. */
/* The box itself is the child <img> (an SVG outline). The wrapper paints
   nothing: Chrome's "Auto Dark Mode for Web Contents" repaints element
   backgrounds regardless of color-scheme opt-outs, but never images. */
.sig-ghost { position: absolute; pointer-events: none; background: none; }
.sig-ghost img { width: 100%; height: 100%; display: block; }
.sig-ghost span {
  position: absolute; left: -2px; bottom: -20px; white-space: nowrap;
  background: #9A7130; color: #fff; font-weight: 700; font-size: 10.5px;
  letter-spacing: .4px; padding: 1px 7px; border-radius: 3px;
}
.placebar {
  position: sticky; bottom: 0; margin-top: 14px; display: flex;
  align-items: center; justify-content: space-between; gap: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; box-shadow: 0 -2px 10px rgba(11,24,74,.08);
}
.copybar { display: inline-flex; gap: 8px; margin-left: 10px; align-items: center; }
.copybar input { font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 6px; width: 320px; max-width: 55vw; color: var(--gray); }

.login-foot { background: var(--navy); padding: 24px 16px; text-align: center; }
.login-foot p { margin: 0; font-size: 12px; color: #bbc6f3; }
.login-foot a { color: #bbc6f3; text-decoration: none; }
.login-foot a:hover { text-decoration: underline; text-underline-offset: 2px; }
