/* =====================================================================
   ThrivoSign NEXT: the approved UI/UX revamp layer
   ---------------------------------------------------------------------
   Specification: docs/ui-revamp/BUILD-CONTRACT.md
   Visual targets: docs/ui-revamp/reference-screens.html

   Load order (everywhere that loads the design layer):
       tokens -> page CSS -> ui -> components -> next

   This file is LAST on purpose. It does three things, in this order:

     1. Re-points the existing tokens. Almost every colour in
        thrivosign-ui.css is already var(--fs-brand-action) and friends, so
        moving the token moves the whole product from orange buttons to
        navy buttons without touching 2,500 lines of rules.
     2. Re-skins the two big existing surfaces (app shell, document
        manager) and turns the login family into the "focus screen".
     3. Adds the new components from contract section 3.5.

   Rules this file lives by (contract section 1):
     * No raw hex outside this :root block. Add a token first.
     * px, not rem (Bootstrap 3 sets the root to 10px).
     * Orange is used for exactly one thing: the tick inside the seal.
     * Remove the one <link> to this file to revert the whole revamp.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */
:root {
  /* Action colour. Was #b25a00 (orange, 4.82:1). Navy is 12.6:1 on white
     and is the colour of the logo, so an action reads as "ThrivoSign"
     rather than as a warning. */
  --fs-brand-action:       #003365;
  --fs-brand-action-hover: #06284f;
  --fs-brand-action-quiet: #eaf0f7;
  --fs-brand-border:       #c9d6e8;

  /* The old "display orange" was used for decorative edges, dashed drop
     zones and the active tile underline. It becomes a mid navy-blue
     (4.0:1, borders and large graphics only). */
  --fs-brand-display:      #2f6fb5;
  --fs-brand-gradient:     linear-gradient(150deg, #123a6e 0%, #0b2a55 55%, #001d43 100%);

  /* Page ground: cool, not the warm #faf7f2 of the first pass. */
  --fs-canvas:             #f3f6fb;
  --fs-canvas-sunk:        #e9eef5;

  /* Orange survives for one job. Never a button, link or text on white. */
  --fs-seal:               #ff8200;     /* 5.1:1 on #003365, 6.7:1 on #001d43 */
  --fs-on-navy-accent:     #ffffff;     /* was orange; the rail marker is no longer orange */

  /* Trust surfaces: the only large navy areas (trust card, signer dock,
     sealed panel, focus-screen illustration panel). */
  --fs-navy-trust:         #0b2a55;
  --fs-navy-raised:        #123a6e;
  --fs-navy-edge:          #2f5b93;
  --fs-on-trust:           #ffffff;
  --fs-on-trust-muted:     #b9c8dc;     /* 8.4:1 on --fs-navy-trust */
  --fs-trust-track:        #2a4a78;     /* ink-stroke track on navy */

  /* Text. --fs-text-3 is for dates and captions: 5.2:1 on white, 4.8:1 on
     the canvas. #7d8ba0 (3.5:1) is allowed for icons and placeholders only. */
  --fs-text:               #0f1b2d;
  --fs-text-2:             #5b6b82;
  --fs-text-3:             #5f6e84;
  --fs-line:               #e3e9f1;
  --fs-field-line:         #d3dce8;
  --fs-icon-muted:         #7d8ba0;

  --fs-radius-btn:         10px;
  --fs-radius-focus:       18px;

  /* Shadows are tinted navy, never black. */
  --fs-shadow-sm:          0 1px 2px rgba(0, 51, 101, 0.06);
  --fs-shadow-md:          0 2px 8px rgba(0, 51, 101, 0.10);
  --fs-shadow-lg:          0 8px 28px rgba(0, 51, 101, 0.14), 0 2px 6px rgba(0, 51, 101, 0.06);
  --fs-shadow-dock:        0 8px 24px rgba(0, 29, 67, 0.25);
  --fs-shadow-focus-card:  0 24px 60px rgba(0, 29, 67, 0.35);
  --fs-veil:               rgba(0, 29, 67, 0.42);
  --fs-veil-solid:         rgba(0, 29, 67, 0.72);   /* where backdrop-filter is unsupported */

  /* Recipient colours: solid (dots, borders) / fill / text on the fill.
     They follow recipient ORDER and repeat after six. */
  --fs-rcp-1: #2f6fbf;  --fs-rcp-1-fill: #e8f1fb;  --fs-rcp-1-text: #1a4f8a;
  --fs-rcp-2: #1d9e75;  --fs-rcp-2-fill: #e1f5ee;  --fs-rcp-2-text: #085041;
  --fs-rcp-3: #7f77dd;  --fs-rcp-3-fill: #eeedfe;  --fs-rcp-3-text: #3c3489;
  --fs-rcp-4: #d4537e;  --fs-rcp-4-fill: #fbeaf0;  --fs-rcp-4-text: #72243e;
  --fs-rcp-5: #0e7490;  --fs-rcp-5-fill: #e0f2f7;  --fs-rcp-5-text: #0b4f63;
  --fs-rcp-6: #8a6d3b;  --fs-rcp-6-fill: #f6efe2;  --fs-rcp-6-text: #5a4520;

  /* Bootstrap 5 palette (core/css/bootstrap.min.css) follows the brand. */
  --bs-primary-rgb:        0, 51, 101;
  --bs-link-color-rgb:     0, 51, 101;
}

/* ---------------------------------------------------------------------
   2. APP SHELL: light navigation rail
   ---------------------------------------------------------------------
   Same markup, same JS (.menuline / .headline / .contline). The first
   pass made the rail dark navy with an orange marker; the approved design
   keeps navy for trust moments only, so the rail is light and the active
   item is a white pill. Contract S1. The 56px icon-only rail with a
   bottom tab bar on phones is the remaining part of S1 (new fragments).
   ---------------------------------------------------------------------
   The legacy nav icons are dark SVGs; the active ones (icon_a_*) are
   orange. brightness(0) turns every one into ink, so no icon is orange.
   ------------------------------------------------------------------- */
.menuline {
  background: var(--fs-brand-action-quiet);
  box-shadow: none;
  border-right: 1px solid var(--fs-line);
}
.menuline .logo {
  background-image: url(brand/pqctrust-mark.svg);
  background-size: 32px auto;
  background-position: 18px center;
  border-bottom: 1px solid var(--fs-line);
}
.menuline.less .logo {
  background-image: url(brand/pqctrust-mark.svg);
  background-size: 28px auto;
}

.menuline > ul > li > a,
.menuline > ul > li .focus b {
  color: var(--fs-text-2);
}
.menuline > ul > li:hover > a,
.menuline > ul > li:hover > .focus b {
  color: var(--fs-brand-action);
  background: rgba(0, 51, 101, 0.06);
}
/* !important mirrors thrivosign-ui.css section 15, which had to beat
   masterCss.css's own !important. Navy rail + white pill + bold: three
   signals, so the state survives greyscale. */
.menuline > ul > li.active > a,
.menuline > ul > li.active .focus b {
  color: var(--fs-brand-action);
  background: #fff !important;
  box-shadow: var(--fs-shadow-sm);
  border-left-color: var(--fs-brand-action);
}
.menuline > ul > li .focus.block b { background: rgba(0, 51, 101, 0.06); }

/* Idle icons are the grey legacy set. thrivosign-ui.css inverted them to
   white for the dark rail; on the light rail they just show as they are.
   Active icons (icon_a_*) were recoloured from orange to navy at source by
   tools/retheme_svg_assets.py. */
.menuline > ul > li:not(.active) > a:before,
.menuline > ul > li:not(.active) .focus b:before,
.menuline.less > ul > li:not(.active):not(:first-child):before {
  filter: none;
  opacity: .8;
}
.menuline > ul > li.active > a:before,
.menuline > ul > li.active .focus b:before { filter: none; opacity: 1; }
.menuline > ul > li:hover > a:before,
.menuline > ul > li:hover .focus b:before { opacity: 1; }
.menuline > ul > li b:after,
.menuline > ul > li.active:after,
.menuline > ul > li .focus.block b:after {
  filter: none;
  opacity: .6;
}

.menuline > ul > li > .focus > ul > li,
.menuline > ul > li > .focus > ul > li > a { color: var(--fs-text-2); }
.menuline > ul > li > .focus > ul > li:hover a {
  color: var(--fs-brand-action);
  background: rgba(0, 51, 101, 0.06);
}
.menuline > ul > li > .focus > ul > li.active > a,
.menuline > ul > li > .focus > ul > li.active::marker {
  color: var(--fs-brand-action);
  font-weight: var(--fs-weight-semibold);
}
.menuline > ul > li > .focus > ul > li.active > a { background: #fff; }

/* Collapsed rail flyout: white card, not navy. */
.menuline.less > ul > li > .focus {
  background: #fff;
  border: 1px solid var(--fs-line);
  box-shadow: var(--fs-shadow-lg);
}
.menuline.less > ul > li .focus.block > b {
  border-bottom: 1px solid var(--fs-line);
  color: var(--fs-brand-action);
}
.menuline.less > ul > li.active { background: #fff; }
.menuline.less > ul > li:hover  { background: rgba(0, 51, 101, 0.06); }

.headline { border-bottom-color: var(--fs-line); }
.headline .account span { color: var(--fs-text); }

/* The drop zone on the older home page was width:100% plus padding and
   border, so it stuck out of its card (4px on desktop, 24px on a phone). */
.boxfile,
.boxfile .nenupload { box-sizing: border-box; max-width: 100%; }

/* Small supporting text that read below AA (found by tools/ui_audit.mjs):
   the "pdf, docx ..." hint under the drop zone, the idle wizard step
   numbers, and the version tag on the login card. */
.boxfile .nenupload span,
.boxfile .nenupload i,
.boxfile .nenupload p { color: var(--fs-text-3); }
.stepByLine ul li:not(.active):not(.done) i { color: var(--fs-text-2); }
.fullset .form_Area > label:last-child { color: var(--fs-text-3); }

/* ---------------------------------------------------------------------
   3. BUTTONS and controls
   ------------------------------------------------------------------- */
.fs-btn { border-radius: var(--fs-radius-btn); font-weight: var(--fs-weight-semibold); }
.fs-btn--secondary { border-color: var(--fs-field-line); }
.fs-btn--danger-ghost { background: transparent; color: var(--fs-danger-fg); }
.fs-btn--danger-ghost:hover { background: var(--fs-danger-bg); }
.fs-btn--block { display: flex; width: 100%; }

/* ---------------------------------------------------------------------
   4. DOCUMENT MANAGER (body.fs-docs): contract S2
   ---------------------------------------------------------------------
   The six status tiles become one segmented control: label then a count
   pill. The anchors, data-id values and onclick handlers are untouched;
   only presentation changes. The selected segment is white with a shadow
   and bold text (not colour alone); each label keeps its icon.
   ------------------------------------------------------------------- */
body.fs-docs .TopArea h2 {
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--fs-text);
}
body.fs-docs .TopArea .btn,
body.fs-docs .fs-start .btn { border-radius: var(--fs-radius-btn); }

/* Greeting above the page title (dashboard.jsp .fs-titlegroup). */
body.fs-docs .fs-titlegroup { display: flex; flex-direction: column; min-width: 0; }
body.fs-docs .fs-greeting { margin: 0 0 2px; font-size: 13px; line-height: 18px; color: var(--fs-text-2); }

body.fs-docs .fs-start { border-radius: var(--fs-radius-lg); border-color: var(--fs-line); }
body.fs-docs .fs-start::before { background: var(--fs-brand-action); }

body.fs-docs .ToolArea { border-color: var(--fs-line); background: #fff; }

body.fs-docs .count_area {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--fs-canvas-sunk);
  border-radius: 12px;
  margin-bottom: var(--fs-space-3);
  max-width: 100%;
}
body.fs-docs .count_area a {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--fs-text-2);
  white-space: nowrap;
}
body.fs-docs .count_area a:hover {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
  color: var(--fs-brand-action);
}
body.fs-docs .count_area a.active {
  background: #fff;
  border: 0;
  box-shadow: var(--fs-shadow-sm);
  color: var(--fs-brand-action);
  font-weight: var(--fs-weight-semibold);
}
body.fs-docs .fs-tile__label {
  order: 1;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: inherit;
}
body.fs-docs .fs-tile__count {
  order: 2;
  min-width: 24px;
  padding: 1px 8px;
  border-radius: var(--fs-radius-pill);
  background: rgba(0, 51, 101, 0.08);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: inherit;
}
body.fs-docs .count_area a.active .fs-tile__count { color: var(--fs-brand-action); background: var(--fs-brand-action-quiet); }
/* Before the list loads the count span is empty; show nothing, not a sliver. */
body.fs-docs .fs-tile__count:has(> span:empty) { display: none; }

body.fs-docs .grid { border-color: var(--fs-line); border-radius: var(--fs-radius-lg); }

/* A completed package is a SEALED one: navy chip carrying the brand seal
   (navy disc, orange tick) instead of a generic green check. The cell
   classes come from loadList() and are unchanged. */
body.fs-docs .grid table tbody td.sta_1Completed > span {
  color: var(--fs-brand-action);
  background-color: var(--fs-brand-action-quiet);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7.5' fill='%23003365'/%3E%3Cpath d='M4.8 8.2 7 10.4 11.3 5.6' fill='none' stroke='%23ff8200' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------
   5. FOCUS SCREEN (contract section 3.4)
   ---------------------------------------------------------------------
   Login, OTP, TOTP, PIN, registration, activation and reset all share the
   legacy shell:

       <section class="fullset">
         <div class="setright"> ...the form... </div>
         <div class="setleft">  ...brand panel (optional)... </div>
       </section>

   Re-declaring those same class names as a centred card over a blurred
   product backdrop gives every one of those pages the new look with no
   markup change. :has() (Chrome 105, Safari 15.4, Firefox 121) scopes the
   page-level backdrop to pages that actually have a .fullset; a browser
   without it keeps the previous split-screen, which still works.
   ------------------------------------------------------------------- */
body:has(.fullset) {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--fs-space-5) var(--fs-space-4);
  background: var(--fs-navy-trust);
}
body:has(.fullset)::before {            /* the blurred product, behind the card */
  content: "";
  position: fixed;
  inset: -24px;
  z-index: -2;
  background: url(illustrations/backdrop-app.svg) center / cover no-repeat;
  filter: blur(8px);
}
body:has(.fullset)::after {             /* the veil that makes the card pop */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--fs-veil);
}

