/*
 * Qolqoi signing UI — follows Apple Human Interface Guidelines:
 * system font and type scale, semantic system colors (light/dark), inset grouped lists,
 * translucent bars, sheets, 44pt hit targets, visible focus, reduced motion.
 */

:root {
  color-scheme: light dark;

  /* Semantic colors (iOS/macOS system palette) */
  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --label: #000000;
  --label-secondary: rgba(60, 60, 67, 0.6);
  --label-tertiary: rgba(60, 60, 67, 0.3);
  --bg-grouped: #f2f2f7;
  --bg-grouped-secondary: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-pressed: rgba(120, 120, 128, 0.2);
  --separator: rgba(60, 60, 67, 0.29);
  --bar: rgba(249, 249, 249, 0.78);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);

  /* Type scale (pt ≈ px at 100%), scales with the user's font size */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --large-title: 2.125rem;  /* 34 */
  --title2: 1.375rem;       /* 22 */
  --headline: 1.0625rem;    /* 17 semibold */
  --body: 1.0625rem;        /* 17 */
  --subhead: 0.9375rem;     /* 15 */
  --footnote: 0.8125rem;    /* 13 */
  --caption: 0.75rem;       /* 12 */

  /* 8pt grid */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --radius: 10px;
  --radius-lg: 14px;
  --hit: 44px;
  --content: 720px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #0a84ff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --label: #ffffff;
    --label-secondary: rgba(235, 235, 245, 0.6);
    --label-tertiary: rgba(235, 235, 245, 0.3);
    --bg-grouped: #000000;
    --bg-grouped-secondary: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-pressed: rgba(118, 118, 128, 0.36);
    --separator: rgba(84, 84, 88, 0.6);
    --bar: rgba(29, 29, 31, 0.72);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  font: 400 var(--body) / 1.35 var(--font);
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg-grouped);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ---------- Layout ---------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* Staging only (QOLQOI_STAGING): real EDS keys are accepted there, so every page says it is a test stand. */
.stage-banner {
  margin: 0;
  padding: calc(env(safe-area-inset-top) + var(--s2)) max(var(--s4), env(safe-area-inset-left)) var(--s2);
  background: var(--orange);
  color: #000;
  font-size: var(--footnote);
  text-align: center;
}

.page {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: var(--s2) max(var(--s5), env(safe-area-inset-left)) calc(var(--s8) * 3);
}

/* ---------- Navigation bar (translucent material) ---------- */

.navbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  min-height: var(--hit);
  padding: env(safe-area-inset-top) var(--s2) 0;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.2s;
}
.navbar.scrolled { border-bottom-color: var(--separator); }
.navbar__title {
  font-weight: 600; font-size: var(--headline);
  opacity: 0; transition: opacity 0.2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw;
}
.navbar.scrolled .navbar__title { opacity: 1; }
.navbar__leading { justify-self: start; }
.navbar__trailing { justify-self: end; display: flex; gap: var(--s1); }

.subtitle { margin: calc(-1 * var(--s3)) 0 var(--s6); color: var(--label-secondary); font-size: var(--subhead); }

.large-title {
  margin: var(--s1) 0 var(--s4);
  font: 700 var(--large-title) / 1.2 var(--font-display);
  letter-spacing: 0.01em;
}

/* ---------- Buttons ---------- */

.button {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--hit); min-width: var(--hit);
  padding: 0 var(--s4);
  border: 0; border-radius: var(--radius);
  font: 400 var(--body) var(--font);
  color: var(--blue); background: transparent;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.button:hover { background: var(--fill); }
.button:active { background: var(--fill-pressed); }
.button:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.button--filled { color: #fff; background: var(--blue); font-weight: 600; }
.button--filled:hover { background: color-mix(in srgb, var(--blue) 88%, #000); }
.button--filled:active { transform: scale(0.98); }
.button--tinted { background: color-mix(in srgb, var(--blue) 15%, transparent); font-weight: 600; }
.button--destructive { color: var(--red); }
.button--destructive.button--filled { color: #fff; background: var(--red); }
.button--large { min-height: 50px; padding: 0 var(--s6); border-radius: var(--radius-lg); }
.button--block { width: 100%; }
.button--plain { padding: 0 var(--s2); }
.button svg { width: 20px; height: 20px; flex: none; }
a.button { text-decoration: none; }

/* ---------- Inset grouped list ---------- */

.section { margin-bottom: var(--s6); }
.section__header {
  margin: 0 var(--s4) var(--s2);
  font-size: var(--footnote); text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--label-secondary); font-weight: 400;
}
.section__footer {
  margin: var(--s2) var(--s4) 0;
  font-size: var(--footnote); color: var(--label-secondary);
}

.list {
  margin: 0; padding: 0; list-style: none;
  background: var(--bg-grouped-secondary);
  border-radius: var(--radius);
  overflow: hidden;
}

.row {
  position: relative;
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--hit);
  padding: var(--s3) var(--s4);
  color: inherit; text-decoration: none;
}
/* Inset separators between list items (aligned with the text, as in iOS). */
.list > li { position: relative; }
.list > li + li::before {
  content: ""; position: absolute; top: 0; right: 0; z-index: 1;
  left: var(--s4);
  border-top: 0.5px solid var(--separator);
}
.list > li:has(.row__icon) + li:has(.row__icon)::before { left: calc(var(--s4) + 30px + var(--s3)); }
a.row, button.row {
  width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
a.row:hover, button.row:hover { background: var(--fill); }
a.row:active, button.row:active { background: var(--fill-pressed); }

.row__icon {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px;
  color: #fff; background: var(--blue);
}
.row__icon svg { width: 18px; height: 18px; }
.row__icon--green { background: var(--green); }
.row__icon--orange { background: var(--orange); }
.row__icon--red { background: var(--red); }
.row__icon--gray { background: var(--label-tertiary); }
/* The text keeps a readable width; a long detail or status beside it wraps instead of squeezing it. */
.row__body { flex: 1; min-width: min(9em, 45%); display: flex; flex-direction: column; }
.row__title { font-size: var(--body); overflow-wrap: anywhere; }
.row__subtitle { margin-top: 2px; font-size: var(--subhead); color: var(--label-secondary); overflow-wrap: anywhere; }
.row__detail { flex: 0 1 auto; min-width: 0; font-size: var(--subhead); color: var(--label-secondary); text-align: right; overflow-wrap: anywhere; }
.row > .status { flex-shrink: 1; min-width: 0; }
@media (max-width: 480px) {
  .row > .status { white-space: normal; text-align: right; }
}
.row__chevron { flex: none; width: 8px; height: 13px; color: var(--label-tertiary); }
.row--value .row__title { color: var(--label-secondary); }
.mono { font-family: var(--mono); font-size: var(--footnote); letter-spacing: 0; }

/* ---------- Status ---------- */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--subhead); font-weight: 500;
  white-space: nowrap;
}
.status svg { width: 18px; height: 18px; flex: none; }
.status--signed, .status--completed { color: var(--green); }
.status--waiting, .status--pending { color: var(--orange); }
.status--declined, .status--cancelled, .status--expired { color: var(--red); }
.status--paper_signed { color: var(--label-secondary); }

.pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: var(--caption); font-weight: 600;
  color: var(--blue); background: color-mix(in srgb, var(--blue) 15%, transparent);
}

/* ---------- Document header & preview ---------- */

.doc-header { display: flex; gap: var(--s4); align-items: flex-start; margin-bottom: var(--s5); }
.doc-header__icon {
  flex: none; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 12px;
  background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red);
}
.doc-header__icon svg { width: 30px; height: 30px; }
.doc-header__title { margin: 0; font: 700 var(--title2) / 1.25 var(--font-display); overflow-wrap: anywhere; }
.doc-header__meta { margin-top: var(--s1); font-size: var(--subhead); color: var(--label-secondary); }

.preview {
  position: relative;
  height: min(70vh, 900px);
  background: var(--bg-grouped-secondary);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview iframe { width: 100%; height: 100%; border: 0; display: block; }
/* A completed request: the copy with the signature sheet, or the original as signed. */
.preview-switch { margin-bottom: var(--s3); }
.preview-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); }
.preview__placeholder {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: var(--s3);
  color: var(--label-secondary); font-size: var(--subhead); text-align: center; padding: var(--s4);
}

/* ---------- Bottom action bar ---------- */

.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: var(--s3) max(var(--s5), env(safe-area-inset-left)) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}
.action-bar__inner {
  max-width: var(--content); margin: 0 auto;
  display: flex; gap: var(--s3); align-items: center;
}
.action-bar__inner .button--filled { flex: 1; }
.action-bar__note { flex: 1; font-size: var(--subhead); color: var(--label-secondary); text-align: center; }

/* ---------- Sign-in ---------- */

.welcome {
  flex: 1; display: grid; place-items: center;
  padding: var(--s8) var(--s5);
}
.welcome__card { width: 100%; max-width: 400px; text-align: center; }
.app-icon {
  width: 88px; height: 88px; margin: 0 auto var(--s5);
  border-radius: 20px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, #3d8bff, #0051d5);
  box-shadow: var(--shadow);
}
.app-icon svg { width: 48px; height: 48px; }
.brand { display: inline-grid; place-items: center; min-width: var(--hit); min-height: var(--hit); border-radius: var(--radius); }
.brand .app-icon { width: 30px; height: 30px; margin: 0; border-radius: 7px; box-shadow: none; }
.brand .app-icon svg { width: 18px; height: 18px; }
.welcome h1 { margin: 0 0 var(--s2); font: 700 1.75rem / 1.2 var(--font-display); }
.welcome p { margin: 0 0 var(--s8); color: var(--label-secondary); }
.welcome .hint { margin-top: var(--s5); font-size: var(--footnote); color: var(--label-secondary); }
.welcome .hint a { color: var(--blue); }
.dev-profiles { margin-top: var(--s8); text-align: start; }

/* ---------- Empty / loading states ---------- */

.empty {
  display: grid; justify-items: center; gap: var(--s2);
  padding: calc(var(--s8) * 2) var(--s5); text-align: center;
  color: var(--label-secondary);
}
.empty svg { width: 56px; height: 56px; color: var(--label-tertiary); margin-bottom: var(--s2); }
.empty h2 { margin: 0; font: 600 var(--title2) var(--font-display); color: var(--label); }

