/* Рабочее место инженера — по утвержденному прототипу v3 (ТЗ 1.3) */
:root {
    --indigo: #363782; --indigo-700: #2b2c68; --orange: #d78d44; --orange-soft: #e7b07e;
    --ink: #01070c; --slate: #5b5f72; --line: #e6e7ef; --mist: #f5f6fa; --paper: #fff;
    --green: #1e9e6a; --red: #c94f4f;
    --grad-hero: linear-gradient(135deg, #2b2c68 0%, #363782 55%, #4a4ba0 100%);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif; background: var(--mist); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--indigo); }
[hidden] { display: none !important; }

/* Шапка */
.topbar { background: var(--grad-hero); color: #fff; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.topbar .brand { font-weight: 800; letter-spacing: .06em; color: #fff; text-decoration: none; }
.topbar .brand small { display: block; font-weight: 600; font-size: 11px; color: var(--orange-soft); letter-spacing: .14em; text-transform: uppercase; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; }
.topbar .user form { margin: 0; }
.topbar .btn.light { border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: #fff; }

.wrap { max-width: 1260px; margin: 22px auto 60px; padding: 0 20px; }
.layout { display: flex; gap: 16px; align-items: flex-start; }
.side { width: 262px; flex: none; position: sticky; top: 16px; }
.side .card { padding: 15px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); margin-bottom: 0; }
.side-h, .side .f, .side .card > .lot, .side .anon-note { flex: none; }
/* Список лотов прокручивается внутри колонки, шапка, поиск и «Настройки» остаются на месте */
.side-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px 7px; padding: 0 6px; position: relative; }
.side-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; gap: 8px; }
.side-h h2 { margin: 0; font-size: 13px; }
.lot { display: block; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 7px; background: #fff; color: inherit; text-decoration: none; }
.lot:hover { border-color: var(--indigo); }
.lot.on { border-color: var(--indigo); background: #f3f3fb; }
.lot .n { font-size: 10.5px; font-weight: 700; color: var(--slate); letter-spacing: .05em; }
.lot .t { font-size: 12.5px; font-weight: 700; margin: 3px 0 6px; line-height: 1.3; }
.lot .r { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.lot .d { font-size: 10.5px; color: var(--slate); white-space: nowrap; }
.main { flex: 1; min-width: 0; }
@media (max-width: 980px) { .layout { flex-direction: column; } .side { width: 100%; position: static; } .side .card { max-height: none; } .side-list { max-height: 50vh; } }

/* Карточки и заголовки */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(54,55,130,.05); }
h1 { font-size: 20px; font-weight: 800; color: var(--indigo); margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 800; color: var(--indigo); margin: 0 0 12px; }
h3 { font-size: 12.5px; font-weight: 800; color: var(--indigo); margin: 0 0 8px; letter-spacing: .02em; }
.sub { color: var(--slate); font-size: 13px; margin: 0; line-height: 1.5; }
.lot-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.lot-head > div:first-child { flex: 1; min-width: 0; }
.lot-head > .chip { flex: none; margin-top: 4px; }
@media (max-width: 640px) { .lot-head { flex-wrap: wrap; } }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Метки статусов */
.chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-radius: 30px; padding: 4px 12px; white-space: nowrap; }
.chip.open { background: #e2f5ec; color: var(--green); }
.chip.round { background: #fdece0; color: var(--orange); }
.chip.final { background: #ecebf7; color: var(--indigo); }
.chip.out { background: #fbe9e9; color: var(--red); }
.chip.none { background: var(--mist); color: var(--slate); }
.vat { font-size: 10.5px; font-weight: 800; border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.vat.y { background: #ecebf7; color: var(--indigo); }
.vat.n { background: #fdece0; color: var(--orange); }

/* Формы */
label { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--slate); margin: 0 0 5px; }
input, textarea, select { width: 100%; font: inherit; font-size: 13.5px; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--indigo); }
input:disabled, select:disabled, textarea:disabled { background: var(--mist); color: var(--slate); }
.f { margin-bottom: 13px; }
.hint { font-size: 11px; color: var(--slate); margin-top: 4px; line-height: 1.4; text-transform: none; letter-spacing: 0; font-weight: 400; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 980px) { .grid, .grid3 { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); margin: 0; }
.chk input { width: 16px; height: 16px; padding: 0; flex: none; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; max-height: 210px; overflow-y: auto; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; }

.file { display: block; border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px 12px; text-align: center; color: var(--slate); font-size: 12.5px; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
.file b { color: var(--indigo); }
.file.drag, .file:hover { border-color: var(--indigo); background: #f7f7fc; }
.files { list-style: none; margin: 0 0 12px; padding: 0; }
.files li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.files li:last-child { border-bottom: none; }
.files .nm { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.files .sz { color: var(--slate); font-size: 11.5px; white-space: nowrap; }

/* Кнопки */
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn { display: inline-block; font: inherit; font-weight: 800; font-size: 13.5px; border-radius: 40px; padding: 11px 22px; cursor: pointer; border: none; text-decoration: none; text-align: center; }
.btn.pri { background: var(--indigo); color: #fff; }
.btn.fin { background: var(--orange); color: #fff; }
.btn.ghost { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn.sec { background: transparent; color: var(--indigo); border: 1.5px solid var(--indigo); }
.btn.sm { padding: 7px 15px; font-size: 12px; }
.btn.xs { padding: 5px 12px; font-size: 11px; border-radius: 30px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

/* Параметры торгов */
.stage-filter { margin: 10px 0 16px; }
.stage-filter summary { cursor: pointer; font-size: 12px; font-weight: 700; }
.stage-filter .chk { display: flex; gap: 8px; margin: 9px 0; font-size: 12px; }
.stage-filter .btns { gap: 6px; margin-top: 10px; }
.setgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 12px; }
.setbox { background: var(--mist); border-radius: 10px; padding: 11px 13px; }
.setbox .v { font-size: 14px; font-weight: 800; color: var(--ink); }
.setbox.lock { background: #f3f3fb; border: 1px solid #dcdcee; }

/* Показатели */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { flex: 1; min-width: 120px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 800; color: var(--indigo); }
.stat .n.o { color: var(--orange); } .stat .n.g { color: var(--green); } .stat .n.r { color: var(--red); }
.stat .k { font-size: 11px; color: var(--slate); font-weight: 600; margin-top: 2px; line-height: 1.3; }

/* Вкладки */
.subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.subtab { padding: 9px 15px; font-size: 12.5px; font-weight: 700; color: var(--slate); cursor: pointer; border: none; border-bottom: 3px solid transparent; background: none; font-family: inherit; }
.subtab.on { color: var(--indigo); border-bottom-color: var(--indigo); }

/* Таблицы */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { background: var(--indigo); color: #fff; text-align: left; padding: 9px 10px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; white-space: nowrap; }
table.t th.base { background: #2b2c68; border-bottom: 3px solid var(--orange); }
table.t th.wrap { white-space: normal; line-height: 1.3; }
table.t td .hint { display: block; margin-top: 2px; }
table.t th.r, table.t td.r { text-align: right; }
table.t th.c, table.t td.c { text-align: center; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.base { background: #f7f7fc; }
table.t tr.win td { background: #e9f7f1; }
table.t tr.dim td { color: var(--slate); }
table.t tr.own-comparison td { background: #f0f0fb; border-bottom: 2px solid #c7c7e5; vertical-align: top; }
.own-comparison .co { white-space: nowrap; }
.own-label { display: block; margin: 3px 0; color: var(--slate); font-size: 10.5px; font-weight: 600; }
.own-money, .own-period { white-space: nowrap; }
.own-breakdown { display: grid; gap: 3px; margin-top: 7px; color: var(--slate); font-size: 11px; font-variant-numeric: tabular-nums; }
.own-terms { min-width: 160px; max-width: 300px; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.5; }
td .co { font-weight: 800; color: var(--indigo); }
td .old { color: var(--slate); text-decoration: line-through; font-size: 11px; display: block; }
td .now { font-weight: 800; font-variant-numeric: tabular-nums; }
td .ref { color: var(--slate); font-variant-numeric: tabular-nums; }
td .delta { font-size: 11px; color: var(--green); font-weight: 800; display: block; }
.mk { display: inline-flex; width: 19px; height: 19px; border-radius: 50%; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.mk.y { background: var(--green); }
.mk.n { background: #d9dbe6; color: var(--slate); }

/* Журнал */
.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li { padding: 9px 0 9px 16px; border-bottom: 1px solid var(--line); position: relative; line-height: 1.5; }
.timeline li:last-child { border-bottom: none; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.timeline li.ok::before { background: var(--green); }
.timeline li.err::before { background: var(--red); }
.timeline li.night::before { background: var(--slate); }
.timeline .tm { color: var(--slate); font-size: 11.5px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.timeline b { color: var(--indigo); }

/* Сообщения */
.f [aria-invalid="true"] { border-color: var(--red); }
.hint.err { color: var(--red); }
.banner { border-radius: 11px; padding: 13px 16px; font-size: 12.5px; line-height: 1.5; margin-bottom: 14px; border-left: 4px solid; }
.banner.ok { background: #e9f7f1; border-color: var(--green); color: #16694a; }
.banner.warn { background: #fbe9e9; border-color: var(--red); color: #8d3232; }
.banner.info { background: #fdf6ef; border-color: var(--orange); color: #7a5121; }
.banner b { display: block; margin-bottom: 3px; font-size: 13px; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.empty { border: 1.5px dashed var(--line); border-radius: 12px; padding: 30px 20px; text-align: center; color: var(--slate); font-size: 13px; line-height: 1.6; background: #fff; }
.empty b { display: block; color: var(--indigo); font-size: 14px; }
.anon-note { font-size: 11.5px; color: var(--slate); margin-top: 10px; line-height: 1.5; }
.muted { color: var(--slate); }

/* Модальные окна */
.overlay { position: fixed; inset: 0; background: rgba(1,7,12,.45); display: none; align-items: flex-start; justify-content: center; padding: 36px 16px; overflow: auto; z-index: 50; }
.overlay.show { display: flex; }
.modal { background: #fff; border-radius: 14px; max-width: 760px; width: 100%; padding: 24px 26px; box-shadow: 0 12px 48px rgba(1,7,12,.25); }
.modal h2 { margin-bottom: 4px; }
.modal .sub { margin-bottom: 16px; }

/* Шаблоны писем */
.tpl { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.tpl:last-child { border-bottom: none; }
.tpl .n { font-weight: 700; }
.tpl .w { font-size: 11.5px; color: var(--slate); display: block; margin-top: 2px; }

.search-row { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.search-row .co { flex: 1; }
.search-row input { width: 230px; padding: 6px 9px; }

.file.over { border-color: var(--red); color: var(--red); }

/* Ссылка-действие из прототипа: «отозвать», «документы (N)» */
.expand { font: inherit; font-size: 11.5px; color: var(--indigo); font-weight: 800; cursor: pointer; text-decoration: underline; white-space: nowrap; background: none; border: 0; padding: 0; }
details > summary.expand { list-style: none; }
details > summary.expand::-webkit-details-marker { display: none; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.acts form { margin: 0; }