.fullset {
  position: relative;
  width: min(880px, 100%);
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  background: #fff;
  border-radius: var(--fs-radius-focus);
  overflow: hidden;
  box-shadow: var(--fs-shadow-focus-card);
}
.fullset:not(:has(.setleft)) {
  grid-template-columns: minmax(0, 1fr);
  width: min(480px, 100%);
}

.fullset .setright {
  order: 1;
  float: none;
  width: auto;
  max-width: none;
  height: auto;
  padding: 32px 32px 28px;
  overflow: visible;
  background: #fff;
}
.fullset .setright .td { max-width: 100%; }

/* Brand panel: navy trust surface, illustration on top, copy below. */
.fullset .setleft {
  order: 2;
  float: none;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 100%;
  padding: 32px 28px;
  background: var(--fs-navy-trust);
  box-shadow: none;
  color: var(--fs-on-trust);
  font-family: var(--fs-font);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.fullset .setleft::before {
  content: "";
  flex: none;
  width: 170px;
  height: 205px;
  margin-bottom: 18px;
  background: url(illustrations/sign-intro.svg) center / contain no-repeat;
}
.fullset .setleft h1 { margin: 0; font-weight: var(--fs-weight-semibold); }
.fullset .setleft h1 img {
  max-width: 220px;
  margin: 0 auto 6px;
}
.fullset .setleft h1:not(.thrivosign-logo) {
  font-size: 18px;
  line-height: 1.3;
  color: var(--fs-on-trust);
}
.fullset .setleft p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fs-on-trust-muted);
}
.fullset .setleft p.fs-brand-statement { font-weight: var(--fs-weight-medium); color: var(--fs-on-trust); }

