:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #f59e0b;
  --accent-dark: #b45309;
  --primary: #1f4e78;
  --primary-hover: #163a5a;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --row-hover: #f8fafc;
  --row-selected: #fff7e6;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
.spacer { flex: 1; }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--primary); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; color: var(--accent); }
.brand-title { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 12px; opacity: .75; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar .muted { color: #cbd5e1; font-size: 13px; }
.topbar .btn { border-color: rgba(255,255,255,.35); }
.topbar .btn:not(.primary) { background: transparent; color: #fff; }
.topbar .btn:not(.primary):hover { background: rgba(255,255,255,.12); }
.topbar .btn.primary { background: var(--accent); border-color: var(--accent); color: #1e293b; }
.topbar .btn.primary:hover { background: #fbbf24; }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 4px; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: none; padding: 12px 16px; font-size: 14px; cursor: pointer; color: var(--muted);
  border-bottom: 3px solid transparent; font-weight: 600;
}
.tab.active { color: var(--primary); border-bottom-color: var(--accent); }
main { padding: 16px 24px 40px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px;
  cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--row-hover); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn[style*="--btn-accent"] { border-left: 4px solid var(--btn-accent); }

.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor;
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.problems {
  background: #fefce8; border: 1px solid #fde047; color: #713f12; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 12px; font-size: 13.5px;
}
.problems a { color: #a16207; margin-left: 6px; }

/* ---------- фильтры ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px;
  cursor: pointer; font-size: 13px; border-left: 4px solid var(--chip);
}
.chip b { margin-left: 4px; color: var(--muted); }
.chip.active { background: var(--chip); color: #fff; border-color: var(--chip); }
.chip.active b { color: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 320px; min-width: 220px; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--text);
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #93c5fd; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.check.block { display: flex; margin: 4px 0; }

.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px;
  background: #fff7e6; border: 1px solid #fde68a; border-radius: var(--radius);
}
#bulk-count { font-weight: 600; margin-right: 6px; }
#bulk-buttons { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- таблица ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--primary); }
th.sorted::after { content: " " attr(data-dir); }
#tenders-table tbody tr { cursor: pointer; }
#tenders-table tbody tr:hover { background: var(--row-hover); }
#tenders-table tbody tr.selected { background: var(--row-selected); }
#tenders-table tbody tr.dim { opacity: .55; }
.col-check, .col-star { width: 32px; padding-right: 0; }
.col-title { min-width: 320px; }
.col-title .title { font-weight: 600; line-height: 1.35; }
.col-customer { min-width: 160px; max-width: 260px; }
.sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sub b { color: #475569; font-weight: 600; }
.kw.off { background: #f1f5f9; color: var(--muted); }
.kw { display: inline-block; background: #fef3c7; color: var(--accent-dark); border-radius: 4px; padding: 0 5px; margin-left: 4px; font-size: 11px; }
.proc { font-size: 12.5px; color: #94a3b8; margin-top: 2px; }
.context { font-size: 12px; color: var(--accent-dark); margin-top: 3px; font-style: italic; }
.open-link {
  display: inline-block; margin-top: 6px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--primary); background: var(--panel);
}
.open-link:hover { background: #eff6ff; border-color: #93c5fd; }
.comment-preview { font-size: 12px; color: #475569; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2563eb; margin-right: 6px; vertical-align: middle; }
.star { border: 0; background: none; font-size: 18px; color: #cbd5e1; cursor: pointer; padding: 0; line-height: 1; }
.star.on { color: var(--accent); }
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--badge); background: color-mix(in srgb, var(--badge) 12%, white);
}
.dl-over { color: var(--muted); text-decoration: line-through; }
.dl-urgent { color: var(--danger); font-weight: 600; }
.dl-soon { color: var(--warn); font-weight: 600; }
.dl-ok { color: var(--ok); }
.dl-none { color: var(--muted); }
.empty { padding: 48px; text-align: center; color: var(--muted); font-size: 15px; }

/* ---------- карточка тендера ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .3); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--panel); z-index: 21;
  box-shadow: -8px 0 30px rgba(0,0,0,.15); overflow-y: auto; padding: 8px 24px 32px;
}
.drawer-head { display: flex; justify-content: flex-end; }
.drawer-title { font-size: 18px; font-weight: 700; line-height: 1.35; margin-bottom: 12px; }
.status-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.status-btn {
  border: 1px solid var(--st); color: var(--st); background: var(--panel); border-radius: 8px; padding: 7px 12px;
  cursor: pointer; font-weight: 600; font-size: 13px;
}
.status-btn.active { background: var(--st); color: #fff; }
.fields { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 18px 0; }
.f-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin: 14px 0 6px; display: block; }
.fields .f-label { margin: 0; padding-top: 2px; }
.f-value { word-break: break-word; }
.description { white-space: pre-wrap; background: #f8fafc; padding: 12px; border-radius: 8px; max-height: 300px; overflow-y: auto; font-size: 13px; }
.history { padding-left: 18px; margin: 0 0 16px; font-size: 13px; }
.history li { margin: 3px 0; }

/* ---------- журнал ---------- */
.source-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.source-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 12px; }
.source-card.ok { border-left-color: var(--ok); }
.source-card.fail { border-left-color: var(--danger); }
.source-card.warn { border-left-color: #eab308; background: #fefce8; }
.source-card.retry { border-left-color: #eab308; }
.source-card.outage { border-left-color: #94a3b8; background: #f8fafc; }
#runs-table tr.outage td:first-child { border-left: 3px solid #94a3b8; }
.pg-outage { color: #cbd5e1; }
#runs-table tr.retry td:first-child { border-left: 3px solid #eab308; }
.warn-text { color: #a16207; font-size: 12px; }
.small-note { font-size: 11.5px; margin-top: 2px; }
#runs-table tr.warn td:first-child { border-left: 3px solid #eab308; }
.source-name { font-weight: 700; margin-bottom: 4px; }
.err { color: var(--danger); font-size: 12px; word-break: break-word; }
#runs-table tr.fail td:first-child { border-left: 3px solid var(--danger); }
#runs-table tr.interrupted td { color: #94a3b8; }
#runs-table tr.interrupted td:first-child { border-left: 3px solid #cbd5e1; }

/* ---------- настройки ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card h3:not(:first-child) { margin-top: 18px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; line-height: 1.45; }
input.short { width: 80px; }
.row-inline { display: flex; gap: 8px; }
.row-inline input { flex: 1; min-width: 0; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.settings-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; }
.test-result { margin-top: 8px; font-size: 13px; }
.explain { padding-left: 4px; list-style: none; margin: 6px 0 0; }
.explain li { margin: 6px 0; }
.explain .frag { color: var(--muted); font-size: 12px; font-style: italic; }

/* ---------- диалог ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, 95vw); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .4); }
dialog form { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
dialog h3 { margin: 0; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
dialog .row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- уведомления ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff;
  padding: 10px 18px; border-radius: 8px; z-index: 50; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 90vw;
}
.toast.error { background: var(--danger); }

/* ---------- быстрый разбор ---------- */
#tenders-table tbody tr.current { background: #eef2ff; box-shadow: inset 4px 0 0 var(--primary); }
.drawer { display: flex; flex-direction: column; padding-bottom: 0; }
#drawer-body { flex: 1; }
.drawer-nav { font-size: 12px; margin-bottom: 4px; }
.drawer-hint {
  position: sticky; bottom: 0; margin: 16px -24px 0; padding: 8px 24px; background: #f8fafc;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.9;
}
kbd {
  display: inline-block; min-width: 18px; padding: 0 4px; border: 1px solid #cbd5e1; border-bottom-width: 2px;
  border-radius: 4px; background: #fff; font: 600 11px/16px inherit; font-family: inherit; text-align: center; color: var(--text);
}
.status-btn .key { font-size: 11px; opacity: .6; margin-right: 2px; }
table.positions { font-size: 13px; }
table.positions tr.pos-match { background: #fef3c7; font-weight: 600; }
table.positions th, table.positions td { padding: 6px 8px; }
#collect-info { display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: 560px; }
.pg { white-space: nowrap; }
.pg-running { color: #fde68a; font-weight: 600; }
.pg-done { color: #bbf7d0; }
.pg-error { color: #fecaca; font-weight: 600; }
.pw-row { margin: 8px 0 12px; }
.pw-row .row-inline { margin-top: 4px; }

/* ---------- телефон: карточки вместо таблицы ---------- */
.m-cards { display: none; }
.m-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 10px; cursor: pointer;
}
.m-card.dim { opacity: .55; }
.m-top { display: flex; justify-content: space-between; align-items: center; }
.m-title { font-weight: 600; margin: 8px 0 6px; line-height: 1.35; word-break: break-word; }
.m-row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.m-price { font-weight: 700; }
.m-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 720px) {
  .topbar, main { padding-left: 12px; padding-right: 12px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .fields { grid-template-columns: 1fr; }
  .table-wrap:has(#tenders-table) { display: none; }
  .m-cards { display: block; }
  .filters > * { flex: 1 1 100%; }
  .filters .spacer { display: none; }
  .drawer { padding: 8px 14px 0; }
  .drawer-hint { display: none; }  /* на телефоне клавиатуры нет */
  #collect-info { max-width: none; }
  .brand-sub { display: none; }
}

/* ---------- параметры станции и счёт ---------- */
.auto { display: inline-block; font-size: 10px; font-weight: 600; color: #7c3aed; background: #f3e8ff;
        border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.col-kw { font-variant-numeric: tabular-nums; }
#tenders-table tbody tr.fund-urgent { background: #fef2f2; box-shadow: inset 4px 0 0 var(--danger); }
.m-card.fund-urgent { border-color: #fecaca; background: #fef2f2; }
.m-params { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12.5px; margin-top: 6px; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; margin: 4px 0 8px; padding: 10px 12px;
          background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); }
.params .f-label { margin-top: 6px; }
.params input[type=number] { width: 120px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 5px 10px;
           font-size: 13px; cursor: pointer; }
.seg-btn:hover { border-color: #94a3b8; }
.seg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-btn.suggest { border: 1px dashed #7c3aed; color: #5b21b6; }
.seg-btn.warn.active { background: var(--danger); border-color: var(--danger); }
.seg-btn.clear { color: var(--muted); padding: 5px 8px; }
.fund-date { margin-top: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.fund-date input { flex: 0 1 auto; }
@media (max-width: 720px) { .params { grid-template-columns: 1fr; } }

.role-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
              background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.role-badge.light { background: #eef2ff; color: var(--primary); border-color: #c7d2fe; align-self: center; }

/* таблица с параметрами станции: помещается в 1366–1440 px */
#tenders-table th, #tenders-table td { padding: 9px 8px; }
#tenders-table .col-title { min-width: 260px; }
#tenders-table .col-customer { min-width: 130px; max-width: 190px; font-size: 13px; }
.title-status { margin-bottom: 4px; }
#tenders-table .col-dl { min-width: 118px; }
#tenders-table .col-fund { min-width: 100px; white-space: nowrap; }
#tenders-table .col-fund .sub { white-space: normal; }
#tenders-table .comment-preview { max-width: 360px; }

/* три даты в колонке «Сроки» */
.dl-line + .dl-line { margin-top: 5px; padding-top: 4px; border-top: 1px dashed var(--line); }
.dl-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.dl-line.fund .dl-label { color: var(--danger); }
.link-btn { border: 0; background: none; color: var(--primary); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.dl-line.overdue .dl-label, .dl-line.overdue .nowrap { color: var(--danger); font-weight: 700; }

/* Этап «Не участвуем»: причина для директора */
.decline-line { font-size: 12.5px; color: #334155; margin-top: 4px; font-weight: 600; }
.decline-line::before { content: "🚫 "; }
.decline-box { margin: 12px 0; padding: 10px 12px; background: #f1f5f9; border-left: 4px solid #64748b; border-radius: 8px;
  font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.decline-box .reason { white-space: pre-wrap; word-break: break-word; }
.decline-box .btn { margin-left: auto; }
#decline-dialog textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }

/* ================= тендерная площадка ================= */
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link { color: #e2e8f0; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.nav-link:hover { background: rgba(255,255,255,.12); }
.nav-link.active { background: rgba(255,255,255,.18); color: #fff; }
.page { max-width: 1180px; margin: 0 auto; padding: 16px 20px 48px; }
.page-title { font-size: 20px; font-weight: 700; margin: 4px 0 2px; line-height: 1.3; word-break: break-word; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card h2 { font-size: 16px; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card h2 .count { background: var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 600; }
.notfilled { color: #94a3b8; font-style: italic; }
.clarify { color: var(--warn); font-weight: 600; }
.ro-note { background: #f1f5f9; border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 13px; }
.soon { opacity: .55; }

/* поля «название: значение» */
.kv { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 8px 16px; font-size: 14px; }
.kv > .k { color: var(--muted); }
.kv > .v { word-break: break-word; white-space: pre-wrap; }
@media (max-width: 720px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv > .v { margin-bottom: 8px; } }

/* поля карточки по ТЗ */
.tfield { border-top: 1px solid var(--line); padding: 10px 0; display: grid; grid-template-columns: 230px 1fr; gap: 10px; }
.tfield:first-of-type { border-top: 0; }
.tfield .name { font-weight: 600; }
.tfield textarea { width: 100%; min-height: 38px; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.tfield select { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); }
.tfield .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 720px) { .tfield { grid-template-columns: 1fr; gap: 4px; } }

/* документы */
.drop { border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); background: #f8fafc; }
.drop.over { border-color: var(--primary); background: #eef2ff; }
.doc { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.doc:first-child { border-top: 0; }
.doc .name { font-weight: 600; word-break: break-word; }
.doc .info { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.doc .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.doc.old { opacity: .65; padding-left: 16px; }
.doc.child { padding-left: 18px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 8px; background: #f1f5f9; color: #475569; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.info { background: #e0e7ff; color: #3730a3; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress > div { height: 100%; background: var(--primary); width: 0; transition: width .2s; }
@media (max-width: 720px) { .doc { grid-template-columns: 1fr; } .doc .acts { justify-content: flex-start; } }

/* ИИ-отчёт */
.verdict { border-radius: var(--radius); padding: 14px 16px; border: 1px solid; }
.verdict .v { font-size: 20px; font-weight: 800; }
.verdict.go { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.verdict.ask { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.verdict.stop { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.fit-status { font-weight: 700; white-space: nowrap; }
.fit-status.yes { color: var(--ok); } .fit-status.no { color: var(--danger); } .fit-status.unk { color: var(--warn); }
.kind { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.kind.direct { background: #e0f2fe; color: #075985; }
.kind.assumption { background: #f3e8ff; color: #6b21a8; }
.src { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; border-radius: 6px; padding: 1px 7px; margin: 2px 4px 2px 0;
  border: 1px solid; cursor: pointer; background: #fff; white-space: nowrap; font-family: inherit; }
.src.ok { border-color: #86efac; color: #166534; }
.src.approx { border-color: #fcd34d; color: #92400e; background: #fffbeb; }
.src.not_found { border-color: #fca5a5; color: #991b1b; background: #fef2f2; }
.report-table { font-size: 13.5px; }
.report-table td { vertical-align: top; }
.report-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.report-list li { line-height: 1.45; }
@media (max-width: 720px) {
  .report-table thead { display: none; }
  .report-table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .report-table td { display: block; border: 0; padding: 3px 4px; }
  .report-table td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }
}

/* окно источника */
dialog.wide { width: min(920px, 96vw); }
.viewer { padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; max-height: 86vh; }
.viewer pre { white-space: pre-wrap; word-break: break-word; font: 13.5px/1.55 inherit; font-family: inherit; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; margin: 0; flex: 1; min-height: 200px; }
.viewer mark { background: #fde047; padding: 0 1px; }
.viewer mark.soft { background: #fef08a; }

/* профиль */
.ent-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.prof-table td, .prof-table th { font-size: 13px; }
.prof-table tr.click { cursor: pointer; }
.prof-table tr.click:hover { background: var(--row-hover); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
.form-grid .checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.form-grid .checks label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
dialog.form { width: min(760px, 96vw); }
dialog.form form { max-height: 88vh; overflow: auto; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.warn-box { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; }
.bad-box { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; }
.ok-box { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; border-radius: var(--radius); padding: 10px 14px; font-size: 13.5px; }

/* список тендеров: метки площадки */
.dir-tag { display: inline-block; font-size: 11px; background: #ecfeff; color: #155e75; border-radius: 4px; padding: 0 5px; margin: 2px 4px 0 0; }
.dir-tag.auto { background: #f1f5f9; color: #64748b; }
.plat-line { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 720px) { .tabs { overflow-x: auto; white-space: nowrap; padding: 0 12px; } .tab { flex: 0 0 auto; padding: 12px 10px; } }

.auto.ai { color: #92400e; background: #fef3c7; }

/* загрузка документов: большая зона, файлы можно бросить в любое место карточки */
.drop.big { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; cursor: pointer;
  border-width: 3px; min-height: 190px; justify-content: center; }
.drop.big:hover { border-color: var(--primary); background: #f1f5ff; }
.drop-title { font-size: 20px; font-weight: 700; color: var(--text); }
.drop-or { color: var(--muted); }
body.dragging .drop.big { border-color: var(--primary); background: #eef2ff; box-shadow: 0 0 0 4px #c7d2fe; }
.lot-files { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
@media (max-width: 720px) { .drop.big { min-height: 150px; padding: 24px 12px; } .drop-title { font-size: 17px; } .drop.big .btn { padding: 12px 22px; font-size: 16px; } }

.pill.no-docs { text-decoration: none; cursor: pointer; }
.pill.no-docs:hover { background: #fde68a; }

/* ================= единый интерфейс (шапка, главная) ================= */
.topbar { padding: 8px 20px; gap: 8px 18px; flex-wrap: wrap; }
.brand { text-decoration: none; color: #fff; gap: 8px; }
.brand .logo { font-size: 22px; }
.brand-title { font-size: 16px; }
.topbar .nav { flex: 1; }
.topbar .btn.small { padding: 5px 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar #f-search { flex: 1 1 320px; min-width: 180px; padding: 9px 12px; font: inherit; border: 1px solid var(--line); border-radius: 8px; }
.toolbar .small-note { font-size: 12.5px; }
#btn-filters b { margin-left: 2px; }
.filters-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.filters-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; align-items: end; }
.filters-grid label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.filters-grid select, .filters-grid input[type=number] { font: inherit; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; }
#filters-backdrop { display: none; }
tr.row-link { cursor: pointer; }
.title-link { color: inherit; text-decoration: none; font-weight: 600; }
.title-link:hover { text-decoration: underline; }
.open-icon { display: inline-block; margin-left: 4px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px;
  text-decoration: none; color: var(--primary); line-height: 18px; vertical-align: 1px; }
.open-icon:hover { background: #eef2ff; }
.col-stage { width: 1%; white-space: nowrap; }
#tenders-table .col-title .sub { margin-top: 2px; }
@media (max-width: 720px) {
  .topbar { padding: 8px 12px 0; display: grid; grid-template-columns: 1fr auto; }
  .topbar .nav { grid-column: 1 / -1; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; margin: 0 -12px; padding: 0 12px 6px; scrollbar-width: none; }
  .topbar .nav::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
  .nav-link { padding: 6px 9px; font-size: 13.5px; }
  .brand-title { font-size: 15px; }
  main { padding: 10px 12px 40px; }
  .toolbar #collect-info, .toolbar #btn-export { display: none; }
  .toolbar #f-search { flex-basis: 100%; order: -1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 10px; padding: 0 12px; scrollbar-width: none; }
  .chip { flex: 0 0 auto; }
  .filters-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); z-index: 60; margin: 0; border-radius: 0;
    overflow: auto; box-shadow: -8px 0 24px rgba(0, 0, 0, .15); }
  .filters-panel.hidden { display: none !important; }
  #filters-backdrop:not(.hidden) { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 55; }
  .filters-grid { grid-template-columns: 1fr; }
  .m-card .m-title .title-link { font-weight: 700; }
}

/* ================= карточка тендера ================= */
.card-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
#t-nav { display: flex; align-items: center; gap: 6px; }
.page-title .proc { font-size: 13px; font-weight: 400; color: #94a3b8; margin-top: 2px; }
.star-btn { color: var(--muted); }
.star-btn.on { color: var(--accent-dark); font-weight: 600; }
.next-step { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: var(--radius); padding: 12px 16px; margin: 6px 0 12px; }
.next-step.done { background: #f0fdf4; border-color: #bbf7d0; }
.ns-steps { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-bottom: 6px; }
.ns-steps span { padding: 1px 8px; border-radius: 999px; background: #fff; color: var(--muted); border: 1px solid var(--line); }
.ns-steps span.past { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.ns-steps span.now { color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600; }
.ns-title { font-size: 17px; font-weight: 700; }
.ns-body { margin-top: 2px; color: #334155; }
.ns-action { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ns-action #upload-list { flex-basis: 100%; }
.ns-drop { display: flex; align-items: center; gap: 8px; padding: 14px 16px; cursor: pointer; flex: 1 1 320px; justify-content: center; }
body.dragging .ns-drop { border-color: var(--primary); background: #eef2ff; box-shadow: 0 0 0 4px #c7d2fe; }
.card-tabs { padding: 0; background: none; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tfield.view .val .row-top { display: flex; align-items: flex-start; gap: 8px; }
.tfield.view .val .v { white-space: pre-wrap; word-break: break-word; flex: 1; }
.tfield.view .val .notfilled { flex: 1; }
.pencil { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; padding: 0 4px; border-radius: 6px; }
.pencil:hover { color: var(--primary); background: #eef2ff; }
.wide-input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.btn.warn-on { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
details.card > summary { cursor: pointer; list-style: revert; }
#tab-main input[type=datetime-local], #tab-main input[type=number] { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 720px) { .ns-title { font-size: 16px; } .next-step { padding: 10px 12px; } .card-nav { font-size: 13px; } }
#tab-main .kv > .v { white-space: normal; }
#tab-main .row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
#tab-main .row-inline input { width: auto; flex: 0 0 auto; }

/* Поле даты ДД.ММ.ГГГГ ЧЧ:ММ (см. enhanceDateInput в common.js) */
.dt { position: relative; display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.dt .dt-text { width: 150px; font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-variant-numeric: tabular-nums; }
.dt .dt-text[maxlength="10"] { width: 110px; }
.dt .dt-text.invalid { border-color: #dc2626; outline-color: #fca5a5; }
.dt .dt-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 4px 7px; cursor: pointer; line-height: 1; }
.dt .dt-btn:hover { background: #f3f4f6; }
.dt .dt-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
label > .dt { display: flex; margin-top: 4px; }
label > .dt .dt-text { flex: 1; width: auto; }

/* Состав закупки: блок под «Что дальше», строка позиций в списке */
.positions-card { margin-bottom: 12px; }
.positions-card h2 { margin-bottom: 8px; }
.pos-cards { display: none; }
.pos-item { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.pos-item.pos-match { background: #fef3c7; }
.pos-item .pos-name { font-size: 14px; }
.pos-item.pos-match .pos-name { font-weight: 600; }
.pos-item .pos-qty { font-size: 13px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .pos-table { display: none; } .pos-cards { display: block; } }
.pos-line { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 640px; }
.pos-line .pos-solar { color: #92400e; }
@media (max-width: 720px) { .pos-line { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } }

/* Страница «Отправить в программу» (send.html) */
ol.howto { margin: 6px 0 12px; padding-left: 20px; line-height: 1.6; }
ol.howto li { margin-bottom: 6px; }
.bookmarklet { cursor: grab; margin: 4px 0; }
#receive .ok { color: #15803d; } #receive .bad { color: #b91c1c; } #receive .same { color: #64748b; }