.spinner {
  width: 20px; height: 20px; flex: none;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner--large { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Banner ---------- */

.banner {
  display: flex; gap: var(--s3); align-items: flex-start;
  margin-bottom: var(--s5); padding: var(--s3) var(--s4);
  border-radius: var(--radius);
  font-size: var(--subhead);
  background: color-mix(in srgb, var(--orange) 14%, var(--bg-grouped-secondary));
}
.banner--error { background: color-mix(in srgb, var(--red) 12%, var(--bg-grouped-secondary)); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner--error svg { color: var(--red); }
.banner strong { display: block; font-weight: 600; margin-bottom: 2px; }

/* ---------- Sheets & alerts (<dialog>) ---------- */

dialog {
  border: 0; padding: 0; color: inherit;
  background: var(--bg-grouped-secondary);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }

.sheet {
  width: min(100%, 520px); max-height: 90vh;
  margin: auto auto 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--bg-grouped);
}
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: var(--radius-lg); }
}
.sheet[open] { animation: sheet-in 0.35s var(--ease); }
.sheet__header {
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center; gap: var(--s1);
  min-height: 56px; padding: 0 var(--s2);
}
/* The buttons keep their size; a long title truncates instead of running under them. */
.sheet__header h2 {
  margin: 0; min-width: 0; font-size: var(--headline); font-weight: 600; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Both actions hug their text and sit at the edges (as in a UINavigationBar), not stretched over a column. */
.sheet__header > :first-child { justify-self: start; }
.sheet__header > :last-child { justify-self: end; }
.sheet[open] { display: flex; flex-direction: column; }
/* Dark mode: a modal surface is elevated (lighter) so it separates from the black page behind it. */
@media (prefers-color-scheme: dark) {
  .sheet { --bg-grouped: #1c1c1e; --bg-grouped-secondary: #2c2c2e; }
}
.sheet__body { padding: var(--s2) var(--s5) var(--s6); overflow-y: auto; overscroll-behavior: contain; }
.sheet__fields { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Quick Look: a large sheet with the file on a stage and its details under it. */
.quicklook { width: min(100%, 880px); height: min(92vh, 1000px); max-height: 92vh; }
.quicklook__body {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s5);
  padding: var(--s2) var(--s5) var(--s5); overflow-y: auto; overscroll-behavior: contain;
}
.quicklook__body .section { margin-bottom: 0; }
.quicklook__stage {
  flex: 1 0 auto; min-height: min(60vh, 640px);
  display: grid; place-items: center; gap: var(--s3);
  border-radius: var(--radius); overflow: hidden;
  color: var(--label-secondary); background: var(--bg-grouped-secondary);
}
.quicklook__stage iframe { align-self: stretch; justify-self: stretch; width: 100%; min-height: min(60vh, 640px); border: 0; }
.quicklook__stage .banner { margin: var(--s4); }
.quicklook__open { align-self: flex-start; margin-top: calc(-1 * var(--s3)); }
.quicklook__zoom {
  appearance: none; display: grid; place-items: center; width: 100%; height: 100%;
  padding: var(--s3); border: 0; background: none; cursor: zoom-in;
}
.quicklook__zoom:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--blue) 60%, transparent); border-radius: var(--radius); outline: 0; }
.quicklook__zoom img { max-width: 100%; max-height: calc(min(60vh, 640px) - 2 * var(--s3)); object-fit: contain; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.quicklook__stage.is-zoomed { overflow: auto; place-items: start; }
.quicklook__stage.is-zoomed .quicklook__zoom { width: max-content; height: max-content; cursor: zoom-out; }
.quicklook__stage.is-zoomed img { max-width: none; max-height: none; }
.sheet__fields:disabled { opacity: 0.6; }
.sheet .section { margin-bottom: var(--s5); }
.sheet .section:last-child { margin-bottom: 0; }

.textarea {
  width: 100%; min-height: 120px; resize: vertical;
  padding: var(--s3) var(--s4);
  border: 0; border-radius: var(--radius);
  font: inherit; color: inherit; background: var(--bg-grouped-secondary);
}

.alert {
  width: min(100% - 2 * var(--s8), 300px);
  border-radius: var(--radius-lg);
  text-align: center;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
}
.alert[open] { animation: alert-in 0.25s var(--ease); }
.alert__content { padding: var(--s5) var(--s4) var(--s4); }
.alert__content h2 { margin: 0 0 var(--s1); font-size: var(--headline); font-weight: 600; }
.alert__content p { margin: 0; font-size: var(--footnote); white-space: pre-line; }
.alert__content .mono { display: block; margin-top: var(--s2); color: var(--label-secondary); }
.alert__actions { display: flex; border-top: 0.5px solid var(--separator); }
.alert__actions .button { flex: 1; border-radius: 0; min-height: var(--hit); }
.alert__actions .button + .button { border-left: 0.5px solid var(--separator); }
/* The confirming action (sheet "Загрузить", nav-bar "Отправить", alert default) is semibold, per HIG. */
.button--default { font-weight: 600; }

.progress-steps { display: grid; gap: var(--s3); margin: var(--s5) 0 var(--s2); text-align: left; }
.progress-step { display: flex; gap: var(--s3); align-items: center; font-size: var(--subhead); color: var(--label-tertiary); }
.progress-step svg, .progress-step .spinner { width: 20px; height: 20px; }
.progress-step.is-active { color: var(--label); }
.progress-step.is-done { color: var(--label-secondary); }
.progress-step.is-done svg { color: var(--green); }
.progress-dot { width: 20px; height: 20px; flex: none; border: 2px solid currentColor; border-radius: 50%; }

.success-mark {
  width: 72px; height: 72px; margin: var(--s2) auto var(--s4);
  border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: var(--green);
}
.success-mark svg { width: 40px; height: 40px; }

@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes alert-in { from { transform: scale(1.1); opacity: 0; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--s5));
  padding: var(--s3) var(--s5);
  border-radius: 999px;
  font-size: var(--subhead); font-weight: 500;
  color: var(--label); background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow);
}

.noscript { padding: var(--s8); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Segmented control ---------- */

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  margin-bottom: var(--s5); padding: 2px;
  border-radius: 9px; background: var(--fill);
}
.segmented a, .segmented button {
  appearance: none; border: 0; background: transparent; cursor: pointer; font-family: inherit;
  display: grid; place-items: center; min-height: 32px; padding: 0 var(--s3);
  border-radius: 7px;
  font-size: var(--subhead); font-weight: 500; color: var(--label-secondary); text-decoration: none;
  transition: background-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.segmented a:hover, .segmented button:hover { color: var(--label); background: var(--fill); }
/* The selected segment is filled with the accent, so it reads as chosen at a glance, not only by weight. */
.segmented a[aria-current="page"], .segmented button[aria-pressed="true"] {
  color: #fff; background: var(--blue);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--blue) 35%, transparent);
  font-weight: 600;
}
@media (min-width: 720px) { .segmented { max-width: 420px; } }

/* Mailbox tabs with the primary "new document" action beside them; on phones the button wraps below. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.toolbar .segmented { flex: 1 1 280px; margin: 0; }
.toolbar > .button { flex: 1 0 auto; }
@media (min-width: 720px) { .toolbar > .button { flex: none; margin-left: auto; min-height: 36px; border-radius: 9px; } }

/* ---------- Forms inside grouped lists ---------- */

.field {
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--hit); padding: 0 var(--s4);
}
.field__label { flex: none; width: 110px; color: var(--label); }
.field input, .field select {
  flex: 1; min-width: 0; min-height: var(--hit);
  border: 0; outline: 0; padding: 0;
  font: inherit; color: var(--label); background: transparent; text-align: right;
}
.field input::placeholder { color: var(--label-tertiary); }
.field input[inputmode="numeric"] { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.field:focus-within { background: color-mix(in srgb, var(--blue) 6%, transparent); }
.field--error input { color: var(--red); }
.field__status { display: inline-flex; flex: none; }
.field__status svg { width: 20px; height: 20px; }
.field__status--ok { color: var(--green); }
.field__status--error { color: var(--red); }
.field-error { margin: var(--s1) var(--s4) 0; font-size: var(--footnote); color: var(--red); }

/* Who the register says is behind a BIN, under the BIN field. */
.company {
  display: grid; gap: 2px;
  margin: 0 var(--s4) var(--s3); padding: var(--s2) var(--s3);
  border-radius: 8px; background: var(--fill);
  font-size: var(--footnote); color: var(--label-secondary);
}
.company__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.company__name { font-size: var(--subhead); font-weight: 600; color: var(--label); }
.company__badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-weight: 600; color: var(--orange); background: color-mix(in srgb, var(--orange) 15%, transparent);
}
.company__badge svg { width: 14px; height: 14px; }
.company__line { display: flex; gap: var(--s2); }
.company__key { flex: none; width: 92px; }
.company__note { display: flex; align-items: center; gap: var(--s2); }
.company__note svg, .company__note .spinner { width: 16px; height: 16px; color: var(--orange); }
.company__note .spinner { color: var(--label-secondary); border-width: 2px; }
@media (max-width: 480px) { .company__line { flex-direction: column; gap: 0; } .company__key { width: auto; } }
/* Label above a full-width input (multi-line template fields). */
.field--stacked { flex-direction: column; align-items: stretch; gap: var(--s1); padding: var(--s3) var(--s4); }
.field--stacked .field__label { width: auto; }
.field--stacked textarea {
  width: 100%; min-height: 96px; resize: vertical; padding: 0;
  border: 0; outline: 0; font: inherit; color: inherit; background: transparent;
}
.field--error textarea { color: var(--red); }
.page-lead { margin: calc(-1 * var(--s3)) var(--s4) var(--s5); color: var(--label-secondary); }

.signer-card { margin-bottom: var(--s4); }
.signer-card__header { display: flex; align-items: center; justify-content: space-between; margin: 0 var(--s4) var(--s2); }
.signer-card__header h3 { margin: 0; font-size: var(--footnote); font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--label-secondary); }
.signer-card .segmented { margin: 0 0 var(--s2); max-width: none; }

/* Compose: each signer is one bordered box (header, type, fields, its own "Удалить"), so what a button
   removes is never in doubt. Hovering "Удалить" tints the box it would remove. */
