/* NEDVIJIMOST · локальный интерфейс. Палитра: фон #F7F5F0, текст #172923, акцент #1F6A5C. */
:root {
  --bg: #F7F5F0;
  --card: #FFFFFF;
  --card-soft: #FAF8F3;
  --ink: #172923;
  --ink-2: #33433D;
  --muted: #56645E;
  --placeholder: #98A19D;
  --line: #E6E1D7;
  --line-strong: #D3CDC0;
  --accent: #1F6A5C;
  --accent-hover: #185A4E;
  --accent-press: #124A40;
  --accent-soft: #E1EDE8;
  --accent-tint: #F0F5F2;
  --accent-line: #CFE1DA;
  --warn-bg: #FBF4E3; --warn-line: #EADAB0; --warn-ink: #6B5112;
  --error-bg: #FBEEEB; --error-line: #EBCBC3; --error-ink: #983A2A;
  --radius: 16px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px rgba(31, 106, 92, .24);
  --shadow: 0 1px 2px rgba(23, 41, 35, .04), 0 4px 18px rgba(23, 41, 35, .035);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--accent-tint); border-radius: 4px; padding: 1px 4px; }

/* Header: brand, the list of steps, link to the agent profile */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header-inner { max-width: 1240px; margin: 0 auto; padding: 18px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 760; letter-spacing: .16em; }
.brand:hover { color: var(--ink); }
.brand:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.brand-mark { width: 16px; height: 16px; background: var(--accent); clip-path: polygon(50% 0, 100% 42%, 100% 100%, 0 100%, 0 42%); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.flow li { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px 4px 4px; }
.flow li span { font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.agent-link { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-size: 13px; font-weight: 560; line-height: 1.3; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; transition: border-color .15s; }
.agent-link:hover { color: var(--ink); border-color: var(--accent); }
.agent-link:focus-visible { outline: none; box-shadow: var(--ring); }
.agent-link img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.agent-link small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.2; }
/* Service mode: the signed-in user and «Выйти» at the right of the header; hidden (no space) in local mode. */
.service-user { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 560; color: var(--ink-2); white-space: nowrap; }
.service-user form { margin: 0; }
.service-user .text-button { margin-left: 0; }
.service-user-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.site-header-inner:has(> .service-user:not([hidden])) > .flow { margin: 0 auto; }
.site-header-inner:has(> .service-user:not([hidden])) > .agent-link { flex: none; }
.site-header-inner:has(> .service-user:not([hidden])) > .back-link { margin-left: auto; }
.service-notice { background: var(--accent-tint); border-bottom: 1px solid var(--accent-line); }
.service-notice-inner { max-width: 1240px; margin: 0 auto; padding: 6px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); }
.service-notice-inner p { margin: 0; }
.service-notice-inner .text-button { margin-left: 0; flex: none; }
.service-user a.text-button { text-decoration: none; }
/* «Мои оценки»: the home page of service mode. */
.section-title .evaluation-new { width: auto; flex: none; margin-left: auto; padding: 10px 16px; font-size: 14px; }
#evaluations-page .section-title h2 { white-space: nowrap; }
@media (max-width: 560px) {
  #evaluations-page .section-title { flex-wrap: wrap; }
  #evaluations-page .section-title .evaluation-new { width: 100%; margin-left: 0; }
}
/* «Сообщить о проблеме» (service mode): the last item of a step title, before «Новая оценка» in the list header. */
.section-title > .problem-button { flex: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.section-title > .problem-button:hover { color: var(--accent); }
.section-title > .help + .problem-button { margin-left: 0; }
.section-title > .problem-button + .evaluation-new { margin-left: 0; }
.problem-sent { flex: none; font-size: 12.5px; font-weight: 560; color: var(--accent); }
.problem-dialog { width: min(440px, calc(100vw - 32px)); box-sizing: border-box; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.problem-dialog::backdrop { background: rgba(23, 41, 35, .35); }
.problem-form { margin: 0; }
.problem-label { margin-bottom: 0; }
.problem-hint { margin: 8px 0 16px; }
.problem-error { margin: 0 0 16px; }
.problem-actions { display: flex; align-items: center; gap: 8px; }
.problem-actions .text-button { margin-left: 0; }
@media (max-width: 560px) {
  .section-title > .help + .problem-button { margin-left: auto; }
  .section-title > .text-button + .help + .problem-button { margin-left: 0; }
}
.evaluations-warning { margin: -8px 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-tint); border: 1px solid var(--accent-line); font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.evaluation-list { list-style: none; margin: 0; padding: 0; }
.evaluation-list:empty { display: none; }
.evaluation-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.evaluation-row:first-child { border-top: 0; }
.evaluation-link { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 2px; padding: 14px 4px; color: var(--ink); text-decoration: none; }
.evaluation-link:hover .evaluation-title { color: var(--accent); }
.evaluation-link:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
.evaluation-number { grid-row: span 2; font-size: 13px; font-weight: 620; color: var(--muted); padding-top: 1px; white-space: nowrap; }
.evaluation-title { font-weight: 600; overflow-wrap: anywhere; }
.evaluation-note { font-size: 13px; color: var(--muted); }
.evaluation-row .text-button { flex: none; }
main { max-width: 1240px; margin: 0 auto; padding: 44px 24px 32px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--accent); }

/* Layout and panels */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.workspace:has(> aside[hidden]) { grid-template-columns: minmax(0, 1fr); } /* one column while the side panel is hidden */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 20px; box-shadow: var(--shadow); }
/* Steps 04 and 05: full-width panels below the workspace; under the table, actions left and a summary right. */
.wide { margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; margin-top: 18px; }
.two-col > * > :first-child { margin-top: 0; }
.two-col > * > .disclosure:first-child { border-top: 0; padding-top: 0; }
.section-title { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.01em; font-weight: 680; margin: 0; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 650; margin: 0 0 14px; }
.step { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
/* «?» at the end of a step title opens one help block right under the title. */
.help { flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-left: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.text-button + .help, .cma-basis:not(:empty) + .help { margin-left: 0; }
.help:hover { color: var(--accent); border-color: var(--accent); }
.help:focus-visible { outline: none; box-shadow: var(--ring); }
.help[aria-expanded=true] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.step-help { background: var(--card-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.6; color: var(--ink-2); margin: -6px 0 20px; }
.step-help p { margin: 8px 0 0; }
.step-help > :first-child { margin-top: 0; }
.step-help .setup-steps { margin: 6px 0 0; }
.step-help .secondary { margin-top: 10px; }

/* Form controls */
label { display: block; font-size: 13px; font-weight: 560; color: var(--ink-2); margin: 0 0 18px; }
input, textarea, select { display: block; width: 100%; margin-top: 7px; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; padding: 11px 12px; font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input:hover, textarea:hover, select:hover { border-color: #BDB6A7; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--ring); }
input:disabled, textarea:disabled, select:disabled { background: #F3F1EC; color: var(--muted); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
textarea { resize: vertical; line-height: 1.5; }
select { cursor: pointer; }
.fields { display: grid; gap: 16px; }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.optional { font-weight: 400; color: var(--muted); }
.field-note { display: block; font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 450; margin-bottom: 0; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.hint.lead { margin: -8px 0 20px; }

/* Buttons */
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: var(--accent); color: #fff; border: 0; border-radius: 12px; font: inherit; font-size: 15px; font-weight: 620; padding: 16px 20px; cursor: pointer; text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s; }
.primary:hover { background: var(--accent-hover); color: #fff; }
.primary:active { background: var(--accent-press); transform: translateY(1px); }
.primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.primary:disabled { background: #94B0A8; cursor: not-allowed; transform: none; }
.primary span { font-size: 18px; line-height: 1; }
.action { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 11px; font: inherit; font-size: 14.5px; font-weight: 620; padding: 12px 18px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.action:hover { background: var(--accent-tint); }
.action:active { background: var(--accent-soft); }
.action:focus-visible { outline: none; box-shadow: var(--ring); }
.secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #fff; color: var(--accent); border: 1px solid var(--line-strong); border-radius: 9px; font: inherit; font-size: 13.5px; font-weight: 580; padding: 10px 14px; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.secondary:hover { border-color: var(--accent); background: var(--accent-tint); }
.secondary:active { background: var(--accent-soft); }
.secondary:focus-visible { outline: none; box-shadow: var(--ring); }
.secondary:disabled { color: var(--muted); background: #F3F1EC; border-color: var(--line); cursor: not-allowed; }
.secondary[data-copied] { border-color: var(--accent); background: var(--accent-soft); }
.text-button { margin-left: auto; font: inherit; font-size: 13px; font-weight: 560; color: var(--accent); background: none; border: 0; border-radius: 7px; padding: 6px 8px; cursor: pointer; transition: background .15s; }
.text-button:hover { background: var(--accent-tint); }
.text-button:focus-visible { outline: none; box-shadow: var(--ring); }
.local-note { font-size: 12px; text-align: center; color: var(--muted); margin: 12px 0 28px; }

/* Segmented switches: entry modes of step 01 (buttons), data source of step 03 (labels around hidden radios) */
.entry-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #F1EEE7; border-radius: 12px; padding: 4px; margin: -4px 0 22px; }
.entry-mode { margin: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); padding: 10px 12px; font: inherit; font-size: 14px; font-weight: 560; text-align: center; cursor: pointer; transition: background .15s, color .15s; }
.entry-mode:hover { color: var(--ink); }
.entry-mode.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(23, 41, 35, .12); }
.entry-mode:has(input:checked) { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(23, 41, 35, .12); }
.entry-mode:focus-visible { outline: none; box-shadow: var(--ring); }
.entry-mode:has(input:focus-visible) { box-shadow: var(--ring); }
#listing-fields { margin-bottom: 22px; }
.listing-help { margin: 16px 0 0; }
.import-status { background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink-2); font-size: 13px; line-height: 1.55; margin: -6px 0 18px; }
#import-status { white-space: pre-line; }
/* Step 01: «Для презентации» — subject fields used only by the client presentation */
.sub { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.sub-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.sub-title h3 { margin: 0; }
.sub-title .optional { font-size: 12px; }
#winner-status { margin: 14px 0 0; }
#winner-status[data-error=true] { background: var(--error-bg); border-color: var(--error-line); color: var(--error-ink); }
/* Service mode, step 02: «Найти аналоги», «Отменить поиск» and the line of the search job. */
.search-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.action:disabled { color: var(--muted); border-color: var(--line-strong); background: #F3F1EC; cursor: not-allowed; }
#search-status { margin: 14px 0 0; }
#search-status:is([data-state=error], [data-state=too_many], [data-state=empty], [data-state=failed]) { background: var(--error-bg); border-color: var(--error-line); color: var(--error-ink); }

/* Step 02: search */
.search-summary { background: var(--card-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 18px 0 16px; }
.summary-label { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
#winner-summary { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink); }
.setup-steps { font-size: 13px; line-height: 1.65; color: var(--ink-2); padding-left: 20px; margin: 0 0 12px; }
.setup-steps li + li { margin-top: 4px; }
.code-field { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; margin-top: 12px; }
#winner-params-code { font-size: 12px; margin-top: 12px; }

/* Disclosures */
.disclosure { border-top: 1px solid var(--line); margin: 18px 0 0; padding-top: 14px; }
.disclosure > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent); border-radius: 7px; padding: 2px 0; width: fit-content; max-width: 100%; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin: 0 2px; }
.disclosure[open] > summary::before { transform: rotate(45deg) translate(-1px, -1px); }
.disclosure > summary:hover { color: var(--accent-hover); }
.disclosure > summary:focus-visible { outline: none; box-shadow: var(--ring); }
.disclosure-body { padding-top: 14px; }
.disclosure-body > :last-child, .disclosure-body > .fields:last-child > label { margin-bottom: 0; }
/* Panel «Закладки для браузера» in the side column: name and place of use, one copy button per row. */
.bm { list-style: none; margin: 10px 0 0; padding: 0; }
.bm li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.bm li:first-child { border-top: 0; }
.bm small { display: block; color: var(--muted); font-size: 11.5px; }
.bm .secondary { padding: 6px 10px; font-size: 12px; line-height: 1.3; max-width: 150px; text-align: center; }

/* Step 03: data for analysis; the source switch is a fieldset styled as .entry-modes */
.source-switch { border: 0; min-width: 0; }
.load-status { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 12px; align-items: start; background: var(--card-soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; }
.load-status::before { content: ""; grid-row: 1 / span 2; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px dashed var(--line-strong); display: grid; place-items: center; font-size: 13px; font-weight: 800; line-height: 1; color: #fff; box-sizing: border-box; }
.load-title { font-size: 14.5px; font-weight: 640; color: var(--ink); overflow-wrap: anywhere; }
.load-detail { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 2px; overflow-wrap: anywhere; }
.load-detail:empty { display: none; }
.load-status[data-state="loading"]::before { border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.load-status[data-state="ok"] { background: var(--accent-tint); border-color: var(--accent-line); }
.load-status[data-state="ok"]::before { content: "✓"; border: 0; background: var(--accent); }
.load-status[data-state="error"] { background: var(--error-bg); border-color: var(--error-line); }
.load-status[data-state="error"]::before { content: "!"; border: 0; background: var(--error-ink); }
.load-status[data-state="error"] .load-title { color: var(--error-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .load-status[data-state="loading"]::before { animation-duration: 2.4s; } }
.load-file { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 4px; }
.load-file .hint { margin: 0; }
.load-file label { margin: 0; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; opacity: 0; }
.file-input:focus-visible + label { box-shadow: var(--ring); border-color: var(--accent); }
#sheet-input { margin: 16px 0 0; }

/* Objects preview */
#winner-groups-preview { max-height: 460px; overflow: auto; overscroll-behavior: contain; }
.preview-warnings { margin: 0 0 12px; padding: 10px 14px 10px 30px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.55; color: var(--warn-ink); }
.winner-object { border-top: 1px solid var(--line); padding: 10px 0; }
.winner-object:first-of-type { border-top: 0; }
.winner-object summary { cursor: pointer; line-height: 1.5; font-size: 13.5px; color: var(--ink); padding: 2px 0; border-radius: 6px; }
.winner-object summary:focus-visible { outline: none; box-shadow: var(--ring); }
.winner-object .table-scroll table { min-width: 540px; }
.winner-object th, .winner-object td { text-align: left; }
.winner-object th:nth-child(2), .winner-object td:nth-child(2), .winner-object th:nth-child(4), .winner-object td:nth-child(4) { text-align: right; }

/* Errors */
.error { background: var(--error-bg); border: 1px solid var(--error-line); color: var(--error-ink); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13.5px; line-height: 1.55; margin-bottom: 18px; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: #F5F3EE; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child, th:nth-child(3), td:nth-child(3) { text-align: right; }

/* Step 04: analogues and estimate */
.cma-basis { margin-left: auto; font-size: 12px; font-weight: 560; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 6px 12px; }
.cma-basis:empty { display: none; }
.cma-warning { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.6; color: var(--warn-ink); margin: 14px 0 0; }
.cma-table { font-size: 12.5px; }
.cma-table.compact { min-width: 680px; }
.cma-table .cma-return { font-size: 12px; padding: 5px 10px; min-height: 0; white-space: nowrap; }
.cma-return-blocked { font-size: 11.5px; color: var(--muted); }
.cma-returned { font-size: 11.5px; color: var(--warn-ink); margin-top: 3px; }
.cma-table th, .cma-table td { padding: 9px 6px; text-align: left; }
/* Fourteen columns across the full-width panel: headers may wrap («Площадь, м²»), cells keep their padding tight. */
.cma-table th { white-space: normal; line-height: 1.3; }
.cma-table td:nth-child(11) { text-align: right; font-weight: 650; white-space: nowrap; }
.cma-table td:nth-child(12), .cma-table td:nth-child(5) { white-space: nowrap; }
.cma-table td:last-child, .cma-table th:last-child { text-align: left; }
.cma-table input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.cma-notes .cma-description-toggle { color: var(--warn-ink); margin-top: 0; }
.cma-notes-list p { color: var(--warn-ink); }
.cma-reserve-row { background: #FDF9EE; }
.cma-subject-row { background: var(--accent-tint); }
.cma-subject-row td { border-bottom: 1px solid var(--accent-line); font-weight: 560; }
.cma-subject-row .cma-object-id { color: var(--accent); font-weight: 600; letter-spacing: .02em; }
.cma-subject-row td.cma-subject-price-note { font-size: 11.5px; font-weight: 400; color: var(--muted); line-height: 1.35; }
/* The scroll wrapper must not be a scroll container, or sticky cells would pin to it, not the window. */
.table-scroll:has(> .cma-table:not(.compact)) { overflow-x: clip; }
/* When the table is still wider than the page (long addresses, a narrow window), it scrolls
 * sideways instead of losing its last columns; the script sets the class after measuring. */
.table-scroll.cma-overflow:has(> .cma-table:not(.compact)) { overflow-x: auto; }
.cma-table th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--line); border-bottom: 0; }
.cma-subject-row td { position: sticky; top: var(--cma-head, 38px); z-index: 1; background: var(--accent-tint); box-shadow: inset 0 -1px 0 var(--accent-line), 0 0 0 .5px var(--accent-tint); border-bottom: 0; }
.cma-diff { text-decoration: underline dotted; text-decoration-color: #B9B0A0; text-underline-offset: 3px; cursor: help; }
.cma-source-link { font-size: 11.5px; font-weight: 560; color: var(--accent); text-decoration: none; white-space: nowrap; border-radius: 4px; }
.cma-source-link:hover { color: var(--accent-hover); text-decoration: underline; }
.cma-source-link:focus-visible { outline: none; box-shadow: var(--ring); }
.cma-source-link.cma-source-generic { color: var(--muted); font-weight: 400; }
.cma-object-id { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cma-sources { white-space: nowrap; }
.cma-sources div + div { margin-top: 3px; }
.cma-source-plain { font-size: 11.5px; color: var(--muted); }
.cma-description-toggle { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 0; border: 0; background: none; font: inherit; font-size: 11.5px; color: var(--accent); cursor: pointer; border-radius: 6px; }
.cma-description-toggle::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.cma-description-toggle[aria-expanded=true]::before { transform: rotate(45deg) translate(-1px, -1px); }
.cma-description-toggle:hover { color: var(--accent-hover); }
.cma-description-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.cma-table tr.cma-open td { border-bottom: 0; }
.cma-description-row td { padding: 0 8px 12px 48px; }
.cma-description-row .cma-description + .cma-description { margin-top: 8px; }
.cma-description { background: var(--card-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; max-width: 72ch; }
.cma-description-id { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.cma-description-id:first-child { margin-top: 0; }
.cma-description p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink); white-space: pre-line; }
.cma-description p + p, .cma-description-id + p { margin-top: 4px; }
/* The summary card of step 04: result and chart in the right column (the policy notes stay in the PDF). */
.cma-summary { background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 12px; padding: 18px 20px; }
.cma-headline { font-size: 24px; font-weight: 720; color: var(--accent); letter-spacing: -.02em; line-height: 1.2; }
.cma-headline.muted { color: var(--muted); font-size: 22px; }
.cma-result p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.55; }
.cma-strong { font-weight: 650; }
.cma-status { color: var(--accent-press); }
.cma-chart svg { width: 100%; max-width: 340px; height: auto; margin-top: 14px; }
.cma-chart .grid { stroke: #ECE8DF; stroke-width: 1; }
.cma-chart .band { fill: #D9E9E2; }
.cma-chart .median { stroke: var(--ink); stroke-width: 1.6; }
.cma-chart .span { stroke: #8C9792; stroke-width: 1.2; }
.cma-chart .dot { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
.cma-chart .outlier { fill: var(--ink); stroke: #fff; stroke-width: 1.5; }
.cma-chart .label, .cma-chart .axis { font-size: 11px; fill: var(--muted); }
.cma-note { margin-top: 18px; }
#cma-error { margin: 16px 0; }
#cma-error div + div { margin-top: 4px; }
/* One line of links under the button that produced the files (report in 04, presentation in 05). */
.cma-done { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 18px; margin-top: 12px; font-size: 13px; }
.cma-done .hint { flex-basis: 100%; margin: 0; }
/* Service mode, the evaluation page: its state line, «Изменить подбор» over the selection, the presentations list. */
.evaluation-line { background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.cma-reopen { display: flex; justify-content: flex-end; margin: 28px 0 -12px; }
.cma-reopen:has(> [hidden]) { display: none; }
.cma-reopen .secondary { width: auto; }
.pr-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.pr-list li + li { margin-top: 6px; }

/* Screen-reader-only text */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Agent page (/agent) */
.back-link { font-size: 13px; font-weight: 560; text-decoration: none; }
.agent-page { max-width: 820px; margin: 0 auto; }
.agent-page .section-title .hint { margin: 0 0 0 auto; }
.agent-page h3 { margin: 22px 0 10px; }
.agent-head { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 20px; align-items: center; margin-bottom: 6px; }
.agent-head img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 2px 10px rgba(23, 41, 35, .12); }
/* In place of a missing photo: a round placeholder with the initials, so the head keeps both columns */
.agent-head .ag-initials { width: 112px; height: 112px; font-size: 34px; letter-spacing: .02em; }
.agent-head b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.agent-head .role { font-size: 14px; color: var(--muted); }
.agent-head .photo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.agent-head .photo-actions label { margin: 0; }
.agent-head .photo-actions .hint { margin: 0; align-self: center; }
.agent-offer input { margin-top: 0; }
.benefit { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; align-items: end; margin-bottom: 12px; }
.benefit .n { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; margin-bottom: 10px; }
.benefit label { margin: 0; }
.offer-edit { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px 12px; margin-bottom: 18px; padding: 14px 16px 12px; background: var(--panel-soft, rgba(0, 0, 0, .03)); border-radius: 12px; }
.offer-edit .n { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; grid-row: 1 / span 3; }
.offer-edit .fields, .offer-edit > label { grid-column: 2; margin: 0; }
.offer-edit textarea { width: 100%; min-height: 110px; resize: vertical; }
.weeks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.weeks label { margin: 0; }
.swatch { position: relative; display: inline-flex; align-items: center; gap: 12px; margin-top: 6px; cursor: pointer; }
.swatch i { display: block; width: 44px; height: 44px; border-radius: 10px; background: #5343DF; border: 1px solid rgba(0, 0, 0, .12); box-shadow: inset 0 0 0 3px #fff; }
.swatch input[type=color] { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; padding: 0; border: 0; }
.swatch input[type=color]:focus-visible + i { box-shadow: inset 0 0 0 3px #fff, var(--ring); }
.swatch code { font-size: 14px; font-family: ui-monospace, Menlo, monospace; background: none; padding: 0; }
.swatch small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
#ag-error { margin: 22px 0 0; }
.save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 26px; }
.save-row .primary { margin: 0; width: auto; padding: 12px 22px; }
.save-row .hint { margin: 0; }
.save-row .danger { color: var(--error-ink); }
/* Profile chips (also on step 05 of the main page) */
.ag-profiles { display: flex; flex-wrap: wrap; gap: 8px; }
.ag-chip { display: inline-flex; align-items: center; gap: 9px; font: inherit; font-size: 13px; font-weight: 560; line-height: 1.3; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 16px 4px 4px; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.ag-chip:hover { border-color: var(--accent); }
.ag-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.ag-chip img, .ag-initials { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.ag-initials { display: grid; place-items: center; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.ag-chip small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; line-height: 1.2; }
.ag-chip[aria-pressed=true] { border-color: var(--accent); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent); }
.ag-chip.add { padding: 4px 16px; min-height: 42px; color: var(--accent); border-style: dashed; }
.agent-page .ag-profiles { margin: -6px 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
/* Company logo block: the grey box is the slide background */
.ag-logo { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; align-items: center; }
.ag-logo-box { height: 76px; display: grid; place-items: center; background: #F1F2F0; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--placeholder); font-size: 12px; }
.ag-logo-box img { max-width: 104px; max-height: 52px; }
.ag-logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ag-logo-actions label { margin: 0; }
.ag-logo-actions .text-button { margin-left: 0; }
.ag-logo .hint { margin: 8px 0 0; }
.ag-logo-actions .hint { margin: 0; }
/* Photo and logo of an unsaved new agent: the file input is disabled, its label looks like .secondary:disabled */
.file-input:disabled + label.secondary { color: var(--muted); background: #F3F1EC; border-color: var(--line); cursor: not-allowed; pointer-events: none; }
@media (max-width: 860px) { .weeks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .ag-logo { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .agent-head { grid-template-columns: 80px minmax(0, 1fr); gap: 14px; }
  .agent-head img, .agent-head .ag-initials { width: 80px; height: 80px; }
  .agent-head .ag-initials { font-size: 26px; }
  .benefit { grid-template-columns: 30px minmax(0, 1fr); }
  .benefit label + label { grid-column: 2; }
  .weeks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Client presentation: photo slots of step 01, step 05 */
.pr-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.pr-photo-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: var(--card-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 12px; min-height: 92px; }
.pr-photo-slot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.pr-photo-slot .secondary { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-photo-slot .text-button { margin-left: 0; padding-left: 0; }
.pr-photo-slot .hint { margin: -4px 0 0; font-size: 12px; }
/* Gallery of the imported Cian listing under the slots */
.pr-gallery { margin: -4px 0 16px; }
.pr-gallery .hint { margin: 0 0 8px; }
.pr-gallery-items { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-gallery-item { position: relative; width: 104px; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--card-soft); cursor: pointer; overflow: hidden; }
.pr-gallery-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pr-gallery-item:hover { border-color: var(--line-strong); }
.pr-gallery-item:focus-visible { outline: none; box-shadow: var(--ring); }
.pr-gallery-item[aria-pressed="true"] { border-color: var(--accent); }
.pr-gallery-item:disabled { opacity: .5; cursor: progress; }
.pr-gallery-item small { position: absolute; left: 6px; bottom: 6px; font-size: 11px; line-height: 1.3; color: var(--ink-2); background: rgba(255, 255, 255, .92); border-radius: 4px; padding: 1px 5px; }
.pr-gallery-item b { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; color: #fff; background: var(--accent); border-radius: 50%; }
.pr-table td:nth-child(5) { white-space: nowrap; text-align: right; }
.pr-table th:nth-child(3), .pr-table td:nth-child(3), .pr-table th:last-child, .pr-table td:last-child { text-align: left; }
.pr-table input[type=text], .pr-table input[type=number] { margin-top: 0; padding: 7px 9px; font-size: 13px; min-width: 120px; }
.pr-unchanged { margin: -10px 0 18px; font-size: 13px; }
.pr-table .checkbox { font-size: 12px; margin-top: 6px; }
.pr-table .checkbox input { width: 15px; height: 15px; }
.pr-muted-row td { color: var(--muted); }
#pr-competitors-note:empty { display: none; }
.pr-strategy { border: 0; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.pr-strategy legend { font-size: 13px; font-weight: 560; color: var(--ink-2); padding: 0; margin-bottom: 8px; width: 100%; }
.pr-strategy .checkbox { font-size: 14px; }
#pr-error { margin: 16px 0; }
#pr-make { margin-top: 18px; }
/* Step 05: the agent chips, «3 | 5» competitors on the slide, the slide cards; the chosen agent in the header */
.agent-link .ag-initials { width: 26px; height: 26px; font-size: 10px; }
.pr-agent { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 26px; }
.pr-agent a { font-size: 13px; font-weight: 560; text-decoration: none; }
.pr-agent .ag-chip:disabled { opacity: .6; cursor: not-allowed; border-color: var(--line-strong); }
.pr-count { display: inline-grid; grid-auto-flow: column; gap: 3px; background: #F1EEE7; border-radius: 10px; padding: 3px; align-self: center; }
.pr-count button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 5px 16px; cursor: pointer; }
.pr-count button:focus-visible { outline: none; box-shadow: var(--ring); }
.pr-count button[aria-pressed=true] { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(23, 41, 35, .12); }
.pr-count-label { margin-left: auto; font-size: 13px; color: var(--ink-2); font-weight: 560; align-self: center; }
.pr-slides { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.pr-slide { position: relative; display: block; margin: 0; background: var(--accent-tint); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 12px 13px; cursor: pointer; transition: background .15s, border-color .15s; }
.pr-slide input { position: absolute; top: 11px; right: 11px; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.pr-slide .num { display: inline-grid; place-items: center; min-width: 24px; height: 24px; font-size: 12px; font-weight: 700; color: var(--accent); background: #fff; border: 1px solid var(--accent-line); border-radius: 7px; font-variant-numeric: tabular-nums; }
.pr-slide b { display: block; font-size: 13.5px; font-weight: 650; color: var(--ink); margin-top: 9px; line-height: 1.3; }
.pr-slide small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.pr-slide:not(:has(input:checked)) { background: #F6F4EF; border: 1px dashed var(--line-strong); }
.pr-slide:not(:has(input:checked)) b { color: var(--muted); text-decoration: line-through; }
.pr-slide:not(:has(input:checked)) .num { color: var(--muted); border-color: var(--line); }
.pr-slide.locked, .pr-slide.locked input { cursor: default; }
.pr-slide em { display: block; font-style: normal; font-size: 11px; font-weight: 600; color: var(--accent); margin-top: 6px; }
.pr-slides-total { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
.pr-block { margin-top: 30px; }
@media (max-width: 1100px) { .pr-slides { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 620px) { .pr-slides { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pr-photos { grid-template-columns: 1fr; } }

/* Responsive */
@media (max-width: 1100px) {
  .workspace { gap: 22px; }
}
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  main { padding: 30px 20px 24px; }
  .site-header-inner { padding-left: 20px; padding-right: 20px; }
  .flow { display: none; }
  /* Service mode: the user and «Выйти» move to a second row instead of running off the screen. */
  .site-header-inner:has(> .service-user:not([hidden])) { flex-wrap: wrap; row-gap: 8px; }
  .site-header-inner:has(> .service-user:not([hidden])) > .agent-link,
  .site-header-inner:has(> .service-user:not([hidden])) > .service-user { margin-left: auto; }
  .workspace { grid-template-columns: 1fr; }
  aside { display: flex; flex-direction: column; }
  .panel { padding: 22px; }
  .three { grid-template-columns: 1fr 1fr; }
  .four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  main { padding: 24px 16px 20px; }
  .site-header-inner { padding: 14px 16px; }
  .service-user-name { max-width: 110px; }
  .service-notice-inner { padding: 6px 16px; }
  .panel { padding: 18px; border-radius: 14px; }
  .section-title { flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
  /* The «?» stays at the right of the first title row (30px high: the step badge) while the rest wraps. */
  .section-title:has(> .help) { position: relative; padding-right: 34px; }
  .section-title:has(> .help) > .help { position: absolute; right: 0; top: 2px; margin: 0; }
  h2 { font-size: 18px; }
  .text-button { font-size: 12.5px; padding: 6px 2px; }
  .two, .three { grid-template-columns: 1fr; }
  input, textarea, select { font-size: 16px; }
  .action { width: 100%; justify-content: space-between; }
  .entry-mode { font-size: 13px; padding: 10px 8px; }
  .cma-basis { margin-left: 0; }
  .cma-summary { padding: 16px; }
}

/* The cow in the corner: decorative, never in the way of clicks. */
.margin-cow { position: fixed; left: 12px; bottom: 12px; width: 120px; height: auto; z-index: 5; pointer-events: none; }
@media (max-width: 560px) { .margin-cow { width: 72px; left: 6px; bottom: 6px; } }
