/* ==========================================================================
   NC Energy Saver — Go Green brand design system
   Balanced palette: teal-navy dark sections, green CTAs, azure accents,
   lime/mint highlights. Mobile-first.
   ========================================================================== */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/public/fonts/figtree-400.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/public/fonts/figtree-600.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/public/fonts/figtree-700.woff2") format("woff2");
}
@font-face {
  font-family: "Signature Script";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/public/fonts/signature.woff2") format("woff2");
}

:root {
  /* Brand */
  --navy-900: #0e2a34;
  --navy: #143a47;
  --navy-700: #1d4b5a;
  --blue: #1c8ed0;
  --blue-600: #1577b0;
  --blue-50: #e8f4fb;
  --green: #2f9e57;
  --green-600: #268049;
  --green-50: #e7f6ec;
  --lime: #84c23f;
  --mint: #bfe39a;
  --mint-50: #eef6e3;

  /* Neutrals */
  --ink: #16252e;
  --ink-soft: #33424c;
  --muted: #5a6b76;
  --line: #e3eaee;
  --line-strong: #d2dce1;
  --surface: #ffffff;
  --bg: #f4f8fa;
  --bg-tint: #eef3f5;

  /* Status */
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #8a5d12;
  --warn-bg: #fbf1dd;
  --warn-line: #f0d8a3;
  --ok: #1f7a45;
  --ok-bg: #e7f6ec;
  --ok-line: #bfe3cb;

  /* Shape & depth */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 42, 52, .06), 0 2px 6px rgba(16, 42, 52, .06);
  --shadow: 0 10px 30px rgba(16, 42, 52, .10);
  --shadow-lg: 0 24px 60px rgba(16, 42, 52, .18);

  --font: "Figtree", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.customer-body { background: var(--bg); }