.signer-card--boxed {
  margin: var(--s3) 0; padding: var(--s3) var(--s3) var(--s3);
  border: 1px solid var(--separator); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-grouped-secondary) 55%, var(--bg-grouped));
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.signer-card--boxed:focus-within { border-color: color-mix(in srgb, var(--blue) 55%, var(--separator)); }
.signer-card--boxed:has(.signer-card__remove:hover, .signer-card__remove:focus-visible) {
  border-color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--bg-grouped));
}
.signer-card--boxed.signer-card--error { border-color: var(--red); }
.signer-card--boxed .signer-card__header { margin: 0 0 var(--s3); gap: var(--s2); justify-content: flex-start; min-height: 32px; }
.signer-card--boxed .signer-card__title {
  margin: 0; flex: 1; font-size: var(--headline); font-weight: 600; color: var(--label);
  text-transform: none; letter-spacing: 0;
}
.signer-card__number {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: var(--footnote); font-weight: 700; color: #fff; background: var(--blue);
  font-variant-numeric: tabular-nums;
}
.signer-card__remove { flex: none; min-height: 32px; font-size: var(--subhead); }
.signer-card__remove svg { width: 16px; height: 16px; padding: 1px; border-radius: 50%; color: #fff; background: var(--red); }
.signer-card--boxed .segmented { margin: 0 0 var(--s3); }
.signer-card--boxed > .field-error { margin-left: var(--s1); }
.signer-card__footer { margin: var(--s2) var(--s1) 0; font-size: var(--footnote); color: var(--label-secondary); }
.button--block.button--tinted { margin-top: var(--s1); }

/* «необязательно» under a label: the few fields that may stay empty are the ones marked. */
.field__label { display: flex; flex-direction: column; width: auto; min-width: 110px; max-width: 50%; }
.field__optional { font-size: var(--caption); color: var(--label-secondary); line-height: 1.2; }

/* Disclosure row (HIG): "› Дополнительно" with what is set inside shown while closed. */
.disclosure {
  appearance: none; border: 0; background: transparent; font: inherit; color: var(--blue); cursor: pointer;
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--hit);
  padding: 0 var(--s4); text-align: left;
}
.disclosure:hover { background: var(--fill); }
.disclosure:focus-visible { outline: none; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--blue) 60%, transparent); }
.disclosure__chevron { display: inline-flex; transition: transform 0.2s var(--ease); }
.disclosure__chevron svg { width: 14px; height: 14px; }
.disclosure[aria-expanded="true"] .disclosure__chevron { transform: rotate(90deg); }
.disclosure__label { flex: none; }
.disclosure__summary {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--subhead); color: var(--label-secondary); text-align: right;
}
.list--nested { border-radius: 0; background: transparent; }
.list--nested > li:first-child::before {
  content: ""; position: absolute; top: 0; left: var(--s4); right: 0; height: 0.5px; background: var(--separator);
}

/* The form's own bottom bar: summary on the left, Cancel + the primary action on the right. */
.action-bar--form .action-bar__inner .button--filled { flex: none; padding: 0 var(--s5); }
.action-bar--form .action-bar__note { text-align: left; display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.action-bar--form .action-bar__note svg { width: 18px; height: 18px; flex: none; }
.action-bar__note--error { color: var(--red); }
@media (max-width: 560px) {
  .action-bar--form .action-bar__inner { flex-wrap: wrap; }
  .action-bar--form .action-bar__note { flex-basis: 100%; justify-content: center; font-size: var(--footnote); }
  .action-bar--form .action-bar__inner > .button--plain { display: none; } /* the nav bar has Cancel */
  .action-bar--form .action-bar__inner .button--filled { flex: 1; }
}

/* Switch (HIG toggle) */
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--fill-pressed);
  transition: background-color 0.2s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 60%, transparent); outline-offset: 2px; }

.file-pick { position: relative; }
.file-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* Inset, keyboard only: an outset ring is clipped by the list's rounded corners. */
.file-pick:has(input:focus-visible) { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--blue) 60%, transparent); border-radius: var(--radius); }
.file-pick:hover { background: var(--fill); }
.file-pick--error .row__subtitle { color: var(--red); }
.row__thumb { flex: none; width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--fill); }
.row__detail--action { color: var(--blue); }

/* Phones: a button inside a list row shows only its icon, so the row's text keeps its width. */
@media (max-width: 480px) {
  .row > .button--tinted:has(svg) { padding: 0 var(--s3); }
  .row > .button--tinted:has(svg) .button__label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

.row__icon--blue { background: var(--blue); }
.row__action { flex: none; min-height: 32px; padding: 0 var(--s3); font-size: var(--subhead); }
.row__action svg { width: 18px; height: 18px; }
.row__time { flex: none; font-size: var(--footnote); color: var(--label-secondary); text-align: right; white-space: nowrap; }

.invite-card {
  width: 100%; max-width: 440px; margin: 0 auto; padding: var(--s6);
  text-align: center; border-radius: var(--radius-lg); background: var(--bg-grouped-secondary);
}
.invite-card .doc-header__icon { margin: 0 auto var(--s4); }
.invite-card h1 { margin: 0 0 var(--s2); font: 700 var(--title2) / 1.25 var(--font-display); overflow-wrap: anywhere; }
.invite-card p { margin: 0 0 var(--s2); color: var(--label-secondary); }
.invite-card .button { margin-top: var(--s5); }

.spacer-s { height: var(--s2); }
.invite-card > svg { width: 48px; height: 48px; color: var(--orange); margin-bottom: var(--s3); }
.welcome .invite-card .hint { margin-top: var(--s5); font-size: var(--footnote); }
[aria-busy="true"] { opacity: 0.5; cursor: progress; }

/* ---- Template editor (Notion-like) ------------------------------------------------------------ */
.button-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 var(--s5); }
.button-row--tight { margin: 0; gap: 0; }
.row-split { display: flex; align-items: center; }
.row-split > .row { flex: 1; min-width: 0; }
.row-split > .button { flex: none; margin-right: var(--s2); }

.page--editor { max-width: 860px; }
.doc-meta { display: flex; align-items: center; gap: var(--s1); margin: var(--s4) 0 var(--s2); font-size: var(--footnote); color: var(--label-secondary); }
.doc-meta svg { width: 16px; height: 16px; }
.doc-title, .doc-subtitle {
  display: block; width: 100%; padding: 0; border: 0; outline: 0;
  color: var(--label); background: transparent;
}
.doc-title { font: 700 2.25rem / 1.2 var(--font-display); margin-bottom: var(--s1); }
.doc-subtitle { font: 400 var(--body) / 1.4 var(--font); color: var(--label-secondary); margin-bottom: var(--s5); }
.doc-title::placeholder, .doc-subtitle::placeholder { color: var(--label-tertiary); }
.doc-hint { margin: 0 0 var(--s2); font-size: var(--footnote); color: var(--label-secondary); }

.doc-sheet {
  margin: 0 0 var(--s6); padding: var(--s6) var(--s5) var(--s6) var(--s2);
  background: var(--bg-grouped-secondary); border-radius: var(--radius-lg, 14px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.doc-editor { position: relative; }
.doc-block { display: flex; align-items: flex-start; position: relative; border-radius: 6px; }
.doc-block__gutter { flex: none; display: flex; align-items: center; gap: 2px; width: 48px; padding-top: 3px; opacity: 0; transition: opacity 0.12s; }
.doc-block:hover .doc-block__gutter, .doc-block--focused .doc-block__gutter { opacity: 1; }
.doc-block__add, .doc-block__handle {
  display: inline-grid; place-items: center; width: 22px; height: 24px; padding: 0;
  border: 0; border-radius: 4px; background: transparent; color: var(--label-tertiary); cursor: pointer;
}
.doc-block__add svg { width: 16px; height: 16px; }
.doc-block__handle { cursor: grab; font-size: 13px; letter-spacing: -2px; user-select: none; }
.doc-block__add:hover, .doc-block__handle:hover { background: var(--fill); color: var(--label-secondary); }
.doc-block__content {
  flex: 1; min-width: 0; padding: 3px 2px; outline: 0;
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; color: var(--label);
}
.doc-block__content--h1 { font: 700 1.5rem / 1.3 var(--font-display); text-align: center; padding: 10px 2px 6px; }
.doc-block__content--h2 { font: 600 1.15rem / 1.35 var(--font-display); padding-top: 10px; }
.doc-block__content.is-empty::before { content: attr(data-placeholder); color: var(--label-tertiary); pointer-events: none; }
.doc-block__content.is-empty:not(:focus)::before { content: ""; }
.doc-editor .doc-block:only-child .doc-block__content.is-empty::before { content: attr(data-placeholder); }
.doc-block--dragging { opacity: 0.4; }
.doc-block--drop-before { box-shadow: 0 -2px 0 var(--blue); }
.doc-block--drop-after { box-shadow: 0 2px 0 var(--blue); }

.chip {
  display: inline-block; margin: 0 1px; padding: 0 6px; border-radius: 5px;
  font-size: 0.95em; line-height: 1.5; white-space: nowrap; cursor: default; user-select: all;
  color: var(--blue); background: color-mix(in srgb, var(--blue) 13%, transparent);
}
.chip--context { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.chip--missing { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }

.doc-menu, .doc-toolbar {
  position: absolute; z-index: 20;
  background: var(--bg-grouped-secondary); border-radius: 10px; box-shadow: var(--shadow);
  border: 0.5px solid var(--separator);
}
.doc-menu { width: 300px; max-height: 320px; overflow-y: auto; padding: 4px; }
.doc-menu__item {
  display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 6px 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--label); text-align: start; cursor: pointer; font: inherit;
}
.doc-menu__item[aria-selected="true"] { background: var(--fill); }
.doc-menu__icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 6px; border: 0.5px solid var(--separator); color: var(--label-secondary); }
.doc-menu__icon svg { width: 16px; height: 16px; }
.doc-menu__text { display: flex; flex-direction: column; min-width: 0; }
.doc-menu__text small { font-size: var(--footnote); color: var(--label-secondary); }
.doc-menu__empty { padding: 8px; color: var(--label-secondary); font-size: var(--subhead); }
.doc-toolbar { display: flex; padding: 3px; gap: 2px; white-space: nowrap; }
.doc-toolbar__button { padding: 5px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--label); font: 500 var(--footnote) var(--font); cursor: pointer; }
.doc-toolbar__button:hover { background: var(--fill); }
.doc-toolbar__button--primary { color: var(--blue); }

