/* ==========================================================================
   Signing ceremony — the screen recipients actually see.
   Owns the whole viewport (chrome: 'bare'). Every class is prefixed `sg-`.
   ========================================================================== */

.sg {
  --sg-tab-bg: var(--warn-100);
  --sg-tab-bd: color-mix(in srgb, var(--warn-500) 62%, transparent);
  --sg-tab-ink: var(--warn-700);
  --sg-paper-ink: var(--paper-ink);

  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-canvas);
}
/* Paper stays white in dark mode, so the sign-here tab keeps its light amber face. */
:root[data-theme="dark"] .sg {
  --sg-tab-bg: color-mix(in srgb, var(--warn-500) 62%, var(--n-0));
  --sg-tab-bd: color-mix(in srgb, var(--warn-500) 72%, var(--n-950));
  --sg-tab-ink: var(--n-950);
}

/* ------------------------------------------------------------- brandbar -- */
.sg-brandbar { display: flex; align-items: center; gap: var(--s-4); flex: none; color: var(--a-500); }
.sg-brandbar__mark { display: flex; }
.sg-brandbar__name {
  font-size: var(--fs-15); font-weight: 660; letter-spacing: -.02em;
  color: var(--tx-1); white-space: nowrap;
}
.sg-brandbar__name b { color: var(--a-600); font-weight: 660; }
.sg-brandbar--compact .sg-brandbar__name { display: none; }

.sg-slim {
  display: flex; align-items: center; gap: var(--s-6);
  height: var(--topbar-h); flex: none;
  padding: 0 var(--s-9);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--br-1);
}

/* ================================================================ top === */
.sg-top {
  display: flex; align-items: center; gap: var(--s-8);
  flex: none; min-height: 58px;
  padding: var(--s-5) var(--s-8);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--br-1);
}
.sg-top__l { display: flex; align-items: center; gap: var(--s-7); min-width: 0; flex: 1 1 34%; }
.sg-sender { display: flex; align-items: center; gap: var(--s-5); min-width: 0; }
.sg-sender__t { gap: 1px; min-width: 0; }
.sg-sender__who { font-size: var(--fs-12); color: var(--tx-3); white-space: nowrap; }
.sg-sender__who b { color: var(--tx-1); font-weight: 620; }
.sg-sender__subj { font-size: var(--fs-12); color: var(--tx-2); max-width: 300px; }

.sg-top__title {
  display: flex; align-items: center; gap: var(--s-4);
  min-width: 0; flex: 0 1 auto; justify-content: center;
  font-size: var(--fs-13); font-weight: 600; color: var(--tx-1);
}
.sg-top__title > span.truncate { max-width: 320px; }
.sg-top__docs { white-space: nowrap; }

.sg-top__r { display: flex; align-items: center; gap: var(--s-6); margin-left: auto; flex: none; }
.sg-count { display: flex; flex-direction: column; gap: 4px; min-width: 176px; }
.sg-count__t { font-size: var(--fs-11); font-weight: 560; color: var(--tx-2); white-space: nowrap; }
.sg-count .prog { width: 100%; }
.sg-finish { min-width: 104px; }

/* ============================================================= ribbon === */
.sg-ribbon-host { flex: none; }
.sg-ribbon {
  display: flex; align-items: center; gap: var(--s-7); flex-wrap: wrap;
  padding: var(--s-6) var(--s-8);
  background: var(--warn-50);
  border-bottom: 1px solid var(--warn-100);
  font-size: var(--fs-13);
}
.sg-ribbon__ic { color: var(--warn-500); flex: none; }
.sg-ribbon__body { min-width: 0; flex: 1 1 240px; }
.sg-ribbon__lead { font-weight: 620; color: var(--tx-1); }
.sg-ribbon__why { font-size: var(--fs-11); color: var(--tx-3); margin-top: 1px; }
.sg-ribbon__check {
  flex: none; padding: var(--s-4) var(--s-6);
  background: var(--bg-surface);
  border: 1px solid var(--warn-100);
  border-radius: var(--r-8);
  align-items: center;
}
.sg-ribbon__check .check__text { font-weight: 570; }
.sg-ribbon__check .check__box { margin-top: 0; }
.sg-ribbon__check.is-nudge { animation: sgNudge .62s var(--ease); border-color: var(--warn-500); }
@keyframes sgNudge {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}
.sg-ribbon__link {
  font-size: var(--fs-12); font-weight: 570; color: var(--tx-link);
  text-decoration: underline; text-underline-offset: 2px; flex: none;
}
.sg-ribbon__link:hover { color: var(--a-700); }