h1, h2, h3 { line-height: 1.18; margin: 0 0 14px; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(24px, 5vw, 34px); }
h2 { font-size: clamp(19px, 3.5vw, 23px); }
h3 { font-size: 17px; }
p { margin: 0 0 14px; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.fineprint { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.hidden { display: none !important; }

/* ----- Topbar ----------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  min-height: 60px;
  background: linear-gradient(120deg, var(--navy-900), var(--navy) 70%, var(--navy-700));
  color: #fff;
}
.customer-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.brand img { width: 104px; height: auto; display: block; }
.brand span { font-size: 15px; letter-spacing: .01em; }
.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
}
.topbar nav a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  opacity: .92;
}
.topbar nav a:hover { opacity: 1; text-decoration: underline; }
.nav-button {
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  opacity: .92;
}
.nav-button:hover { opacity: 1; text-decoration: underline; }

main {
  width: min(var(--maxw), calc(100% - 28px));
  margin: 26px auto 48px;
}

/* ----- Buttons ---------------------------------------------------------- */
button, .button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
  text-decoration: none;
}
button:hover, .button:hover { background: var(--green-600); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button:disabled, .button:disabled {
  background: #b9c6cd;
  color: #f3f6f7;
  cursor: not-allowed;
  box-shadow: none;
}
button:focus-visible, .button:focus-visible,
a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(28, 142, 208, .45);
  outline-offset: 2px;
}
.button.secondary, .secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.button.secondary:hover, .secondary:hover { background: var(--bg-tint); }
.submit-button { width: 100%; min-height: 54px; font-size: 17px; font-weight: 700; }
.link-button {
  background: none;
  border: 0;
  color: var(--blue-600);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  min-height: 0;
}
.link-button:hover, .link-button:focus { background: none; box-shadow: none; color: var(--navy); }
.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-weight: 600;
}
.google-button:hover { background: var(--bg-tint); }
.google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 800;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ----- Forms ------------------------------------------------------------ */
label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
}
input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #9aa7af; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input[readonly] { background: var(--bg-tint); color: var(--ink-soft); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.stack { display: grid; gap: 16px; }
.grid-form { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-form .full { grid-column: 1 / -1; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 0;
  flex: 0 0 22px;
  margin-top: 1px;
  accent-color: var(--green);
  cursor: pointer;
}

/* ----- Cards / panels --------------------------------------------------- */
.panel, .table-wrap, .auth-card, .complete-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.panel > h1:first-child, .panel > h2:first-child { margin-top: 0; }
.auth-card, .complete-card { box-shadow: var(--shadow); text-align: center; }
.narrow { max-width: 460px; margin: 8vh auto 0; }
.auth-logo { width: 180px; max-width: 70%; margin: 0 auto 14px; display: block; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ----- Tables ----------------------------------------------------------- */
.table-wrap { padding: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
td input[readonly] { font-size: 13px; min-height: 38px; }
.status {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--bg-tint);
  color: var(--muted);
}
.status.completed { background: var(--green-50); color: var(--green-600); }
.status.pending { background: var(--warn-bg); color: var(--warn); }
.status.expired { background: var(--danger-bg); color: var(--danger); }
.status.voided { background: #eceff1; color: #6b7780; text-decoration: line-through; }
.doc-tag {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-tint);
  color: var(--ink, #143a47);
  white-space: nowrap;
}

/* Destructive action (Void) */
.button.danger, button.danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #e3b4ad;
}
.button.danger:hover, button.danger:hover { background: var(--danger-bg); }
.table-action {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 600;
}
.table-action:hover { text-decoration: none; background: #d9edf9; }

/* ----- Copy box --------------------------------------------------------- */
.copy-box { display: grid; gap: 14px; margin: 16px 0; }
.copy-box label { font-size: 13px; }
.copy-box input { cursor: copy; font-weight: 600; }

/* ----- Invite share block ---------------------------------------------- */
.invite-share { margin-top: 4px; }
.invite-preview {
  white-space: pre-line;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
}
.invite-raw { margin-top: 14px; }
.invite-raw summary { cursor: pointer; color: var(--blue-600); font-weight: 600; font-size: 14px; }
.invite-raw[open] summary { margin-bottom: 6px; }

/* ----- Notices ---------------------------------------------------------- */
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}
.notice .button { margin-left: auto; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

/* ----- Section title (numbered) ---------------------------------------- */
.section-title { display: flex; gap: 14px; align-items: flex-start; margin: 4px 0 14px; }
.section-title span {
  flex: 0 0 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.section-title h2 { margin: 0 0 2px; }
.section-title p { margin: 0; color: var(--muted); font-size: 14px; }

/* ----- Modals ----------------------------------------------------------- */
.modal {
  width: min(960px, calc(100% - 24px));
  max-height: min(82vh, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  color: var(--ink);
}
.modal::backdrop { background: rgba(8, 22, 30, .55); }
.compact-modal { width: min(520px, calc(100% - 24px)); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.modal-head h2 { margin: 0; }
.modal-body { padding: 20px; overflow: auto; max-height: calc(82vh - 64px); }
.modal-table { overflow: auto; }

/* ----- Settings modal sections ----------------------------------------- */
.settings-section { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.settings-section + .settings-section { border-top: 1px solid var(--line); padding-top: 18px; }
.settings-section h3 { margin: 0; }
.settings-section form { width: 100%; }
.success-text { color: var(--ok); font-weight: 600; }

.template-preview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--bg);
  font-size: 14px;
}
.template-preview .preview-kicker {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.template-preview .preview-subject { margin-bottom: 10px; }
.template-preview .preview-body p { margin: 0 0 10px; }
.template-preview .preview-button {
  display: inline-block;
  background: var(--green);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
}
.template-preview .preview-code { margin-top: 10px; font-size: 18px; letter-spacing: .12em; font-weight: 700; color: var(--green-600); }
.template-preview .preview-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* ----- Project preset builder ------------------------------------------ */
.project-detail-builder {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--bg);
}
.builder-head h2 { margin: 0 0 2px; }
.preset-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.preset-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
}
.preset-chip:hover { border-color: var(--green); background: var(--green-50); }
.preset-chip.selected { background: var(--green); border-color: var(--green); color: #fff; }

/* ----- ServiceTitan search --------------------------------------------- */
.st-search {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.st-search-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.st-search-bar input { flex: 1 1 220px; }
.st-search-bar .button { white-space: nowrap; }
.st-results { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.st-customer {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.st-customer-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--line);
}
.st-result-name { font-weight: 700; color: var(--navy); }
.st-result-contact { font-size: 13px; color: var(--ink-soft); }
.st-loc-count { font-size: 12px; font-weight: 700; color: var(--green-600); }
.st-loc-list { display: flex; flex-direction: column; }
.st-result, .st-loc-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  align-items: flex-start;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  min-height: 0;
  border-radius: 0;
}
.st-loc-option:first-child { border-top: 0; }
.st-result:hover, .st-loc-option:hover { background: var(--green-50); }
.st-result-addr, .st-loc-addr { font-weight: 600; color: var(--navy); }
.st-loc-name { font-size: 12px; color: var(--muted); }
.st-linked { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.st-linked-badge {
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ----- Auth / login ----------------------------------------------------- */
.auth-card h1 { margin-bottom: 6px; }

/* ==========================================================================
   CUSTOMER-FACING
   ========================================================================== */
.customer-shell {
  display: grid;
  gap: 18px;
  margin: 18px 0;
}
.customer-hero {
  background: linear-gradient(140deg, var(--navy-900), var(--navy) 60%, var(--navy-700));
  color: #fff;
  border-radius: var(--radius);
  padding: 30px 24px;
  box-shadow: var(--shadow);
}
.customer-hero img {
  width: 200px;
  max-width: 70%;
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}
.customer-hero h1 { color: #fff; font-size: clamp(26px, 6vw, 40px); margin-bottom: 12px; }
.customer-hero p:not(.eyebrow) { color: rgba(255, 255, 255, .9); font-size: 17px; max-width: 56ch; }
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--lime);
  margin: 0 0 8px;
}
.trust-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.trust-list span {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  background: rgba(255, 255, 255, .06);
}
.single-customer-card { max-width: 720px; margin-inline: auto; }

.secure-card, .document-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-kicker {
  display: inline-block;
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}
.prepared-for { color: var(--muted); margin-bottom: 14px; }
.code-input {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .4em;
  padding-left: .4em;
  min-height: 60px;
}

/* ----- Sign layout ------------------------------------------------------ */
.sign-layout { display: grid; gap: 18px; margin: 18px 0; }
.sign-summary {
  background: linear-gradient(140deg, var(--navy-900), var(--navy) 65%, var(--navy-700));
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.sign-summary img { width: 160px; max-width: 60%; background: #fff; border-radius: 10px; padding: 8px 12px; margin-bottom: 16px; }
.sign-summary h1 { color: #fff; font-size: clamp(24px, 5vw, 32px); }
.sign-summary p { color: rgba(255, 255, 255, .9); }
.sign-summary dl { display: grid; gap: 10px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .2); }
.sign-summary dt { color: var(--lime); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.sign-summary dd { margin: 2px 0 0; color: rgba(255, 255, 255, .92); }

.document-heading { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.document-heading h2 { margin: 0; }
.document-heading span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}

/* ----- Stepper ---------------------------------------------------------- */
.stepper { display: flex; gap: 6px; margin: 18px 0 22px; }
.stepper .step {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.stepper .step .dot {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tint);
  color: var(--muted);
  font-weight: 700;
  border: 2px solid var(--line-strong);
}
.stepper .step.active .dot { background: var(--green); border-color: var(--green); color: #fff; }
.stepper .step.active { color: var(--green-600); }

/* ----- Read-only summary card ------------------------------------------ */
.summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 16px 18px;
}
.summary-card dl { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
.summary-card .row { display: grid; gap: 1px; }
.summary-card dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.summary-card dd { margin: 0; font-weight: 600; color: var(--ink); }

/* ----- Confirmations card ---------------------------------------------- */
.confirm-block { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.confirm-block-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.confirm-counter { font-size: 13px; font-weight: 700; color: var(--muted); }
.confirm-counter.done { color: var(--green-600); }
.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-weight: 500;
  transition: background-color .12s ease;
}
.confirm-row:first-of-type { border-top: 0; }
.confirm-row:hover { background: var(--bg); }
.confirm-row input[type="checkbox"] { width: 24px; height: 24px; flex: 0 0 24px; min-height: 0; margin-top: 1px; accent-color: var(--green); cursor: pointer; }
.confirm-row.checked { background: var(--green-50); }

/* ----- Attestation statement ------------------------------------------- */
.attestation {
  background: var(--mint-50);
  border-left: 4px solid var(--lime);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 18px;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.6;
}
.attestation p { margin: 0; }
.legal-copy { background: var(--bg); }

/* ----- Signature method (segmented) ------------------------------------ */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-option {
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  min-height: 52px;
  padding: 0 12px;
  cursor: pointer;
}
.seg-option:hover { border-color: var(--green); background: var(--green-50); }
.seg-option.active { border-color: var(--green); background: var(--green-50); color: var(--green-600); box-shadow: inset 0 0 0 1px var(--green); }

.signature-preview {
  min-height: 92px;
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: "Signature Script", "Brush Script MT", "Segoe Script", cursive;
  font-size: 42px;
  line-height: 1.1;
  color: var(--ink);
}

/* DocuSign-style adopt-to-sign box */
.signature-adopt-box {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  min-height: 0;
  overflow: hidden;
}
.signature-adopt-box:hover { border-color: var(--green); background: var(--green-50); }
.signature-adopt-box .signature-preview { border: 0; background: transparent; width: 100%; opacity: .45; }
.signature-adopt-box .adopt-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--green-600);
  letter-spacing: .01em;
  text-transform: none;
  background: linear-gradient(0deg, rgba(231,246,236,.55), rgba(231,246,236,.55));
}
.signature-adopt-box.applied {
  border-style: solid;
  border-color: var(--green);
  cursor: default;
  background: var(--surface);
}
.signature-adopt-box.applied .signature-preview { opacity: 1; }
.signature-adopt-box.applied .adopt-hint { display: none; }
.sign-applied { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.applied-badge { color: var(--green-600); font-weight: 700; font-size: 14px; }
.signature-pad {
  display: block;
  width: 100%;
  height: 200px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  touch-action: none;
}
.signature-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.signature-image { max-width: 360px; border-bottom: 1px solid var(--ink); }

/* ----- Inline validation ------------------------------------------------ */
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 6px 0 0; }
.form-error {
  background: var(--danger-bg);
  border: 1px solid #f1c4bd;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 16px;
}

/* ----- Completion ------------------------------------------------------- */
.success-mark {
  width: 64px;
  height: 64px;
  margin: 4px auto 12px;
  border-radius: var(--radius-pill);
  background: var(--green-50);
  color: var(--green-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 800;
}

/* ==========================================================================
   AUDIT TIMELINE
   ========================================================================== */
.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 18px;
}
.status-summary .item { display: grid; gap: 2px; }
.status-summary .item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.status-summary .item .v { font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 4px 0 0; }
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 0 0 18px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 30px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid #cfe7f6;
}
.timeline .dot.good { background: var(--green-50); color: var(--green-600); border-color: var(--ok-line); }
.timeline .dot.bad { background: var(--danger-bg); color: var(--danger); border-color: #f1c4bd; }
.timeline .body { padding-top: 4px; }
.timeline .title { font-weight: 600; }
.timeline .time { font-size: 13px; color: var(--muted); }
.timeline .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }

/* ==========================================================================
   PRINTABLE DOCUMENT
   ========================================================================== */
.print-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.print-actions .muted { width: 100%; margin: 0; }
.paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: clamp(20px, 5vw, 44px);
  max-width: 820px;
  margin: 0 auto;
}

/* ----- e-signed attestation document (one clean page) ------------------- */
.attestation-doc { font-size: 12.5px; line-height: 1.5; color: #1c2b34; }
.attestation-doc .doc-head {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.attestation-doc .doc-logo { width: 124px; height: auto; flex: 0 0 auto; }
.attestation-doc .doc-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--green-600);
}
.attestation-doc h1 { margin: 2px 0 0; font-size: 23px; color: var(--navy); }
.doc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 30px; margin: 0 0 18px; }
.doc-fields .wide { grid-column: 1 / -1; }
.doc-fields dt { margin: 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.doc-fields dd { margin: 1px 0 0; font-weight: 600; }
.doc-attestation { margin: 0 0 14px; }
.doc-attestation h2,
.doc-cert-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); margin: 0; }
.doc-attestation p { margin: 6px 0 0; }
.doc-acks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 9px; }
.doc-acks li { position: relative; padding-left: 28px; }
.doc-acks li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--green);
  border-radius: 4px;
  color: var(--green-600);
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-sign { margin: 0 0 16px; }
.doc-sign-mark {
  min-height: 56px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1.5px solid #2a3942;
  padding-bottom: 4px;
  max-width: 380px;
}
.doc-sig-text { font-family: "Signature Script", "Brush Script MT", "Segoe Script", cursive; font-size: 38px; line-height: 1; color: #15303c; }
.doc-sig-img { max-height: 64px; max-width: 360px; }
.doc-sign-meta { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.doc-cert { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #f7faf9; }
.doc-cert-title { display: block; margin-bottom: 8px; }
.doc-cert-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.doc-cert-grid dt { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); align-self: center; }
.doc-cert-grid dd { margin: 0; font-size: 12px; }
.doc-hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10px; word-break: break-all; color: var(--ink-soft); }

/* ==========================================================================
   RESPONSIVE — tablet & up
   ========================================================================== */
@media (min-width: 640px) {
  main { margin-top: 30px; }
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .copy-box { grid-template-columns: 1fr 1fr; }
  .summary-card dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
  .summary-card .row.full { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 170px 1fr; }
}

@media (min-width: 980px) {
  .customer-shell { grid-template-columns: minmax(0, 1.05fr) minmax(380px, .8fr); gap: 30px; align-items: start; margin: 28px 0; }
  .customer-hero { padding: 40px 36px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  .single-customer-card { display: block; }

  .sign-layout { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .sign-summary { position: sticky; top: 22px; }
  .secure-card, .document-card { padding: 32px; }
}

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
  body { background: #fff; }
  .topbar, .print-actions { display: none; }
  main { width: 100%; margin: 0; }
  .paper { border: 0; padding: 0; box-shadow: none; max-width: none; }
  .form-grid { grid-template-columns: 170px 1fr; }
  .form-grid dd { break-inside: avoid; }
}