/* Legacy markup marks its inline links (Terms of Use, Privacy Notice, ...)
   with .color-red, which is literally `color: red`. On these pages it is an
   accent, not an error, so it becomes the navy link style. */
.fullset .color-red {
  color: var(--fs-brand-action);
  font-weight: var(--fs-weight-semibold);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Secondary action on a legacy <input class="btn"> (Request OTP, Resend):
   outlined, so the one navy button on the card stays the obvious next step.
   These carried inline grey / green / cyan fills before. */
.fullset .form_Area .btn.fs-btn-secondary,
.fullset .btn.fs-btn-secondary {
  background: #fff;
  color: var(--fs-brand-action);
  border: 1px solid var(--fs-field-line);
  box-shadow: none;
}
.fullset .form_Area .btn.fs-btn-secondary:hover,
.fullset .btn.fs-btn-secondary:hover {
  background: var(--fs-brand-action-quiet);
  border-color: var(--fs-brand-border);
}

/* Per-page illustrations. The page opts in with a class on its .fullset
   section; with no class the generic sign-intro art above is used. */
.fullset.fs-art-otp     .setleft::before { background-image: url(illustrations/otp-phone.svg); }
.fullset.fs-art-totp    .setleft::before { background-image: url(illustrations/totp-app.svg); }
.fullset.fs-art-pin     .setleft::before { background-image: url(illustrations/pin-lock.svg); }
.fullset.fs-art-id      .setleft::before { background-image: url(illustrations/register-id.svg); }
.fullset.fs-art-sealed  .setleft::before { background-image: url(illustrations/sealed.svg); }

@media (max-width: 768px) {
  /* The legacy stylesheet hides .setleft here, but `.fullset .setleft`
     above is more specific, so the hide is restated. The card goes single
     column and nearly full width. */
  .fullset { grid-template-columns: minmax(0, 1fr); width: min(480px, 100%); }
  .fullset .setleft { display: none; }
  /* With the brand panel gone the phone would carry no brand at all, so the
     logo sits above the form. It is a background, so no markup changes. */
  .fullset:has(.setleft) .setright .td::before {
    content: "";
    display: block;
    height: 40px;
    margin-bottom: 18px;
    background: url(brand/pqctrust-mark.svg) center / auto 100% no-repeat;
  }
}
@media (max-width: 520px) {
  body:has(.fullset) { padding: var(--fs-space-3); }
  .fullset .setright { padding: 24px 20px 20px; }
}
@supports not (backdrop-filter: blur(1px)) {
  /* Static backdrop is already blurred with filter on a pseudo-element, so
     nothing to fall back to there; only the in-app overlay needs this. */
  .fs-focus::before { background: var(--fs-veil-solid); }
}

/* The in-app version: a dialog over the live page (signer intro, adopt
   signature, decline, send confirmation). Same card, real backdrop blur. */
.fs-focus {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: var(--fs-space-4);
}
.fs-focus::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fs-veil);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}
.fs-focus__card {
  position: relative;
  width: min(640px, 100%);
  max-height: 100%;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  background: #fff;
  border-radius: var(--fs-radius-focus);
  box-shadow: var(--fs-shadow-focus-card);
  color: var(--fs-text);
  font-family: var(--fs-font);
}
.fs-focus__card--single { grid-template-columns: minmax(0, 1fr); width: min(480px, 100%); }
.fs-focus__body { padding: 26px 24px; }
.fs-focus__step { margin: 0 0 6px; font-size: 12px; color: var(--fs-text-3); }
.fs-focus__title { margin: 0 0 6px; font-size: 22px; line-height: 1.2; font-weight: var(--fs-weight-bold); letter-spacing: -0.02em; }
.fs-focus__text { margin: 0 0 16px; font-size: 14px; color: var(--fs-text-2); }
.fs-focus__art {
  min-height: 260px;
  background: var(--fs-navy-trust) url(illustrations/sign-intro.svg) center / 62% no-repeat;
}
@media (max-width: 640px) {
  .fs-focus__card { grid-template-columns: minmax(0, 1fr); }
  .fs-focus__art { display: none; }
}

