/* Кабинет (app.html) и страницы документов (/docs/*) «39.18 Монитор».
   Тот же язык, что у главной (landing.css): шрифт Golos Text, холодная
   бумага и чернила, белые «листы» с тонкой рамкой вместо карточек с тенями,
   этапы участка — линия с точками, как процедура на главной.
   Цвета этапов: синий квартала — ждёт извещения, янтарный — ждёт аукциона,
   зелёный — аукцион найден. Красный — только линия процедуры и ошибки. */
@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f4f6f7;
  --sheet: #ffffff;
  --sheet-2: #eef1f3;
  --ink: #1c2633;
  --ink-2: #3d4957;
  --muted: #66727f;
  --faint: #8c97a2;
  --rule: #d5dce2;
  --rule-soft: #e4e9ed;
  --action: #2f6f4f;
  --action-hover: #255c40;
  --action-ink: #ffffff;
  --action-soft: #e3efe8;
  --boundary: #c4382e;
  --st-reg: #2e5b86;
  --st-reg-soft: #e4ecf4;
  --st-notice: #95580f;
  --st-notice-soft: #f8ecda;
  --st-auction: #25734a;
  --st-auction-soft: #e0f0e6;
  --danger: #b3342a;
  --danger-soft: #f9e6e4;
  --focus: #2f6f4f66;
  --font: "Golos Text", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121820;
    --sheet: #18202a;
    --sheet-2: #1e2732;
    --ink: #e6ebf0;
    --ink-2: #c1cad3;
    --muted: #93a0ad;
    --faint: #6d7a88;
    --rule: #2c3743;
    --rule-soft: #243039;
    --action: #6fbf94;
    --action-hover: #86cda6;
    --action-ink: #0d1d14;
    --action-soft: #1b2f24;
    --boundary: #ef7b70;
    --st-reg: #86b1dc;
    --st-reg-soft: #1c2a38;
    --st-notice: #e3a860;
    --st-notice-soft: #33261a;
    --st-auction: #7dcf9f;
    --st-auction-soft: #1b3125;
    --danger: #ef8f84;
    --danger-soft: #3a1c19;
    --focus: #6fbf9466;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15.5px/1.55 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--action); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); text-wrap: balance; }
p { margin: 0 0 12px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1.5px solid var(--rule); background: var(--sheet); color: var(--ink);
  font: 500 15px/1.2 var(--font); cursor: pointer; white-space: nowrap;
  text-decoration: none !important; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--action); border-color: var(--action); color: var(--action-ink); font-weight: 600; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--rule); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 16.5px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--muted); }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=tel], input[type=search], textarea, select {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 6px;
  border: 1.5px solid var(--rule); background: var(--sheet); color: var(--ink);
  font: 15.5px/1.4 var(--font);
}
textarea { min-height: 88px; resize: vertical; }
textarea.mono { font-size: 14px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--focus); }
.field.recognized input, .field.recognized textarea { border-color: var(--action); background: var(--action-soft); }
.tag-recognized { font-size: 12.5px; font-weight: 500; color: var(--action); margin-left: 8px; }

/* ---------- этапы участка: цвет + подпись ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 0 10px;
  border-radius: 4px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.registered { color: var(--st-reg); background: var(--st-reg-soft); }
.badge.demand_notice_found { color: var(--st-notice); background: var(--st-notice-soft); }
.badge.auction_found { color: var(--st-auction); background: var(--st-auction-soft); }
.badge.warn { color: var(--st-notice); background: var(--st-notice-soft); }
.badge.neutral { color: var(--muted); background: var(--sheet-2); }
.badge.neutral::before { display: none; }

/* ---------- листы (вместо карточек с тенью) ---------- */
.card { background: var(--sheet); border: 1px solid var(--rule); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--rule-soft); }
.card-head h2, .card-head h3 { font-size: 17px; font-weight: 600; }
.card-body { padding: 18px 24px; }

/* уведомления — полоса слева, как на главной */
.notice {
  display: flex; gap: 16px; align-items: center; padding: 14px 18px; margin-bottom: 20px;
  border-left: 3px solid var(--action); background: var(--action-soft);
}
.notice.warn { border-left-color: var(--st-notice); background: var(--st-notice-soft); }
.notice.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.notice .notice-body { flex: 1; }
.notice strong { display: block; margin-bottom: 2px; font-weight: 600; }
.notice .btn { flex: none; }

/* ---------- логотип ---------- */
.brand { display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink); text-decoration: none !important; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand b { color: var(--action); font-weight: 700; }

