/* Text-to-Pay design system · components
   Подключение: fonts.css → tokens.css → components.css.
   Компоненты повторяют примитивы Ultima (PrimaryBtn, GhostBtn, Btn, Badge, Chip, Card, KV,
   Field, Fld, Row, Warn, Spinner, Sheet, Header, сайдбар консоли) в виде CSS-классов,
   чтобы серверные шаблоны Jinja могли их использовать без React.

   Плотность. Размеры шрифтов и элементов заданы переменными --d-*.
   По умолчанию — плотность консоли Ultima (сотрудники, много данных на экране).
   Класс .density-comfort на <body> включает крупный масштаб клиента (~125 %, поля 16 px —
   на iPhone поле меньше 16 px увеличивает страницу при фокусе). */

/* ================= плотность ================= */
:root {
  --d-body: 13.5px; --d-small: 12px; --d-xsmall: 11px; --d-label: 10px;
  --d-h1: 22px; --d-h2: 19px; --d-h3: 16px; --d-hero: 28px; --d-brand: 20px;
  --d-ctl-fs: 13.5px; --d-ctl-py: 11px; --d-ctl-px: 13px; --d-ctl-r: var(--r-lg);
  --d-btn-fs: 12.5px; --d-btn-py: 9px; --d-btn-px: 16px; --d-btn-r: var(--r-md);
  --d-btn-sm-fs: 11.5px; --d-btn-sm-py: 6px; --d-btn-sm-px: 12px;
  --d-btn-lg-fs: 14.5px; --d-btn-lg-py: 14px; --d-btn-lg-px: 18px;
  --d-icon: 16px; --d-icon-sm: 14px; --d-icon-lg: 19px; --d-iconbtn: 32px; --d-iconbtn-sm: 26px;
  --d-badge: 11.5px; --d-badge-lg: 13.5px; --d-dot: 6px;
  --d-table: 12.5px; --d-table-py: 11px; --d-table-px: 16px;
  --d-card-pad: 16px; --d-chip: 11px; --d-chip-py: 4px; --d-chip-px: 11px; --d-seg: 11px;
  --d-avatar: 30px; --d-file-icon: 34px; --d-gap: 12px;
  --d-page-pt: 24px; --d-page-pb: 40px;
}
.density-comfort {
  --d-body: 16px; --d-small: 14px; --d-xsmall: 13px; --d-label: 11.5px;
  --d-h1: 30px; --d-h2: 22px; --d-h3: 18px; --d-hero: 40px; --d-brand: 24px;
  --d-ctl-fs: 16px; --d-ctl-py: 14px; --d-ctl-px: 16px; --d-ctl-r: var(--r-lg);
  --d-btn-fs: 15px; --d-btn-py: 12px; --d-btn-px: 20px; --d-btn-r: var(--r-lg);
  --d-btn-sm-fs: 14px; --d-btn-sm-py: 8px; --d-btn-sm-px: 14px;
  --d-btn-lg-fs: 16.5px; --d-btn-lg-py: 16px; --d-btn-lg-px: 26px;
  --d-icon: 19px; --d-icon-sm: 16px; --d-icon-lg: 22px; --d-iconbtn: 40px; --d-iconbtn-sm: 34px;
  --d-badge: 14px; --d-badge-lg: 16px; --d-dot: 7px;
  --d-table: 15px; --d-table-py: 15px; --d-table-px: 20px;
  --d-card-pad: 22px; --d-chip: 14px; --d-chip-py: 7px; --d-chip-px: 14px; --d-seg: 13px;
  --d-avatar: 38px; --d-file-icon: 42px; --d-gap: 16px;
  --d-page-pt: 40px; --d-page-pb: 64px;
  --w-client: 880px; --w-narrow: 480px; --h-topbar: 68px;
}
@media (max-width: 640px) {
  .density-comfort { --d-h1: 26px; --d-hero: 30px; --d-card-pad: 18px; --d-page-pt: 24px; --d-table-px: 16px; --h-topbar: 60px; }
}