.sg-consented {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-8);
  background: var(--ok-50);
  border-bottom: 1px solid var(--ok-100);
  font-size: var(--fs-12); color: var(--tx-2);
}
.sg-consented__ic { color: var(--ok-500); flex: none; }
.sg-consented__link {
  font-size: var(--fs-12); color: var(--tx-link); font-weight: 550;
  text-decoration: underline; text-underline-offset: 2px; margin-left: auto;
}

/* ============================================================== stage === */
.sg-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sg-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; }

.sg-rail { flex: none; width: 122px; min-height: 0; display: flex; }
.sg-rail .thumbs { flex: 1 1 auto; min-height: 0; }
.sg-railtoggle { display: none; }

.sg-viewer { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sg-vbar {
  flex: none; display: flex; align-items: center; gap: var(--s-6);
  height: 42px; padding: 0 var(--s-7);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--br-1);
}
.sg-pagechip {
  font-size: var(--fs-11); font-weight: 600; color: var(--tx-2);
  background: var(--bg-sunken); border: 1px solid var(--br-1);
  border-radius: var(--r-pill); padding: 3px var(--s-6);
}
.sg-vstage { flex: 1 1 auto; min-height: 0; display: flex; }
.sg-vstage > .dv { flex: 1 1 auto; min-width: 0; }

/* ============================================================== fields == */
.sg-f {
  position: absolute;
  z-index: 6;
  display: flex; align-items: center;
  border-radius: 2px;
  background: color-mix(in srgb, var(--rc-fill) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc-bd) 50%, transparent);
  font-family: var(--font-sans);
  color: var(--sg-paper-ink);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.sg-f:hover { background: color-mix(in srgb, var(--rc-fill) 88%, transparent); border-color: var(--rc-bd); }
.sg-f.is-filled { background: transparent; border-color: color-mix(in srgb, var(--rc-bd) 26%, transparent); }
.sg-f.is-filled:hover { background: color-mix(in srgb, var(--rc-fill) 34%, transparent); }

/* required / optional edge marker */
.sg-f::after {
  content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 3px; border-radius: 2px 0 0 2px; pointer-events: none; z-index: 3;
  background: var(--err-500);
}
.sg-f--opt::after { width: 2px; background: var(--rc-bd); opacity: .45; }
.sg-f--checkbox::after, .sg-f--radio::after { display: none; }

/* enlarge the hit area of very small fields */
.sg-f--checkbox { justify-content: center; }
.sg-f--checkbox .sg-check::before { content: ""; position: absolute; inset: -12px; }

/* current target */
.sg-f.is-target { z-index: 9; }
.sg-f.is-target::before {
  content: ""; position: absolute; inset: -4px;
  border: 2px solid var(--a-500); border-radius: 4px;
  pointer-events: none; z-index: 1;
  animation: sgRing 1.5s var(--ease) infinite;
}
@keyframes sgRing {
  0%, 100% { opacity: .95; transform: scale(1); }
  50% { opacity: .3; transform: scale(1.05); }
}

.sg-f.is-invalid { border-color: var(--err-500); background: color-mix(in srgb, var(--err-50) 80%, transparent); }
.sg-f.is-locked { cursor: not-allowed; filter: grayscale(.4); opacity: .68; }
.sg-f.is-locked .sg-tab { box-shadow: none; }

