/* SignEnvoy brand design system — see docs/frontend-design.md */

@font-face {
  font-family: "Great Vibes";
  src: url("/static/fonts/GreatVibes-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink:       #081833;  /* sampled from wordmark (source of truth) */
  --ink-raise: #1B2A41;
  --ink-soft:  #3D4F66;
  --paper:     #FAF7F0;
  --surface:   #FFFFFF;
  --amber:     #D9A441;
  --line:      #E4DED2;
  --success:   #2E6B4F;
  --danger:    #A63D2F;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(27, 42, 65, 0.08);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-mark { height: 28px; width: auto; }
.brand-wordmark { height: 26px; width: auto; }

main { max-width: 860px; margin: 2rem auto; padding: 0 1rem; }

.site-footer {
  max-width: 860px;
  margin: 2rem auto 1.5rem;
  padding: 0.75rem 1rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1.25rem;
}
.site-footer a { color: var(--ink-soft); font-size: 0.85rem; }

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.settings-nav a { color: var(--ink-soft); font-size: 0.9rem; }
.settings-nav a.current { color: var(--ink); font-weight: 600; }
.settings-groups .card h2 { margin-top: 0; font-size: 1.05rem; }
.settings-links { list-style: none; margin: 0; padding: 0; }
.settings-links li { margin: 0.25rem 0; }

.danger-form { border-top: 1px solid var(--line); padding-top: 0.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
}
input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.4);
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

button, a.button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  min-height: 44px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:hover, a.button:hover {
  background: var(--ink-raise);
  box-shadow: inset 0 -2px 0 var(--amber);
}
button:disabled {
  background: var(--line);
  color: var(--ink-soft);
  cursor: default;
  box-shadow: none;
}
button.link {
  background: none;
  color: var(--ink);
  margin: 0;
  padding: 0;
  min-height: 0;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: underline;
}
button.link:hover {
  background: none;
  box-shadow: none;
  text-decoration-color: var(--amber);
}
.nav-form { margin: 0; }

a { color: var(--ink); }
a:hover { text-decoration-color: var(--amber); }

.error {
  background: rgba(166, 61, 47, 0.07);
  border: 1px solid rgba(166, 61, 47, 0.35);
  color: var(--danger);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.mono { font-family: var(--mono); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}

/* Status badges: stamp of record, not pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.status-icon {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  image-rendering: pixelated;
}
.status-sent   { color: var(--ink-soft); }
.status-viewed { color: var(--ink); }
.status-signed { color: var(--success); }
.status-signed::after { content: "\2713"; }
.tag { margin-left: 0.4rem; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }

/* Empty states / loading moments: slot for the pixel pigeon sprite */
.envoy-sprite {
  width: 64px;
  height: 64px;
  margin: 0.5rem auto;
  background: var(--line);
  border-radius: var(--radius);
  image-rendering: pixelated;
}
.empty-state { text-align: center; padding: 1rem 0; }

/* Confirmation page checkmark motif */
.done-check {
  width: 56px;
  height: 56px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--success);
  border-radius: 50%;
  color: var(--success);
  font-size: 1.8rem;
  font-weight: 700;
}

.pdf-view {
  width: 100%;
  height: 32rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.signature-input { font-size: 1rem; }
.signature-preview {
  min-height: 4.2rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.signature-preview span {
  font-family: "Great Vibes", cursive;
  font-size: 2.4rem;
  color: var(--ink);
}

.consent {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 1rem;
}
.consent input {
  width: 1.4rem;
  height: 1.4rem;
  flex: none;
  accent-color: var(--ink);
}

/* ---- M2 dashboard additions (B7) ------------------------------------- */
.main-nav {
  display: flex;
  gap: 1.1rem;
  align-items: center;
}
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.main-nav a:hover { box-shadow: inset 0 -2px 0 var(--amber); }

.banner {
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--line);
}
.banner a { color: inherit; font-weight: 600; }
.banner-info { background: var(--surface); color: var(--ink-soft); }
.banner-warn {
  background: rgba(217, 164, 65, 0.14);
  color: var(--ink);
  border-left: 4px solid var(--amber);
}
.banner-danger {
  background: rgba(166, 61, 47, 0.10);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.notice { color: var(--success); font-weight: 500; }

.secret-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  word-break: break-all;
  user-select: all;
}

.check-inline {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0.25rem 1rem 0.25rem 0;
  min-height: 44px;
  font-weight: 400;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0.8rem 0;
}
legend { font-weight: 600; padding: 0 0.4rem; }

.row-actions { display: flex; gap: 0.8rem; align-items: center; }
.link.danger { color: var(--danger); }
tr.revoked td { color: var(--ink-soft); opacity: 0.7; }

/* ---- UX-M2: signup fork + usage meter ---- */
.fork-cards { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.fork-card {
  flex: 1 1 240px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; background: var(--surface);
}
.fork-card h2 { margin-top: 0; font-size: 18px; }
.usage-meter { margin: 8px 0 16px; }
.usage-meter .banner { margin-top: 8px; }
.checklist { padding-left: 20px; }
.checklist li { margin-bottom: 10px; }
.checklist .done-check { color: var(--success); font-size: inherit; }
pre.quickstart {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; font-size: 13px; line-height: 1.5;
}
.tag-danger { color: var(--danger); border-color: var(--danger); }

/* ---- UX-M3: document detail, timeline (LC-1..LC-4) ---- */
.timeline { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.timeline li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline-what { color: var(--ink); }
.timeline-when { white-space: nowrap; }
.raw-events { margin-top: 1rem; }
.raw-events summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 0.4rem 0;
}
.raw-events summary:focus-visible { outline: 2px solid var(--amber); }
.downloads { list-style: none; margin: 0; padding: 0; }
.downloads li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.downloads li:last-child { border-bottom: 0; }
.downloads .muted { display: block; }
.void-form { margin-top: 0.75rem; }
/* the solid treatment is for the primary destructive action only; a
   `.link.danger` stays a link, or its label disappears into the fill */
button.danger:not(.link) { background: var(--danger); color: var(--paper); }
button.link.danger { color: var(--danger); }

@media (max-width: 34rem) {
  .timeline li { flex-direction: column; gap: 0.15rem; }
}
.downloads .unavailable { color: var(--ink-soft); }

/* ---- UX-M3: list filters and sort (LC-5) ---- */
.list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}
.list-controls .list-sort { margin-left: 0.75rem; }
.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--amber); }
.chip-on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---- UX-M3: four-step send flow (SD-1..SD-5) ---- */
.steps { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none;
         margin: 0 0 1.25rem; padding: 0; font-size: 0.85rem; }