/* ================= base ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--c-bg); color: var(--c-text);
  font: 400 var(--d-body)/var(--lh-body) var(--f-body);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--c-gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--c-wire-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--c-text-faint); opacity: 1; }
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
hr, .wire { border: 0; height: 1px; background: var(--c-border); margin: var(--sp-7) 0; }
.wire--gold { background: var(--c-wire); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ================= type ================= */
.display, .display-hero, .display-1, .display-2, .display-3, h1, h2, h3 { font-family: var(--f-display); font-weight: 400; letter-spacing: 0.005em; margin: 0; line-height: var(--lh-tight); }
h1, .display-1 { font-size: var(--d-h1); }
.display-hero { font-size: var(--d-hero); line-height: 1.15; }
h2, .display-2 { font-size: var(--d-h2); }
h3, .display-3 { font-size: var(--d-h3); }
.brand { font-family: var(--f-display); font-size: var(--d-brand); color: var(--c-gold); white-space: nowrap; }
.brand small { font: 400 var(--d-small) var(--f-body); color: var(--c-text-faint); }
.eyebrow { font: 500 var(--d-label)/1.2 var(--f-body); text-transform: uppercase; letter-spacing: var(--ls-eyebrow); color: var(--c-text-faint); }
.muted { color: var(--c-text-muted); }
.faint { color: var(--c-text-faint); }
.small { font-size: var(--d-small); }
.xsmall { font-size: var(--d-xsmall); }
.tnum { font-variant-numeric: tabular-nums; letter-spacing: var(--ls-tnum); }
.mono { font-family: var(--f-mono); font-size: 0.95em; letter-spacing: 0; }
.text-danger { color: var(--c-danger); }
.text-positive { color: var(--c-positive); }
.text-gold { color: var(--c-gold); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ================= icon ================= */
.icon { width: var(--d-icon); height: var(--d-icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.icon--sm { width: var(--d-icon-sm); height: var(--d-icon-sm); }
.icon--lg { width: var(--d-icon-lg); height: var(--d-icon-lg); }

/* ================= layout helpers ================= */
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--d-gap)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--sp-3)); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ================= button ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: var(--d-btn-py) var(--d-btn-px); border-radius: var(--d-btn-r);
  border: 1px solid var(--c-border); background: transparent; color: var(--c-text-muted);
  font: 500 var(--d-btn-fs)/1.2 var(--f-body); white-space: nowrap; cursor: pointer; text-decoration: none !important;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), filter var(--dur-fast);
}
.btn:hover { border-color: var(--c-border-strong); color: var(--c-text); }
.btn--primary { background: var(--g-gold); border-color: transparent; color: var(--c-ink); box-shadow: var(--sh-btn); font-weight: 600; }
.btn--primary:hover { color: var(--c-ink); filter: brightness(1.06); border-color: transparent; }
.btn--violet { background: var(--g-violet); border-color: transparent; color: var(--c-ink); box-shadow: var(--sh-btn); font-weight: 600; }
.btn--ghost { border-color: var(--c-wire); color: var(--c-text); }
.btn--ghost:hover { border-color: var(--c-wire-strong); }
.btn--danger { border-color: var(--c-danger-wire); color: var(--c-danger-strong); }
.btn--danger:hover { border-color: var(--c-danger-strong); color: var(--c-danger-strong); }
.btn--quiet { border-color: transparent; padding-inline: 0.6em; }
.btn--sm { padding: var(--d-btn-sm-py) var(--d-btn-sm-px); font-size: var(--d-btn-sm-fs); }
.btn--lg { padding: var(--d-btn-lg-py) var(--d-btn-lg-px); border-radius: var(--r-lg); font-size: var(--d-btn-lg-fs); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: var(--d-iconbtn); height: var(--d-iconbtn); border-radius: var(--r-pill); }
.btn--icon.btn--sm { width: var(--d-iconbtn-sm); height: var(--d-iconbtn-sm); }
.btn:disabled, .btn[aria-disabled="true"] { background: rgba(255,255,255,0.05); border-color: transparent; color: var(--c-text-faint); box-shadow: none; filter: none; cursor: default; opacity: 0.7; }
.btn .spinner { width: 1em; height: 1em; border-width: 2px; }

/* ================= badge: точка + текст (admin Badge) ================= */
.badge { display: inline-flex; align-items: center; gap: 0.45em; font: 400 var(--d-badge)/1.2 var(--f-body); white-space: nowrap; color: var(--badge, var(--c-text-faint)); }
.badge::before { content: ""; width: var(--d-dot); height: var(--d-dot); border-radius: var(--r-pill); background: currentColor; flex: none; }
.badge--none { --badge: var(--st-none); }
.badge--submitted { --badge: var(--st-submitted); }
.badge--progress { --badge: var(--st-progress); }
.badge--executed { --badge: var(--st-executed); }
.badge--rejected { --badge: var(--st-rejected); }
.badge--pending { --badge: var(--st-pending); }
.badge--approved { --badge: var(--st-approved); }
.badge--invited { --badge: var(--st-invited); }
.badge--active { --badge: var(--st-active); }
.badge--blocked { --badge: var(--st-blocked); }
.badge--pending::before { animation: pulse 1.6s ease-in-out infinite; }
.badge--lg { font-size: var(--d-badge-lg); }
.badge--lg::before { width: calc(var(--d-dot) + 2px); height: calc(var(--d-dot) + 2px); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--c-wire); background: var(--c-gold-soft); color: var(--c-gold); font: 500 var(--d-label)/1.4 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.tag--violet { border-color: rgba(148,169,189,0.4); background: var(--c-violet-soft); color: var(--c-violet); }
.dot { width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--c-gold); display: inline-block; box-shadow: 0 0 0 3px var(--c-gold-soft); }
.count { color: var(--c-amber); font-size: 0.86em; font-variant-numeric: tabular-nums; }