.sg-f.is-applied { animation: sgApplied .46s var(--ease-spring); }
@keyframes sgApplied {
  0% { transform: scale(.84); opacity: .25; }
  62% { transform: scale(1.035); opacity: 1; }
  100% { transform: scale(1); }
}
.sg-f__flash {
  position: absolute; right: -2px; top: -17px; z-index: 10;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 5px; border-radius: var(--r-pill);
  background: var(--ok-500); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
  animation: sgFlash 1s var(--ease-out) forwards;
  pointer-events: none;
}
@keyframes sgFlash {
  0% { opacity: 0; transform: translateY(4px) scale(.85); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* ---- the yellow sign-here tab ---- */
.sg-tab {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--sg-tab-bg);
  border: 1px solid var(--sg-tab-bd);
  border-radius: 2px;
  color: var(--sg-tab-ink);
  font-size: 11px; font-weight: 680; letter-spacing: .01em;
  box-shadow: var(--sh-sm);
  transition: filter var(--dur-2) var(--ease);
}
.sg-tab svg { width: 12px; height: 12px; }
.sg-tab:hover { filter: brightness(1.04) saturate(1.1); }
.sg-tab:active { transform: translateY(.5px); }
.sg-tab::before, .sg-tab::after {
  content: ""; position: absolute; top: 50%;
  width: 0; height: 0; border-style: solid; border-color: transparent;
  transform: translateY(-50%);
}
.sg-tab::before { left: -9px; border-width: 9px 9px 9px 0; border-right-color: var(--sg-tab-bd); }
.sg-tab::after { left: -7px; border-width: 7px 7px 7px 0; border-right-color: var(--sg-tab-bg); }
.sg-f--initials .sg-tab { font-size: 9.5px; gap: 2px; }
.sg-f--initials .sg-tab svg { display: none; }

/* ---- filled signature ---- */
.sg-f__sig { display: flex; align-items: center; justify-content: flex-start; padding: 0 4px; overflow: hidden; width: 100%; }
.sg-f__sig .sigvis__type { color: var(--sg-paper-ink); }
.sg-f__change {
  position: absolute; right: -1px; top: -16px; z-index: 8;
  display: none; align-items: center; gap: 2px;
  padding: 1px 5px; border-radius: var(--r-4) var(--r-4) 0 0;
  background: var(--a-500); color: #fff;
  font-size: 9px; font-weight: 650; letter-spacing: .02em; white-space: nowrap;
}
.sg-f__change svg { width: 10px; height: 10px; }
.sg-f:hover .sg-f__change,
.sg-f:focus-within .sg-f__change { display: inline-flex; }

/* ---- read-only auto fills ---- */
.sg-f--auto { background: color-mix(in srgb, var(--rc-fill) 34%, transparent); cursor: default; }
.sg-f--auto:hover { background: color-mix(in srgb, var(--rc-fill) 40%, transparent); }
.sg-f__ink {
  padding: 0 5px; width: 100%;
  font-size: 11px; line-height: 1.2; color: var(--sg-paper-ink);
}
.sg-f__ph { position: absolute; left: 5px; font-size: 10px; color: color-mix(in srgb, var(--rc-ink) 55%, transparent); }
.sg-f.is-filled .sg-f__ph { display: none; }

/* ---- text input ---- */
.sg-input {
  width: 100%; height: 100%;
  border: 0; background: transparent;
  padding: 0 5px;
  font-family: var(--font-sans); font-size: 11px;
  color: var(--sg-paper-ink);
}
.sg-input::placeholder { color: color-mix(in srgb, var(--rc-ink) 48%, transparent); }
.sg-input:focus { outline: 2px solid var(--a-500); outline-offset: -2px; border-radius: 1px; }

/* ---- checkbox ---- */
.sg-check {
  position: relative;
  width: 100%; height: 100%;
  display: grid; place-content: center;
  color: var(--rc-ink);
}
.sg-check svg { width: 74%; height: 74%; stroke-width: 2.6; }

/* ---- radio group ---- */
.sg-radio { display: flex; flex-direction: column; justify-content: center; gap: 3px; width: 100%; padding: 2px 4px; }
.sg-radio__row { display: flex; align-items: center; gap: 5px; cursor: pointer; position: relative; }
.sg-radio__row input { position: absolute; opacity: 0; width: 11px; height: 11px; margin: 0; }
.sg-radio__dot {
  flex: none; width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid var(--rc-bd); background: var(--paper);
}
.sg-radio__row input:checked + .sg-radio__dot { border-width: 3.5px; border-color: var(--rc-bd); }
.sg-radio__row input:focus-visible + .sg-radio__dot { box-shadow: 0 0 0 2px var(--a-300); }
.sg-radio__t { font-size: 9.5px; color: var(--sg-paper-ink); line-height: 1.15; }

/* ---- dropdown ---- */
.sg-select {
  width: 100%; height: 100%;
  border: 0; background: transparent;
  padding: 0 4px;
  font-family: var(--font-sans); font-size: 10.5px;
  color: var(--sg-paper-ink);
  appearance: none; cursor: pointer;
}
.sg-select:focus { outline: 2px solid var(--a-500); outline-offset: -2px; }

/* ---- attachment ---- */
.sg-attach {
  display: flex; align-items: center; gap: 4px;
  width: 100%; height: 100%; padding: 0 5px;
  font-size: 10px; font-weight: 560; color: var(--rc-ink);
  text-align: left;
}
.sg-attach.is-on { color: var(--sg-paper-ink); font-weight: 500; }
.sg-attach__x {
  flex: none; display: grid; place-content: center;
  width: 13px; height: 13px; border-radius: 50%;
  background: color-mix(in srgb, var(--rc-bd) 20%, transparent); color: var(--rc-ink);
}
.sg-attach__x:hover { background: var(--err-500); color: #fff; }

/* ---- approve ---- */
.sg-approve {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  width: 100%; height: 100%;
  font-size: 10.5px; font-weight: 650; color: var(--rc-ink);
}
.sg-approve.is-on { color: var(--ok-700); }

/* ---- sheet stub (field too small to edit inline) ---- */
.sg-stub {
  display: flex; align-items: center; gap: 3px;
  width: 100%; height: 100%; padding: 0 4px;
  font-size: 10.5px; color: var(--sg-paper-ink); text-align: left;
}
.sg-stub svg { flex: none; opacity: .6; }
.sg-stub--ph { color: color-mix(in srgb, var(--rc-ink) 55%, transparent); }

/* ---- validation message ---- */
.sg-f__msg {
  position: absolute; left: 0; top: calc(100% + 3px); z-index: 10;
  display: inline-flex; align-items: center; gap: 3px;
  max-width: 260px; padding: 2px 5px;
  border-radius: var(--r-3);
  background: var(--err-500); color: #fff;
  font-size: 9.5px; font-weight: 560; line-height: 1.3;
  pointer-events: none;
}
.sg-f__msg--above { top: auto; bottom: calc(100% + 3px); }
.sg-f__msg svg { flex: none; }

/* ---- other recipients' fields ---- */
.sg-ghost {
  position: absolute; z-index: 4; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  overflow: hidden; border-radius: 2px;
  background: color-mix(in srgb, var(--rc-fill) 24%, transparent);
  border: 1px dashed color-mix(in srgb, var(--rc-bd) 42%, transparent);
}
.sg-ghost__t {
  font-family: var(--font-sans); font-size: 9px; font-weight: 680;
  text-transform: uppercase; letter-spacing: .05em;
  color: color-mix(in srgb, var(--rc-ink) 72%, transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sg-ghost__done { color: var(--ok-500); display: flex; }

/* =========================================================== navigator == */
.sg-navhost { position: relative; }
.sg-nav {
  position: fixed; left: 50%; top: 50%;
  z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--s-7);
  padding: var(--s-5) var(--s-6);
  background: var(--bg-raised);
  border: 1px solid var(--br-2);
  border-radius: var(--r-12);
  box-shadow: var(--sh-lg);
  transition: left var(--dur-3) var(--ease), top var(--dur-3) var(--ease);
}
.sg-nav__meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sg-nav__count { font-size: var(--fs-12); font-weight: 620; color: var(--tx-1); white-space: nowrap; }
.sg-nav__hint { font-size: var(--fs-11); color: var(--tx-3); white-space: nowrap; }
.sg-nav__btn { --btn-h: 38px; border-radius: var(--r-8); }
.sg-nav.is-ready .sg-nav__count { color: var(--ok-600); }
.sg-navhost.is-locked .sg-nav { opacity: .78; }

/* ============================================================= sealing == */
.sg-seal {
  position: absolute; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center;
  padding: var(--s-8);
  background: var(--bg-scrim);
  backdrop-filter: blur(2px);
  animation: fadeIn var(--dur-3) var(--ease-out);
}
.sg-seal__card {
  width: min(420px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-5);
  padding: var(--s-12) var(--s-10);
  text-align: center;
  background: var(--bg-surface);
  border-radius: var(--r-12);
  box-shadow: var(--sh-xl);
}
.sg-seal__spin { color: var(--a-500); }
.sg-seal__t { font-size: var(--fs-16); font-weight: 620; letter-spacing: -.01em; }
.sg-seal__s { font-size: var(--fs-12); color: var(--tx-3); }
.sg-seal__steps { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-5); width: 100%; }
.sg-seal__step {
  display: flex; align-items: center; gap: var(--s-5);
  font-size: var(--fs-12); color: var(--tx-4);
  opacity: .5; transition: opacity var(--dur-3) var(--ease), color var(--dur-3) var(--ease);
  text-align: left;
}
.sg-seal__dot {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--br-3);
  transition: background var(--dur-3) var(--ease), border-color var(--dur-3) var(--ease);
}
.sg-seal__step.is-on { opacity: 1; color: var(--tx-2); }
.sg-seal__step.is-on .sg-seal__dot { background: var(--ok-500); border-color: var(--ok-500); }

/* ====================================================== single-panel === */
.sg-single { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; padding: var(--s-12) var(--s-8); }
.sg-single__card {
  margin: auto; width: 100%; max-width: 540px;
  padding: var(--s-12) var(--s-11);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-7);
}
.sg-single__art {
  width: 62px; height: 62px; border-radius: var(--r-16);
  display: grid; place-content: center;
  background: var(--bg-sunken); color: var(--tx-3);
  border: 1px solid var(--br-1);
}
.sg-single__art--ok { background: var(--ok-50); color: var(--ok-500); border-color: var(--ok-100); }
.sg-single__art--err { background: var(--err-50); color: var(--err-500); border-color: var(--err-100); }
.sg-single__art--warn { background: var(--warn-50); color: var(--warn-500); border-color: var(--warn-100); }
.sg-single__art--info { background: var(--a-50); color: var(--a-600); border-color: var(--a-100); }
.sg-single__title { font-size: var(--fs-20); font-weight: 640; letter-spacing: -.016em; }
.sg-single__text { font-size: var(--fs-13); color: var(--tx-2); line-height: 1.65; max-width: 44ch; }
.sg-single__meta { width: 100%; text-align: left; padding-top: var(--s-4); border-top: 1px solid var(--br-1); }
.sg-single__meta .kv { font-size: var(--fs-12); }
.sg-single__sub {
  font-size: var(--fs-11); font-weight: 620; color: var(--tx-4);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-4);
}
.sg-single__trail { width: 100%; text-align: left; }
.sg-single__dl { justify-content: center; flex-wrap: wrap; }
.sg-single__actions { display: flex; gap: var(--s-5); flex-wrap: wrap; justify-content: center; width: 100%; }
.sg-single__card .empty { padding: 0; }

