/*
 * css/style.css
 *
 * Components and layout mechanics. No build step. One layout for both
 * accounts: which navigation shows (the strip under the header or the
 * bottom tab bar) depends on the width of the screen only.
 *
 * This file is the base layer. The look that is shown comes from the
 * layers loaded after it, which override the tokens below:
 *
 *   css/theme.css        brand colours, solid surfaces, page frame
 *   css/country-de.css   the German importer's interface
 *   css/country-id.css   the Indonesian exporter's interface
 *
 * What the components keep to, whatever the layer:
 *
 *  Response      every control answers on press, not on release
 *                (:active), with no delay in the input path.
 *  Spatial       a sheet rises from the bottom edge and leaves the same
 *  consistency   way; a menu grows out of the button that opened it.
 *  Typography    tracking and leading change with size (tight on
 *                titles, open on body text); sizes in rem so the
 *                user's own text size is respected.
 *  Simplicity    one primary action per screen, one accent colour,
 *                status colour only inside badges.
 *  Accessibility reduced motion, reduced transparency and higher
 *                contrast each get their own treatment.
 *
 * Status is never colour alone: each badge has an icon and a word.
 */

/* ------------------------------------------------------------- tokens */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --text: #1C2430;            /* 15.6:1 */
  --text-muted: #5A6472;      /*  6.0:1 */
  --border: #D8DDE3;          /* decoration only */
  --border-input: #7D8796;    /*  3.6:1, input borders */
  --hairline: rgba(28, 36, 48, 0.1);

  --primary: #183047;         /* 13.5:1 with white · WeaveBridge brand navy */
  --primary-press: #0F1F30;
  --primary-tint: #EAF0F7;

  /* Copper from the WeaveBridge mark, used on avatars only - not
     swapped in for --primary's existing active/selected meaning, so
     nothing that already relies on --primary changes. */
  --brand-copper: #D49A70;

  --meets-text: #1B6B43;      --meets-bg: #E6F4EC;      /* 5.7:1 */
  --notmeet-text: #9A3324;    --notmeet-bg: #FBEAE7;    /* 6.3:1 */
  --unclear-text: #7A4F00;    --unclear-bg: #FFF3D6;    /* 6.5:1 */
  --needed-text: #3E4C5E;     --needed-bg: #EEF1F5;     /* 7.7:1 */
  --approval-text: #3B4BA0;   --approval-bg: #ECEFFC;   /* 6.8:1 */
  --ai-text: #5B3E96;         --ai-bg: #F1ECFA;         /* 7.0:1 */

  /* Translucent chrome: content scrolls underneath. */
  --material: rgba(246, 247, 249, 0.78);
  --material-blur: saturate(180%) blur(20px);

  /* Spacing in rem, so layout grows with the user's text size. */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;

  --radius-card: 14px;
  --radius-control: 10px;
  --shadow-card: 0 1px 2px rgba(28, 36, 48, 0.06);
  --shadow-float: 0 12px 32px rgba(28, 36, 48, 0.18), 0 2px 6px rgba(28, 36, 48, 0.08);

  --header-h: 3.5rem;
  --tabbar-h: 3.75rem;
  --sidebar-w: 15rem;

  /* One easing for everything: fast start, soft landing, no overshoot. */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* -------------------------------------------------------------- base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/*
 * Inter, self-hosted (assets/fonts/, SIL OFL - see Inter-OFL.txt next to
 * it). Fetched once, the same way the icon set is "sourced once at
 * build time" (see js/icons.js) - the running app makes no font
 * request over the network, file:// included. A variable font, one
 * file covers every weight the site uses (400-700), so the browser
 * always renders the exact same face regardless of OS/browser
 * defaults - that inconsistency was why the previous system-ui stack
 * could look different depending on where the prototype opened.
 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/inter-variable-latin.woff2') format('woff2');
}

/*
 * The stand-in while Inter is still on its way (a slow connection):
 * Arial, scaled so that its lines are as long as Inter's. When Inter
 * arrives, no line breaks differently and nothing on the screen moves.
 * The scale was measured with the app's own texts, once for regular
 * and once for bold, because the two differ.
 */
@font-face {
  font-family: 'Inter Fallback';
  font-weight: 100 549;
  src: local('Arial'), local('ArialMT');
  size-adjust: 106.3%;
  ascent-override: 91.1%;
  descent-override: 22.7%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Inter Fallback';
  font-weight: 550 900;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 102.2%;
  ascent-override: 94.8%;
  descent-override: 23.6%;
  line-gap-override: 0%;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--s4));
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 100%/1.5 'Inter', 'Inter Fallback', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.has-dialog {
  overflow: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

/* Tracking and leading follow size: tight on titles, open on body. */
h1 {
  font-size: 1.625rem;
  line-height: 1.15;
  letter-spacing: -0.021em;
  font-weight: 700;
}

h2 {
  font-size: 1.125rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 650;
}

.display {
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.026em;
  font-weight: 700;
  text-wrap: balance;
}

a {
  color: var(--primary);
  text-underline-offset: 0.15em;
}

q {
  quotes: '“' '”';
}

img {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* A tap acts at once: no wait for a possible double-tap zoom. Pinch
   zoom is not affected. */
a,
button,
input,
select,
textarea,
label,
summary {
  touch-action: manipulation;
}

code {
  font: 0.875em ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.icon {
  width: 1.375rem;
  height: 1.375rem;
  flex: 0 0 auto;
}

.icon-small {
  width: 1rem;
  height: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--s2);
  top: -4rem;
  z-index: 100;
  padding: var(--s2) var(--s4);
  border-radius: var(--radius-control);
  background: var(--primary);
  color: #fff;
}

.skip-link:focus {
  top: var(--s2);
}

/* A visible focus ring on everything, for keyboard users only. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

#app-main:focus {
  outline: none;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.muted {
  color: var(--text-muted);
}

.fine {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  letter-spacing: 0.003em;
}

/* ------------------------------------------------------------ header */

#app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top);
}

/* Until the scripts have drawn the header it is empty. It keeps its
   height all the same, so the page below does not jump down later. */
#app-header:empty::before {
  content: '';
  display: block;
  height: var(--header-h);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  height: var(--header-h);
  padding: 0 max(var(--s4), env(safe-area-inset-right)) 0 max(var(--s4), env(safe-area-inset-left));
}