/* ================= chip-фильтр (admin Chip) ================= */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip { display: inline-flex; align-items: center; gap: 0.45em; padding: var(--d-chip-py) var(--d-chip-px); border-radius: var(--r-pill); border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text-muted); font-size: var(--d-chip); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.chip:hover { color: var(--c-text); border-color: var(--c-border-strong); }
.chip[aria-pressed="true"], .chip[aria-current="true"], .chip.is-active, .chip:has(input:checked) { background: var(--c-gold-tint); border-color: var(--c-wire); color: var(--c-gold); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:disabled) { opacity: 0.45; cursor: default; }
.chip:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.chip .count { color: inherit; opacity: 0.8; }

.seg { display: inline-flex; padding: 2px; border-radius: var(--r-pill); border: 1px solid var(--c-border); background: var(--c-surface-2); flex: none; }
.seg a, .seg button { padding: 0.25em 0.8em; border-radius: var(--r-pill); border: 0; background: transparent; color: var(--c-text-faint); font: 500 var(--d-seg)/1.4 var(--f-body); letter-spacing: 0.04em; cursor: pointer; text-decoration: none !important; }
.seg [aria-current="true"] { background: var(--c-gold-soft); color: var(--c-gold); box-shadow: inset 0 0 0 1px var(--c-wire); }

/* ================= card ================= */
.card { background: var(--g-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--pad, var(--d-card-pad)); }
.density-comfort .card { border-radius: var(--r-xl); }
.card--flat { background: var(--c-surface); }
.card--wire { border-color: var(--c-wire); }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: calc(var(--d-card-pad) * 0.85) var(--d-card-pad); border-bottom: 1px solid var(--c-border); }
.card__body { padding: var(--d-card-pad); }
.card__foot { padding: calc(var(--d-card-pad) * 0.65) var(--d-card-pad); border-top: 1px solid var(--c-border); }

/* ================= key-value ================= */
.kv { margin: 0; }
.kv__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-5); padding: 8px 0; border-bottom: 1px solid var(--c-border); }
.kv__row:last-child { border-bottom: 0; }
.kv dt { color: var(--c-text-faint); font-size: var(--d-small); display: flex; align-items: center; gap: 6px; }
.kv dd { margin: 0; text-align: right; font-size: var(--d-small); overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

/* ================= field ================= */
.field { display: block; min-width: 0; }
.field + .field { margin-top: var(--d-gap); }
.stack > .field + .field, .field-stack > .field + .field, .field__row > .field + .field, .field__row > * + * { margin-top: 0; }
.field-stack { display: flex; flex-direction: column; gap: var(--d-gap); }
.field__label { display: block; margin-bottom: 8px; }
.input, .textarea, .select {
  width: 100%; display: block; padding: var(--d-ctl-py) var(--d-ctl-px); border-radius: var(--d-ctl-r);
  background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text);
  font-size: var(--d-ctl-fs); line-height: 1.35; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--c-border-strong); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--c-wire-strong); box-shadow: 0 0 0 3px var(--c-gold-soft); }
.input[readonly] { background: transparent; color: var(--c-text-muted); }
.textarea { min-height: 128px; resize: vertical; line-height: var(--lh-body); }
.select { appearance: none; padding-right: 2.4em; background-image: linear-gradient(45deg, transparent 50%, var(--c-text-faint) 50%), linear-gradient(135deg, var(--c-text-faint) 50%, transparent 50%); background-position: calc(100% - 1.2em) 52%, calc(100% - 0.85em) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input--sm, .select--sm { padding: 7px 10px; border-radius: var(--r-sm); font-size: var(--d-small); background-color: var(--c-surface-2); }
.field.is-invalid .input, .field.is-invalid .textarea, .input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: rgba(192,138,126,0.6); }
.field__error { display: block; margin-top: 6px; color: var(--c-danger); font-size: var(--d-xsmall); line-height: 1.45; }
.field__hint { display: block; margin-top: 6px; color: var(--c-text-faint); font-size: var(--d-xsmall); }
.field__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--d-gap); align-items: start; }
@media (max-width: 640px) { .field__row { grid-template-columns: minmax(0, 1fr); } }