.sg-order { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.sg-order__row {
  display: flex; align-items: center; gap: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-6);
  font-size: var(--fs-12); color: var(--tx-2);
}
.sg-order__row + .sg-order__row { border-top: 1px solid var(--br-1); }
.sg-order__n {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--bg-sunken); border: 1px solid var(--br-2);
  font-size: var(--fs-11); font-weight: 650; color: var(--tx-3);
}
.sg-order__row.is-done .sg-order__n { background: var(--ok-500); border-color: var(--ok-500); color: #fff; }
.sg-order__row.is-now { background: var(--bg-selected); }
.sg-order__row.is-now .sg-order__n { border-color: var(--a-500); color: var(--a-600); }

.sg-quote {
  width: 100%; text-align: left;
  padding: var(--s-6) var(--s-7);
  background: var(--bg-sunken);
  border: 1px solid var(--br-1);
  border-left: 3px solid var(--br-3);
  border-radius: var(--r-6);
}
.sg-quote__label {
  font-size: var(--fs-11); font-weight: 620; color: var(--tx-4);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-3);
}
.sg-quote blockquote { font-size: var(--fs-13); color: var(--tx-2); line-height: 1.6; font-style: italic; }

/* ============================================================ access === */
.sg-code { max-width: 470px; }
.sg-code__env {
  display: flex; align-items: center; gap: var(--s-5);
  width: 100%; text-align: left;
  padding: var(--s-5) var(--s-6);
  background: var(--bg-sunken); border: 1px solid var(--br-1);
  border-radius: var(--r-8);
}
.sg-code__field { width: 100%; text-align: left; }
.sg-code__input {
  text-align: center; letter-spacing: .32em; font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.sg-code .btn--block { width: 100%; }
.sg-code__alt { display: flex; gap: var(--s-5); justify-content: center; flex-wrap: wrap; }

/* ========================================================== completion = */
.sg-done { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--s-12) var(--s-8) var(--s-14); }
.sg-done > * { max-width: 940px; margin-inline: auto; }
.sg-done__hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-5); }
.sg-done__badge {
  width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--ok-50); color: var(--ok-500);
  border: 1px solid var(--ok-100);
  animation: sgPop var(--dur-5) var(--ease-spring);
}
@keyframes sgPop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.sg-done__title { font-size: var(--fs-28); font-weight: 660; letter-spacing: -.02em; }
.sg-done__text { font-size: var(--fs-13); color: var(--tx-2); line-height: 1.65; max-width: 56ch; }
.sg-done__env {
  display: flex; align-items: center; gap: var(--s-4);
  font-size: var(--fs-12); color: var(--tx-3);
  padding: var(--s-3) var(--s-6);
  background: var(--bg-surface); border: 1px solid var(--br-1);
  border-radius: var(--r-pill); max-width: 100%;
}
.sg-done__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-8);
  margin-top: var(--s-11);
}
.sg-done__card { display: flex; flex-direction: column; }
.sg-done__card .card__body { flex: 1 1 auto; }
.sg-done__links {
  display: flex; gap: var(--s-5); flex-wrap: wrap; justify-content: center;
  margin-top: var(--s-10);
}