.field-editor { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s4); }
.field-editor__main { flex: 1; min-width: 0; }
.field-editor__label { width: 100%; padding: 2px 0; border: 0; outline: 0; font: inherit; color: var(--label); background: transparent; }
.field-editor__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); font-size: var(--footnote); color: var(--label-secondary); }
.field-editor__type { font: inherit; color: var(--blue); border: 0; background: transparent; padding: 0; }
.field-editor__required { display: inline-flex; align-items: center; gap: 4px; }
.field-editor--unused .field-editor__label { color: var(--label-secondary); }
.field-editor__note { color: var(--orange); }
.field select { flex: 1; min-width: 0; font: inherit; color: var(--label); border: 0; background: transparent; text-align: end; }

.authority { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); }
.authority__label { color: var(--label); }
.authority__chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.authority small { color: var(--label-secondary); font-size: var(--footnote); }
.pill {
  padding: 5px 11px; border-radius: 999px; border: 0.5px solid var(--separator);
  background: transparent; color: var(--label); font: 500 var(--footnote) var(--font); cursor: pointer;
}
.pill--on { color: #fff; background: var(--blue); border-color: var(--blue); }

/* "Новый документ": the two ways to start, as large rows. */
.list--choices .row { min-height: 76px; }
.list--choices .row__title { font-weight: 600; }
.search {
  display: block; width: 100%; margin: 0 0 var(--s5); padding: 9px 12px;
  border: 0; border-radius: var(--radius); outline: 0;
  font: inherit; color: var(--label); background: var(--fill);
}
.search::placeholder { color: var(--label-secondary); }
.page:has(~ .action-bar--form:not(.desktop-only)) { padding-bottom: 160px; } /* room to scroll past the fixed bar */
.action-bar--form .action-bar__inner { max-width: calc(var(--content) - 2 * var(--s5)); }

/* ---------- Unknown senders ---------- */

/* A count on a mailbox tab ("Новые 3"): white on the selected blue, blue elsewhere. */
.segmented a, .segmented button { gap: 6px; grid-auto-flow: column; }
.segmented__badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: inline-grid; place-items: center;
  font-size: var(--caption); font-weight: 700; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--blue);
}
.segmented a[aria-current="page"] .segmented__badge, .segmented button[aria-pressed="true"] .segmented__badge { color: var(--blue); background: #fff; }
.toolbar .segmented { flex-basis: 360px; }
@media (min-width: 720px) { .toolbar .segmented { max-width: 480px; } }

.page-note { margin: 0 var(--s4) var(--s4); font-size: var(--footnote); color: var(--label-secondary); }

/* A document from someone the viewer hasn't worked with: who it is, and trust / block. */
.sender-card {
  margin-bottom: var(--s5); padding: var(--s4);
  border: 1px solid color-mix(in srgb, var(--orange) 45%, var(--separator)); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--orange) 8%, var(--bg-grouped-secondary));
}
.sender-card--blocked { border-color: color-mix(in srgb, var(--red) 45%, var(--separator)); background: color-mix(in srgb, var(--red) 8%, var(--bg-grouped-secondary)); }
.sender-card__head { display: flex; align-items: center; gap: var(--s2); font-size: var(--headline); }
.sender-card__head svg { width: 22px; height: 22px; color: var(--orange); flex: none; }
.sender-card--blocked .sender-card__head svg { color: var(--red); }
.sender-card p { margin: var(--s2) 0 0; font-size: var(--subhead); color: var(--label-secondary); }
.sender-card__facts { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s3); margin: var(--s3) 0 0; font-size: var(--subhead); }
.sender-card__facts dt { color: var(--label-secondary); }
.sender-card__facts dd { margin: 0; overflow-wrap: anywhere; }
.sender-card .company { margin: var(--s3) 0 0; }
.sender-card .button-row { margin: var(--s3) 0 0; }

/* Alerts with three choices stack them, as iOS does. */
.alert__actions:has(> :nth-child(3)) { flex-direction: column; }
.alert__actions:has(> :nth-child(3)) .button + .button { border-left: 0; border-top: 0.5px solid var(--separator); }

/* ---------- Invitations: the link itself, copy, e-mail ---------- */

.invite { padding: var(--s3) var(--s4); display: grid; gap: var(--s2); }
.invite__head { display: flex; align-items: center; gap: var(--s3); }
.invite__url {
  width: 100%; min-width: 0; padding: var(--s2) var(--s3);
  border: 1px solid var(--separator); border-radius: 8px;
  font: var(--footnote) / 1.4 var(--mono); color: var(--label); background: var(--fill);
  cursor: text;
}
.invite__url:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
.invite__actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.invite__actions .button { min-height: 36px; }
.invite__email { margin: 0; font-size: var(--footnote); color: var(--label-secondary); }
.invite__email--sent { color: var(--green); }
.invite__email--failed { color: var(--red); }

/* ---------- Company workspace ---------- */

/* Category filter above a mailbox: scrolls sideways on phones rather than wrapping into a wall. */
.chips { display: flex; gap: var(--s2); margin: 0 0 var(--s4); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip {
  appearance: none; flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 var(--s3); border: 1px solid var(--separator); border-radius: 999px;
  font: inherit; font-size: var(--subhead); color: var(--label); background: var(--bg-grouped-secondary); cursor: pointer;
}
.chip:hover { background: var(--fill); }
.chip svg { width: 14px; height: 14px; color: var(--red); }
.chip[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); }
.chip[aria-pressed="true"] svg { color: #fff; }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 40%, transparent); }

/* A list row that is a choice: radio (one of) or checkbox (several), the control on the left. */
.row.choice { cursor: pointer; }
.row.choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--blue); }
.row.choice:hover { background: var(--fill); }
.row__buttons { display: inline-flex; gap: var(--s1); flex: none; }
.sheet__header-gap { margin-top: var(--s5); }
.access-notice__sent { margin: var(--s2) 0 0; font-weight: 600; }
.field select {
  flex: 1; min-width: 0; min-height: var(--hit); border: 0; outline: 0; padding: 0;
  font: inherit; color: var(--blue); background: transparent; text-align: right; text-align-last: right; cursor: pointer;
}
.section-action { margin: calc(-1 * var(--s3)) 0 var(--s6); }
.banner .button { margin-top: var(--s2); }

/* Subfolders: indented under their folder. */
.list > li.depth-1 { padding-left: var(--s6); }
.list > li.depth-2 { padding-left: calc(2 * var(--s6)); }
.list > li.depth-3 { padding-left: calc(3 * var(--s6)); }
.chips + .chips { margin-top: calc(-1 * var(--s2)); }
.chips + .chips .chip { min-height: 28px; font-size: var(--footnote); }
.dev-profiles__search {
  width: 100%; margin: 0 0 var(--s4); padding: var(--s2) var(--s3); min-height: 40px;
  border: 1px solid var(--separator); border-radius: var(--radius);
  font: inherit; color: var(--label); background: var(--bg-grouped-secondary);
}
.dev-profiles__search:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }

/* ---------- Support view ---------- */

/* While support staff look at someone's portal: a bar no one can miss, on every page. */
.support-bar {
  position: sticky; top: 0; z-index: 30;
  padding: var(--s2) max(var(--s4), env(safe-area-inset-left));
  color: #1c1c1e; background: repeating-linear-gradient(-45deg, #ffcc00 0 18px, #ffb800 18px 36px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.support-bar__inner {
  max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4);
  font-size: var(--subhead);
}
.support-bar__inner strong { font-size: var(--headline); text-transform: uppercase; letter-spacing: 0.03em; }
.support-bar__left { font-variant-numeric: tabular-nums; font-weight: 600; }
.support-bar .button--filled { margin-left: auto; color: #fff; background: #1c1c1e; min-height: 36px; }
.support-mode .navbar { top: 52px; }
/* Nothing to press: the server refuses every change anyway, the screen shouldn't invite one. */
.support-mode .action-bar,
.support-mode .toolbar > .button,
.support-mode .navbar [aria-label="Отправить на подпись"],
.support-mode .sender-card .button-row,
.support-mode .invite__actions,
.support-mode .section-action,
.support-mode .sidebar__actions,
.support-mode .action-card__buttons,
.support-mode .sidebar__signout { display: none !important; }
.support-mode .page { padding-bottom: var(--s8); }
.support-ended { text-align: center; padding-top: 20vh; }

/* The person's log of support visits. */
.visit {
  margin-bottom: var(--s3); padding: var(--s3) var(--s4);
  border: 1px solid var(--separator); border-radius: var(--radius-lg); background: var(--bg-grouped-secondary);
}
.visit--live { border-color: var(--orange); }
.visit__head { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.visit__head span { color: var(--label-secondary); font-size: var(--subhead); }
.visit p { margin: var(--s1) 0 0; font-size: var(--subhead); color: var(--label-secondary); }
.visit__pages { margin: var(--s2) 0 0; padding-left: var(--s5); font-size: var(--footnote); display: grid; gap: 2px; }
.visit__pages time { color: var(--label-secondary); font-variant-numeric: tabular-nums; }
.visit__refused { color: var(--red); }
.preview__placeholder svg { width: 48px; height: 48px; flex: none; }

/* Signature check page (#/check/…) */
.stack { display: grid; gap: var(--s2); margin-top: var(--s4); }
.row__subtitle--ok { color: var(--green); }
.row__subtitle--bad { color: var(--red); }
.list__note { margin: 0; padding: var(--s3) var(--s4); font-size: 13px; line-height: 1.4; color: var(--label-secondary); }


/* ---------- History timeline: newest first, a dot per event on one line ---------- */
.timeline { padding: var(--s4) var(--s4) var(--s2); background: var(--bg-grouped-secondary); border-radius: var(--radius); }
.timeline__list { list-style: none; margin: 0; padding: 0; }
.timeline__item {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); row-gap: 2px;
  padding: 0 0 var(--s4) 24px;
}
/* The line joining this dot to the next one. */
.timeline__item::before {
  content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; border-radius: 1px; background: var(--fill);
}
.timeline__item:last-child { padding-bottom: var(--s2); }
.timeline__item:last-child::before { display: none; }
.timeline__dot {
  position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--label-tertiary); box-shadow: 0 0 0 3px var(--bg-grouped-secondary);
}
.timeline__dot--green { background: var(--green); }
.timeline__dot--blue { background: var(--blue); }
.timeline__dot--red { background: var(--red); }
.timeline__dot--orange { background: var(--orange); }
.timeline__item:first-child .timeline__dot { width: 14px; height: 14px; left: -1px; top: 3px; } /* the latest */
.timeline__title { font-size: var(--subhead); font-weight: 600; line-height: 1.35; }
.timeline__time { font-size: var(--footnote); color: var(--label-secondary); white-space: nowrap; line-height: 1.6; }
.timeline__subtitle { grid-column: 1 / -1; font-size: var(--footnote); color: var(--label-secondary); overflow-wrap: anywhere; }
.timeline__more {
  display: block; width: 100%; margin-top: var(--s1); padding: var(--s2) 0; border: 0; border-top: 1px solid var(--fill);
  background: none; color: var(--blue); font: inherit; font-size: var(--subhead); cursor: pointer; text-align: start;
}
.timeline__more:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.timeline__empty { margin: 0; color: var(--label-secondary); font-size: var(--subhead); }
@media (max-width: 480px) {
  .timeline__item { grid-template-columns: minmax(0, 1fr); }
  .timeline__time { line-height: 1.3; }
}
.banner--info { background: color-mix(in srgb, var(--blue) 10%, var(--bg-grouped-secondary)); }
.banner--info svg { color: var(--blue); }