/* поле с иконкой слева и кнопкой справа */
.input-group { position: relative; display: block; }
.input-group > .icon { position: absolute; left: var(--d-ctl-px); top: 50%; transform: translateY(-50%); color: var(--c-text-faint); pointer-events: none; }
.input-group > .icon ~ .input { padding-left: calc(var(--d-ctl-px) + var(--d-icon) + 10px); }
.input-group .input:has(+ .btn--icon) { padding-right: calc(var(--d-iconbtn) + 12px); }
.input-group > .btn--icon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); color: var(--c-text-faint); border: 0; }
.input-group:focus-within > .icon { color: var(--c-gold); }

.radio-pref { display: inline-flex; align-items: center; gap: 6px; color: var(--c-text-faint); font-size: var(--d-xsmall); cursor: pointer; white-space: nowrap; }
.radio-pref input { accent-color: var(--c-gold); margin: 0; }
.radio-pref:has(input:checked) { color: var(--c-gold); }
.radio-pref:has(input:checked) .icon, .text-gold > .icon[aria-hidden] { fill: currentColor; }

/* ================= notice ================= */
.notice { display: flex; gap: 11px; padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--c-wire); background: rgba(255,255,255,0.02); color: var(--c-text-muted); font-size: var(--d-small); line-height: 1.5; }
.notice .icon { color: var(--c-amber); margin-top: 1px; }
.notice--danger { border-color: rgba(192,138,126,0.35); }
.notice--danger .icon { color: var(--c-danger); }
.notice--positive { border-color: rgba(143,174,147,0.35); }
.notice--positive .icon { color: var(--c-positive); }