.header-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  min-height: 2.75rem;
  color: var(--text);
  text-decoration: none;
}

.header-logo {
  height: 3.25rem;
  width: auto;
  max-width: 45vw;
  object-fit: contain;
  flex: 0 1 auto;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

.header-lang,
.header-account {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
  padding: 0 var(--s3);
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms var(--ease), transform 100ms ease-out;
}

.header-lang {
  font-size: 0.875rem;
  font-weight: 650;
}

.header-account {
  padding-left: var(--s1);
  min-width: 0;
}

.header-account-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.2;
  text-align: left;
}

/* A phone shows the avatar only. The names stay in the button, out of
   sight, so a screen reader can still say whose account it is. */
@media (max-width: 719px) {
  .header-account-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

.header-account-company {
  font-size: 0.875rem;
  font-weight: 650;
  white-space: nowrap;
}

.header-account-person {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.header-lang:active,
.header-account:active {
  transform: scale(0.97);
  background: var(--needed-bg);
}

@media (hover: hover) {
  .header-lang:hover,
  .header-account:hover {
    background: rgba(28, 36, 48, 0.06);
  }
}

/* Menus grow out of the button that opened them. */
.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + var(--s1));
  right: 0;
  z-index: 40;
  min-width: 15rem;
  max-width: calc(100vw - 2rem);
  padding: var(--s2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform-origin: top right;
  animation: menu-in 160ms var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.menu-head {
  display: flex;
  flex-direction: column;
  padding: var(--s2) var(--s3) var(--s3);
  margin-bottom: var(--s2);
  border-bottom: 1px solid var(--hairline);
}

.menu-head-title {
  font-weight: 650;
}

.menu-head-sub {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 2.75rem;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item > span {
  flex: 1 1 auto;
}

.menu-item.is-current {
  font-weight: 650;
  color: var(--primary);
}

.menu-item-quiet {
  color: var(--text-muted);
}

.menu-item:active {
  background: var(--needed-bg);
}

@media (hover: hover) {
  .menu-item:hover {
    background: var(--bg);
  }
}

/* ------------------------------------------------- shell + navigation */

.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
}

#app-main {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

#app-sidebar {
  display: none;
}

.page {
  max-width: 66rem;
  margin: 0 auto;
  padding: var(--s5) var(--s4) calc(var(--s7) + var(--tabbar-h));
}

/* A new screen arrives with a short fade; the same screen drawn again
   (an action, a tab, a filter, the language) appears at once. */
.page.is-entering {
  animation: page-in 240ms var(--ease);
}

.page-narrow {
  max-width: 44rem;
}

body[data-signed-in='no'] .page,
body[data-signed-in='no'] .welcome,
body[data-signed-in='no'] .signin {
  padding-bottom: var(--s7);
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* The bottom tab bar: phones and tablets. */
#app-bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}

#app-bottomnav:empty {
  display: none;
}

.tabbar {
  display: flex;
  height: var(--tabbar-h);
  max-width: 34rem;
  margin: 0 auto;
}

.tabbar li {
  flex: 1 1 0;
  min-width: 0;
}

.tabbar-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  height: 100%;
  padding: 0 0.125rem;
  color: var(--text-muted);
  font-size: 0.65625rem;
  font-weight: 550;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  transition: transform 100ms ease-out;
}

.tabbar-link .nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabbar-link.is-active {
  color: var(--primary);
}

.tabbar-link:active {
  transform: scale(0.94);
}

.nav-icon {
  position: relative;
  display: inline-flex;
}

.nav-count {
  position: absolute;
  top: -0.375rem;
  right: -0.75rem;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.125rem;
  text-align: center;
}

/* The side bar: wide screens. Same items, same order. */
@media (min-width: 1024px) {
  #app-bottomnav {
    display: none;
  }

  #app-sidebar:not(:empty) {
    display: block;
    position: sticky;
    top: var(--header-h);
    flex: 0 0 var(--sidebar-w);
    align-self: stretch;
    height: calc(100vh - var(--header-h));
    padding: var(--s5) var(--s3);
    border-right: 1px solid var(--hairline);
    overflow-y: auto;
  }

  .sidenav {
    display: grid;
    gap: 0.125rem;
  }

  .sidenav-link {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-height: 2.75rem;
    padding: 0 var(--s3);
    border-radius: var(--radius-control);
    color: var(--text);
    font-weight: 550;
    text-decoration: none;
    transition: background-color 120ms var(--ease), transform 100ms ease-out;
  }

  .sidenav-link .icon {
    color: var(--text-muted);
  }

  /* The counter sits on the icon's corner without touching the label. */
  .sidenav-link .nav-count {
    top: -0.4375rem;
    right: -0.4375rem;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.625rem;
    line-height: 1rem;
  }

  .sidenav-link.is-active {
    background: var(--primary-tint);
    color: var(--primary);
    font-weight: 650;
  }

  .sidenav-link.is-active .icon {
    color: var(--primary);
  }

  .sidenav-link:hover {
    background: rgba(28, 36, 48, 0.05);
  }

  .sidenav-link.is-active:hover {
    background: var(--primary-tint);
  }

  .sidenav-link:active {
    transform: scale(0.98);
  }

  .page {
    padding: var(--s6) var(--s6) var(--s7);
  }

  h1 {
    font-size: 1.875rem;
  }
}