.sg-promo {
  display: flex; align-items: flex-start; gap: var(--s-9);
  margin-top: var(--s-8); padding: var(--s-10);
  background: linear-gradient(135deg, var(--a-25), var(--bg-surface) 62%);
  border-color: var(--a-100);
}
.sg-promo__art {
  flex: none; width: 52px; height: 52px; border-radius: var(--r-12);
  display: grid; place-content: center;
  background: var(--bg-surface); color: var(--a-500);
  border: 1px solid var(--a-100);
}
.sg-promo__t { font-size: var(--fs-16); font-weight: 640; letter-spacing: -.012em; }
.sg-promo__s { font-size: var(--fs-13); color: var(--tx-2); line-height: 1.6; margin-top: var(--s-3); max-width: 62ch; }
.sg-promo__list { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-8); margin-top: var(--s-6); }
.sg-promo__list li { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-12); color: var(--tx-2); }
.sg-promo__list svg { color: var(--ok-500); flex: none; }
.sg-promo__cta { flex: none; display: flex; flex-direction: column; gap: var(--s-4); align-items: stretch; }

/* ============================================================= modals == */
.sg-prose p { font-size: var(--fs-13); color: var(--tx-2); line-height: 1.7; }
.sg-prose p + p { margin-top: var(--s-6); }
.sg-about__meta { padding-top: var(--s-7); border-top: 1px solid var(--br-1); }