/* ---------------------------------------------------------------------
   6. BRAND ELEMENTS (contract 3.3)
   ------------------------------------------------------------------- */

/* The seal: navy disc with an orange tick. Inline SVG from
   fragments/ui/seal.jsp; these classes only size it. */
.fs-seal { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; flex: none; }
.fs-seal--lg { width: 24px; height: 24px; vertical-align: -6px; }
.fs-seal--xl { width: 96px; height: 96px; }
.fs-seal__disc { fill: var(--fs-brand-action); }
.fs-seal__tick { fill: none; stroke: var(--fs-seal); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fs-seal--on-navy .fs-seal__disc { fill: #fff; }

/* Ink-stroke progress: the signature squiggle from the logo, drawn as it
   fills. pathLength="100" makes the dash arithmetic a straight percentage:
   set --fs-ink-pct (0 to 100) on the element. */
.fs-ink { display: inline-block; width: 72px; height: 20px; vertical-align: middle; overflow: visible; }
.fs-ink__track,
.fs-ink__fill { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fs-ink__track { stroke: #dfe6ef; }
.fs-ink__fill {
  stroke: var(--fs-brand-action);
  stroke-dasharray: 100px;
  stroke-dashoffset: calc(100px - var(--fs-ink-pct, 0) * 1px);
  transition: stroke-dashoffset 400ms var(--fs-ease);
}
.fs-ink--on-navy .fs-ink__track { stroke: var(--fs-trust-track); }
.fs-ink--on-navy .fs-ink__fill  { stroke: #fff; }
.fs-ink--declined .fs-ink__track { stroke: #f3d4d0; }
.fs-ink--declined .fs-ink__fill  { display: none; }
@media (prefers-reduced-motion: reduce) { .fs-ink__fill { transition: none; } }

/* Status pill. Text always carries the state; colour only supports it. */
.fs-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--fs-radius-pill);
  font-size: 11px;
  font-weight: var(--fs-weight-medium);
  line-height: 18px;
  white-space: nowrap;
  background: var(--fs-neutral-bg);
  color: var(--fs-neutral-fg);
}
.fs-pill--wait     { background: var(--fs-warn-bg);   color: var(--fs-warn-fg); }
.fs-pill--progress { background: var(--fs-info-bg);   color: var(--fs-info-fg); }
.fs-pill--sealed   { background: var(--fs-brand-action-quiet); color: var(--fs-brand-action); }
.fs-pill--declined { background: var(--fs-danger-bg); color: var(--fs-danger-fg); }
.fs-pill--draft,
.fs-pill--expired  { background: var(--fs-neutral-bg); color: var(--fs-neutral-fg); }

.fs-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--fs-radius-pill);
  background: var(--fs-neutral-bg);
  color: var(--fs-ink-800);
  font-size: 12px;
  white-space: nowrap;
}

.fs-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dfe8f4;
  color: var(--fs-brand-action);
  font-size: 11px;
  font-weight: var(--fs-weight-semibold);
  flex: none;
}
.fs-avatar--sm { width: 20px; height: 20px; font-size: 9px; border: 1.5px solid #fff; margin-left: -5px; }

/* Segmented tabs with counts: <div class="fs-seg"><button aria-selected="true">…<span class="fs-seg__count">8</span> */
.fs-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--fs-canvas-sunk);
  border-radius: 12px;
  max-width: 100%;
  overflow-x: auto;
}
.fs-seg > * {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fs-text-2);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.fs-seg > *:hover { background: rgba(255, 255, 255, 0.6); color: var(--fs-brand-action); }
.fs-seg > [aria-selected="true"],
.fs-seg > .is-active {
  background: #fff;
  color: var(--fs-brand-action);
  font-weight: var(--fs-weight-semibold);
  box-shadow: var(--fs-shadow-sm);
}
.fs-seg__count { padding: 1px 8px; border-radius: var(--fs-radius-pill); background: rgba(0, 51, 101, 0.08); font-size: 12px; }