/* --------------------------------------------------------- page head */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  min-height: 2.75rem;
  margin: calc(var(--s3) * -1) 0 var(--s1) calc(var(--s1) * -1);
  padding-right: var(--s3);
  font-weight: 550;
  text-decoration: none;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.page-head-text {
  min-width: 0;
}

.page-sub {
  margin-top: var(--s1);
  color: var(--text-muted);
}

.page-actions,
.card-actions,
.next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.card-actions,
.next-actions {
  margin-top: var(--s4);
}

.section-title {
  margin: var(--s6) 0 var(--s3);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin: var(--s6) 0 0;
}

.section-head .section-title {
  margin: 0;
}

.group-label {
  margin: var(--s4) 0 var(--s2);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 650;
}

/* ----------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border: 0;
  border-radius: var(--radius-control);
  font-weight: 650;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* The press answers at once; the release eases back. */
  transition: transform 100ms ease-out, background-color 120ms var(--ease), opacity 120ms;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:active:not(:disabled) {
  background: var(--primary-press);
}

.btn-secondary {
  background: var(--primary-tint);
  color: var(--primary);
}

.btn-secondary:active:not(:disabled) {
  background: #DCE6F2;
}

.btn-danger {
  background: var(--notmeet-text);
  color: #fff;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    background: var(--primary-press);
  }

  .btn-secondary:hover:not(:disabled) {
    background: #DCE6F2;
  }
}

.btn-small {
  min-height: 2.25rem;
  padding: 0 var(--s3);
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
  padding: 0 var(--s2);
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
}

/* ------------------------------------------------------------- cards */

.foc-card {
  margin-bottom: var(--s4);
  padding: var(--s5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.foc-card > h2 {
  margin-bottom: var(--s3);
}

.foc-card > p + p,
.foc-card > .data-list + p,
.foc-card > p + .data-list {
  margin-top: var(--s3);
}

.foc-card.is-muted {
  background: transparent;
  box-shadow: none;
}

.foc-card.is-muted > h2 {
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .foc-card {
    padding: var(--s4);
  }
}

/* The next-step card: the one thing to do, said once. */
.next-card {
  margin-bottom: var(--s5);
  padding: var(--s5);
  border-radius: var(--radius-card);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-card);
}

.next-card h2 {
  margin: var(--s1) 0 var(--s2);
  font-size: 1.375rem;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

.next-card > p {
  max-width: 56ch;
}

.next-card .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.next-card .btn-primary {
  background: #fff;
  color: var(--primary);
}

.next-card .btn-primary:active,
.next-card .btn-primary:hover {
  background: var(--primary-tint);
}

.next-card.is-waiting,
.next-card.is-done {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
}

.next-card.is-waiting .eyebrow {
  color: var(--approval-text);
}

.next-card.is-done .eyebrow {
  color: var(--meets-text);
}

.next-card a:not(.btn) {
  color: inherit;
}

.next-card .mt-block {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.5);
}

.next-switch {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.next-switch .icon {
  margin-top: 0.1875rem;
}

.next-card.is-waiting .next-switch a,
.next-card.is-done .next-switch a,
.foc-card .next-switch a,
.page > .next-switch a {
  color: var(--primary);
  font-weight: 650;
}

.page > .next-switch {
  border-top: 0;
}

/* The two results, side by side on a wide screen. */
.result-cards {
  display: grid;
  gap: var(--s4);
  margin-bottom: var(--s4);
}

.result-cards .foc-card {
  margin: 0;
}

@media (min-width: 760px) {
  .result-cards {
    grid-template-columns: 3fr 2fr;
    align-items: start;
  }
}

.result-card .foc-badge {
  margin-top: var(--s2);
}

.result-reason {
  margin: var(--s3) 0;
}

.legal-note,
.notice {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s3);
  font-size: 0.875rem;
  line-height: 1.45;
}

.legal-note {
  color: var(--text-muted);
}

.legal-note .icon,
.notice .icon {
  margin-top: 0.1875rem;
}

.notice {
  padding: var(--s3);
  border-radius: var(--radius-control);
  background: var(--needed-bg);
  color: var(--needed-text);
}

.page > .notice {
  margin-bottom: var(--s4);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.foc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.1875rem 0.5625rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.35;
}

.badge-meets { background: var(--meets-bg); color: var(--meets-text); }
.badge-notmeet { background: var(--notmeet-bg); color: var(--notmeet-text); }
.badge-unclear { background: var(--unclear-bg); color: var(--unclear-text); }
.badge-needed { background: var(--needed-bg); color: var(--needed-text); }
.badge-approval { background: var(--approval-bg); color: var(--approval-text); }
.badge-ai { background: var(--ai-bg); color: var(--ai-text); }

.ai-tag {
  padding: 0 0.1875rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------- stepper */

.stepper {
  margin-bottom: var(--s5);
  padding: var(--s4) var(--s5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stepper-list {
  display: flex;
  gap: var(--s1);
}

.stepper-item {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* The line to the next stage. */
.stepper-item + .stepper-item::before {
  content: '';
  position: absolute;
  top: 0.8125rem;
  right: calc(50% + 1.125rem);
  width: calc(100% - 2.25rem);
  height: 2px;
  border-radius: 1px;
  background: var(--border);
}

.stepper-item.is-done + .stepper-item::before {
  background: var(--primary);
}

.stepper-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 700;
}

.stepper-item.is-done .stepper-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.stepper-item.is-current {
  color: var(--text);
  font-weight: 650;
}

.stepper-item.is-current .stepper-dot {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}

.stepper-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
}

.stepper-now {
  font-weight: 650;
}

.stepper-turn {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--needed-bg);
  color: var(--needed-text);
  font-weight: 650;
}

.stepper-turn.is-mine {
  background: var(--primary);
  color: #fff;
}

.stepper-turn.is-done {
  background: var(--meets-bg);
  color: var(--meets-text);
}

/* On a phone the five labels do not fit: dots stay, the status line names the stage. */
@media (max-width: 640px) {
  .stepper {
    padding: var(--s4);
  }

  .stepper-label {
    display: none;
  }
}

/* ------------------------------------------------------------- stats */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--s3);
}