/* ================= КАБИНЕТ ================= */
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 22px 16px; background: var(--paper); border-right: 1px solid var(--rule);
}
.sidebar .brand { padding: 2px 10px 26px; }
.nav a {
  display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 0 10px 0 12px;
  border-left: 3px solid transparent; color: var(--ink-2); font-weight: 500; text-decoration: none !important;
}
.nav a svg { width: 19px; height: 19px; flex: none; color: var(--faint); }
.nav a:hover { color: var(--ink); }
.nav a.active { border-left-color: var(--action); color: var(--ink); font-weight: 600; background: var(--sheet); }
.nav a.active svg { color: var(--action); }
.nav .count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--st-notice); color: #fff; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 6px 0; border-top: 1px solid var(--rule); }
.sub-chip { font-size: 14px; line-height: 1.45; }
.sub-chip b { display: block; font-weight: 600; }
.sub-chip span { color: var(--muted); }
.sub-chip a { font-weight: 600; }
.user-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }

.main { min-width: 0; padding: 30px 40px 64px; }
.main-inner { max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* счётчики: одна строка крупных чисел, разделённых линиями */
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--sheet); border: 1px solid var(--rule); }
.stat { display: block; padding: 18px 22px 20px; color: var(--ink); text-decoration: none !important; border-left: 1px solid var(--rule-soft); background: none !important; }
.grid-4 .stat:first-child { border-left: 0; }
.stat:hover .stat-value { color: var(--action); }
.stat .stat-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.stat .stat-label i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.stat .stat-value { font-size: 40px; line-height: 1.1; font-weight: 700; margin-top: 8px; letter-spacing: -.03em; transition: color .12s; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 24px; border-top: 1px solid var(--rule-soft); }
.list li:first-child { border-top: none; }
.list .li-main { flex: 1; min-width: 0; }
.list .li-title { font-weight: 600; }
.list .li-meta { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.list .li-side { font-size: 13.5px; color: var(--muted); white-space: nowrap; text-align: right; }
.empty-line { padding: 22px 24px; color: var(--muted); font-size: 15px; }

.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; }
.dot.dot-notice { background: var(--st-notice); }
.dot.dot-auction { background: var(--st-auction); }

/* решение по предложенному совпадению */
.match-card { border-left: 3px solid var(--st-notice); background: var(--st-notice-soft); padding: 16px 20px; }
.match-card + .match-card { margin-top: 12px; }
.match-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.match-card .diffs { margin: 10px 0 14px; padding: 0; list-style: none; font-size: 14.5px; }
.match-card .diffs li { padding: 3px 0; }
.match-card .buttons { display: flex; gap: 10px; flex-wrap: wrap; }

/* таблица участков */
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.toolbar input[type=search] { max-width: 320px; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg button {
  border: 1.5px solid transparent; background: transparent; color: var(--ink-2); min-height: 34px; padding: 0 12px; border-radius: 6px;
  font: 500 14.5px var(--font); cursor: pointer; white-space: nowrap;
}
.seg button:hover { border-color: var(--rule); }
.seg button .n { color: var(--faint); margin-left: 5px; }
.seg button.on { border-color: var(--ink); color: var(--ink); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th {
  text-align: left; font-size: 13.5px; color: var(--muted); font-weight: 500;
  padding: 12px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap;
  background: var(--sheet); position: sticky; top: 0; cursor: pointer; user-select: none;
}
table.data th:hover { color: var(--ink); }
table.data th.num, table.data td.num { text-align: right; }
table.data th .arrow { color: var(--action); margin-left: 4px; }
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: var(--sheet-2); }
table.data tbody tr:last-child td { border-bottom: none; }
td .t-title { font-weight: 600; color: var(--ink); }
td .t-sub { font-size: 13.5px; color: var(--muted); }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--st-notice); margin-top: 4px; }
.flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.overdue { color: var(--danger); font-weight: 600; }

/* этапы участка — линия с точками, как процедура на главной */
.stepper { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; padding: 24px 24px 22px; }
.stepper::before { content: ""; position: absolute; left: 31px; right: 31px; top: 31px; border-top: 2px solid var(--rule); }
.step { position: relative; padding-top: 30px; }
.step .step-bar { position: absolute; left: 0; top: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); border: 3px solid var(--rule); z-index: 1; }
.step.done .step-bar { background: var(--boundary); border-color: var(--boundary); }
.step.current .step-bar { border-color: var(--boundary); }
.step .step-num { font-size: 14px; font-weight: 600; color: var(--faint); }
.step.done .step-num, .step.current .step-num { color: var(--boundary); }
.step .step-title { font-weight: 600; font-size: 16.5px; margin: 3px 0 4px; }
.step .step-text { font-size: 14.5px; color: var(--muted); }
.step .step-text a { font-weight: 600; }

