/* ── Self-hosted webfonts (2026-08-21) ────────────────────────────────────────
   Replaces the Google Fonts @import that used to sit on line 1. An @import is
   the worst case for a stylesheet: the browser cannot even discover it until
   style.css itself has downloaded, so it serialised HTML → style.css → Google
   CSS → font files on EVERY app page (the signer flow included). These are the
   same files the marketing pages use (see public/css/home.css, which declares
   its own copies because it is inlined and cannot @import).

   Archivo/Inter/Lora are VARIABLE — one file spans every weight, which also
   fixes a long-standing bug: the old link requested Inter 400/500/600 while the
   app renders 700 and 800, so those were faux-bolded by the browser. IBM Plex
   Mono has no variable version, hence three static weights; @font-face is lazy,
   so pages without monospace never fetch them. Latin subset throughout, plus
   latin-ext for Inter only — app text is user-generated (tenant and signer
   names), and unicode-range means that file is fetched ONLY when such a
   character actually appears.

   ⚠️ Served immutable for a year (esign-stack DeployFonts): change a face =
   NEW FILENAME, never overwrite in place.
   Licenses vendored in public/fonts/ (SIL OFL 1.1 for all four families). */
@font-face {
  font-family: 'Archivo';
  font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('/fonts/archivo-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('/fonts/inter-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('/fonts/inter-var-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lora';
  font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/fonts/lora-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lora';
  font-style: italic; font-weight: 400 700; font-display: swap;
  src: url('/fonts/lora-italic-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/ibm-plex-mono-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* HankoSign palette — a Japanese hanko (seal) theme.
   Shu vermillion seal ink on warm washi paper, sumi-ink text. */
:root {
  --ink: #1C1815;          /* sumi ink — text + dark surfaces */
  --ink-soft: #4a423b;     /* softened sumi for secondary text */
  --paper: #F1EBE0;        /* washi paper — page background */
  --card: #ffffff;         /* clean card surface over the washi */
  --seal: #C8382A;         /* shu vermillion — primary seal ink */
  --seal-dark: #A52D22;    /* pressed-deeper vermillion (hover) */
  --seal-tint: #F7E1DD;    /* faint vermillion wash (tints/notices) */
  --gold: #b8862e;         /* warm secondary accent (sent badge) */
  --gold-tint: #f7ecd9;
  --line: #E4DBCB;         /* warm washi hairline */
  /* AA-audited 2026-08-21: was #8a7d6c, which read 4.01:1 on white cards and only
     3.38:1 on the washi page background — a fail on both counts for the ~197 places
     this token is used (labels, table headers, help text, the whole signer flow).
     #716659 is the same warm grey-brown, one step darker: 5.60 on white, 4.72 on washi. */
  --muted: #716659;        /* muted warm grey-brown */
  --danger: #9a2b1f;       /* deep brick — distinct from the vermillion brand */
  --danger-tint: #f3ddd8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 24, 21, 0.06), 0 8px 24px rgba(28, 24, 21, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { font-family: 'Archivo', system-ui, sans-serif; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 .4em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; font-weight: 700; }
/* A card that IS the whole page (signer stages, terminal states) needs its title to
   be the document's <h1> — a page must not start at <h2> — but at card scale, not
   page scale. Added 2026-08-21 when those headings were promoted for the landmark/
   heading pass; matches the h2 metrics exactly, so nothing moved on screen. */
h1.card-title { font-size: 1.25rem; font-weight: 700; }
/* Screen-reader-only text: removed from the visual layout, still read aloud and
   still focusable if it ever needs to be. Used for the <h1> on pages whose visible
   "title" is the logo lockup plus a tagline (sign-in, password reset, MFA) — those
   pages need a heading for assistive tech, but adding a visible one would be
   redundant next to the wordmark. Do NOT use display:none (that hides it from
   screen readers too, defeating the point). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
h3 { font-size: 1.05rem; font-weight: 700; }

a { color: var(--seal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: 'IBM Plex Mono', monospace; font-size: 0.85em; }

.container { max-width: none; margin: 0 auto; padding: 32px 24px 64px; }
.container--narrow { max-width: 560px; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.topbar__inner {
  max-width: none; margin: 0 auto; padding: 11px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Archivo', system-ui, sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
/* Primary lockup (seal + wordmark), rasterized so it never depends on the
   wordmark fonts being present. */
.brand__logo { height: 56px; width: auto; display: block; }
/* Seal-only mark, used beside a text label (e.g. the platform console). */
.brand__icon { height: 36px; width: 36px; border-radius: 8px; display: block; flex-shrink: 0; }
.topbar__user { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 20px; }

.eyebrow {
  font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; letter-spacing: .08em;
  font-size: 0.72rem; color: var(--muted); margin-bottom: 6px; display: block;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.9rem;
  padding: 10px 18px; text-decoration: none; transition: box-shadow .12s ease, opacity .15s ease;
}
.btn-primary { background: var(--seal); color: #fff; }
.btn-primary:hover { background: var(--seal-dark); text-decoration: none; }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-soft); text-decoration: none; }
.btn-danger { background: var(--card); color: var(--danger); border-color: var(--danger-tint); }
.btn-danger:hover { background: var(--danger-tint); text-decoration: none; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; color: var(--ink-soft); }
input[type="text"], input[type="email"], input[type="password"], input[type="file"], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px;
  font-family: 'Inter', sans-serif; font-size: 0.92rem; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--seal); outline-offset: 1px; }
.field { margin-bottom: 18px; }
.help { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] { width: 16px; height: 16px; min-width: 16px; margin-top: 3px; flex-shrink: 0; accent-color: var(--seal); }
.checkbox-row label { font-weight: 500; color: var(--ink); margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 100px;
  font-size: 0.74rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
}
/* ⭐ ENVELOPE STATUS — the single source of truth. Text colour only: no fill, no border,
   so a status reads the same on the dashboard, the detail page and the signer table.
   dashboard.ejs used to re-declare all of this at a higher specificity, which is how the
   two copies drifted (Draft was brown here and blue there). Do not re-add a page-level
   copy — change these values instead. */
.badge-draft { color: #6F5334; }
.badge-sent { color: #185FA5; }
.badge-completed { color: #197322; }
.badge-declined, .badge-signer_withdrawn, .badge-voided { color: #C93626; }
/* No document is ever stored with status "archived" (archiving sets archived_at and
   leaves status alone), so this cannot render today — kept so the rule exists if the
   status is ever made real. */
.badge-archived { color: #1C1815; }
/* Informational pill — NOT an envelope status. Lives outside the status block so a
   palette change up there cannot silently restyle it (document-detail field count). */
.badge-info { background: #e6f1fb; color: #185fa5; }

.seal {
  width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--seal); display: flex; align-items: center; justify-content: center;
  position: relative; color: var(--seal); font-family: 'Lora', serif; font-weight: 600;
}
.seal::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--seal); border-radius: 50%; }
.seal--gold { border-color: var(--gold); color: var(--gold); }
.seal--gold::before { border-color: var(--gold); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }

.audit-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.83rem; }
.audit-row:last-child { border-bottom: none; }
.audit-time { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; }

.notice {
  border: 1px solid var(--line); background: var(--seal-tint); border-radius: 8px;
  padding: 14px 16px; font-size: 0.85rem; color: var(--seal-dark); margin-bottom: 18px;
}
.notice--danger { background: var(--danger-tint); color: var(--danger); border-color: transparent; }
.notice--muted { background: #f1eee7; color: var(--muted); }

.disclosure {
  border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; max-height: 360px;
  overflow-y: auto; font-size: 0.85rem; color: var(--ink-soft); background: #fffefb; margin-bottom: 20px;
}
.disclosure h3 { font-size: 0.95rem; margin-top: 1.1em; }
.disclosure p { margin: 0.5em 0; }

.signer-list { display: flex; flex-direction: column; gap: 10px; }
.signer-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.remove-signer { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; padding: 10px 4px; }
.remove-signer:hover { color: var(--danger); }

.sig-canvas-wrap { border: 1px dashed var(--line); border-radius: 8px; background: #fff; }
#sig-pad { width: 100%; height: 160px; display: block; cursor: crosshair; touch-action: none; }
.sig-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.sig-tab { padding: 6px 14px; border-radius: 100px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 0.82rem; }
.sig-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.typed-sig-preview { font-family: 'Lora', serif; font-style: italic; font-size: 1.8rem; color: var(--ink); padding: 18px 4px; border-bottom: 1px solid var(--line); }

.center-stage { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--muted); }
.footer-note { text-align: center; font-size: 0.78rem; color: var(--muted); margin-top: 28px; }

@media (max-width: 600px) {
  /* Reclaim horizontal space on phones so content isn't crushed by padding. */
  .container { padding: 22px 16px 48px; }
  .topbar__inner { padding: 10px 16px; }
  .card { padding: 20px 18px; }
  .disclosure { padding: 16px 16px; }

  h1 { font-size: 1.42rem; }
  h2 { font-size: 1.15rem; }

  /* Long titles, emails, and tokens must wrap rather than force sideways scroll. */
  h1, h2, h3, p, a, .text-muted, td { overflow-wrap: break-word; }

  /* A little more height for the primary full-width call-to-action (touch target). */
  .btn-block { padding: 12px 18px; }

  .signer-row { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr; }

  /* Reusable table -> stacked cards on phones. Add class "responsive-table" to a
     <table> and data-label="..." to each <td>; the label prints above its value.
     A <td> with no data-label (e.g. an actions cell) shows just its content. The
     !important widths override any inline widths set by the resizable-table JS. */
  table.responsive-table { display: block; width: 100% !important; }
  table.responsive-table thead { display: none; }
  table.responsive-table tbody { display: block; }
  table.responsive-table tr { display: block; border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin: 0 0 12px; padding: 4px 0; }
  table.responsive-table td { display: block; width: auto !important; border: none; padding: 7px 14px; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  table.responsive-table td::before { content: attr(data-label); display: block; font-weight: 600; color: var(--muted); font-size: 0.66rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
  table.responsive-table td:not([data-label])::before { display: none; }
}

/* ── Social sign-in buttons (login + register) ──────────────────────────────── */
.oauth-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.oauth-btn {
  flex: 1 1 160px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: #1f1f1f; font-weight: 600; font-size: 0.92rem;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.oauth-btn:hover { background: #f7f7f7; text-decoration: none; }
.oauth-ico { display: inline-flex; width: 18px; height: 18px; }
.oauth-divider { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 0.8rem; margin: 0 0 16px; }
.oauth-divider::before, .oauth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.oauth-divider span { padding: 0 12px; }

/* Phones: stack the buttons full-width. Placed AFTER the base rules so it wins on
   source order — otherwise the base `flex: 1 1 160px` bleeds through and, in a
   column, its 160px basis becomes the button HEIGHT (giant buttons). `flex: 0 0 auto`
   resets that so height is content-sized; align-items:stretch makes them full-width. */
@media (max-width: 768px) {
  .oauth-row { flex-direction: column; }
  .oauth-btn { flex: 0 0 auto; }
}

/* ============================================================
   FLAT BUTTONS · light outer shadow (replaces the old 3D keycap)
   Solid fills + a soft neutral drop shadow — no gradient, ledge,
   or press. The shadow matches the field-placer tiles.
   ============================================================ */
.btn {
  transition: box-shadow .12s ease, background .15s ease, border-color .15s ease, color .15s ease;
  box-shadow: 0 1px 4px rgba(28,24,21,.15);
}
.btn:hover { box-shadow: 0 2px 7px rgba(28,24,21,.18); }
.btn:active { box-shadow: 0 1px 3px rgba(28,24,21,.13); }

.btn-secondary:hover { border-color: var(--seal); color: var(--seal-dark); }
.btn-danger:hover { background: var(--danger-tint); }

/* Disabled buttons stay flat (no shadow) */
.btn[disabled], .btn:disabled { box-shadow: none; }

/* ── Premium-feature lock badge + upgrade CTA ────────────────────────────────
   Shared treatment for gated features (views/partials/upgrade-lock.ejs).
   Spec: PREMIUM_LOCK_STANDARDIZATION_SPEC.md. The whole badge is one tap target
   linking to /billing — a visible "Premium · Upgrade" cue (no hover/title needed). */
.feat-lock {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--seal-dark); text-decoration: none; line-height: 1;
  border: 1px solid var(--seal); background: var(--seal-tint);
  border-radius: 999px; font-weight: 700; letter-spacing: .01em;
  text-transform: none; /* immune to uppercase table headers etc. */
  transition: background .12s ease, border-color .12s ease;
}
.feat-lock:hover { background: #f2d3ce; border-color: var(--seal-dark); text-decoration: none; }
.feat-lock:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.feat-lock__glyph { display: inline-flex; color: var(--seal); }
.feat-lock__tag { text-transform: uppercase; }

/* Inline pill — for row menus, table cells, next to a button. */
.feat-lock--inline { padding: 3px 10px; font-size: 0.7rem; }
.feat-lock--inline .feat-lock__cta { color: var(--seal-dark); opacity: .85; }
.feat-lock--inline .feat-lock__cta::before { content: '·'; margin-right: 6px; opacity: .6; }

/* Block CTA — for cards (payment ask, settings, empty-state affordances). */
.feat-lock--block {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; border-radius: var(--radius); font-weight: 600;
}
.feat-lock--block .feat-lock__glyph { align-self: flex-start; margin-top: 2px; }
.feat-lock--block .feat-lock__body { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.feat-lock--block .feat-lock__title { font-family: 'Archivo', system-ui, sans-serif; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.feat-lock--block .feat-lock__tag {
  font-size: 0.6rem; padding: 2px 7px; border-radius: 999px;
  background: var(--seal); color: #fff; letter-spacing: .06em;
}
.feat-lock--block .feat-lock__sub { font-size: 0.82rem; color: var(--ink-soft); font-weight: 500; }
.feat-lock--block .feat-lock__cta {
  flex: none; align-self: center; padding: 8px 16px; border-radius: 7px;
  background: var(--seal); color: #fff; font-weight: 700; font-size: 0.85rem;
}
.feat-lock--block:hover .feat-lock__cta { background: var(--seal-dark); }

/* A control rendered inert because the tenant isn't entitled: dim it, kill pointer
   events, and let the sibling .feat-lock carry the affordance. Applied to a wrapper
   around the real (disabled) control so the layout is preserved. */
.is-locked { opacity: .55; pointer-events: none; filter: grayscale(0.3); }
.locked-wrap { display: flex; flex-direction: column; gap: 8px; }
.locked-wrap--row { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