.sg-help__row { padding-bottom: var(--s-6); border-bottom: 1px solid var(--br-1); }
.sg-help__row:last-child { border-bottom: 0; padding-bottom: 0; }
.sg-help__q { font-size: var(--fs-13); font-weight: 620; }
.sg-help__a { font-size: var(--fs-12); color: var(--tx-2); line-height: 1.6; margin-top: var(--s-3); }

.sg-disc { display: flex; flex-direction: column; gap: var(--s-7); }
.sg-disc__head {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--tx-4); text-align: center;
}
.sg-disc__scroll {
  max-height: min(50vh, 420px); overflow-y: auto;
  padding: var(--s-8);
  background: var(--bg-sunken);
  border: 1px solid var(--br-1);
  border-radius: var(--r-8);
  font-size: var(--fs-12); line-height: 1.7; color: var(--tx-2);
}
.sg-disc__scroll:focus-visible { outline: 2px solid var(--a-500); outline-offset: 1px; }
.sg-disc__sec + .sg-disc__sec { margin-top: var(--s-8); }
.sg-disc__sec p + p { margin-top: var(--s-5); }
.sg-disc__h {
  font-size: var(--fs-13); font-weight: 660; color: var(--tx-1);
  margin-bottom: var(--s-4);
}
.sg-disc__rows { margin: var(--s-6) 0; }
.sg-disc__rows .kv { font-size: var(--fs-12); gap: var(--s-4) var(--s-7); }
.sg-disc__ul { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-5); }
.sg-disc__ul li { display: flex; gap: var(--s-5); align-items: flex-start; }
.sg-disc__ul svg { flex: none; margin-top: 3px; color: var(--ok-500); }
.sg-disc__copy { padding-top: var(--s-2); }
.sg-disc__foot { max-width: 46%; line-height: 1.4; }