/* ---------- Request page on wide screens: the document beside its signers, signatures and history ---------- */
@media (min-width: 1100px) {
  .page.page--wide { max-width: 1320px; }
  .request-layout {
    display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); gap: var(--s6); align-items: start;
  }
  /* The document stays in view while the column beside it scrolls. */
  .request-layout__main { position: sticky; top: calc(var(--s4) + 44px); }
  .request-layout__main .preview { height: calc(100vh - 290px); min-height: 520px; }
  .request-layout__side .section:last-child { margin-bottom: 0; }
  .page--wide ~ .action-bar .action-bar__inner, .action-bar__inner--wide { max-width: 1320px; }
}

/* ---------- Amount with its currency (send form, grant limit) ---------- */
.amount { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s2); }
.amount input { flex: 1; text-align: right; font-variant-numeric: tabular-nums; }
.field .amount select { flex: none; width: auto; color: var(--label-secondary); }
.field--stacked textarea { min-height: 56px; }

/* ---------- «Полномочия»: the list and the chosen grant ---------- */
.state-pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap;
  padding: 2px 9px; border-radius: 999px; font-size: var(--caption); font-weight: 600;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.state-pill svg { width: 13px; height: 13px; }
.state-pill--green { --tone: var(--green); }
.state-pill--orange { --tone: var(--orange); }
.state-pill--blue { --tone: var(--blue); }
.state-pill--red { --tone: var(--red); }
.state-pill--gray { --tone: var(--label-secondary); }
.empty--compact { padding: var(--s8) var(--s5); }
.empty--compact svg { width: 40px; height: 40px; }
.authority-layout__list .row[aria-current="page"] { background: color-mix(in srgb, var(--blue) 10%, var(--bg-grouped-secondary)); }
.authority-layout__list .banner { margin-bottom: var(--s4); }
.grant-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s3); }
.grant-card__title { margin: 0; font: 700 var(--title2) var(--font-display); }
.grant-card .banner { margin-bottom: var(--s4); }
.grant-fact { align-items: flex-start; padding-top: var(--s3); padding-bottom: var(--s3); gap: var(--s4); }
.grant-fact__label { flex: none; width: 120px; color: var(--label-secondary); }
.grant-fact__value { flex: 1; min-width: 0; display: grid; gap: 2px; color: var(--label); overflow-wrap: anywhere; }
/* Phones: the list, or the chosen grant on its own (the back button returns to the list). */
.authority-layout--detail .authority-layout__list, .authority-layout__placeholder { display: none; }
@media (min-width: 1000px) {
  .authority-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr); gap: var(--s6); align-items: start;
  }
  .authority-layout--detail .authority-layout__list, .authority-layout__placeholder { display: grid; }
  .authority-layout--detail .authority-layout__list { display: block; }
  .authority-layout__detail { position: sticky; top: calc(var(--s4) + 44px); }
  .authority-layout__placeholder { min-height: 320px; align-content: center; border-radius: var(--radius-lg); background: var(--bg-grouped-secondary); }
}
@media (max-width: 480px) { .grant-fact { flex-direction: column; gap: 2px; } .grant-fact__label { width: auto; } }
/* A signer whose доверенность doesn't cover the document: why, next to «Отклонить», instead of «Подписать». */
.action-bar__note--error { display: flex; align-items: center; justify-content: flex-start; gap: var(--s2); text-align: left; }
.action-bar__note--error svg { width: 18px; height: 18px; flex: none; }
/* Four filters with counts don't fit a phone: the row scrolls by itself, the page never does. */
.authority-layout__list .toolbar .segmented { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; grid-auto-columns: max-content; }
.authority-layout__list .toolbar .segmented::-webkit-scrollbar { display: none; }
.authority-layout__list { min-width: 0; }
@media (max-width: 480px) { .authority-layout__list .row__chevron { display: none; } }
/* Two actions beside a row's text don't fit a phone: they go under it, right-aligned. */
@media (max-width: 480px) {
  .row:has(> .row__buttons) { flex-wrap: wrap; }
  .row:has(> .row__buttons) > .row__body { flex: 1 1 calc(100% - 60px); }
  .row > .row__buttons { flex-basis: 100%; justify-content: flex-end; padding-left: 44px; }
}

/* ---------- Consent and the privacy policy ---------- */
.consent { max-width: 560px; display: grid; gap: var(--s4); padding-top: calc(var(--s8) * 1.5); }
.consent__icon { width: 56px; height: 56px; }
.consent__list { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s2); color: var(--label); }
.policy p { max-width: 70ch; line-height: 1.55; margin: 0 0 var(--s3); }
.policy__title { font: 600 var(--headline) var(--font); margin: var(--s6) 0 var(--s2); }

/* ======================================================================================================
   Desktop. Most people use Qolqoi at a desk (Windows, Chrome/Edge, 24–27" monitors). Everything below
   applies only to a wide window used with a mouse: the query is DESKTOP_QUERY in js/layout.js, keep the
   two in step. Phones, touch tablets and narrow windows keep the layout above, unchanged.
   ====================================================================================================== */