/* Command bar (search / jump to). */
.fs-cmdbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  background: #fff;
  border-radius: var(--fs-radius-btn);
  box-shadow: var(--fs-shadow-sm);
  color: var(--fs-text-2);
}
.fs-cmdbar kbd {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--fs-canvas-sunk);
  font: inherit;
  font-size: 11px;
  color: var(--fs-text-2);
}

/* Trust card: the product's trust summary. Navy, shield watermark. */
.fs-card--trust {
  position: relative;
  overflow: hidden;
  background: var(--fs-navy-trust);
  border-color: transparent;
  color: var(--fs-on-trust);
}
.fs-card--trust::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -30px;
  width: 120px;
  height: 130px;
  opacity: 0.12;
  background: url(brand/pqctrust-mark.svg) center / contain no-repeat;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
.fs-card--trust .fs-card__muted { color: var(--fs-on-trust-muted); }

/* Chain of trust: vertical timeline. */
.fs-timeline { list-style: none; margin: 0; padding: 0; }
.fs-timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 12px;
}
.fs-timeline > li::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 22px;
  bottom: 0;
  width: 1.5px;
  background: #d6e0ec;
}
.fs-timeline > li:last-child::before { display: none; }
.fs-timeline__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--fs-brand-action-quiet);
  color: var(--fs-brand-action);
  font-size: 12px;
}
.fs-timeline__dot--sealed { background: var(--fs-brand-action); }
.fs-timeline__title { font-weight: var(--fs-weight-semibold); }
.fs-timeline__meta { color: var(--fs-text-3); font-size: 12px; }

