/* Partner — светлый лист, navy-чернила, графитовая боковая панель. Без внешних шрифтов (строгий CSP). */
:root {
  --paper: #faf9f6;
  --paper-2: #f1efe9;
  --white: #ffffff;
  --ink: #1b2240;
  --ink-2: #3b4058;
  --muted: #6a6d7c;
  --rule: #e1ddd4;
  --accent: #8b5a3c;
  --accent-soft: #f7f1e8;
  --side: #2a2c33;
  --side-2: #383b44;
  --side-line: #3d4049;
  --side-text: #e9e7e2;
  --side-muted: #a3a2a9;
  --ok: #2f5d3a;
  --ok-soft: #e3ece2;
  --warn: #8a5a00;
  --warn-soft: #f4ead3;
  --serif: 'PT Serif', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius: 3px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 2rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ——— типографика ——— */
.serif { font-family: var(--serif); }
.mono { font: 500 .72rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.eyebrow { font: 500 .75rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: .75rem; }
.eyebrow a { text-decoration: none; }
.display { font-size: clamp(2.2rem, 5.2vw, 4rem); letter-spacing: -.01em; margin-bottom: 1.25rem; }
.display-s { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: 1.5rem; }
.h2 { font-size: 1.45rem; margin: 2.25rem 0 1rem; }
.h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 40em; }
.lead-l { font-size: 1.35rem; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cite {
  display: inline-block; min-width: 1.15em; margin: 0 .1em; padding: 0 .25em;
  font: 600 .7em/1.5 var(--mono); vertical-align: super; text-align: center; text-decoration: none;
  color: var(--accent); border: 1px solid currentColor; border-radius: var(--radius);
}
.cite:hover { background: var(--accent); color: var(--white); }

/* ——— каркас публичных страниц ——— */
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(480px, 100% - 32px); }
.block { padding-block: 4rem; }
.rule-b { border-bottom: 1px solid var(--rule); }
.bg-white { background: var(--white); }
.paper { min-height: 100vh; display: flex; flex-direction: column; }
.paper > main { flex: 1; }

.topbar { border-bottom: 1px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.topbar__row { display: flex; align-items: center; gap: 2rem; min-height: 64px; }
.topbar__nav { display: flex; gap: 1.5rem; flex: 1; }
.topbar__nav a, .topbar__cta a:not(.btn) { text-decoration: none; font-size: .95rem; }
.topbar__cta { display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font: 400 1.3rem/1 var(--serif); text-decoration: none; }
.brand:hover { color: inherit; }

.footer { border-top: 1px solid var(--ink); padding-block: 1.75rem; }
.footer__row { display: flex; gap: 2rem; align-items: baseline; flex-wrap: wrap; }
.footer__brand { font: 1.1rem var(--serif); }
.footer__note { color: var(--muted); font-size: .85rem; max-width: 60em; }

/* ——— лендинг ——— */
.hero { padding-block: 4.5rem; }
.hero__row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 4rem; align-items: center; }
.sample { margin: 0; padding: 1.75rem; background: var(--white); border: 1px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.sample__q { font-size: 1.05rem; }
.sample__a { font-size: 1.1rem; line-height: 1.6; }
.sample figcaption { margin: 1rem 0 0; }
.triple { display: grid; grid-template-columns: repeat(3, 1fr); }
.triple > div { padding: 1.75rem 1.5rem 1.75rem 0; }
.triple > div + div { border-left: 1px solid var(--rule); padding-left: 1.5rem; }
.split { display: grid; grid-template-columns: 1fr 2fr; gap: 3rem; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 4rem 1fr; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.steps span { font: 500 .85rem var(--mono); color: var(--accent); padding-top: .2rem; }
.steps b { font: 400 1.2rem var(--serif); display: block; margin-bottom: .25rem; }
.steps p { margin: 0; color: var(--muted); }

/* ——— сравнение тарифов ——— */
.compare { width: 100%; border-collapse: collapse; margin-bottom: 1rem; min-width: 560px; }
.compare th, .compare td { padding: .9rem 1rem; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare thead th { font: 400 1.3rem var(--serif); border-bottom: 1px solid var(--ink); }
.compare tbody th { font-weight: 400; color: var(--muted); width: 28%; }
.compare .is-featured { color: var(--accent); }
.compare__price td { font: 1.15rem var(--serif); }
.compare__price small { font: .8rem var(--sans); color: var(--muted); }

/* ——— кнопки и формы ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: .5rem 1.1rem; border: 1px solid var(--ink); border-radius: var(--radius);
  font: 500 .95rem/1.2 var(--sans); text-decoration: none; cursor: pointer; background: transparent; color: var(--ink);
  transition: background .15s, color .15s;
}
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn--line:hover { background: var(--ink); color: var(--paper); }
.btn--small { min-height: 30px; padding: .2rem .7rem; font-size: .85rem; margin-top: .25rem; }
.btn--danger { border-color: var(--accent); color: var(--accent); }
.btn--danger:hover { background: var(--accent); color: var(--white); }
.btn--lg { min-height: 48px; padding-inline: 1.5rem; font-size: 1rem; }
.btn[disabled], .btn[aria-busy='true'] { opacity: .55; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--accent); text-decoration-color: var(--accent); }

.form, .stack { display: flex; flex-direction: column; gap: 1rem; }
.form { margin-bottom: 1.5rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--ink-2); }
label small { color: var(--muted); }
input, textarea, select {
  width: 100%; padding: .6rem .7rem; font: 1rem/1.45 var(--sans); color: var(--ink);
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--ink); }
input[readonly], textarea[readonly] { background: var(--paper-2); color: var(--ink-2); }
textarea { resize: vertical; }
textarea.serif { font: 1.02rem/1.65 var(--serif); }
.check { flex-direction: row; align-items: flex-start; gap: .6rem; }
.check input { width: auto; margin-top: .3rem; }
.inline-form { display: flex; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.inline-form .grow { flex: 1; }
.row-gap { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }

.notice { padding: .8rem 1rem; margin-bottom: 1.25rem; border-left: 3px solid var(--accent); background: var(--accent-soft); }
.notice--ok { border-color: var(--ok); background: var(--ok-soft); }

/* ——— кабинет ——— */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { display: flex; flex-direction: column; gap: .15rem; padding: 1.25rem .75rem 1rem; background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; font-size: .92rem; }
.side a { color: inherit; text-decoration: none; }
.side a:hover { color: #ffffff; }
.side__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 1.5rem; padding-left: .5rem; }
.side__brand { margin: 0; }
.side__space { display: flex; gap: 2px; padding: 2px; border: 1px solid #474a54; border-radius: var(--radius); background: #33363e; }
.side__space > * { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; border-radius: 2px; color: var(--side-text); }
.side__space > [aria-current] { background: var(--paper); color: var(--side); }
.side__space > [aria-disabled] { color: var(--side-muted); opacity: .55; cursor: not-allowed; }
.side__mode { font: 500 .7rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); margin: 0 .5rem .5rem; }
.side__link { display: block; padding: .5rem .6rem; border-radius: var(--radius); }
.side__link:hover { background: var(--side-2); }
.side__link.is-active { background: var(--side-2); font-weight: 600; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: .9rem; padding: 1rem .5rem 0; border-top: 1px solid var(--side-line); font-size: .875rem; }
.side__small { color: var(--side-muted); }
.side__user { display: flex; align-items: center; gap: .6rem; }
.side__avatar { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--paper); color: var(--side); font: 400 .85rem/1 var(--serif); }
.side__name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side__user form { margin: 0; }
.side__logout { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--side-muted); cursor: pointer; }
.side__logout:hover { background: var(--side-2); color: #ffffff; }
.side :focus-visible { outline-color: var(--side-text); }
.switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #474a54; border-radius: var(--radius); overflow: hidden; background: #33363e; }
.switch button { padding: .45rem; border: 0; background: transparent; font: 500 .85rem var(--sans); color: inherit; cursor: pointer; }
.switch button[aria-pressed='true'] { background: var(--paper); color: var(--side); }

.main { padding: 2.25rem clamp(1rem, 3vw, 3rem) 4rem; min-width: 0; max-width: 1240px; }
.page-head { margin-bottom: 1.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--ink); }
.page-head h1 { margin: 0; }
.page-head p.muted { margin: .5rem 0 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.panel { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; background: var(--white); border: 1px solid var(--rule); }
.panel .h3 { margin-top: .5rem; }
.card { padding: 1.25rem; background: var(--white); border: 1px solid var(--rule); margin-bottom: 1.25rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--rule); }

.list { list-style: none; margin: 0 0 1.5rem; padding: 0; border-top: 1px solid var(--rule); }
.list li { border-bottom: 1px solid var(--rule); }
.list a { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem .25rem; text-decoration: none; }
.list a b { font: 400 1.08rem var(--serif); }
.list a:hover { background: var(--white); }
.list--compact a { flex-direction: column; gap: .1rem; padding: .6rem 0; }
.list--compact a b { font-size: .98rem; }
.list__row { display: flex; justify-content: space-between; gap: 1.5rem; padding: 1rem .25rem; align-items: flex-start; }
.list__row p { margin: .35rem 0 0; }

/* ——— консультация ——— */
.thread { display: flex; flex-direction: column; gap: 1.25rem; }
.disclaimer { margin: 0; padding: .7rem 1rem; font-size: .85rem; color: var(--ink-2); background: var(--warn-soft); border-left: 3px solid var(--warn); }
.messages { display: flex; flex-direction: column; gap: 1rem; }
.msg { padding: 1.1rem 1.25rem; border: 1px solid var(--rule); background: var(--white); }
.msg p:last-child { margin-bottom: 0; }
.msg--user { background: transparent; border-style: dashed; }
.msg--ai .serif { font-size: 1.05rem; line-height: 1.65; }
.msg--withheld { border-color: var(--warn); background: var(--warn-soft); }
.msg__note { margin: .9rem 0 0; font-size: .78rem; color: var(--muted); }
.msg__review { margin: .6rem 0 0; font-size: .875rem; }
.msg__review .linkbtn { text-align: left; }
.msg--pending { color: var(--muted); }
.msg--pending::after { content: '…'; animation: blink 1.2s steps(3) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.sources { margin: 1rem 0 0; padding: .9rem 0 0; list-style: none; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: .45rem; font-size: .88rem; }
.sources li { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; }
.sources .mono { margin: 0; color: var(--accent); }
.sources .muted { font-size: .8rem; }
.sources li:target, .sources li.is-open { background: var(--accent-soft); }
.sources__text { flex-basis: 100%; }
.sources__practice, .sources__reversed { flex-basis: 100%; font-size: .82rem; color: var(--ink-2); }
.sources__reversed { padding: .2rem .5rem; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--ink); }
.sources__text summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.sources__text blockquote { margin: .5rem 0 .25rem; padding: .6rem .9rem; border-left: 3px solid var(--accent); background: var(--white); font-size: .95rem; line-height: 1.6; white-space: pre-line; }

/* ——— ответ ИИ: записка, а не реплика ——— */
.msg--user { background: transparent; border: 0; border-top: 1px solid var(--rule); padding: 1.1rem 0 0; color: var(--ink-2); }
.answer { padding: 1.4rem 1.6rem 1.25rem; }
.trust { display: flex; flex-direction: column; gap: .15rem; margin: .25rem 0 1.1rem; padding: .65rem .9rem; border: 1px solid var(--rule); border-left-width: 4px; background: var(--paper); font-size: .9rem; }
.trust b { font-weight: 600; }
.trust--warn { border-color: var(--warn); background: var(--warn-soft); }
.trust--ok { border-color: var(--ok); background: var(--ok-soft); }
.trust--alert { border-color: var(--accent); background: var(--accent-soft); }
.answer__summary { font-size: 1.3rem; line-height: 1.45; }
.answer__summary p { margin-bottom: .5rem; }
.answer__part { margin-top: 1.4rem; }
.answer__part .serif { font-size: 1.05rem; line-height: 1.65; }
.answer__h { font: 500 .72rem/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .45rem; }
.answer__unsupported { margin: .25rem 0 0; padding-left: .75rem; border-left: 3px solid var(--warn); font-size: .85rem; color: var(--ink-2); }
.answer__steps, .answer__risks { margin: 0; padding-left: 1.4rem; font-size: 1.05rem; line-height: 1.6; }
.answer__steps li + li, .answer__risks li + li { margin-top: .35rem; }
.answer__deadline { display: block; font: .85rem var(--sans); color: var(--accent); }
.answer__clarify { margin-top: 1.4rem; padding: 1rem 1.1rem; background: var(--paper); border: 1px solid var(--rule); }
.answer__q + .answer__q { margin-top: .9rem; }
.answer__q p { margin: 0 0 .5rem; font-family: var(--serif); font-size: 1.02rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips form { margin: 0; }
.chip { padding: .35rem .85rem; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--white); font: 500 .9rem var(--sans); color: var(--ink); cursor: pointer; }
.chip:hover { background: var(--ink); color: var(--paper); }
.answer__actions .msg__review { margin-top: 1.25rem; }
.answer__actions:empty { display: none; }
.answer .sources { margin-top: 0; }

.ask { display: flex; flex-direction: column; gap: .75rem; padding: 1rem; background: var(--white); border: 1px solid var(--ink); position: sticky; bottom: 1rem; }
.ask .btn { align-self: flex-end; }
/* На невысоком экране закреплённое поле закрывало треть ответа — там оно стоит в конце ленты. */
@media (max-height: 760px) {
  .ask { position: static; }
}
.ask__error { color: var(--accent); font-size: .875rem; margin: 0; }

/* ——— документы ——— */
.editor { display: flex; flex-direction: column; gap: 1rem; }
.editor .btn { align-self: flex-start; }
.versions { list-style: none; margin: 0; padding: 0; font-size: .875rem; display: flex; flex-direction: column; gap: .4rem; }
.versions li { padding-left: .6rem; border-left: 2px solid var(--rule); }
.versions li.is-current { border-left-color: var(--accent); font-weight: 600; }
.versions .muted { display: block; font-weight: 400; }
.review-strip { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .75rem 1rem; margin-bottom: 1.25rem; background: var(--white); border: 1px solid var(--rule); }

/* ——— статусы и таблицы ——— */
.badge { display: inline-block; padding: .1rem .5rem; font: 500 .72rem/1.6 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid currentColor; border-radius: var(--radius); white-space: nowrap; }
.badge--queued { color: var(--warn); }
.badge--in_review { color: var(--ink-2); }
.badge--returned { color: var(--warn); background: var(--warn-soft); }
.badge--approved { color: var(--ok); background: var(--ok-soft); }
.badge--rejected { color: var(--accent); background: var(--accent-soft); }
.badge--cancelled { color: var(--muted); }
.scroll-x { overflow-x: auto; margin-bottom: 1.5rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .7rem .6rem; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table thead th { font: 500 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--ink); background: var(--white); }
.facts > div { display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem 1.25rem; }
.facts > div + div { border-left: 1px solid var(--rule); }
.facts b { font: 400 1.8rem var(--serif); }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pack { display: flex; flex-direction: column; gap: .5rem; padding: 1.25rem; background: var(--white); border: 1px solid var(--rule); }
.pack b { font: 400 1.3rem var(--serif); }

/* ——— режим юриста: тёмная колонка ——— */
.mode-lawyer .side { --side: #1f2127; --side-2: #2e3038; }
.mode-lawyer .page-head .eyebrow { color: var(--ink-2); }

/* ——— адаптив ——— */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
  .panel { position: static; }
  .hero__row, .split { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; padding: .75rem 16px; }
  .side__head { width: 100%; margin: 0 0 .25rem; padding: 0; }
  .side__mode { display: none; }
  .side__link { padding: .35rem .5rem; }
  .side__foot { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; margin: 0; padding-top: .6rem; }
  .main { padding: 1.5rem 16px 3rem; }
  .topbar__nav { display: none; }
  .topbar__row { justify-content: space-between; }
  .triple { grid-template-columns: 1fr; }
  .triple > div + div { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .list__row { flex-direction: column; }
  .block { padding-block: 2.5rem; }
  .hero { padding-block: 2.5rem; }
  .sample { box-shadow: 4px 4px 0 var(--ink); }
  .ask { position: static; }
  .answer { padding: 1.1rem 1rem; }
  .answer__summary { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Проверка договора: таблица «пункт → риск → правка». */
.contract { min-width: 0; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--ink); }
.contract__table td { min-width: 9rem; }
.contract__table td:nth-child(3), .contract__table td:nth-child(4) { min-width: 14rem; }
.contract__row--high td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.contract__row--medium td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.contract__quote { margin: .4rem 0 0; padding-left: .6rem; border-left: 2px solid var(--rule); color: var(--ink-2); font-size: .88rem; }
.contract form > .btn { margin-top: 1rem; }
.risk { display: inline-block; padding: .1rem .5rem; font: 500 .72rem/1.6 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid currentColor; border-radius: var(--radius); white-space: nowrap; }
.risk--high { color: var(--accent); background: var(--accent-soft); }
.risk--medium { color: var(--warn); background: var(--warn-soft); }
.risk--low { color: var(--muted); }
.check { display: inline-flex; padding: .2rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; }
input[type="file"] { padding: .4rem 0; border: 0; background: none; }
@media (max-width: 760px) {
  /* На телефоне находка — карточка: пункт и риск, затем проблема и правка. */
  .contract__table, .contract__table tbody, .contract__table tr, .contract__table td { display: block; min-width: 0 !important; }
  .contract__table thead { display: none; }
  .contract__table tr { padding: .6rem 0 .6rem .75rem; border-bottom: 1px solid var(--rule); }
  .contract__table td { padding: .3rem 0; border: 0; }
  .contract__row--high, .contract__row--medium { box-shadow: inset 3px 0 0 var(--warn); }
  .contract__row--high { box-shadow: inset 3px 0 0 var(--accent); }
  .contract__row td:first-child { box-shadow: none; }
  .contract__table td:nth-child(4)::before { content: 'Предлагаемая редакция'; display: block; font: 500 .7rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
}

/* Агент: форма поручения и «Ход работы». */
.agent-form { margin-top: 1rem; border-top: 1px solid var(--rule); padding-top: .75rem; }
.agent-form summary { cursor: pointer; font-weight: 600; }
.agent-form form { margin-top: .75rem; }
.agent-run { border-left: 3px solid var(--ink-2); padding-left: .9rem; }
.agent-run--failed { border-left-color: var(--accent); }
.agent-run--done { border-left-color: var(--ok); }
.agent-run__steps { margin: .5rem 0; padding-left: 1.2rem; display: grid; gap: .45rem; font-size: .9rem; }
.agent-run__steps li { display: grid; gap: .1rem; }
.agent-run__tool { font: 500 .72rem var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.agent-run__detail { overflow-wrap: anywhere; }
.agent-run__live { font-size: .9rem; color: var(--ink-2); }

/* Предложения агента: черновик и правки ждут подтверждения клиента. */
.proposals { margin-top: .9rem; padding-top: .75rem; border-top: 1px dashed var(--rule); display: grid; gap: .9rem; }
.proposal { padding: .8rem .9rem; border: 1px solid var(--rule); background: var(--white); min-width: 0; }
.proposal__title { margin: .2rem 0 .4rem; font: 600 1rem var(--serif); }
.proposal__body { white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0 0; font-size: .9rem; max-height: 22rem; overflow: auto; }
.proposal__actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .7rem 0 .3rem; }
.proposal__edits { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .6rem; }
.proposal__edits li { display: flex; gap: .5rem; align-items: flex-start; }
.proposal__edits del, .proposal__edits ins { display: block; padding: .15rem .35rem; text-decoration: none; overflow-wrap: anywhere; }
.proposal__edits del { background: var(--accent-soft); text-decoration: line-through; }
.proposal__edits ins { background: var(--ok-soft); margin-top: .2rem; }
.proposal__state { margin: .5rem 0 0; font-size: .9rem; }
.proposal__state--ok { color: var(--ok); }

/* Выгрузка документа. */
.export { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

/* Текст источника (/sources/:id) */
.source-text { white-space: pre-line; font-size: 1.02rem; line-height: 1.65; max-width: 46rem; }
blockquote.source-text { margin: .5rem 0; padding: .6rem .9rem; border-left: 3px solid var(--accent); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1.5rem; }
dl.meta dt { color: var(--muted, #666); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }


/* Public guides: readable prose and an index, scoped away from the workspace. */
.guide-index .lead { margin-bottom: 2rem; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.guide-card { display: flex; flex-direction: column; padding: 1.5rem; background: var(--white); border: 1px solid var(--rule); min-width: 0; }
.guide-card h3 { font-size: 1.4rem; line-height: 1.3; }
.guide-card h3 a { text-decoration: none; }
.guide-card p:not(.eyebrow) { color: var(--ink-2); }
.guide-card__link { margin-top: auto; font-size: .95rem; }
.guide-wrap { max-width: 1040px; padding-bottom: 4rem; }
.guide-breadcrumbs { display: flex; flex-wrap: wrap; gap: .55rem; padding-block: 1.5rem; font-size: .875rem; color: var(--muted); }
.guide-article { max-width: 760px; margin-inline: auto; overflow-wrap: anywhere; }
.guide-header { padding-block: 1.5rem; border-bottom: 1px solid var(--rule); }
.guide-header h1 { font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.15; }
.guide-meta { color: var(--muted); font-size: .875rem; margin: 1.5rem 0 0; }
.guide-toc { padding: 1.5rem; margin: 2rem 0; background: var(--paper-2); }
.guide-toc h2 { font-size: 1.15rem; }
.guide-toc ol { margin-bottom: 0; padding-left: 1.3rem; }
.guide-toc li + li { margin-top: .5rem; }
.guide-section { padding: 0; margin-block: 2.5rem; scroll-margin-top: 6rem; }
.guide-section h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 1rem; }
.guide-section h3 { font-size: 1.2rem; margin-top: 1.5rem; }
.guide-section p, .guide-section li { line-height: 1.8; }
.guide-section ul, .guide-section ol { padding-left: 1.4rem; }
.guide-section li + li { margin-top: .8rem; }
.guide-example { border-left: 3px solid var(--accent); padding: 1.3rem 1.5rem; background: var(--white); }
.guide-example p:last-child { margin-bottom: 0; }
.guide-sources { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.guide-sources h2 { font-size: 1.3rem; }
.guide-sources li { margin-bottom: .65rem; }
.guide-action { margin-top: 3rem; padding: 1.5rem; border: 1px solid var(--rule); background: var(--accent-soft); }
.guide-action h2 { font-size: 1.5rem; }
.guide-related { margin-top: 3rem; }
.guide-related .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 780px) {
  .guide-grid, .guide-related .guide-grid { grid-template-columns: 1fr; }
  .guide-header { padding-top: .5rem; }
  .guide-card { padding: 1.25rem; }
}


/* Документы: доступ и предложения внешних сервисов. */
.exchange-panel { position: static; margin-block: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
.exchange-panel .check { display: flex; align-items: flex-start; gap: .6rem; }
.exchange-panel .check input { flex: 0 0 1.1rem; }
.exchange-pr + .exchange-pr { border-top: 1px solid var(--rule); padding-top: 1.5rem; margin-top: 1rem; }
.exchange-pr details { padding: .75rem; margin-block: .75rem; border: 1px solid var(--rule); }
.exchange-pr summary { cursor: pointer; font-weight: 600; }
.exchange-pr form { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ——— Проекты: рабочая область ——— */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.cards .card { margin: 0; }
.cards .card a { display: flex; flex-direction: column; gap: .4rem; text-decoration: none; color: inherit; }
.cards .card b { font-size: 1.1rem; font-weight: 400; }
.ws { display: grid; grid-template-columns: 260px minmax(0, 1fr) 260px; gap: 1.5rem; align-items: start; }
.ws__head p.muted { margin-top: .4rem; }
.ws__tree { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; padding-right: .25rem; }
.ws__search { display: flex; gap: .4rem; margin-bottom: .75rem; }
.ws__search input { flex: 1; min-width: 0; }
.tree { list-style: none; margin: 0 0 1rem; padding: 0; font-size: .9rem; }
.tree__d1 { padding-left: .9rem; } .tree__d2 { padding-left: 1.8rem; } .tree__d3 { padding-left: 2.7rem; }
.tree__d4 { padding-left: 3.6rem; } .tree__d5 { padding-left: 4.5rem; } .tree__d6 { padding-left: 5.4rem; }
.tree a { display: block; padding: .25rem .4rem; border-radius: var(--radius); text-decoration: none; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree a:hover { background: var(--paper-2); }
.tree__folder a { font-weight: 600; }
.tree__folder a::before { content: '▸ '; color: var(--muted); }
.tree__folder--root a::before { content: ''; }
.tree__item--document a::before { content: '¶ '; color: var(--muted); font-family: var(--serif); }
.tree__item--file a::before { content: '◻ '; color: var(--muted); }
.tree .is-current > a { background: var(--ink); color: var(--paper); }
.tree .is-current > a::before, .tree .is-current .muted { color: var(--paper); opacity: .7; }
.ws__upload { border-top: 1px solid var(--rule); padding-top: .75rem; font-size: .9rem; }
.ws__upload summary { cursor: pointer; font-weight: 600; margin-bottom: .5rem; }
.ws__main { min-width: 0; background: var(--white); border: 1px solid var(--rule); padding: 2rem 2.5rem; min-height: 60vh; }
.ws__title { margin-bottom: .25rem; }
.ws__doc { font-family: var(--serif); font-size: 1.02rem; line-height: 1.65; max-width: 44em; margin-top: 1.25rem; }
.ws__p { position: relative; margin: 0 0 .9em; }
.ws__n { position: absolute; left: -2.6rem; width: 2rem; text-align: right; font: .7rem/1.9 var(--mono); color: var(--muted); user-select: none; }
.ws__p:target { background: var(--warn-soft); outline: 4px solid var(--warn-soft); }
.ws__empty { color: var(--ink-2); }
.ws__side { position: sticky; top: 1rem; font-size: .9rem; }
.ws__actions .btn { justify-content: flex-start; }
.ws__compare, .ws__move { margin-top: 1rem; }
.ws__compare label, .ws__move label { display: flex; gap: .5rem; align-items: center; }
.ws__compare select { flex: 1; }
.hits { margin: 0; padding-left: 1.2rem; }
.hits li { margin-bottom: 1rem; }
.hits p { margin: .2rem 0 0; color: var(--ink-2); font-family: var(--serif); }
.diff { font-family: var(--serif); line-height: 1.6; max-width: 44em; }
.diff p { margin: 0 0 .5em; padding: .15em .5em; border-left: 3px solid transparent; }
.diff__add { border-left-color: var(--ok) !important; background: var(--ok-soft); }
.diff__del { border-left-color: var(--accent) !important; background: var(--accent-soft); text-decoration: line-through; color: var(--ink-2); }
span.diff__add, span.diff__del { background: none; text-decoration: none; padding: 0; color: inherit; font-weight: 600; }
@media (max-width: 1100px) {
  .ws { grid-template-columns: 220px minmax(0, 1fr); }
  .ws__side { grid-column: 1 / -1; position: static; }
}
@media (max-width: 720px) {
  .ws { grid-template-columns: 1fr; }
  .ws__tree, .ws__side { position: static; max-height: none; }
  .ws__main { padding: 1.25rem 1rem 1.25rem 2.75rem; }
}