/* ================= spinner ================= */
.spinner { width: 20px; height: 20px; border-radius: var(--r-pill); border: 2px solid rgba(255,255,255,0.07); border-top-color: var(--c-amber); animation: spin 0.9s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes pop { 0% { transform: scale(0.72); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================= table ================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px var(--d-table-px); font: 500 var(--d-label)/1.2 var(--f-body); text-transform: uppercase; letter-spacing: var(--ls-eyebrow); color: var(--c-text-faint); white-space: nowrap; }
.table td { padding: var(--d-table-py) var(--d-table-px); border-top: 1px solid var(--c-border); font-size: var(--d-table); vertical-align: middle; }
.table tbody tr { position: relative; }
.table tbody tr:hover td { background: rgba(255,255,255,0.015); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-tight { width: 1%; white-space: nowrap; }
.table a.row-link { color: inherit; }
.table a.row-link::after { content: ""; position: absolute; inset: 0; }
.table .row-actions { position: relative; z-index: 1; }

/* ================= list-row ================= */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--c-border); }
.list-row:last-child { border-bottom: 0; }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title { font-size: var(--d-body); font-weight: 450; overflow-wrap: anywhere; }
.list-row__sub { color: var(--c-text-faint); font-size: var(--d-xsmall); margin-top: 1px; }
.list-row > .icon { color: var(--c-text-muted); }

/* ================= карточки заявок (список клиента) ================= */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 18px 20px; border-radius: var(--r-xl); border: 1px solid var(--c-border); background: var(--g-surface); transition: border-color var(--dur-fast); }
.req:hover { border-color: var(--c-wire); }
.req__top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.req__num { color: var(--c-text); font-family: var(--f-mono); font-size: 0.95em; text-decoration: none !important; }
.req__num::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.req__date { color: var(--c-text-faint); font-size: var(--d-small); font-variant-numeric: tabular-nums; }
.req__text { grid-column: 1 / -1; color: var(--c-text-muted); font-size: var(--d-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req__side { display: flex; align-items: center; gap: 14px; color: var(--c-text-faint); font-size: var(--d-small); }
@media (max-width: 640px) { .req { grid-template-columns: minmax(0, 1fr); padding: 16px; } .req__side { justify-content: space-between; } }

/* ================= files ================= */
.file { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-border); }
.file:last-child { border-bottom: 0; }
.file__icon { width: var(--d-file-icon); height: var(--d-file-icon); border-radius: var(--r-md); display: grid; place-items: center; background: var(--c-surface-3); border: 1px solid var(--c-border); color: var(--c-text-muted); flex: none; }
.file__main { flex: 1; min-width: 0; }
.file__name { color: var(--c-text); font-size: var(--d-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
a.file__name:hover { color: var(--c-gold); text-decoration: none; }
.file__meta { color: var(--c-text-faint); font-size: var(--d-xsmall); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.file__author { display: inline-flex; align-items: center; gap: 4px; }
.file__author--staff { color: var(--c-gold); }
.file.is-error .file__icon { color: var(--c-danger); border-color: var(--c-danger-wire); }
.file.is-error .file__meta { color: var(--c-danger); }

.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 22px 16px; border-radius: var(--r-lg); border: 1px dashed var(--c-wire); background: rgba(200,169,106,0.025); color: var(--c-text-muted); text-align: center; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.dropzone:hover, .dropzone.is-over { background: var(--c-gold-soft); border-color: var(--c-wire-strong); color: var(--c-text); }
.dropzone .icon { color: var(--c-gold); width: 1.3em; height: 1.3em; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.only-coarse { display: none; }
@media (pointer: coarse) { .only-fine { display: none; } .only-coarse { display: inline; } }
.dropzone__types { font-size: var(--d-label); letter-spacing: 0.1em; color: var(--c-text-faint); text-transform: uppercase; }

/* ================= composer: главное поле новой заявки ================= */
.composer { position: relative; border-radius: 24px; border: 1px solid var(--c-wire); background: var(--g-surface); box-shadow: 0 30px 80px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.03); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.composer:focus-within { border-color: var(--c-wire-strong); box-shadow: 0 30px 80px rgba(0,0,0,0.45), 0 0 0 4px var(--c-gold-soft); }
.composer.is-over { border-style: dashed; background: var(--c-gold-soft); }
.composer.is-disabled { opacity: 0.55; border-color: var(--c-border); box-shadow: none; }
.composer__input { display: block; width: 100%; min-height: 132px; max-height: 50vh; padding: 22px 24px 8px; border: 0; background: transparent; color: var(--c-text); font-size: calc(var(--d-body) * 1.12); line-height: 1.55; resize: none; outline: none; }
.composer__files { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 20px 0; }
.composer__files:empty { display: none; }
.composer__bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 12px 14px; }
.composer__send { width: 48px; height: 48px; border-radius: var(--r-pill); padding: 0; }
.composer__send .icon { width: 22px; height: 22px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 6px 6px 10px; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface-3); font-size: var(--d-small); }
.fchip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fchip__size { color: var(--c-text-faint); font-variant-numeric: tabular-nums; }
.fchip.is-error { border-color: var(--c-danger-wire); color: var(--c-danger); }
.fchip .btn--icon { width: 24px; height: 24px; }
.hero { min-height: calc(100dvh - var(--h-topbar) - var(--d-page-pt) - var(--d-page-pb) - var(--bottom-nav, 0px)); display: flex; flex-direction: column; justify-content: center; padding-bottom: 6vh; }
.hero > * { width: 100%; max-width: 760px; margin-inline: auto; }
.hero__title { text-align: center; margin-bottom: 28px; }
.hero__chips { justify-content: center; margin-top: 18px; }
@media (max-width: 640px), (pointer: coarse) { .composer__hint { display: none; } }
@media (max-width: 640px) { .composer__input { min-height: 120px; padding: 18px 18px 6px; } .composer__files { padding-inline: 14px; } .hero__title { margin-bottom: 20px; } }
.kbd { font: 500 0.8em var(--f-mono); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--c-border); color: var(--c-text-faint); }

/* ================= встроенная заметка (как описание задачи) ================= */
.note { position: relative; }
.note__input { display: block; width: 100%; min-height: 120px; padding: 10px 12px; margin: 0 -12px; width: calc(100% + 24px); border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--c-text); font-size: var(--d-body); line-height: var(--lh-body); resize: vertical; transition: border-color var(--dur-fast), background var(--dur-fast); }
.note__input:hover { border-color: var(--c-border); }
.note__input:focus { outline: none; border-color: var(--c-wire-strong); background: var(--c-surface); }
.note__state { font-size: var(--d-xsmall); color: var(--c-text-faint); transition: opacity var(--dur-base); }
.note__state.is-saved { color: var(--c-positive); }
.note__state.is-error { color: var(--c-danger); }

/* ================= timeline / журнал ================= */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 7px 0; font-size: var(--d-small); border-bottom: 1px solid var(--c-border); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--c-text-faint); font-variant-numeric: tabular-nums; font-size: var(--d-xsmall); padding-top: 1px; }
.timeline__who { color: var(--c-text-muted); }

/* ================= avatar ================= */
.avatar { width: var(--d-avatar); height: var(--d-avatar); border-radius: var(--r-pill); display: inline-grid; place-items: center; border: 1px solid var(--c-wire); color: var(--c-gold); font: 500 calc(var(--d-avatar) * 0.36) var(--f-body); letter-spacing: 0.04em; background: var(--c-gold-soft); flex: none; }