.sg-offenders { display: flex; flex-direction: column; gap: 2px; }
.sg-offenders__row {
  display: flex; align-items: center; gap: var(--s-6);
  width: 100%; padding: var(--s-5) var(--s-6);
  border-radius: var(--r-6); text-align: left;
  transition: background var(--dur-1) var(--ease);
}
.sg-offenders__row:hover { background: var(--bg-hover); }
.sg-offenders__ic { display: flex; color: var(--err-500); flex: none; }
.sg-offenders__t { font-size: var(--fs-13); font-weight: 570; }
.sg-offenders__s { font-size: var(--fs-11); color: var(--tx-3); }

.sg-history { margin: 0 calc(var(--s-2) * -1); max-height: 58vh; overflow-y: auto; }

.sg-counter { font-size: var(--fs-11); color: var(--tx-3); font-variant-numeric: tabular-nums; }
.sg-counter.is-ok { color: var(--ok-600); }

.sg-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-7); }
.sg-steps { display: flex; flex-direction: column; gap: var(--s-6); }
.sg-steps__row { display: flex; gap: var(--s-6); align-items: flex-start; font-size: var(--fs-13); color: var(--tx-2); line-height: 1.55; }
.sg-steps__n {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--a-50); color: var(--a-600);
  font-size: var(--fs-11); font-weight: 680;
}

.sg-sheet__list { display: flex; flex-direction: column; gap: 2px; margin: 0 calc(var(--s-3) * -1); }
.sg-sheet__item {
  display: flex; align-items: center; gap: var(--s-7);
  width: 100%; padding: var(--s-6) var(--s-6);
  border-radius: var(--r-8); text-align: left;
}
.sg-sheet__item:hover { background: var(--bg-hover); }
.sg-sheet__item svg { color: var(--tx-3); flex: none; }
.sg-sheet__item.is-danger { color: var(--err-600); }
.sg-sheet__item.is-danger svg { color: var(--err-500); }
.sg-sheet__item:disabled { opacity: .45; }
.sg-sheet__t { display: block; font-size: var(--fs-14); font-weight: 560; }
.sg-sheet__s { display: block; font-size: var(--fs-11); color: var(--tx-3); margin-top: 1px; }

/* ============================================================= footer == */
.sg-foot {
  flex: none;
  display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap;
  padding: var(--s-5) var(--s-9);
  background: var(--bg-surface);
  border-top: 1px solid var(--br-1);
  font-size: var(--fs-11); color: var(--tx-3);
}
.sg-foot__powered b { color: var(--tx-2); font-weight: 620; }
.sg-foot__sep { color: var(--tx-4); }
.sg-foot__links { display: flex; gap: var(--s-6); flex-wrap: wrap; }
.sg-foot__link { font-size: var(--fs-11); color: var(--tx-3); }
.sg-foot__link:hover { color: var(--tx-accent); text-decoration: underline; text-underline-offset: 2px; }
.sg-foot__copy { margin-left: auto; }