/* A quiet second button beside a filled one (desktop dialog footers). */
.button--secondary { color: var(--label); background: var(--fill); font-weight: 500; }
.button--secondary:hover { background: var(--fill-pressed); }
.button--secondary.button--destructive { color: var(--red); }
.button--destructive.button--filled:hover { background: color-mix(in srgb, var(--red) 88%, #000); }

/* Shown on one layout only. Outside the desktop query the sidebar and the desktop-only parts don't exist
   visually, and the page's wrapper takes no box at all, so a phone lays the page out exactly as before. */
.desktop-only, .sidebar { display: none; }
.app__main, .form-columns, .form-columns__col { display: contents; }

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Density: type and controls sized for a mouse and a monitor ---------- */
  :root {
    --large-title: 1.75rem;   /* 28 */
    --title2: 1.25rem;        /* 20 */
    --headline: 0.9375rem;    /* 15 semibold */
    --body: 0.9375rem;        /* 15 */
    --subhead: 0.8125rem;     /* 13 */
    --footnote: 0.75rem;      /* 12 */
    --caption: 0.6875rem;     /* 11 */
    --hit: 36px;
    --content: 800px;
    --sidebar: 264px;
    --top: 0px;               /* what sits above everything: the staging banner, the support bar */
  }
  body { letter-spacing: 0; }
  .phone-only { display: none !important; }
  .desktop-only { display: revert; }
  .row { padding-top: var(--s2); padding-bottom: var(--s2); }
  .row__icon { width: 26px; height: 26px; border-radius: 6px; }
  .row__icon svg { width: 16px; height: 16px; }
  .list > li:has(.row__icon) + li:has(.row__icon)::before { left: calc(var(--s4) + 26px + var(--s3)); }
  .button--large { min-height: 40px; border-radius: var(--radius); }
  .segmented a, .segmented button { min-height: 28px; }
  .large-title { margin: var(--s2) 0 var(--s4); }
  .empty { padding: calc(var(--s8) * 1.5) var(--s5); }

  /* ---------- The shell: sidebar | page ---------- */
  .app--shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: start; }
  .app--shell > .support-bar { grid-column: 1 / -1; }
  .app__main { display: block; grid-column: 2; min-width: 0; min-height: calc(100vh - var(--top)); }
  .app__main:focus { outline: 0; }
  .app--shell .action-bar { left: var(--sidebar); }
  body:has(.stage-banner) { --top: 34px; }
  .stage-banner {
    position: sticky; top: 0; z-index: 40; height: 34px; padding: 0 var(--s4); line-height: 34px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .support-mode { --top: 52px; }
  body:has(.stage-banner).support-mode { --top: 86px; }
  .support-bar { top: calc(var(--top) - 52px); min-height: 52px; }
  .support-mode .navbar { top: var(--top); }

  .sidebar {
    position: sticky; top: var(--top); z-index: 20;
    display: flex; flex-direction: column; gap: var(--s4);
    height: calc(100vh - var(--top)); padding: var(--s4) var(--s3) var(--s3);
    overflow-y: auto; overscroll-behavior: contain;
    background: color-mix(in srgb, var(--bg-grouped-secondary) 65%, var(--bg-grouped));
    border-right: 0.5px solid var(--separator);
  }
  .sidebar__brand {
    display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2);
    color: var(--label); text-decoration: none; font: 700 1.0625rem var(--font-display);
    border-radius: 8px;
  }
  .sidebar__brand .app-icon { width: 28px; height: 28px; margin: 0; border-radius: 7px; box-shadow: none; }
  .sidebar__brand .app-icon svg { width: 17px; height: 17px; }
  .sidebar__new { width: 100%; min-height: 36px; border-radius: 8px; font-size: var(--body); }
  .sidebar__nav { flex: 1; display: grid; align-content: start; gap: var(--s4); }
  .sidebar__heading {
    margin: 0 var(--s2) var(--s1); font-size: var(--caption); font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--label-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sidebar__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 1px; }
  .sidebar__item {
    display: flex; align-items: center; gap: var(--s3); min-height: 32px; padding: 0 var(--s2);
    border-radius: 7px; color: var(--label); text-decoration: none; font-size: var(--body);
  }
  .sidebar__item svg { width: 18px; height: 18px; flex: none; color: var(--label-secondary); }
  .sidebar__item:hover { background: var(--fill); }
  .sidebar__item[aria-current="page"] { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); font-weight: 600; }
  .sidebar__item[aria-current="page"] svg { color: var(--blue); }
  .sidebar__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar__count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center;
    font-size: var(--caption); font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; background: var(--blue);
  }
  .sidebar__account {
    display: flex; align-items: center; gap: var(--s1);
    padding-top: var(--s3); border-top: 0.5px solid var(--separator);
  }
  .sidebar__me {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s2);
    padding: var(--s1) var(--s2); border-radius: 8px; color: var(--label); text-decoration: none;
  }
  .sidebar__me:hover, .sidebar__me[aria-current="page"] { background: var(--fill); }
  .sidebar__avatar {
    flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
    font-size: var(--footnote); font-weight: 700; color: #fff; background: var(--label-tertiary);
  }
  .sidebar__who { min-width: 0; display: grid; }
  .sidebar__name, .sidebar__org { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar__name { font-size: var(--body); font-weight: 600; }
  .sidebar__org { font-size: var(--footnote); color: var(--label-secondary); }
  .sidebar__signout { flex: none; min-width: 32px; min-height: 32px; padding: 0; color: var(--label-secondary); }
  .sidebar__signout svg { width: 18px; height: 18px; }
  .skip-link {
    position: absolute; left: var(--s3); top: var(--s3); z-index: 50; padding: var(--s2) var(--s3);
    border-radius: 8px; color: #fff; background: var(--blue); text-decoration: none; transform: translateY(-200%);
  }
  .skip-link:focus { transform: none; }

  /* A menu under its button (native popover; sidebar.js places it). */
  .menu[popover] {
    position: fixed; inset: auto; margin: 0; padding: var(--s1); border: 0.5px solid var(--separator); border-radius: 10px;
    color: var(--label); background: var(--bg-grouped-secondary); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  }
  .menu__item {
    display: flex; align-items: center; gap: var(--s3); padding: var(--s2); border-radius: 7px;
    color: var(--label); text-decoration: none;
  }
  .menu__item:hover, .menu__item:focus-visible { background: var(--fill); outline: 0; }
  .menu__icon {
    flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px;
    color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent);
  }
  .menu__icon svg { width: 18px; height: 18px; }
  .menu__text { display: grid; }
  .menu__text small { font-size: var(--footnote); color: var(--label-secondary); }

  /* ---------- Mailboxes: a header with search, then a table ---------- */
  .page:has(.documents-table) { max-width: 1440px; }
  .page-head { display: flex; align-items: center; gap: var(--s4); margin: var(--s2) 0 var(--s4); }
  .page-head .large-title { flex: 1; margin: 0; }
  .page-head__tools { display: flex; align-items: center; gap: var(--s2); }
  .search-field {
    position: relative; display: flex; align-items: center;
    width: clamp(260px, 28vw, 380px);
  }
  .search-field svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--label-secondary); pointer-events: none; }
  .search--toolbar {
    margin: 0; padding: 0 var(--s3) 0 32px; min-height: 34px;
    border: 1px solid var(--separator); border-radius: 8px; background: var(--bg-grouped-secondary);
  }
  .search--toolbar:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }

  .documents-table {
    width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed;
    background: var(--bg-grouped-secondary); border-radius: var(--radius); overflow: hidden;
    box-shadow: 0 0 0 0.5px var(--separator);
  }
  .documents-table th {
    padding: var(--s2) var(--s4); text-align: left; font-size: var(--footnote); font-weight: 600;
    color: var(--label-secondary); border-bottom: 0.5px solid var(--separator);
    background: color-mix(in srgb, var(--fill) 40%, var(--bg-grouped-secondary));
  }
  .documents-table td {
    padding: var(--s2) var(--s4); vertical-align: middle; font-size: var(--body);
    border-bottom: 0.5px solid var(--separator); overflow: hidden;
  }
  .documents-table tbody tr:last-child td { border-bottom: 0; }
  .documents-table tbody tr { position: relative; }
  .documents-table tbody tr:hover { background: var(--fill); }
  .documents-table tbody tr:has(a:focus-visible) { background: color-mix(in srgb, var(--blue) 10%, transparent); }
  .documents-table th:nth-child(1) { width: 40%; }
  .documents-table th:nth-child(2) { width: 28%; }
  .documents-table th:nth-child(3) { width: 18%; }
  .documents-table th:last-child, .documents-table td:last-child { text-align: right; }
  .documents-table__doc { display: flex; align-items: center; gap: var(--s3); }
  .documents-table__icon {
    flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px;
    color: #fff; background: var(--blue);
  }
  .documents-table__icon svg { width: 16px; height: 16px; }
  .documents-table__icon.is-green { background: var(--green); }
  .documents-table__icon.is-red { background: var(--red); }
  .documents-table__icon.is-orange { background: var(--orange); }
  .documents-table__name { min-width: 0; display: grid; }
  .documents-table__name a {
    color: var(--label); font-weight: 500; text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .documents-table__name a:focus-visible { outline: 0; }
  /* The title's link covers the whole row: click anywhere, middle-click for a new tab. */
  .documents-table__name a::after { content: ""; position: absolute; inset: 0; }
  .documents-table small, .documents-table__primary { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .documents-table small { font-size: var(--footnote); color: var(--label-secondary); }
  .documents-table__folder { display: inline-flex; align-items: center; gap: 4px; }
  .documents-table__folder svg { width: 13px; height: 13px; color: var(--red); }
  .documents-table__none { color: var(--label-tertiary); }
  .documents-table__date { color: var(--label-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .documents-table .status { font-size: var(--subhead); }
  .documents-table ~ .more { margin-top: var(--s2); }
  /* Folders and the chosen folder's subfolders on one row (the table below never moves). */
  .chips--inline { flex-wrap: wrap; overflow: visible; align-items: center; }
  .chips__group { display: contents; }
  .chips__divider {
    display: inline-flex; align-items: center; margin-left: var(--s2); padding-left: var(--s3);
    border-left: 1px solid var(--separator); min-height: 24px; font-size: var(--footnote); color: var(--label-secondary);
  }
  .documents-table__empty td { padding: var(--s8) var(--s4); text-align: center; color: var(--label-secondary); }
  .documents-table__empty td:last-child { text-align: center; }
  .documents-table__empty svg { display: block; width: 28px; height: 28px; margin: 0 auto var(--s2); color: var(--label-tertiary); }
  .documents-table tbody tr.documents-table__empty:hover { background: none; }
  /* Reloading a mailbox in place: the rows stay; if the answer takes a while they dim, never blink. */
  .mailbox-content .documents-table { transition: opacity 0.15s; }
  .mailbox-content.is-refreshing .documents-table { opacity: 0.55; cursor: progress; }
  .documents-table--skeleton td, .documents-table--skeleton th { height: 53px; }
  .documents-table--skeleton th { height: auto; }
  .skeleton { display: block; width: 60%; height: 12px; border-radius: 6px; background: var(--fill); }
  .skeleton--wide { width: 80%; }
  .skeleton--head { width: 40%; height: 10px; }
  @media (prefers-reduced-motion: no-preference) {
    .skeleton { animation: skeleton-pulse 1.2s ease-in-out infinite alternate; }
  }

  /* ---------- Request page: the viewer's action in a card beside the document ---------- */
  .action-card {
    margin-bottom: var(--s5); padding: var(--s4);
    border-radius: var(--radius-lg); background: var(--bg-grouped-secondary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 35%, var(--separator));
  }
  .action-card--refused { box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 45%, var(--separator)); }
  .action-card__title { margin: 0 0 var(--s1); font: 600 var(--headline) var(--font); }
  .action-card__text { margin: 0 0 var(--s4); font-size: var(--subhead); color: var(--label-secondary); }
  .action-card--refused .action-card__text { color: var(--red); }
  .action-card__buttons { display: flex; gap: var(--s2); }
  .action-card__buttons .button { min-height: 40px; border-radius: 8px; }
  .action-card__buttons .button--filled { flex: 1; }
  .action-card--quiet {
    display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
    box-shadow: none; color: var(--label-secondary); font-size: var(--subhead);
  }
  .action-card--quiet svg { width: 20px; height: 20px; flex: none; color: var(--orange); }
  .action-card--quiet p { margin: 0; }
  /* Two columns from 1024px (the sidebar takes its share), not 1100. */
  .page.page--wide { max-width: 1440px; }
  .request-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: var(--s6); align-items: start; }
  .request-layout__main { position: sticky; top: calc(var(--top) + 52px + var(--s2)); }
  .request-layout__main .preview { height: calc(100vh - var(--top) - 300px); min-height: 480px; }

  /* ---------- The page's top bar: a path of links on the left, the page's actions on the right ---------- */
  .navbar { top: var(--top); min-height: 52px; padding: 0 var(--s6); background: color-mix(in srgb, var(--bg-grouped) 82%, transparent); }
  .navbar__title--crumbs { display: none; }
  .navbar__leading { min-width: 0; }
  .crumbs { display: flex; align-items: center; gap: var(--s1); min-width: 0; font-size: var(--body); }
  .crumbs a { color: var(--blue); text-decoration: none; white-space: nowrap; padding: var(--s1) var(--s1); border-radius: 6px; }
  .crumbs a:hover { background: var(--fill); }
  .crumbs__sep { display: inline-flex; color: var(--label-tertiary); }
  .crumbs__sep svg { width: 14px; height: 14px; }
  .crumbs__current { min-width: 0; padding: var(--s1); color: var(--label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48ch; }
  .page { padding: var(--s3) var(--s8) calc(var(--s8) * 3); }

  @media (prefers-color-scheme: dark) {
    .sidebar { background: #111113; }
  }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Dialogs: title on the left, a close button, Cancel + the filled action in a footer ---------- */
  .sheet--desktop {
    width: min(100% - 48px, 560px); max-height: min(85vh, 960px);
    margin: auto; border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22), 0 0 0 0.5px var(--separator);
  }
  .sheet--desktop.sheet--large { width: min(100% - 48px, 880px); }
  .sheet--desktop[open] { animation: dialog-in 0.16s var(--ease); }
  .sheet--desktop .sheet__header {
    display: flex; align-items: center; gap: var(--s3);
    min-height: 0; padding: var(--s4) var(--s3) var(--s2) var(--s6);
  }
  .sheet--desktop .sheet__header h2 { flex: 1; text-align: left; font-size: 1.125rem; white-space: normal; }
  .sheet__close { min-width: 32px; min-height: 32px; padding: 0; border-radius: 8px; color: var(--label-secondary); }
  .sheet__close svg { width: 18px; height: 18px; }
  .sheet--desktop .sheet__body { flex: 1; min-height: 0; padding: var(--s2) var(--s6) var(--s5); }
  .sheet__footer {
    display: flex; justify-content: flex-end; gap: var(--s2);
    padding: var(--s3) var(--s6) var(--s4);
    border-top: 0.5px solid var(--separator);
  }
  .sheet__footer .button, .alert--desktop .alert__actions .button {
    flex: none; min-height: 36px; padding: 0 var(--s4); border-radius: 8px; font-size: var(--subhead);
  }

  /* Alerts: text on the left, buttons in a row on the right (dialog-model.js orders them). */
  .alert--desktop {
    width: min(100% - 48px, 440px);
    border-radius: 12px; text-align: left;
    background: var(--bg-grouped-secondary);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22), 0 0 0 0.5px var(--separator);
  }
  .alert--desktop[open] { animation: dialog-in 0.16s var(--ease); }
  .alert--desktop .alert__content { display: grid; column-gap: var(--s3); padding: var(--s6) var(--s6) var(--s5); }
  .alert--desktop .alert__content:has(> .alert__icon) { grid-template-columns: auto minmax(0, 1fr); }
  .alert--desktop .alert__content > :not(.alert__icon) { grid-column: -2; }
  .alert__icon { grid-row: 1 / span 3; color: var(--red); }
  .alert__icon svg { width: 24px; height: 24px; }
  .alert--desktop .alert__content h2 { margin-bottom: var(--s2); font-size: var(--headline); }
  .alert--desktop .alert__content p { font-size: var(--subhead); line-height: 1.45; }
  .alert--desktop .alert__actions,
  .alert--desktop .alert__actions:has(> :nth-child(3)) {
    flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2);
    padding: 0 var(--s6) var(--s5); border-top: 0;
  }
  .alert--desktop .alert__actions .button + .button,
  .alert--desktop .alert__actions:has(> :nth-child(3)) .button + .button { border: 0; }
  /* Signing progress: the steps, then a centred success mark. */
  .alert--progress .alert__content { text-align: center; }
  .alert--progress .progress-steps { text-align: left; }
  .alert--progress .alert__actions { justify-content: center; }

  /* Quick Look: the title on the left, Download and close on the right. */
  .quicklook.sheet--desktop { width: min(100% - 48px, 1100px); height: min(92vh, 1200px); max-height: 92vh; }
  .quicklook.sheet--desktop .quicklook__body { padding: var(--s2) var(--s6) var(--s5); }
  .sheet__header-actions { display: flex; align-items: center; gap: var(--s1); }
  .sheet__header-actions .button:not(.sheet__close) { min-height: 32px; font-size: var(--subhead); }

  /* The toast: a small card in the corner, not a pill over a phone's tab bar. */
  .toast {
    left: auto; right: var(--s6); bottom: var(--s6); transform: none;
    max-width: 420px; padding: var(--s3) var(--s4); border-radius: 10px;
  }

  @media (prefers-color-scheme: dark) {
    .alert--desktop { background: #2c2c2e; }
  }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Forms: a label column and bordered, left-aligned inputs (not iOS right-aligned values) ---------- */
  :root {
    --label-col: 180px;
    --field-border: color-mix(in srgb, var(--label) 28%, transparent);
    --field-indent: calc(var(--s4) + var(--label-col) + var(--s4)); /* where an input starts in its row */
  }
  .field { gap: var(--s4); min-height: 0; padding: 6px var(--s4); }
  .field:focus-within { background: transparent; }
  .field__label { flex: none; width: var(--label-col); min-width: 0; max-width: none; }
  .field input:is([type="text"], [type="email"], [type="date"], [type="number"], [type="tel"], :not([type])),
  .field select,
  .field textarea {
    flex: 1 1 auto; min-width: 0; max-width: 520px; min-height: 32px; padding: 0 var(--s2);
    border: 1px solid var(--field-border); border-radius: 6px;
    color: var(--label); background: var(--bg-grouped-secondary);
    text-align: left; text-align-last: auto;
  }
  .field select { cursor: pointer; }
  .field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent);
  }
  .field input[readonly] { color: var(--label-secondary); background: var(--fill); }
  /* The width says how long the answer is: a date and a 12-digit number don't need the whole row. */
  .field input[type="date"] { flex: none; width: 11.5em; }
  .identifier-field .field input { flex: none; width: 12em; }
  .field .amount { flex: 1 1 auto; max-width: 520px; }
  .field .amount input { flex: none; width: 12em; }
  .field .amount select { flex: none; width: auto; color: var(--label); }
  .field.field--error input, .field.field--error select, .field.field--error textarea { color: var(--label); border-color: var(--red); }
  .field.field--error input:focus, .field.field--error textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }
  /* A multi-line answer: the label stays in its column, at the top. */
  .field--stacked { flex-direction: row; align-items: flex-start; gap: var(--s4); padding: 6px var(--s4); }
  .field--stacked .field__label { width: var(--label-col); padding-top: 6px; }
  .field--stacked textarea { min-height: 64px; padding: 6px var(--s2); }
  /* What belongs to one field (its error, the company behind a BIN) lines up under that field's input. */
  .list .field-error { margin: -2px var(--s4) 0 var(--field-indent); padding-bottom: var(--s2); }
  .list .company { margin-left: var(--field-indent); max-width: 520px; }
  .textarea { min-height: 88px; padding: var(--s2) var(--s3); border: 1px solid var(--field-border); border-radius: 8px; }
  .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
  /* Mouse-sized switches and checkboxes. */
  .switch { width: 38px; height: 22px; }
  .switch span::after { width: 18px; height: 18px; }
  .switch input:checked + span::after { transform: translateX(16px); }
  .row.choice input { width: 16px; height: 16px; }
  .disclosure { min-height: 36px; }
  .signer-card--boxed { padding: var(--s3) var(--s4) var(--s4); }
  .signer-card--boxed .segmented { max-width: 480px; }

  /* A form's bottom bar stays over the content column, not across the whole window. */
  .page:has(~ .action-bar--form) { padding-bottom: 120px; }
  .app--shell .action-bar--form { padding-left: var(--s8); padding-right: var(--s8); }
  .action-bar--form .action-bar__inner { max-width: calc(var(--content) - 2 * var(--s8)); }
  .action-bar--form .action-bar__inner .button { min-height: 36px; border-radius: 8px; }

  /* Long dialogs (a доверенность): two columns of sections, checkbox lists two across. */
  .sheet--desktop.sheet--large { width: min(100% - 48px, 1040px); }
  .sheet--large { --label-col: 132px; }
  .sheet--large .form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s6); align-items: start; }
  .sheet--large .form-columns__col { display: block; min-width: 0; }
  .form-columns__col > .section__header:first-child { margin-top: 0; }
  .list--columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list--columns > li + li::before { left: var(--s4); }
  .list--columns > li:nth-child(2)::before { display: none; }
  .sheet--large .field input:is([type="text"], [type="email"], :not([type])) { max-width: none; }
  .field input[type="file"] { flex: 1; min-width: 0; font-size: var(--subhead); color: var(--label-secondary); }
  .field input[type="file"]::file-selector-button {
    margin-right: var(--s2); padding: 5px var(--s3); border: 1px solid var(--field-border); border-radius: 6px;
    font: inherit; color: var(--label); background: var(--fill); cursor: pointer;
  }
  .field input[type="file"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 2px; border-radius: 6px; }
  .form-columns__col > .button--block { margin-top: var(--s2); }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Company area: records as tables, actions in the row ---------- */
  .page:has(.data-table) { max-width: 1200px; }
  .table-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s2); }
  .table-head .section__header { margin-bottom: 0; }
  .table-head .button { min-height: 30px; padding: 0 var(--s3); border-radius: 7px; font-size: var(--subhead); }
  .table-head .button svg { width: 16px; height: 16px; }
  .data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--bg-grouped-secondary); border-radius: var(--radius); overflow: hidden;
    box-shadow: 0 0 0 0.5px var(--separator);
  }
  .data-table th {
    padding: var(--s2) var(--s4); text-align: left; font-size: var(--footnote); font-weight: 600; white-space: nowrap;
    color: var(--label-secondary); border-bottom: 0.5px solid var(--separator);
    background: color-mix(in srgb, var(--fill) 40%, var(--bg-grouped-secondary));
  }
  .data-table td { padding: var(--s2) var(--s4); vertical-align: middle; font-size: var(--body); border-bottom: 0.5px solid var(--separator); }
  .data-table tbody tr:last-child td { border-bottom: 0; }
  .data-table tbody tr:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }
  .data-table__wide { width: 32%; }
  .data-table__actions { width: 1%; white-space: nowrap; text-align: right; }
  .data-table__primary { display: block; overflow-wrap: anywhere; }
  .data-table small { display: block; font-size: var(--footnote); color: var(--label-secondary); }
  .data-table__mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }
  .data-table__none { color: var(--label-tertiary); }
  .data-table__buttons { display: inline-flex; gap: var(--s2); justify-content: flex-end; }
  .data-table__button { min-height: 28px; padding: 0 var(--s3); border-radius: 6px; font-size: var(--subhead); white-space: nowrap; }
  .data-table__button svg { width: 14px; height: 14px; }
  .data-table__role, .data-table__category, .data-table__warning { display: inline-flex; align-items: center; gap: 6px; }
  .data-table__role svg { width: 15px; height: 15px; color: var(--blue); }
  .data-table__category svg { width: 15px; height: 15px; color: var(--label-secondary); }
  .data-table tr:has(.data-table__confidential) .data-table__category svg { color: var(--red); }
  .data-table__confidential { color: var(--red); font-size: var(--subhead); }
  .data-table tr.depth-1 .data-table__category { padding-left: var(--s6); }
  .data-table tr.depth-2 .data-table__category { padding-left: calc(2 * var(--s6)); }
  .data-table__warning { flex-wrap: wrap; color: var(--orange); }
  .data-table__warning svg { width: 15px; height: 15px; }
  .data-table__row--attention td:first-child { box-shadow: inset 3px 0 0 var(--orange); }

  /* «Полномочия»: the list and the chosen grant side by side, beside the sidebar. */
  .page-head .page-head__tools .button { min-height: 34px; border-radius: 8px; }
  .authority-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); gap: var(--s6); align-items: start; }
  .authority-layout--detail .authority-layout__list, .authority-layout__placeholder { display: grid; }
  .authority-layout--detail .authority-layout__list { display: block; }
  .authority-layout__detail { position: sticky; top: calc(var(--top) + 52px + var(--s3)); max-height: calc(100vh - var(--top) - 52px - var(--s6)); overflow-y: auto; }
  .authority-layout__placeholder { min-height: 280px; align-content: center; border-radius: var(--radius-lg); background: var(--bg-grouped-secondary); }
  .authority-layout__list .toolbar .segmented { max-width: none; }
  .authority-layout__list .toolbar { margin-bottom: var(--s4); }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- «Сочетания клавиш» ---------- */
  .shortcuts { width: min(100% - 48px, 460px); }
  .shortcuts__list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s4); margin: var(--s3) 0 var(--s4); }
  .shortcuts__list dt { display: flex; gap: var(--s1); }
  .shortcuts__list dd { margin: 0; font-size: var(--subhead); align-self: center; }
  .shortcuts kbd {
    min-width: 24px; padding: 2px 7px; border: 1px solid var(--field-border); border-bottom-width: 2px; border-radius: 5px;
    font: 600 var(--footnote) var(--font); text-align: center; color: var(--label); background: var(--bg-grouped);
  }
  .alert--desktop.shortcuts .alert__content p { color: var(--label-secondary); font-size: var(--footnote); }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Choices: checkboxes and radios, role cards, what is chosen, dropdowns ---------- */
  :root {
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3l2.2 2.2 4.6-4.9' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.6l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  .row.choice { gap: var(--s3); padding-top: 10px; padding-bottom: 10px; transition: background-color 0.12s; }
  .row.choice > input {
    appearance: none; -webkit-appearance: none; flex: none; align-self: flex-start;
    width: 18px; height: 18px; margin: 1px 0 0;
    border: 1.5px solid var(--field-border); border-radius: 5px; background: var(--bg-grouped-secondary);
    cursor: pointer; transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
  }
  .row.choice > input[type="radio"] { border-radius: 50%; }
  .row.choice > input[type="checkbox"]:checked { border-color: var(--blue); background: var(--blue) var(--check) center / 12px no-repeat; }
  .row.choice > input[type="radio"]:checked { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 3.5px var(--bg-grouped-secondary); }
  .row.choice:hover > input:not(:checked):not(:disabled) { border-color: color-mix(in srgb, var(--blue) 60%, var(--field-border)); }
  .row.choice > input:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 1px; }
  /* What is chosen reads at a glance: the row is tinted, not only its little box. */
  .row.choice:has(> input:checked) { background: color-mix(in srgb, var(--blue) 7%, transparent); }
  .row.choice:has(> input:checked):hover { background: color-mix(in srgb, var(--blue) 11%, transparent); }
  /* A subfolder of a chosen folder: included, so it can't be chosen on its own. */
  .row.choice.choice--included:has(> input), .row.choice.choice--included:has(> input):hover { background: transparent; cursor: default; }
  .row.choice.choice--included > input:checked { cursor: default; border-color: transparent; background-color: color-mix(in srgb, var(--blue) 40%, var(--bg-grouped-secondary)); }
  .choice--included .row__title { color: var(--label-secondary); }
  .choice__included { color: var(--blue); }

  /* One of a few, each with its meaning (roles): cards, the whole card is the target. */
  .list--cards { display: grid; gap: var(--s2); border-radius: 0; background: none; overflow: visible; }
  .list--cards > li + li::before { display: none; }
  .list--cards .row.choice {
    padding: var(--s3) var(--s4); border-radius: 10px;
    background: var(--bg-grouped-secondary); box-shadow: 0 0 0 1px var(--separator);
  }
  .list--cards .row.choice:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 45%, var(--separator)); }
  .list--cards .row.choice:has(> input:checked),
  .list--cards .row.choice:has(> input:checked):hover {
    background: color-mix(in srgb, var(--blue) 7%, var(--bg-grouped-secondary)); box-shadow: 0 0 0 2px var(--blue);
  }
  .list--cards .row.choice:has(> input:checked) .row__title { font-weight: 600; }
  .list--cards .row.choice:has(> input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent); outline-offset: 2px; }
  .list--cards .row.choice > input:focus-visible { outline: 0; }

  /* A list's header with what is chosen in it and «Очистить». */
  .choice-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
  .choice-head__meta { display: inline-flex; align-items: baseline; gap: var(--s2); margin-right: var(--s2); font-size: var(--footnote); white-space: nowrap; }
  .choice-head__count { font-weight: 600; color: var(--blue); }
  .choice-head__count.is-empty { font-weight: 400; color: var(--label-secondary); }
  .choice-head__clear { min-width: 0; min-height: 0; padding: 0 4px; border-radius: 4px; font-size: var(--footnote); }
  .form-columns__col > .choice-head:first-child .section__header { margin-top: 0; }
  /* Why a list doesn't apply (a role without categories): said above it, the list dims but stays usable. */
  .choice-note {
    display: flex; align-items: flex-start; gap: var(--s2); margin: 0 0 var(--s2); padding: var(--s2) var(--s3);
    border-radius: 8px; background: var(--fill); font-size: var(--subhead); color: var(--label-secondary);
  }
  .choice-note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
  .is-muted > .list, .is-muted .choice-head__meta { opacity: 0.5; transition: opacity 0.15s; }
  .is-muted > .list:hover, .is-muted > .list:focus-within { opacity: 0.8; }
  /* A long list of people: a filter above it. */
  .choice-filter { position: relative; display: flex; align-items: center; margin: 0 0 var(--s2); }
  .choice-filter svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--label-secondary); pointer-events: none; }
  .choice-filter__input {
    width: 100%; min-height: 32px; padding: 0 var(--s3) 0 32px;
    border: 1px solid var(--field-border); border-radius: 8px; font: inherit; color: var(--label); background: var(--bg-grouped-secondary);
  }
  .choice-filter__input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }

  /* Dropdowns: the same bordered box as a text field, with a quiet chevron (not the system's arrow). */
  .field select {
    appearance: none; -webkit-appearance: none; padding-right: 30px;
    background-image: var(--chevron); background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
  }
  .field select:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--field-border)); }
}