/* ================= menu (details) ================= */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--sh-pop); z-index: 30; }
.menu__panel a, .menu__panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); border: 0; background: transparent; color: var(--c-text-muted); font-size: var(--d-small); text-align: left; cursor: pointer; text-decoration: none !important; }
.menu__panel a:hover, .menu__panel button:hover { background: var(--c-gold-soft); color: var(--c-text); }

/* ================= dialog ================= */
.dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-top: 1px solid var(--c-wire); border-radius: var(--r-2xl); background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-panel); }
.dialog::backdrop { background: var(--c-scrim); }
.dialog[open] { animation: pop var(--dur-base) var(--ease-sheet); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.dialog__body { padding: 8px 22px 20px; }
.dialog__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 22px 22px; }
@media (max-width: 640px) {   /* на телефоне диалог — шторка снизу, как Sheet в Ultima */
  .dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dialog[open] { animation: rise var(--dur-base) var(--ease-sheet); }
  .dialog__foot > .btn { flex: 1; }
}

/* ================= toast ================= */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--bottom-nav, 0px) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: var(--r-pill); background: var(--c-surface-3); border: 1px solid var(--c-wire); color: var(--c-text); font-size: var(--d-small); box-shadow: var(--sh-pop); z-index: 50; animation: pop var(--dur-base) var(--ease-out); }
.toast .icon { color: var(--c-positive); }

/* ================= empty ================= */
.empty { padding: 36px 18px; text-align: center; color: var(--c-text-faint); font-size: var(--d-small); display: grid; justify-items: center; gap: 12px; }
.empty .icon { width: 26px; height: 26px; color: var(--c-text-faint); }

/* ================= KYC-блок клиента ================= */
.kyc { display: flex; align-items: center; gap: var(--d-gap); padding: var(--d-card-pad); border-radius: var(--r-xl); border: 1px solid var(--c-border); background: var(--g-surface); flex-wrap: wrap; }
.kyc__icon { width: calc(var(--d-avatar) + 8px); height: calc(var(--d-avatar) + 8px); border-radius: var(--r-pill); display: grid; place-items: center; border: 1px solid var(--c-border); color: var(--c-text-faint); flex: none; }
.kyc__main { flex: 1; min-width: 180px; }
.kyc__reason { color: var(--c-danger); font-size: var(--d-small); margin-top: 3px; }
.kyc__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kyc--approved .kyc__icon { color: var(--c-positive); border-color: rgba(143,174,147,0.4); }
.kyc--pending .kyc__icon { color: var(--c-violet); border-color: rgba(148,169,189,0.4); }
.kyc--rejected { border-color: rgba(192,138,126,0.35); }
.kyc--rejected .kyc__icon { color: var(--c-danger); border-color: var(--c-danger-wire); }
.kyc--none { border-color: var(--c-wire); }
.kyc--none .kyc__icon { color: var(--c-gold); border-color: var(--c-wire); }
@media (max-width: 640px) { .kyc__actions { width: 100%; } .kyc__actions .btn { flex: 1; } }

/* ================= client shell ================= */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); background: rgba(10,13,12,0.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--c-border); }
.topbar__inner { max-width: var(--w-client); margin: 0 auto; height: var(--h-topbar); padding: 0 var(--sp-8); display: flex; align-items: center; gap: var(--sp-5); }
.topbar__nav { display: flex; gap: 4px; margin-left: var(--sp-6); }
.topbar__nav a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-md); color: var(--c-text-muted); font-size: var(--d-small); text-decoration: none !important; }
.topbar__nav a:hover { color: var(--c-text); }
.topbar__nav a[aria-current="page"] { color: var(--c-text); background: var(--c-gold-soft); }
.topbar__nav .icon { color: var(--c-text-faint); }
.topbar__nav a[aria-current="page"] .icon { color: var(--c-gold); }
.page { width: 100%; max-width: var(--w-client); margin: 0 auto; padding: var(--d-page-pt) var(--sp-8) var(--d-page-pb); flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-8); }
.page-head__title { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--c-text-faint); font-size: var(--d-small); margin-bottom: var(--sp-6); text-decoration: none !important; }
.back:hover { color: var(--c-text); }
.section + .section { margin-top: var(--sp-10); }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); margin-bottom: var(--sp-5); }

/* нижняя навигация клиента на телефоне */
.bottom-nav { display: none; }
@media (max-width: 640px) {
  .topbar__nav { display: none; }
  .topbar__inner { padding: 0 var(--sp-7); }
  .page { padding-inline: var(--sp-7); }
  .app { --bottom-nav: 64px; padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--bottom-nav) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: rgba(10,13,12,0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--c-border); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--c-text-faint); font-size: 11.5px; text-decoration: none !important; }
  .bottom-nav a .icon { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"] { color: var(--c-gold); }
  .toast { --bottom-nav: 64px; }
}