.stat {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.stat-value {
  display: block;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ------------------------------------------------------------ tables */

.table-card {
  margin-bottom: var(--s3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td {
  font-variant-numeric: tabular-nums;
}

.row-link {
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}

.row-link:active {
  background: var(--primary-tint);
}

@media (hover: hover) {
  .row-link:hover {
    background: var(--bg);
  }
}

.cell-title {
  display: block;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 650;
  text-decoration: none;
}

.cell-sub {
  display: block;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* A style number and its tariff heading belong on one line. */
.styles-table .cell-sub {
  white-space: nowrap;
}

.review-mark {
  color: var(--ai-text);
  font-weight: 700;
}

/* On a phone every table row becomes a card; each value names its column. */
@media (max-width: 760px) {
  .table-card {
    border: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table tr {
    margin-bottom: var(--s3);
    padding: var(--s2) var(--s4);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--s4);
    padding: var(--s2) 0;
    text-align: right;
  }

  /* The column name gives way last: the value shrinks first (a long
     status wraps inside its badge), and only on a very narrow screen
     does the name itself break onto a second line. */
  .data-table td::before {
    content: attr(data-label);
    flex: 0 1 auto;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: left;
  }

  .data-table td > * {
    flex-shrink: 1000;
  }

  .data-table td.cell-main {
    display: block;
    text-align: left;
  }

  .data-table td.cell-main::before {
    content: none;
  }

  .data-table tbody tr td:last-child {
    border-bottom: 0;
  }

  .glossary-table td {
    text-align: left;
    justify-content: flex-start;
  }

  .glossary-table td::before {
    flex: 0 0 5.5rem;
  }
}

/* ------------------------------------------------------------- lists */

/* Grouped rows on one card, separated by hairlines. */
.list-card {
  margin-bottom: var(--s4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.list-card > li + li {
  border-top: 1px solid var(--hairline);
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  min-height: 3.5rem;
  padding: var(--s3) var(--s4);
  color: var(--text);
  text-decoration: none;
}

.list-row-link {
  transition: background-color 120ms var(--ease);
}

.list-row-link:active {
  background: var(--primary-tint);
}

@media (hover: hover) {
  .list-row-link:hover {
    background: var(--bg);
  }
}

.list-row-main {
  flex: 1 1 8rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-row-title {
  font-weight: 600;
}

.list-row-sub {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.list-row-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

.row-chevron {
  color: var(--border-input);
}

.list-row.is-locked .list-row-title {
  color: var(--text-muted);
}

/* The round mark in front of a step. */
.step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--border-input);
  border-radius: 999px;
  color: var(--text-muted);
}

.step-mark.is-done {
  border-color: var(--meets-text);
  background: var(--meets-text);
  color: #fff;
}

.step-mark.is-open {
  border-color: var(--primary);
}

.step-mark.is-returned {
  border-color: var(--unclear-text);
}

.step-mark.is-waitingApproval {
  border-color: var(--approval-text);
}

.step-mark.is-locked {
  border-color: transparent;
}

.mini-list {
  margin-top: var(--s3);
}

.mini-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s1) var(--s3);
  padding: var(--s2) 0;
  border-top: 1px solid var(--hairline);
  font-size: 0.9375rem;
}

.mini-list .foc-badge {
  margin: 0;
}

.check-list li {
  display: flex;
  gap: var(--s2);
  padding: var(--s1) 0;
}

.check-list .icon {
  margin-top: 0.25rem;
}

.check-list .is-done .icon {
  color: var(--meets-text);
}

.check-list .is-open {
  color: var(--text-muted);
}

.data-row {
  display: grid;
  gap: 0.125rem;
  padding: var(--s3) 0;
  border-top: 1px solid var(--hairline);
}

.data-list > .data-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.data-row dt {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.data-row dd {
  font-variant-numeric: tabular-nums;
}

@media (min-width: 560px) {
  .data-row {
    grid-template-columns: 11rem 1fr;
    gap: var(--s4);
  }

  .data-row dt {
    font-size: 0.875rem;
    padding-top: 0.0625rem;
  }
}

.field-mark {
  display: inline-block;
  margin-left: var(--s2);
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--unclear-bg);
  color: var(--unclear-text);
  font-size: 0.75rem;
  font-weight: 600;
}

.quiet-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  margin-top: var(--s4);
}

/* ------------------------------------------------------------- forms */

.field {
  margin-bottom: var(--s4);
}

.field label,
.choice-group legend {
  display: block;
  margin-bottom: var(--s2);
  padding: 0;
  font-size: 0.875rem;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem var(--s3);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-control);
  background: var(--surface);
  /* 16px at least, so iOS does not zoom the page on focus. */
  font-size: 1rem;
  transition: border-color 120ms, box-shadow 120ms;
}

.field textarea {
  min-height: 5.5rem;
  line-height: 1.45;
  resize: vertical;
}

/* A field in focus: its border doubles in the accent colour, with a
   soft ring around it. (The page-wide outline would sit too far out.) */
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent, var(--primary));
  box-shadow: 0 0 0 1px var(--accent, var(--primary)), 0 0 0 4px var(--accent-tint, var(--primary-tint));
}

/* A field that still needs an entry. The message below it says what. */
.field [aria-invalid='true'] {
  border-color: var(--notmeet-text);
}

.field-help {
  margin-top: var(--s2);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.field-error {
  margin-top: var(--s2);
  color: var(--notmeet-text);
  font-size: 0.875rem;
}

.field-row {
  display: grid;
  gap: 0 var(--s3);
  margin-top: var(--s4);
}

@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 3fr 2fr;
  }
}