/* Empty state: an invitation, not an apology. (.fs-empty-state is the
   first-pass name; both are styled so either can be used.) */
.fs-empty,
.fs-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fs-space-2);
  padding: var(--fs-space-7) var(--fs-space-5);
  text-align: center;
  color: var(--fs-text-2);
}
.fs-empty__art { width: 120px; height: 140px; margin-bottom: var(--fs-space-2); background: var(--fs-navy-trust) url(illustrations/sign-intro.svg) center / 78% no-repeat; border-radius: 16px; }
.fs-empty__title { margin: 0; font-size: 18px; font-weight: var(--fs-weight-bold); color: var(--fs-text); }

/* Loading: skeletons that match the final layout, never a blank page. */
.fs-skeleton {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #e9eef5 0%, #f3f6fb 50%, #e9eef5 100%);
  background-size: 200% 100%;
  animation: fs-shimmer 1.4s linear infinite;
}
@keyframes fs-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .fs-skeleton { animation: none; } }

/* One-time code: six boxes (needs thrivosign-otp.js to advance and paste). */
.fs-otp { display: flex; gap: 8px; }
.fs-otp > input {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  padding: 0;
  text-align: center;
  font: inherit;
  font-size: 20px;
  font-weight: var(--fs-weight-bold);
  color: var(--fs-text);
  background: #fff;
  border: 1px solid var(--fs-field-line);
  border-radius: var(--fs-radius-md);
}
.fs-otp > input:focus { outline: none; border-color: var(--fs-brand-action); box-shadow: 0 0 0 3px var(--fs-brand-action-quiet); }