.step { color: var(--ink-soft); display: flex; align-items: center; gap: 0.35rem; }
.step + .step::before { content: "›"; margin-right: 0.35rem; color: var(--line); }
.step-n { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem;
          border: 1px solid currentColor; border-radius: 50%; font-size: 0.75rem; }
.step-on { color: var(--ink); font-weight: 600; }
.step-done { color: var(--success); }
.recipient-lanes { list-style: none; margin: 1rem 0; padding: 0; }
/* The badge sits in the gutter column; every label and control stacks in
   column 2 so a label is always directly above the box it names. Without
   the explicit `grid-column`, auto-placement wraps the pairs across both
   columns and each label ends up beside the PREVIOUS row's input. */
.lane { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr);
        gap: 0.3rem 0.75rem;
        align-items: start; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.lane > * { grid-column: 2; }
.lane-n { grid-column: 1; grid-row: 1; display: inline-grid; place-items: center;
          width: 2rem; height: 2rem; border: 1px solid var(--line);
          border-radius: 50%; color: var(--ink-soft); font-size: 0.85rem; }
.lane select { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--line);
               border-radius: var(--radius); font-family: inherit;
               font-size: 1rem; color: var(--ink); background: var(--surface); }
.lanes { border: 0; padding: 0; margin: 0 0 1rem; }
.lanes legend { font-size: 0.75rem; text-transform: uppercase;
                letter-spacing: 0.06em; color: var(--ink-soft); }
.radio { display: block; padding: 0.25rem 0; }
.radio .muted { display: block; margin-left: 1.6rem; font-weight: 400; }
.radio { font-weight: 600; }
.field-list select, .field-list input { width: auto; }
.page-input { width: 5rem; }
.email-preview { background: var(--paper); border: 1px solid var(--line);
                 border-radius: var(--radius); padding: 0.9rem;
                 white-space: pre-wrap; font-family: var(--mono);
                 font-size: 0.82rem; color: var(--ink); overflow-x: auto; }
.preview h2 { font-size: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0;
           margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; margin: 0; }
.pref-list { list-style: none; margin: 0.75rem 0; padding: 0; }
.pref-list li { padding: 0.3rem 0; }