/* ================= оболочка клиента: левая панель как в ChatGPT / Claude (D-20) ================= */
.shell { --w-side: 288px; display: grid; grid-template-columns: var(--w-side) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns var(--dur-base) var(--ease-out); }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: #0D1110; border-right: 1px solid var(--c-border); }
.side__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 12px 8px 20px; }
.side__new { margin: 8px 12px 6px; justify-content: flex-start; }
.side__scroll { flex: 1; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
.side__label { display: flex; align-items: center; justify-content: space-between; padding: 16px 10px 6px; }
.side__label a { font-size: var(--d-xsmall); color: var(--c-text-faint); }
.side-item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: var(--r-md); color: var(--c-text-muted); text-decoration: none !important; }
.side-item:hover { background: rgba(255,255,255,0.035); color: var(--c-text); }
.side-item[aria-current="page"] { background: var(--c-gold-soft); color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-wire); }
.side-item__main { flex: 1; min-width: 0; }
.side-item__title { display: block; font-size: var(--d-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item__sub { display: block; margin-top: 2px; font: 400 var(--d-xsmall) var(--f-mono); color: var(--c-text-faint); }
.sdot { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--badge, var(--c-text-faint)); flex: none; }
.side__empty { padding: 10px; color: var(--c-text-faint); font-size: var(--d-small); }
.side__foot { border-top: 1px solid var(--c-border); padding: 10px; }
.side-user { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: var(--r-md); }
.side-user:hover { background: rgba(255,255,255,0.035); }
.side-user__text { flex: 1; min-width: 0; line-height: 1.25; }
.side-user__name { display: block; font-size: var(--d-small); color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user__mail { display: block; font-size: var(--d-xsmall); color: var(--c-text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu__panel--up { top: auto; bottom: calc(100% + 8px); left: 0; right: 0; min-width: 0; }
.menu__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; color: var(--c-text-muted); font-size: var(--d-small); }
.main { min-width: 0; display: flex; flex-direction: column; }
.main__bar { display: none; position: sticky; top: 0; z-index: 15; height: var(--main-bar, 56px); align-items: center; gap: 8px; padding: env(safe-area-inset-top, 0px) 12px 0; background: rgba(10,13,12,0.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.main__bar .brand { font-size: calc(var(--d-brand) * 0.9); text-decoration: none; }
.main .page { max-width: 820px; }
.shell .hero { min-height: calc(100dvh - var(--d-page-pt) - var(--d-page-pb) - var(--main-bar-h, 0px)); }
/* значок заявки: в развёрнутой панели — только точка статуса, в свёрнутой — иконка с точкой */
.side-item__ic { display: inline-flex; position: relative; flex: none; }
.side-item__ic .icon { display: none; }
.side__rail { display: none; }
/* пункты навигации в той же панели (консоль): иконка видна всегда */
.side__nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.side-item--nav .side-item__ic .icon { display: block; color: var(--c-text-faint); }
.side-item--nav[aria-current="page"] .side-item__ic .icon { color: var(--c-gold); }
.side-item--nav .side-item__title { font-size: var(--d-body); }
.side-item--nav .count { margin-left: auto; }
.side-item__badge { display: none; }

/* свёрнутая панель на компьютере: узкая полоса с иконками, тексты скрыты, иконки кликабельны (D-21) */
@media (min-width: 901px) {
  html.side-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }
  html.side-collapsed .side { overflow: visible; align-items: center; }
  html.side-collapsed .side__top { padding: 16px 0 8px; justify-content: center; }
  html.side-collapsed .side__top .brand,
  html.side-collapsed .side__text,
  html.side-collapsed .side__label,
  html.side-collapsed .side-item__main,
  html.side-collapsed .side-user__text,
  html.side-collapsed .side-user > .icon,
  html.side-collapsed .side__group--closed,
  html.side-collapsed .side__empty { display: none; }
  html.side-collapsed .side__new { width: 44px; height: 44px; padding: 0; margin: 8px auto 6px; justify-content: center; }
  html.side-collapsed .side__rail { display: inline-flex; margin: 0 auto 8px; }
  html.side-collapsed .side__scroll { width: 100%; overflow: visible; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; border-top: 1px solid var(--c-border); }
  html.side-collapsed .side-item { width: 44px; height: 44px; padding: 0; justify-content: center; }
  html.side-collapsed .side-item__ic .icon { display: block; }
  html.side-collapsed .side-item__ic .sdot { position: absolute; top: -3px; right: -4px; width: 8px; height: 8px; box-shadow: 0 0 0 2px #0D1110; }
  html.side-collapsed .side__foot { width: 100%; display: flex; justify-content: center; padding: 10px 0; }
  html.side-collapsed .side__nav { width: 100%; align-items: center; padding: 6px 0; }
  html.side-collapsed .side-item--nav .count { display: none; }
  html.side-collapsed .side-item__badge { display: inline-grid; place-items: center; position: absolute; top: -7px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--c-amber); color: var(--c-ink); font: 600 10px/1 var(--f-body); }
  html.side-collapsed .side-user { width: auto; padding: 4px; }
  html.side-collapsed .menu__panel--up { left: 0; right: auto; width: 248px; }
  /* подсказка справа от иконки */
  html.side-collapsed .side [data-tip] { position: relative; }
  html.side-collapsed .side [data-tip]:hover::after, html.side-collapsed .side [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 11px; border-radius: var(--r-sm);
    background: var(--c-surface-3); border: 1px solid var(--c-border); color: var(--c-text); font: 400 13px/1.3 var(--f-body);
    box-shadow: var(--sh-pop); pointer-events: none; z-index: 60;
  }
  html.side-collapsed .side details[open] > summary[data-tip]::after { display: none; }
}
.side-backdrop { display: none; }
@media (max-width: 900px) {
  .shell, html.side-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: min(86vw, 320px); height: 100dvh; visibility: visible !important; transform: translateX(-102%); transition: transform var(--dur-base) var(--ease-sheet); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: var(--sh-panel); }
  html.side-open .side { transform: none; }
  html.side-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: var(--c-scrim); }
  html.side-open, html.side-open body { overflow: hidden; }
  .main__bar { display: flex; }
  .shell .hero { --main-bar-h: 56px; }

}
.main__bar .grow + .btn--icon { margin-left: auto; }

/* вход: узкая колонка на сцене */
.stage { min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-9) var(--sp-7); background: var(--g-stage); }
.stage__panel { width: min(100%, var(--w-narrow)); }
.stage__card { padding: calc(var(--d-card-pad) * 1.6); border-radius: var(--r-2xl); background: var(--c-bg); border: 1px solid rgba(200,169,106,0.14); box-shadow: var(--sh-panel); }
.stage__brand { text-align: center; margin-bottom: 24px; font-size: calc(var(--d-brand) * 1.25); }
.stage__foot { display: flex; justify-content: center; margin-top: var(--sp-8); }
@media (max-width: 640px) {
  .stage { place-items: start center; padding-top: max(10vh, 40px); background: var(--c-bg); }
  .stage__card { padding: 0; border: 0; box-shadow: none; background: transparent; }
}

/* ================= staff shell (Ultima ops) ================= */
.staff { min-height: 100dvh; display: grid; grid-template-columns: var(--w-sidebar) minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--c-border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.sidebar .brand { padding: 0 10px 16px; }
.nav-group { margin-bottom: 10px; }
.nav-group__label { padding: 5px 10px 4px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); color: var(--c-text-muted); font-size: 12.5px; text-decoration: none !important; margin-bottom: 2px; }
.nav-item .icon { color: var(--c-text-faint); }
.nav-item:hover { color: var(--c-text); }
.nav-item[aria-current="page"] { background: var(--c-gold-soft); color: var(--c-text); }
.nav-item[aria-current="page"] .icon { color: var(--c-amber); }
.nav-item__label { display: flex; align-items: center; gap: 10px; }
.sidebar__foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--c-border); display: grid; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; font-size: var(--d-small); }
.who__name { color: var(--c-text); }
.who__role { color: var(--c-text-faint); font-size: var(--d-xsmall); }
.staff__main { min-width: 0; display: flex; flex-direction: column; }
.staff__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: 16px 24px; border-bottom: 1px solid var(--c-border); flex-wrap: wrap; }
.staff__body { padding: 20px 24px 40px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.split > .sticky { position: sticky; top: 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

@media (max-width: 900px) {
  .staff { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--c-border); }
  .sidebar .brand { padding: 0 8px 0 0; }
  .sidebar > nav { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav-group { display: flex; gap: 4px; margin: 0; flex: none; }
  .nav-group__label, .sidebar__foot .who > span:not(.avatar) { display: none; }
  .nav-item { width: auto; margin: 0; white-space: nowrap; }
  .sidebar__foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; flex: none; }
  .sidebar__foot .cluster { flex-wrap: nowrap; }
  .staff__head, .staff__body { padding-inline: 14px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .sticky { position: static; }
}
@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}