/* ========================================================= responsive == */
@media (max-width: 1180px) {
  .sg-sender__subj { max-width: 190px; }
  .sg-top__title > span.truncate { max-width: 210px; }
  .sg-count { min-width: 148px; }
}

@media (max-width: 1000px) {
  .sg-top { flex-wrap: wrap; row-gap: var(--s-5); }
  .sg-top__title { order: 3; flex: 1 1 100%; justify-content: flex-start; }
  .sg-top__title > span.truncate { max-width: none; }

  .sg-body { flex-direction: column; }
  .sg-rail {
    width: auto; max-height: 0; overflow: hidden;
    border-right: 0; border-bottom: 1px solid var(--br-1);
    transition: max-height var(--dur-3) var(--ease);
  }
  .sg-rail.is-open { max-height: 138px; }
  .sg-rail .thumbs {
    width: 100%; height: auto;
    overflow-x: auto; overflow-y: hidden;
    padding: var(--s-5) var(--s-6);
    border-right: 0;
  }
  .sg-rail .thumbs__inner { flex-direction: row; align-items: flex-start; }
  .sg-railtoggle { display: inline-flex; }
  .sg-viewer { flex: 1 1 auto; min-height: 0; }

  .sg-done__grid { grid-template-columns: 1fr; }
  .sg-promo { flex-direction: column; gap: var(--s-7); }
  .sg-promo__cta { width: 100%; }
}

@media (max-width: 760px) {
  .sg-top { min-height: 52px; padding: var(--s-4) var(--s-6); gap: var(--s-5); }
  .sg-top__l { flex: 1 1 auto; gap: var(--s-5); }
  .sg-sender__subj { display: none; }
  .sg-sender__who { font-size: var(--fs-11); }
  .sg-count { display: none; }
  .sg-other__label { display: none; }
  .sg-other { width: 34px; padding: 0; justify-content: center; }
  .sg-finish { min-width: 0; }
  .sg-top__title { font-size: var(--fs-12); }

  .sg-ribbon { padding: var(--s-5) var(--s-6); gap: var(--s-5); }
  .sg-ribbon__check { width: 100%; }
  .sg-ribbon__link { font-size: var(--fs-11); }
  .sg-vbar { padding: 0 var(--s-5); gap: var(--s-4); }

  /* the guided navigator becomes a fixed bottom bar */
  .sg-nav {
    left: 0 !important; right: 0; bottom: 0; top: auto !important;
    border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding: var(--s-5) var(--s-6);
    padding-bottom: max(var(--s-5), env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px -8px var(--bg-scrim);
  }
  .sg-nav__btn { flex: 0 0 auto; min-width: 132px; margin-left: auto; }
  /* reserve the bottom bar's height so it never covers the footer or the page */
  .sg--ceremony { padding-bottom: 62px; }

  .sg-single { padding: var(--s-9) var(--s-6) var(--s-12); }
  .sg-single__card { padding: var(--s-10) var(--s-8); }
  .sg-single__actions .btn { flex: 1 1 auto; }
  .sg-done { padding: var(--s-9) var(--s-6) var(--s-13); }
  .sg-done__title { font-size: var(--fs-24); }
  .sg-done__links .btn { flex: 1 1 auto; }
  .sg-form { grid-template-columns: 1fr; }
  .sg-disc__scroll { max-height: 46vh; padding: var(--s-6); }
  .sg-disc__foot { display: none; }
  .sg-foot { padding: var(--s-4) var(--s-6); justify-content: center; text-align: center; row-gap: var(--s-2); }
  .sg-foot__copy { margin-left: 0; flex: 1 1 100%; }
  .sg--ceremony .sg-foot__copy { display: none; }
}

@media (max-width: 420px) {
  .sg-brandbar--compact { display: none; }
  .sg-nav__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-f.is-target::before { animation: none; }
  .sg-nav { transition: none; }
}