.field-nested {
  margin: var(--s2) 0 var(--s2) 2.25rem;
}

.search-field {
  max-width: 24rem;
}

.choice-group {
  min-width: 0;
  margin: 0 0 var(--s4);
  padding: 0;
  border: 0;
}

.choice-group:disabled {
  opacity: 0.6;
}

/* A whole row is the target, not just the small control. */
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  min-height: 2.75rem;
  margin-bottom: var(--s2);
  padding: 0.625rem var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms, transform 100ms ease-out;
}

.choice:active {
  transform: scale(0.99);
}

.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.choice input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.125rem 0 0;
  accent-color: var(--primary);
}

.choice-detail {
  display: flex;
  gap: var(--s2);
  margin: calc(var(--s1) * -1) 0 var(--s2) 2.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.choice-confirm {
  margin-top: var(--s4);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  cursor: pointer;
}

/* A switch that looks like one. */
.switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 3.1875rem;
  height: 1.9375rem;
  margin: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background-color 200ms var(--ease);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.6875rem;
  height: 1.6875rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 200ms var(--ease);
}

.switch:checked {
  background: var(--meets-text);
}

.switch:checked::after {
  transform: translateX(1.25rem);
}

.chip-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.chip-row {
  margin-bottom: var(--s4);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 100ms ease-out;
}

.chip:active {
  transform: scale(0.96);
}

.chip.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 650;
}

.tag {
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: var(--needed-bg);
  color: var(--needed-text);
  font-size: 0.75rem;
}

/* The bar of actions at the end of a form; sticky inside long flows. */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2);
  margin-top: var(--s4);
}

.action-bar .fine {
  margin-right: auto;
}

.action-bar.is-sticky {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s2));
  z-index: 5;
  padding: var(--s3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  box-shadow: var(--shadow-float);
}

@media (min-width: 1024px) {
  .action-bar.is-sticky {
    bottom: var(--s4);
  }
}

/* -------------------------------------------------------- upload flow */

.wizard-steps {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.wizard-steps li {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  padding-top: var(--s2);
  border-top: 3px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* A long step name breaks inside its third of the row instead of
   pushing the row wider than the screen. */
.wizard-steps li > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.wizard-steps li.is-done,
.wizard-steps li.is-current {
  border-top-color: var(--primary);
}

.wizard-steps li.is-current {
  color: var(--text);
}

.wizard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 999px;
  background: var(--needed-bg);
  font-size: 0.75rem;
}

.wizard-steps li.is-done .wizard-num,
.wizard-steps li.is-current .wizard-num {
  background: var(--primary);
  color: #fff;
}

.upload-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.upload-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  padding: var(--s5) var(--s3);
  border: 1px dashed var(--border-input);
  border-radius: var(--radius-card);
  background: var(--bg);
  color: var(--primary);
  font-weight: 650;
  cursor: pointer;
  transition: transform 100ms ease-out, background-color 120ms;
}

.upload-choice:active {
  transform: scale(0.97);
  background: var(--primary-tint);
}

.doc-pick {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  margin: var(--s2) 0 var(--s3);
  padding: var(--s3);
  border: 1px solid var(--primary);
  border-radius: var(--radius-card);
  background: var(--primary-tint);
  text-align: left;
  cursor: pointer;
  transition: transform 100ms ease-out;
}

.doc-pick:active {
  transform: scale(0.98);
}