dl.props { display: grid; grid-template-columns: 190px minmax(0, 1fr); margin: 0; }
dl.props dt, dl.props dd { padding: 11px 0; border-top: 1px solid var(--rule-soft); margin: 0; }
dl.props dt { color: var(--muted); font-size: 14.5px; }
dl.props dt:first-of-type, dl.props dd:first-of-type { border-top: none; }
dl.props dd pre { margin: 0; font: 14px/1.6 var(--font); white-space: pre-wrap; }
.empty-val { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }

.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--rule); }
.file-row .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-row svg { width: 22px; height: 22px; color: var(--action); flex: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; font-size: 15px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--boundary); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 20px; bottom: 2px; border-left: 2px solid var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline .tl-date { font-size: 13.5px; color: var(--muted); }

/* добавление участка */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  padding: 48px 24px; border: 2px dashed var(--st-reg); background: var(--sheet); cursor: pointer; transition: background .12s;
}
.dropzone:hover, .dropzone.over { background: var(--st-reg-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--st-reg); }
.dropzone .dz-title { font-weight: 600; font-size: 17px; }
.steps-mini { position: relative; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps-mini::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 16px; border-left: 2px solid var(--boundary); }
.steps-mini li { counter-increment: s; position: relative; padding: 0 0 16px 32px; font-size: 15px; color: var(--ink-2); }
.steps-mini li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); border: 3px solid var(--boundary); }

/* подписка */
.plan { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.plan .plan-status { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.meter { height: 6px; background: var(--rule-soft); overflow: hidden; margin-top: 14px; }
.meter > span { display: block; height: 100%; background: var(--action); }
.price { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.price small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 10px 0; border-top: 1px solid var(--rule-soft); font-size: 15px; }
.checks li:last-child { border-bottom: 1px solid var(--rule-soft); }

/* экраны «регистрация не завершена» / «подписка не активна» */
.gate { max-width: 580px; margin: 8vh auto; padding: 36px 36px 32px; }
.gate h1 { font-size: 26px; margin-bottom: 12px; letter-spacing: -.02em; }
.gate p { color: var(--ink-2); }
.gate .btn { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100% - 32px));
  background: var(--ink); color: var(--paper); padding: 13px 18px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 15px;
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--rule); border-top-color: var(--action); animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } .stat .stat-value { transition: none; } }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

.mobile-bar { display: none; }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-bar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 6px; overflow-x: auto;
    padding: 8px 12px; background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .mobile-bar .brand { margin-right: 6px; font-size: 16px; }
  .mobile-bar .nav { display: flex; gap: 2px; }
  .mobile-bar .nav a { min-height: 36px; padding: 0 10px; font-size: 14.5px; white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .mobile-bar .nav a.active { border-bottom-color: var(--action); background: none; }
  .mobile-bar .nav a svg { display: none; }
  .main { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 24px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 .stat:nth-child(3) { border-left: 0; }
  .grid-4 .stat:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
  .stat .stat-value { font-size: 32px; }
  .stepper { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .stepper::before { left: 31px; right: auto; top: 31px; bottom: 30px; border-top: 0; border-left: 2px solid var(--rule); }
  .step { padding: 0 0 0 30px; }
  dl.props { grid-template-columns: minmax(0, 1fr); }
  dl.props dt { border-top: 1px solid var(--rule-soft); padding-bottom: 0; }
  dl.props dd { border-top: none; padding-top: 2px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .plan { grid-template-columns: minmax(0, 1fr); }
  table.data .hide-sm { display: none; }
  .card-head, .list li, .card-body, .empty-line { padding-left: 18px; padding-right: 18px; }
}

/* ================= документы (/docs/*) ================= */
.doc-page { background: var(--paper); }
.doc-header { max-width: 860px; margin: 0 auto; padding: 22px 24px; }
.doc-header .brand-mark { color: var(--action); font-weight: 700; }
.doc-main { max-width: 860px; margin: 0 auto 60px; padding: 36px 40px; background: var(--sheet); border: 1px solid var(--rule); }
.doc-main h1 { font-size: 26px; margin-bottom: 20px; letter-spacing: -.02em; }
.doc-text { white-space: pre-wrap; font-size: 16px; line-height: 1.7; color: var(--ink-2); }
@media (max-width: 700px) { .doc-main { padding: 22px 18px; margin: 0 12px 40px; } }

/* поддержка (bot/support.py) */
.attach { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.attach .small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.list li.unread .li-title a { font-weight: 700; }
.thread { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; }
.msg { max-width: min(640px, 88%); padding: 12px 16px; background: var(--sheet-2); border: 1px solid var(--rule-soft); align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--action-soft); border-color: transparent; }
.msg-meta { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .file-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14.5px; overflow-wrap: anywhere; }
.msg .file-link svg { width: 16px; height: 16px; flex: none; }