/* Sheet: bottom sheet on phones, centred dialog on desktop. */
.fs-scrim { position: fixed; inset: 0; z-index: 1000; background: var(--fs-veil); }
.fs-sheet {
  position: fixed;
  z-index: 1001;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90vh;
  overflow: auto;
  padding: 8px 16px 16px;
  background: #fff;
  border-radius: var(--fs-radius-focus) var(--fs-radius-focus) 0 0;
  box-shadow: var(--fs-shadow-focus-card);
  color: var(--fs-text);
  font-family: var(--fs-font);
}
.fs-sheet__grab { width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: #d1d1d6; }
@media (min-width: 768px) {
  .fs-sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(480px, 92vw);
    transform: translate(-50%, -50%);
    border-radius: var(--fs-radius-focus);
    padding: 20px 24px 24px;
  }
  .fs-sheet__grab { display: none; }
}

/* Signer dock: floating bar with ink progress and the one action. */
.fs-dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  background: var(--fs-navy-trust);
  color: var(--fs-on-trust);
  border-radius: 14px;
  box-shadow: var(--fs-shadow-dock);
  font-family: var(--fs-font);
}
.fs-dock__count { font-size: 12px; color: var(--fs-on-trust-muted); white-space: nowrap; }
.fs-dock__action {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--fs-radius-btn);
  background: #fff;
  color: var(--fs-brand-action);
  font: inherit;
  font-weight: var(--fs-weight-bold);
  cursor: pointer;
}
.fs-dock__action:hover { background: var(--fs-brand-action-quiet); }