.doc-thumb {
  flex: 0 0 auto;
  width: 3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.doc-figure {
  margin-bottom: var(--s4);
  text-align: center;
}

.doc-image {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.doc-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.doc-figure figcaption {
  margin-top: var(--s2);
}

/* Document next to its fields on a wide screen, above them on a phone. */
.confirm-layout,
.doc-pair {
  display: grid;
  gap: var(--s4);
  align-items: start;
}

.confirm-layout .doc-figure {
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 860px) {
  .confirm-layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }

  .confirm-layout .doc-figure {
    position: sticky;
    top: calc(var(--header-h) + var(--s4));
    max-width: none;
  }

  .doc-pair {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

.confirm-layout .notice {
  margin: 0 0 var(--s3);
}

.confirm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  transition: background-color 200ms var(--ease);
}

.confirm-row.is-confirmed {
  background: #F4FAF6;
}

.confirm-row-text {
  flex: 1 1 12rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  min-width: 0;
}

.confirm-row-label {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.confirm-row-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.confirm-row-state {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  color: var(--meets-text);
  font-size: 0.8125rem;
  font-weight: 600;
}

.confirm-row-actions {
  display: flex;
  gap: var(--s2);
}

.reading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  padding: var(--s7) var(--s4);
  color: var(--text-muted);
  text-align: center;
}

.reading-spinner {
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--ai-bg);
  border-top-color: var(--ai-text);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.visibility-preview {
  display: flex;
  gap: var(--s2);
  margin: var(--s3) 0;
  padding: var(--s3);
  border-radius: var(--radius-control);
  background: var(--bg);
  font-size: 0.875rem;
}

.visibility-preview .icon {
  margin-top: 0.1875rem;
}

/* The one text the exporter signs: it must not look like app output. */
.statement-box {
  margin: var(--s4) 0 var(--s3);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
}

.statement-text {
  margin-top: var(--s2);
  font: 0.875rem/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

.copy-area {
  width: 100%;
  margin-top: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-control);
  font: 0.875rem/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* -------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: var(--s1);
  margin: var(--s5) 0 var(--s4);
  padding: 0.1875rem;
  border-radius: 12px;
  background: rgba(28, 36, 48, 0.07);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.page-head + .tabs {
  margin-top: 0;
}

/* A segmented control: the selected segment is a raised surface. */
.tab {
  flex: 1 0 auto;
  min-height: 2.25rem;
  padding: 0.4375rem var(--s3);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 550;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms var(--ease), transform 100ms ease-out;
}

.tab:active {
  transform: scale(0.97);
}

.tab.is-active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(28, 36, 48, 0.14);
  font-weight: 650;
}

/* ----------------------------------------- tiles, prose, posts, misc */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s3);
}

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  height: 100%;
  padding: var(--s5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
  transition: transform 100ms ease-out, box-shadow 160ms var(--ease);
}

.tile:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .tile:hover {
    box-shadow: 0 6px 18px rgba(28, 36, 48, 0.1);
  }
}

.tile-title {
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.3;
}

.tile-text {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.tile .badge-row {
  margin: 0;
}

.prose p + p,
.prose p + h2,
.prose .notice {
  margin-top: var(--s4);
}

.prose h2 {
  margin-bottom: var(--s2);
  font-size: 1rem;
}

.prose > p:first-child {
  font-size: 1.0625rem;
}

.post .post-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s2);
  margin-bottom: var(--s2);
}

.post-author {
  font-weight: 650;
}