@media (min-width: 1024px) and (pointer: fine) {
  /* ---------- Dropdowns (select-menu.js): a field-like button and a menu of the options ---------- */
  .select-native {
    position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important;
    padding: 0 !important; border: 0 !important; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none;
  }
  .field:has(.select-native) { position: relative; }
  .select-trigger {
    appearance: none; flex: 1 1 auto; min-width: 0; max-width: 520px; min-height: 32px;
    display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2) 0 10px;
    border: 1px solid var(--field-border); border-radius: 6px;
    font: inherit; color: var(--label); text-align: left; background: var(--bg-grouped-secondary); cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s;
  }
  .select-trigger:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--field-border)); }
  .select-trigger:focus-visible, .select-trigger.is-open {
    outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent);
  }
  .select-trigger:disabled { opacity: 0.5; cursor: default; }
  .select-trigger__value { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s2); }
  .select-trigger__text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .select-trigger__chevron { display: inline-flex; flex: none; color: var(--label-secondary); transform: rotate(90deg); transition: transform 0.15s var(--ease); }
  .select-trigger__chevron svg { width: 13px; height: 13px; }
  .select-trigger.is-open .select-trigger__chevron { transform: rotate(-90deg); }
  .amount .select-trigger { flex: none; width: auto; min-width: 92px; }
  .select-badge {
    flex: none; display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px;
    font-size: var(--footnote); font-weight: 600; color: var(--label-secondary); background: var(--fill);
  }

  .select-menu[popover] {
    position: fixed; inset: auto; margin: 0; padding: 0; max-width: min(460px, calc(100vw - 16px));
    display: none; flex-direction: column; overflow: hidden;
    border: 0.5px solid var(--separator); border-radius: 10px;
    color: var(--label); background: var(--bg-grouped-secondary);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  }
  .select-menu[popover]:popover-open { display: flex; }
  @media (prefers-reduced-motion: no-preference) {
    .select-menu[popover]:popover-open { animation: menu-in 0.12s var(--ease); }
    .select-menu--up[popover]:popover-open { animation-name: menu-in-up; }
  }
  .select-menu__search { position: relative; flex: none; display: flex; align-items: center; padding: var(--s2) var(--s2) var(--s1); }
  .select-menu__search svg { position: absolute; left: 18px; width: 14px; height: 14px; color: var(--label-secondary); pointer-events: none; }
  .select-menu__filter {
    width: 100%; min-height: 30px; padding: 0 var(--s2) 0 28px; border: 1px solid var(--field-border); border-radius: 7px;
    font: inherit; font-size: var(--subhead); color: var(--label); background: var(--bg-grouped);
  }
  .select-menu__filter:focus { outline: none; border-color: var(--blue); }
  .select-menu__list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s1); outline: none; }
  .select-option {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: default;
  }
  .select-option.is-active { background: color-mix(in srgb, var(--blue) 12%, transparent); }
  .select-option[aria-disabled="true"] { opacity: 0.4; }
  .select-option__text { flex: 1; min-width: 0; display: grid; gap: 1px; }
  .select-option__label { font-size: var(--body); overflow-wrap: anywhere; }
  .select-option[aria-selected="true"] .select-option__label { font-weight: 600; }
  .select-option__hint { font-size: var(--footnote); line-height: 1.35; color: var(--label-secondary); }
  .select-option__check { flex: none; width: 16px; display: inline-flex; color: var(--blue); }
  .select-option__check svg { width: 16px; height: 16px; }
  .select-menu__empty { padding: var(--s3) 10px; font-size: var(--subhead); color: var(--label-secondary); }
  @media (prefers-color-scheme: dark) {
    .select-menu[popover] { background: #2c2c2e; }
    .sheet .select-menu[popover] { background: #3a3a3c; }
  }
}

@keyframes dialog-in { from { opacity: 0; transform: scale(0.98); } }

/* Desktop-only animations live inside the desktop query: a phone's stylesheet keeps exactly its own keyframes
   (even an unused one changes when Chrome resolves a sheet's slide-in, and with it how its text is drawn). */
@media (min-width: 1024px) and (pointer: fine) {
  @keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
  @keyframes menu-in-up { from { opacity: 0; transform: translateY(4px); } }
  @keyframes skeleton-pulse { to { opacity: 0.45; } }
}