/* "Sealed by ThrivoSign" signature frame (UI preview of a placed or
   finished signature; the burned-in PDF appearance is a separate,
   backend-owned decision, contract 3.3.4). */
.fs-sigframe {
  display: inline-block;
  min-width: 160px;
  padding: 6px 10px 5px;
  border: 1px solid var(--fs-brand-border);
  border-radius: 10px;
  background: #fbfcfe;
  line-height: 1.25;
}
.fs-sigframe__label { display: flex; align-items: center; gap: 4px; font-size: 9px; font-weight: var(--fs-weight-semibold); color: var(--fs-brand-action); }
.fs-sigframe__sig { font-size: 20px; color: var(--fs-text); }
.fs-sigframe__meta { font-size: 8px; color: var(--fs-text-3); }

/* Recipient colour helpers: add .fs-rcp-N to an element, then use the
   custom properties it exposes. */
.fs-rcp-1 { --fs-rcp: var(--fs-rcp-1); --fs-rcp-bg: var(--fs-rcp-1-fill); --fs-rcp-fg: var(--fs-rcp-1-text); }
.fs-rcp-2 { --fs-rcp: var(--fs-rcp-2); --fs-rcp-bg: var(--fs-rcp-2-fill); --fs-rcp-fg: var(--fs-rcp-2-text); }
.fs-rcp-3 { --fs-rcp: var(--fs-rcp-3); --fs-rcp-bg: var(--fs-rcp-3-fill); --fs-rcp-fg: var(--fs-rcp-3-text); }
.fs-rcp-4 { --fs-rcp: var(--fs-rcp-4); --fs-rcp-bg: var(--fs-rcp-4-fill); --fs-rcp-fg: var(--fs-rcp-4-text); }
.fs-rcp-5 { --fs-rcp: var(--fs-rcp-5); --fs-rcp-bg: var(--fs-rcp-5-fill); --fs-rcp-fg: var(--fs-rcp-5-text); }
.fs-rcp-6 { --fs-rcp: var(--fs-rcp-6); --fs-rcp-bg: var(--fs-rcp-6-fill); --fs-rcp-fg: var(--fs-rcp-6-text); }
.fs-rcp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--fs-rcp); flex: none; }