.post-sub,
.post-date {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.post-date {
  margin-left: auto;
}

.good-answer {
  display: flex;
  gap: var(--s2);
  margin-top: var(--s3);
  color: var(--meets-text);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Translation on top, the original always with it. */
.mt-block {
  margin: var(--s2) 0 0;
  padding: var(--s3) var(--s4);
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--bg);
}

.mt-label {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-bottom: var(--s1);
  color: var(--ai-text);
  font-size: 0.75rem;
  font-weight: 650;
}

.mt-original {
  margin-top: var(--s2);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.mt-original summary,
.disclosure summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.mt-note {
  margin-top: var(--s2);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.next-card:not(.is-waiting):not(.is-done) .mt-block .mt-text {
  color: #fff;
}

.time-pair {
  font-variant-numeric: tabular-nums;
}

.history-item {
  display: grid;
  gap: 0.125rem;
  padding: var(--s3) 0;
  border-top: 1px solid var(--hairline);
}

.history-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-time {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 760px) {
  .history-item {
    grid-template-columns: 11.5rem 1fr;
    gap: var(--s4);
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
  padding: var(--s7) var(--s4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  text-align: center;
}

.empty-state-icon {
  display: inline-flex;
  padding: var(--s3);
  border-radius: 999px;
  background: var(--needed-bg);
  color: var(--text-muted);
}

.empty-state-title {
  font-weight: 650;
}

.empty-state-text {
  max-width: 34ch;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.person-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s2) 0 var(--s3);
}

.person-card-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.person-card-name {
  font-weight: 650;
}

.person-card-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  /* Copper ring: the brand mark's third color, carried onto every
     person in the app instead of staying symbol-only decoration. */
  box-shadow: inset 0 0 0 2px var(--brand-copper);
}

.avatar-large {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 0.9375rem;
}

.request-due {
  display: flex;
  gap: var(--s2);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.request-due .icon {
  margin-top: 0.1875rem;
}

.disclosure {
  margin-top: var(--s2);
}

.feedback-link a {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
}

.pack-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.pack-doc section {
  margin-top: var(--s6);
}

.pack-doc section > h2,
.pack-doc h3 {
  margin-bottom: var(--s3);
}

.pack-doc h3 {
  margin-top: var(--s5);
}

.pack-cover {
  padding-bottom: var(--s5);
  border-bottom: 2px solid var(--primary);
}

.pack-cover h1 {
  margin-bottom: var(--s4);
}

.pack-cover p {
  margin-top: var(--s3);
}

/* ------------------------------------------------ welcome and sign in */

.welcome {
  max-width: 56rem;
  margin: 0 auto;
  padding: var(--s6) var(--s4) var(--s7);
}

.welcome.is-entering {
  animation: page-in 320ms var(--ease);
}

.welcome-hero {
  padding: var(--s5) 0 var(--s6);
}

.welcome-hero .display {
  margin: var(--s2) 0 var(--s4);
}

.welcome-lead {
  max-width: 46ch;
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1.45;
}

.welcome-accounts > h2 {
  margin-bottom: var(--s3);
}

.welcome-accounts > .notice {
  margin: 0 0 var(--s3);
}

.account-grid {
  display: grid;
  gap: var(--s4);
}

@media (min-width: 700px) {
  .account-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.account-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s1);
  width: 100%;
  height: 100%;
  padding: var(--s5);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease-out, box-shadow 200ms var(--ease);
}

.account-card:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .account-card:hover {
    box-shadow: 0 10px 28px rgba(28, 36, 48, 0.12);
  }
}

.account-card-icon {
  display: inline-flex;
  margin-bottom: var(--s3);
  padding: var(--s3);
  border-radius: 12px;
  background: var(--primary-tint);
  color: var(--primary);
}

.account-card-role {
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.account-card-company {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.2;
}

.account-card-does {
  margin: var(--s1) 0 var(--s4);
  color: var(--text-muted);
}

.account-card-person {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.account-card-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s4);
  color: var(--primary);
  font-weight: 650;
}

.welcome-foot {
  display: grid;
  gap: var(--s1);
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.welcome-foot .btn-text {
  justify-self: start;
  margin-left: calc(var(--s2) * -1);
}

.signin {
  max-width: 26rem;
  margin: 0 auto;
  padding: var(--s6) var(--s4) var(--s7);
}

.signin.is-entering {
  animation: page-in 280ms var(--ease);
}

.signin-card {
  padding: var(--s5);
}

.signin-who {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.signin-card .fine {
  margin-top: var(--s4);
}

/* ------------------------------------------------------------- toast */

#toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s4));
  z-index: 70;
  display: flex;
  justify-content: center;
  padding: 0 var(--s4);
  pointer-events: none;
}

@media (min-width: 1024px) {
  #toast-region {
    bottom: var(--s5);
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s3);
  max-width: 32rem;
  padding: var(--s3) var(--s4);
  border-radius: 14px;
  background: rgba(28, 36, 48, 0.94);
  color: #fff;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  animation: toast-in 260ms var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

.toast-undo {
  flex: 0 0 auto;
  min-height: 2.25rem;
  padding: 0 var(--s3);
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

/* ------------------------------------------------------------ dialog */

/* A modal task dims what is behind it. */
.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 26, 34, 0.42);
  animation: scrim-in 220ms ease-out;
  transition: opacity 180ms ease-in;
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}

/* On a phone: a sheet that rises from the bottom edge. */
.dialog {
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  padding: var(--s2) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: sheet-in 320ms var(--ease);
  transition: transform 180ms ease-in;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

/* It leaves along the path it arrived on. */
.dialog-scrim.is-closing {
  opacity: 0;
}

.dialog-scrim.is-closing .dialog {
  transform: translateY(100%);
}

.dialog-grabber {
  width: 2.25rem;
  height: 0.3125rem;
  margin: 0 auto var(--s4);
  border-radius: 999px;
  background: var(--border);
}

.dialog h2 {
  margin-bottom: var(--s3);
  font-size: 1.25rem;
  outline: none;
}

.dialog-body > * + * {
  margin-top: var(--s3);
}

.dialog-body .eyebrow {
  margin-top: var(--s4);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap-reverse;
  gap: var(--s2);
  margin-top: var(--s5);
}

.dialog-actions .btn {
  flex: 1 1 8rem;
}

/* On a wide screen: a centred panel that materialises in place. */
@media (min-width: 640px) {
  .dialog-scrim {
    align-items: center;
    padding: var(--s5);
  }

  .dialog {
    max-width: 30rem;
    max-height: 88vh;
    padding: var(--s5);
    border-radius: 18px;
    animation: panel-in 220ms var(--ease);
    transition: transform 160ms ease-in, opacity 160ms ease-in;
  }

  .dialog-wide {
    max-width: 44rem;
  }

  @keyframes panel-in {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  }

  .dialog-scrim.is-closing .dialog {
    opacity: 0;
    transform: scale(0.97);
  }

  .dialog-grabber {
    display: none;
  }

  .dialog-actions {
    justify-content: flex-end;
  }

  .dialog-actions .btn {
    flex: 0 0 auto;
  }
}

/* ---------------------------------------------- user preference modes */

/* Reduced motion: no travel, no scale. A short cross-fade stays. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }

  .btn:active,
  .tile:active,
  .account-card:active,
  .choice:active,
  .chip:active,
  .tab:active {
    transform: none !important;
  }

  .reading-spinner {
    animation-duration: 1600ms !important;
  }
}

/* Reduced transparency: solid chrome instead of translucent. */
@media (prefers-reduced-transparency: reduce) {
  #app-header,
  #app-bottomnav,
  .action-bar.is-sticky {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* More contrast: solid surfaces, defined borders, darker secondary text. */
@media (prefers-contrast: more) {
  :root {
    --text-muted: #3A4350;
    --hairline: #7D8796;
    --border: #7D8796;
  }

  #app-header,
  #app-bottomnav,
  .action-bar.is-sticky {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .foc-badge {
    border: 1px solid currentColor;
  }
}

/* ------------------------------------------------------------- print */

/* ---------------------------------------------- overview, courses, forum */

/* The state of the process in one sentence (importer's overview). */
.status-line {
  margin-bottom: var(--s5);
  padding: var(--s4) 0;
  border-top: 2px solid var(--primary);
  border-bottom: 1px solid var(--border);
}
.status-line .status-text {
  margin: var(--s1) 0 var(--s3);
  max-width: 46rem;
}

/* The order being checked: customs readiness next to what is at stake. */
.order-block h2 a {
  color: inherit;
  text-decoration: none;
}
.order-block h2 a:hover {
  text-decoration: underline;
}
.order-columns {
  display: grid;
  gap: var(--s5);
  margin-top: var(--s4);
}
@media (min-width: 900px) {
  .order-columns {
    grid-template-columns: 3fr 2fr;
  }
}
.order-column h3 {
  margin: 0 0 var(--s1);
  font-size: 1rem;
}

/* Help where it is needed: a small "?" next to a heading. */
.help-link {
  display: inline-flex;
  vertical-align: middle;
  color: var(--primary);
  padding: 0.25rem;
  border-radius: 50%;
}

/* Forum list: title on the left, status, replies and date on the right. */
.forum-row .forum-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2) var(--s3);
  flex: 0 0 auto;
  max-width: 50%;
}
.post-actions {
  margin-top: var(--s3);
}
.helpful-btn.is-active {
  border-color: var(--meets-text);
  color: var(--meets-text);
}

/* Course questions. */
.quiz-question {
  margin-bottom: var(--s5);
}
.quiz-feedback {
  margin-top: var(--s2);
  padding: var(--s3);
  border-left: 3px solid var(--unclear-text);
  background: var(--unclear-bg);
}
.quiz-feedback.is-right {
  border-left-color: var(--meets-text);
  background: var(--meets-bg);
}
.quiz-feedback p {
  margin: var(--s2) 0 0;
}
.quiz-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

/* ------------------------------------------------- presenter's demo bar */

/* Not part of the product: only shown after opening the page with ?demo=1. */
.demo-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  padding: var(--s2) var(--s3);
  background: #2B2F36;
  color: #fff;
  font-size: 0.8125rem;
}
.demo-bar-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.demo-bar-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}
.demo-bar-btn {
  min-height: 2rem;
  padding: 0 var(--s2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.demo-bar-btn.is-active {
  background: #fff;
  color: #2B2F36;
}
#demo-bar-close {
  margin-left: auto;
}
@media (max-width: 899px) {
  .demo-bar-long {
    display: none;
  }
}
/* Keep the page's own bottom navigation and content above the bar. */
body[data-demo-bar='yes'] {
  padding-bottom: 3rem;
}
@media (max-width: 1023px) {
  body[data-demo-bar='yes'] #app-bottomnav {
    bottom: 2.75rem;
  }
  body[data-demo-bar='yes'] {
    padding-bottom: 6rem;
  }
}

@media print {
  .no-print,
  #toast-region,
  #dialog-root,
  .back-link,
  .pack-toolbar,
  .skip-link,
  .tabs,
  .next-card,
  .stepper,
  .quiet-action,
  .card-actions {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .app-shell {
    display: block;
  }

  .page {
    max-width: none;
    padding: 0;
    animation: none;
  }

  .foc-card,
  .list-card,
  .table-card {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .pack-doc section,
  .doc-figure,
  .list-row {
    break-inside: avoid;
  }

  .doc-pair {
    grid-template-columns: 2fr 3fr;
  }
}

/* ------------------------------------- who is involved, customs hand-over */

/* The thread: parties and systems in the order the evidence passes them,
   joined by a stitched seam in the brand's copper. A real sequence, so
   it is an ordered list; across on wide screens, down on phones. */
.thread-intro {
  margin: calc(-1 * var(--s2)) 0 var(--s5);
  color: var(--text-muted);
}

.thread {
  display: grid;
  gap: var(--s4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.thread-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
  padding: 0 0 var(--s2) var(--s6);
}

.thread-knot {
  position: absolute;
  top: 0.25rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--brand-copper);
  border-radius: 999px;
  background: var(--surface);
}

.thread-step.is-mine .thread-knot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* The seam runs from this knot to the next one. */
.thread-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1.5rem;
  bottom: calc(-1 * var(--s4) + 0.25rem);
  left: calc(0.625rem - 1px);
  width: 2px;
  background: repeating-linear-gradient(180deg, var(--brand-copper) 0 6px, transparent 6px 10px);
}

.thread-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.thread-text {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

@media (min-width: 900px) {
  .thread:not(.is-vertical) {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .thread:not(.is-vertical) .thread-step {
    padding: var(--s6) 0 0;
  }

  .thread:not(.is-vertical) .thread-knot {
    top: 0;
    left: 0;
  }

  .thread:not(.is-vertical) .thread-step:not(:last-child)::after {
    top: calc(0.5rem - 1px);
    bottom: auto;
    left: 1.25rem;
    right: calc(-1 * var(--s4) + 0.25rem);
    width: auto;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--brand-copper) 0 6px, transparent 6px 10px);
  }
}

.party-you {
  display: inline-block;
  margin-left: var(--s1);
  padding: 0 var(--s2);
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 650;
  line-height: 1.6;
  vertical-align: 0.125em;
}

.party {
  padding: var(--s5);
}

.party-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) var(--s4);
}

.party-mark,
.party-avatar {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
}

.party-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-muted);
}

.party-mark .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.party-id {
  flex: 1 1 14rem;
  min-width: 0;
}

.party-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.party-sub {
  margin: 0.125rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.party-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.4;
}

.party-facts {
  display: grid;
  gap: var(--s3) var(--s6);
  margin: var(--s4) 0 0;
}

.party-fact dt {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.party-fact dd {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
}

.party .notice {
  margin-top: var(--s4);
  padding: var(--s3);
}

@media (min-width: 760px) {
  .party-facts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 559px) {
  .party {
    padding: var(--s4);
  }
}

.parties-link {
  margin: var(--s4) 0;
}

.parties-link a {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 2.75rem;
}

.page-intro {
  max-width: 62ch;
  margin: calc(-1 * var(--s3)) 0 var(--s5);
}

.customs-send > p + p {
  margin-top: var(--s2);
}

.customs-send .fine {
  margin-top: var(--s3);
  color: var(--text-muted);
}
