/* Дизайн-система: цвета (из логотипа — чёрный, золото, красный), ширины разделов, отступы, шрифт.
   Точки переключения (по содержимому): 600 — телефон, 800 — планшет, 1100 — каталог и панель рядом,
   1440 — большой экран, 1920 — широкий монитор. */
:root {
  --ink: #1c1814; --muted: #6a6158; --black: #0b0b0c; --surface: #ffffff; --page: #f6f3ee; --line: #e7e0d4; --line-soft: #eee8de;
  --gold: #b48a4c; --gold-dark: #8a6634; --gold-light: #d9bc84; --gold-soft: #f4ecdd; --red: #c8202a; --red-soft: #fbe9e8;
  --accent: var(--black); --accent-soft: var(--gold-soft); --warning: #a8262d; --success: #2f6b3a; --success-soft: #e6f1e6;
  --shadow: 0 1px 2px rgba(28, 24, 20, .05), 0 10px 28px -18px rgba(28, 24, 20, .35);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "PT Serif", serif;
  --w-wide: 1760px;   /* лоты: каталог + панель */
  --w-work: 1440px;   /* подборки, инвесторы, сотрудники, синхронизация, журнал, кабинет инвестора */
  --w-form: 680px;    /* обычные формы */
  --w-text: 75ch;     /* длинный текст */
  --gutter: clamp(16px, 3vw, 56px);
  --gap: clamp(16px, 1.6vw, 32px);
  --radius: 12px;
  font-family: var(--font-sans); color: var(--ink); background: var(--page); font-size: 15px;
}
@media (min-width: 1440px) { :root { font-size: 16px; } }
@media (min-width: 1920px) { :root { font-size: 17px; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
[hidden] { display: none !important; }

/* Каркас */
header { position: relative; height: 76px; padding: 0 var(--gutter); background: var(--black); color: white; display: flex; align-items: center; justify-content: space-between; }
header::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold-dark) 15%, var(--gold-light) 50%, var(--gold-dark) 85%, transparent); }
.brand { display: block; line-height: 0; }
.brand img { height: 50px; width: auto; }
main { width: 100%; margin: clamp(20px, 3vw, 40px) 0; padding: 0 var(--gutter); }
#login { max-width: 440px; margin: clamp(24px, 6vh, 72px) auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 0 32px 32px; overflow: hidden; }
.login-logo { display: block; width: calc(100% + 64px); height: auto; max-height: 300px; object-fit: cover; margin: 0 -32px 18px; background: var(--black); }
#error { max-width: var(--w-wide); margin: 0 auto; }
/* Ширина рабочей области зависит от раздела; меню выравнивается по активному разделу. */
#workspace > div, #workspace > nav, #investorPortal { width: 100%; max-width: var(--w-work); margin-left: auto; margin-right: auto; }
#workspace[data-view="lotsView"] > nav, #workspace > #lotsView { max-width: var(--w-wide); }

/* Типографика */
h1 { font-family: var(--font-serif); font-weight: 700; font-size: clamp(1.9rem, 1.4rem + 1.1vw, 2.7rem); letter-spacing: -.5px; margin: .4rem 0 1rem; }
h1::after { content: ""; display: block; width: 56px; height: 3px; margin-top: .55rem; border-radius: 2px; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); }
h2 { font-family: var(--font-serif); font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { line-height: 1.6; color: var(--muted); }
.eyebrow { font-size: .72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-dark); font-weight: 600; }
.hint { font-size: .82rem; }
.warning, #error { color: var(--warning); }
a { color: var(--gold-dark); }
#count { color: var(--muted); font-weight: 400; }
.notice { background: var(--gold-soft); padding: 18px; border-left: 3px solid var(--gold); margin: 25px 0; }
.empty { padding: 45px 25px; border: 1px dashed var(--gold-light); border-radius: var(--radius); line-height: 1.6; color: var(--muted); background: rgba(255, 255, 255, .55); }

/* Элементы форм */
label { display: block; font-size: .875rem; margin-bottom: 16px; }
/* Размер текста в поле — как у основного текста, а не у подписи (label мельче). */
input, select { display: block; width: 100%; border: 1px solid #d8cfc0; border-radius: 8px; padding: .75rem; margin-top: 7px; font-family: inherit; font-size: 1rem; color: inherit; background: #fffdfa; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: var(--gold-light); }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180, 138, 76, .2); }
button { background: var(--black); color: #fff; border: 0; border-radius: 8px; font-weight: 600; transition: background .15s, color .15s, box-shadow .15s; box-shadow: 0 1px 0 rgba(0, 0, 0, .05); padding: .8rem 1.25rem; font-family: inherit; font-size: 1rem; cursor: pointer; min-height: 44px; }
button:where(:hover:not(:disabled)) { background: #2a241e; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.secondary { background: var(--gold-soft); color: var(--ink); box-shadow: inset 0 0 0 1px #e8dcc5; }
.secondary:hover:not(:disabled) { background: #ecdfc6; }
.danger { background: var(--red-soft); color: var(--warning); box-shadow: inset 0 0 0 1px #f2cfcd; }
.danger:hover:not(:disabled) { background: var(--red); color: #fff; }
/* Уменьшенная кнопка удаления карточки (в форме редактирования), справа от «Сохранить» и «Отмена» */
.danger-small { font-size: .75rem; line-height: 1.2; padding: .2rem .6rem; min-height: 0; margin-left: auto; align-self: center; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
/* Формы не растягиваются вместе с рабочей областью */
#investorForm, #staffForm, #collectionForm > .fields, .collection-content > form.fields, .confirm-delete, #lotForm { max-width: var(--w-form); }

/* Навигация */
nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: clamp(20px, 2.5vw, 36px); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
nav button { background: transparent; color: var(--ink); font-weight: 600; box-shadow: none; }
nav button:hover:not(:disabled) { background: var(--gold-soft); }
nav button[aria-current="page"] { background: var(--black); color: var(--gold-light); }
nav button:last-child { margin-left: auto; }

/* Панели */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: clamp(18px, 1.6vw, 28px); margin-bottom: 20px; min-width: 0; }

/* Лоты: каталог получает приоритет по ширине, панель черновика — справа и не шире 440 px */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 440px); gap: var(--gap); align-items: start; }
.layout > * { min-width: 0; }
.layout > .panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
#cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: var(--gap); align-items: start; }
#cards > .panel { margin-bottom: 0; }
#cards > .empty { grid-column: 1 / -1; }
.import-panel { background: linear-gradient(135deg, #15120f, #2a221a); color: #f3ead9; border: 1px solid #3a2f22; border-radius: 14px; padding: 22px 26px; margin: 24px 0; box-shadow: var(--shadow); }
.import-panel h2 { color: var(--gold-light); }
.import-panel p { color: #cbbfa9; }
.import-panel input { background: #fff; color: var(--ink); }
.import-panel button { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--black); }
.import-panel button:hover:not(:disabled) { background: var(--gold-light); }
.import-panel h2 { margin-top: 0; }
.import-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; max-width: 900px; }
.import-form label { margin: 0; }
.catalog-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 330px) auto; gap: 10px; align-items: end; margin: 6px 0 18px; max-width: 960px; }
.catalog-controls label { margin: 0; }
.catalog-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0 30px; }
.catalog-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.catalog-page { min-width: 44px; padding: .55rem .7rem; text-align: center; }
.catalog-page.current { background: var(--black); color: var(--gold-light); cursor: default; }
.catalog-gap { padding: 0 4px; color: var(--muted); }
.catalog-page-info { font-size: .87rem; color: var(--muted); }
.source-description { padding: 12px 14px; background: var(--page); border-radius: 7px; overflow-wrap: anywhere; white-space: pre-line; max-width: var(--w-text); }
.source-schedule { margin: 20px 0; color: var(--ink); }
.source-schedule summary { cursor: pointer; font-weight: bold; min-height: 32px; }
.source-schedule table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: .87rem; }
.source-schedule td { padding: 7px; border-bottom: 1px solid var(--line); }
.source-schedule td:nth-child(n+2) { text-align: right; }
dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; font-size: .93rem; }
dt { color: var(--muted); }
dd { font-weight: bold; margin: 0; overflow-wrap: anywhere; text-align: right; }
.edit-button { display: block; margin-top: 22px; }
.edit-form { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.price-correction { margin: 18px 0 8px; padding: 14px 16px 6px; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; background: var(--page); max-width: var(--w-form); }
.price-correction legend { font-weight: 700; padding: 0 6px; }
.price-correction .secondary { margin-bottom: 8px; }
.image-manager { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.image-edit { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.image-edit img { width: 100%; height: 105px; object-fit: cover; border-radius: 5px; }
.image-edit small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.image-edit button { padding: 8px; font-size: .8rem; }

/* Галерея: колонки зависят от ширины карточки (container query), а не окна */
.gallery { margin: 14px 0 18px; min-width: 0; container-type: inline-size; }
.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@container (max-width: 440px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 320px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } }
.photo-grid.collapsed .extra { display: none; }
.thumb { display: block; padding: 0; margin: 0; min-height: 0; background: var(--accent-soft); border: 1px solid var(--line-soft); border-radius: 7px; overflow: hidden; aspect-ratio: 4 / 3; cursor: zoom-in; min-width: 0; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-toggle { margin-top: 10px; padding: 9px 14px; font-size: .87rem; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10, 24, 22, .92); display: flex; align-items: center; justify-content: center; padding: 56px 64px; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .14); color: white; font-size: 28px; line-height: 1; padding: 10px 16px; }
.lightbox-close { top: 12px; right: 12px; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-counter { position: absolute; bottom: 8px; left: 0; right: 0; margin: 0; text-align: center; color: #d7e2dd; font-size: .87rem; }
body.lightbox-open { overflow: hidden; }

/* Подборки */
.choice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 14px 0 22px; max-height: 420px; overflow: auto; padding: 2px; }
.choice-list label { border: 1px solid var(--line-soft); border-radius: 7px; padding: 12px; margin: 0; display: flex; align-items: flex-start; gap: 8px; }
.choice-list input { display: inline; width: auto; min-height: 0; margin: 2px 0 0; flex: none; }
.collection-list { border: 1px solid var(--line); border-radius: var(--radius); background: white; overflow: hidden; margin-bottom: 20px; }
.collection-item + .collection-item { border-top: 1px solid var(--line); }
.collection-row { display: flex; align-items: center; gap: 14px; width: 100%; min-width: 0; padding: 16px 20px; background: white; color: var(--ink); border-radius: 0; text-align: left; }
.collection-row:hover { background: var(--page); }
.collection-item.open .collection-row { background: #f7efe0; }
.collection-summary { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.collection-title { font-weight: bold; font-size: 1.07rem; overflow-wrap: anywhere; }
.collection-meta { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.collection-row .collection-status { flex: none; }
.collection-arrow { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--gold-dark); border-bottom: 2px solid var(--gold-dark); transform: translateY(-3px) rotate(45deg); transition: transform .2s ease; }
.collection-item.open .collection-arrow { transform: translateY(2px) rotate(-135deg); }
.collection-body { padding: 4px 20px 22px; border-top: 1px solid var(--line-soft); animation: collection-open .2s ease; }
@keyframes collection-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .collection-body { animation: none; } .collection-arrow { transition: none; } }
.collection-lot { border-top: 1px solid var(--line-soft); padding-top: 18px; margin-top: 18px; }
/* Экономика лота в раскрытой подборке: поля в несколько колонок, но не шире 1100 px */
.collection-lot .fields { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-width: 1100px; }
.collection-lot p { max-width: var(--w-text); }
.collection-status { display: inline-block; padding: 5px 10px; border-radius: 20px; background: var(--gold-soft); color: var(--gold-dark); font-size: .78rem; font-weight: 600; }
.collection-status.sent { background: var(--success-soft); color: var(--success); }
.collection-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Инвесторы и сотрудники */
#investors { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: var(--gap); align-items: start; }
#investors > .panel { margin-bottom: 0; }
#investors > .empty { grid-column: 1 / -1; }
.credentials { margin-top: 18px; padding: 16px; background: #fff4cf; border: 1px solid #dec977; border-radius: 7px; max-width: var(--w-form); }
.credentials strong { display: block; margin: 5px 0; }

/* Синхронизация: показатели — плитками в несколько колонок */
#syncSummary { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 16px 0 0; font-size: 1rem; }
#syncSummary > div { background: var(--page); border: 1px solid var(--line-soft); border-left: 3px solid var(--gold); border-radius: 10px; padding: 12px 14px; min-width: 0; }
#syncSummary dt { font-size: .82rem; }
#syncSummary dd { text-align: left; margin-top: 4px; font-size: 1.05rem; }
#syncLog p, #syncRuns p { overflow-wrap: anywhere; margin: .45rem 0; }
.schedule-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; max-width: var(--w-form); }
.schedule-form label { margin: 0; }
.schedule-form select { min-width: 240px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 600; min-height: 44px; }
.switch input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--gold-dark); }
#syncScheduleState { margin-bottom: 0; }

/* Журнал изменений: строки-таблица; на телефоне — карточки */
.audit-list { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.audit-row { display: grid; grid-template-columns: 11rem 9rem minmax(0, 1fr) 6rem; gap: 16px; padding: 12px 20px; border-top: 1px solid #f1ece3; align-items: baseline; }
.audit-row:first-child { border-top: 0; }
.audit-head { background: var(--page); font-size: .8rem; color: var(--muted); font-weight: bold; }
.audit-row > * { min-width: 0; overflow-wrap: anywhere; }
.audit-time, .audit-entity { color: var(--muted); font-size: .87rem; }

.deposit-status .unpaid { color: var(--warning); }
.deposit-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.deposit-status .paid { color: var(--success); }
.deposit-status button { padding: .4rem .8rem; min-height: 0; font-size: .85rem; }
textarea { display: block; width: 100%; border: 1px solid #d8cfc0; border-radius: 8px; padding: .75rem; margin-top: 7px; font-family: inherit; font-size: 1rem; color: inherit; background: #fffdfa; resize: vertical; }
textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180, 138, 76, .2); }

/* Ноутбук: каталог и панель черновика друг под другом, когда каталогу не хватает места */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout > .panel { position: static; max-height: none; overflow: visible; }
  #lotForm { max-width: var(--w-form); }
}
/* Планшет */
@media (max-width: 800px) {
  header b span { display: none; }
  .fields { gap: 10px; }
  dl { font-size: .87rem; }
  .import-form, .catalog-controls { grid-template-columns: 1fr; }
  .source-schedule table { font-size: .75rem; }
  .audit-row { grid-template-columns: 9.5rem minmax(0, 1fr); }
  .audit-row .audit-action { grid-column: 1 / -1; }
  .audit-head { display: none; }
}
/* Телефон */
@media (max-width: 600px) {
  header { height: 60px; }
  .fields, .collection-lot .fields { grid-template-columns: 1fr; }
  input, select { font-size: max(16px, 1rem); }
  nav { gap: 8px; }
  nav button { padding: .65rem .9rem; flex: 1 1 auto; }
  nav button:last-child { margin-left: 0; }
  .lightbox { padding: 52px 8px 40px; }
  .lightbox-prev, .lightbox-next { top: auto; bottom: 4px; transform: none; }
  .collection-row { padding: 14px; gap: 10px; }
  .collection-row .collection-status { font-size: .73rem; padding: 4px 7px; }
  .collection-body { padding: 4px 14px 18px; }
  .audit-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 14px; }
  .choice-list { grid-template-columns: 1fr; max-height: 360px; }
}

/* Детали оформления */
#cards > .panel { transition: box-shadow .2s, transform .2s; }
#cards > .panel:hover { box-shadow: 0 1px 2px rgba(28, 24, 20, .06), 0 18px 40px -22px rgba(28, 24, 20, .45); }
#cards h2 { font-family: var(--font-sans); font-size: 1.2rem; line-height: 1.35; }
#cards .eyebrow { margin-top: 0; }
.thumb { transition: transform .2s, box-shadow .2s; }
.thumb:hover { box-shadow: 0 0 0 2px var(--gold-light); }
.collection-list, .audit-list { box-shadow: var(--shadow); }
.audit-head { background: var(--gold-soft); color: var(--gold-dark); }
.source-description { border-left: 3px solid var(--gold-light); }
.credentials { background: var(--gold-soft); border-color: var(--gold-light); }
@media (max-width: 600px) {
  header { height: 62px; }
  .brand img { height: 38px; }
  nav { padding: 4px; }
  #login { padding: 0 20px 24px; }
  .login-logo { width: calc(100% + 40px); margin: 0 -20px 14px; max-height: 220px; }
}
/* Ссылка без входа на отправленную подборку и привязка к инвестору */
.offer-link { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.offer-link h3 { margin-top: 0; }
.offer-link-url { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.attach-investor { margin-top: 18px; align-items: end; }
.offer-contact { margin-top: 18px; }
/* Подборка у инвестора и по ссылке: таблица по шаблону «Предложение». Широкая таблица прокручивается внутри рамки, страница — нет. */
.offer { overflow: hidden; }
.offer h2 { margin-top: 0; }
.offer-logo { display: block; width: clamp(120px, 22vw, 200px); height: auto; margin: 0 auto 18px; border-radius: 12px; }
.offer-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px 24px; margin: 0 0 20px; }
.offer-facts > div { min-width: 0; padding: 10px 14px; border-radius: 10px; background: var(--gold-soft); }
.offer-facts dt { font-size: .78rem; letter-spacing: .6px; text-transform: uppercase; }
.offer-facts dd { margin: 4px 0 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.offer-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-width: 100%; }
.offer-table-scroll:focus-visible { outline: 3px solid rgba(180, 138, 76, .4); }
.offer-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: .88rem; }
.offer-table th, .offer-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.offer-table thead th { position: sticky; top: 0; z-index: 1; background: var(--black); color: var(--gold-light); font-weight: 600; font-size: .78rem; line-height: 1.3; vertical-align: bottom; min-width: 72px; max-width: 150px; white-space: normal; }
.offer-table tbody tr:nth-child(even) td { background: #fcfaf6; }
.offer-table .money, .offer-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.offer-table td.money, .offer-table td.num { white-space: nowrap; }
.offer-table thead .money, .offer-table thead .num { text-align: right; }
.offer-table td.accent { color: var(--ink); font-weight: 600; }
.offer-table td.name { min-width: 140px; max-width: 220px; font-weight: 600; color: var(--ink); }
.offer-table td.wide { min-width: 220px; max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.offer-table tfoot th, .offer-table tfoot td { background: var(--gold-soft); color: var(--ink); font-weight: 700; border-top: 2px solid var(--gold); border-bottom: 0; }
.offer-table .paid { color: var(--success); font-weight: 600; }
.offer-table .unpaid { color: var(--warning); font-weight: 600; }
.offer-photo { position: relative; display: block; width: 120px; padding: 0; min-height: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--gold-soft); cursor: zoom-in; }
.offer-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.offer-photo-count { position: absolute; right: 4px; bottom: 4px; padding: 2px 6px; border-radius: 6px; background: rgba(11, 11, 12, .72); color: #fff; font-size: .72rem; }
.offer-description summary { cursor: pointer; color: var(--ink); line-height: 1.45; }
.offer-description[open] summary { margin-bottom: 8px; color: var(--gold-dark); }
.offer-description h4 { margin: 12px 0 6px; font-size: .75rem; letter-spacing: 1px; text-transform: uppercase; color: var(--gold-dark); }
.offer-description dl { margin: 0; }
/* Таблица подборки широкая: кабинет инвестора и страница по ссылке используют всю ширину экрана, как каталог лотов. */
#investorPortal, #offerView { max-width: var(--w-wide); }
#offerView { width: 100%; margin-left: auto; margin-right: auto; }
/* Финансирование и отчётность: сотрудникам — на всю ширину, как каталог */
#workspace[data-view="financeView"] > nav, #workspace[data-view="reportsView"] > nav, #workspace > #financeView, #workspace > #reportsView { max-width: var(--w-wide); }
/* Кабинет инвестора: разделы */
#investorPortal > nav { flex-wrap: wrap; }
.investor-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-right: auto; }
.investor-tabs button { background: transparent; color: var(--ink); box-shadow: none; }
.investor-tabs button[aria-current="page"] { background: var(--black); color: var(--gold-light); }
/* Согласование */
.approval { margin-top: 20px; }
.approval-panel { padding: 16px 18px; border: 1px solid var(--gold-light); border-radius: 12px; background: #fffdf8; }
.approval-panel h3 { margin-top: 0; }
.approval-list { display: grid; gap: 8px; margin: 12px 0; }
.approval-list label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.approval-list label input { grid-row: span 2; width: 18px; height: 18px; margin: 0; }
.approval-list label span { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.approval-list label small { color: var(--muted); }
.approval-total { color: var(--ink); font-weight: 600; }
.approval-confirm { margin-top: 14px; padding: 16px; border: 2px solid var(--gold); border-radius: 12px; background: var(--gold-soft); }
.approval-confirm h3 { margin-top: 0; }
.offer-table tbody tr.excluded td { opacity: .35; text-decoration: line-through; }
.collection-lot.excluded { opacity: .55; }
/* Статус финансирования */
.financing-status { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 0 0 18px; padding: 12px 16px; border-radius: 10px; border-left: 4px solid var(--gold); background: var(--gold-soft); }
.financing-status.funded { border-left-color: var(--success); background: var(--success-soft); }
.financing-status strong { color: var(--ink); }
.financing-status span { color: var(--muted); }
/* Отчёт */
.vehicle-status { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--page); color: var(--ink); white-space: nowrap; }
.vehicle-status.sold { background: var(--success-soft); color: var(--success); font-weight: 600; }
.vehicle-status.repair, .vehicle-status.for_sale { background: var(--gold-soft); }
.report-forms { margin-top: 22px; }
.report-form { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface); }
.report-form summary { cursor: pointer; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.report-form form { margin-top: 12px; }
/* Сотрудники: заблокированный */
.panel.blocked { border-left: 4px solid var(--warning); }
/* Отчётность: сорванные торги и итоговый расчёт */
.failed-section, .settlement { margin-top: 26px; }
.failed-section h3, .settlement h3 { margin: 0 0 10px; }
.failed-table thead th { background: #3a2a2a; }
.settlement { padding: 16px 18px; border: 1px solid var(--gold-light); border-radius: 12px; background: #fffdf8; max-width: 760px; }
.settlement-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
.settlement-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.settlement-list dt { min-width: 0; }
.settlement-list dd { margin: 0; color: var(--ink); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.settlement-list > div.accent { border-bottom: 0; padding-top: 12px; font-size: 1.08em; }
.settlement-list > div.accent dt { color: var(--ink); font-weight: 700; }
.settlement-list > div.unpaid dd { color: var(--warning); }
/* Документооборот */
#workspace[data-view="documentsView"] > nav, #workspace > #documentsView { max-width: var(--w-work); }
#documentsView > .panel select { max-width: 520px; }
.document-upload { margin-top: var(--gap); }
.document-upload h3, .document-group h3 { margin-top: 0; }
.documents { display: grid; gap: var(--gap); margin-top: var(--gap); }
.document-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.document-info { display: grid; gap: 4px; min-width: 0; }
.document-info a { font-weight: 600; overflow-wrap: anywhere; }
.document-info small { color: var(--muted); overflow-wrap: anywhere; }

/* Подтверждение внутри страницы (вместо системного окна браузера) */
.confirm-dialog { padding: 0; border: 0; border-radius: 16px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(11, 11, 12, .55); }
.confirm-dialog::backdrop { background: rgba(11, 11, 12, .55); backdrop-filter: blur(2px); }
.confirm-dialog[open] { animation: dialog-in .16s ease-out; }
.confirm-dialog-box { padding: 24px 24px 20px; border-top: 3px solid var(--gold); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 1.2rem; line-height: 1.35; overflow-wrap: anywhere; }
.confirm-dialog p { margin: 0 0 18px; }
.confirm-dialog .form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }

/* Выгрузка в Excel */
.excel-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s; }
.excel-link::before { content: ""; width: 16px; height: 16px; border-radius: 3px; background: #1f7244 linear-gradient(135deg, transparent 45%, rgba(255, 255, 255, .35) 45%, rgba(255, 255, 255, .35) 55%, transparent 55%); flex: none; }
.excel-link:hover { border-color: var(--gold); background: var(--gold-soft); }
.collection-content > .excel-link, #financeList .excel-link, #reportsList .excel-link { margin: 0 0 14px; }

/* Кабинет инвестора: сводка, шапка подборки, этапы, ключевые цифры */
#investorPortal > nav { position: sticky; top: 8px; z-index: 5; }
.tab-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 8px; padding: 0 6px; border-radius: 11px; background: var(--gold-soft); color: var(--gold-dark); font-size: .75rem; font-weight: 700; }
.investor-tabs button[aria-current="page"] .tab-count { background: var(--gold); color: var(--black); }
.investor-overview { position: relative; overflow: hidden; margin: 0 0 clamp(24px, 3vw, 40px); padding: clamp(20px, 2.4vw, 32px); border-radius: 18px; background: radial-gradient(120% 140% at 100% 0%, #2a2219 0%, var(--black) 55%); color: #fff; box-shadow: var(--shadow); }
.investor-overview::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold-dark) 15%, var(--gold-light) 50%, var(--gold-dark) 85%, transparent); }
.overview-greeting .eyebrow { color: var(--gold-light); margin: 0; }
.overview-name { margin: 4px 0 18px; font-family: var(--font-serif); font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); color: #fff; line-height: 1.25; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-radius: 12px; background: var(--page); border: 1px solid var(--line-soft); }
.kpi-label { font-size: .75rem; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: clamp(1.15rem, 1rem + .5vw, 1.5rem); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-note { font-size: .8rem; color: var(--muted); }
.kpi.accent { background: var(--gold-soft); border-color: var(--gold-light); }
.kpi.accent .kpi-value { color: var(--gold-dark); }
.overview-kpis .kpi { background: rgba(255, 255, 255, .06); border-color: rgba(217, 188, 132, .22); }
.overview-kpis .kpi-label, .overview-kpis .kpi-note { color: rgba(255, 255, 255, .62); }
.overview-kpis .kpi-value { color: #fff; }
.overview-kpis .kpi.accent { background: rgba(180, 138, 76, .18); border-color: rgba(217, 188, 132, .5); }
.overview-kpis .kpi.accent .kpi-value { color: var(--gold-light); }

.investor-collection { margin-bottom: clamp(24px, 3vw, 40px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.investor-collection > .panel { margin: 0; border: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line-soft); }
.investor-collection > .panel h2 { font-size: 1.05rem; color: var(--muted); }
.collection-hero { padding: clamp(18px, 2vw, 28px); background: linear-gradient(180deg, #fffdf8, var(--surface)); }
.hero-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.hero-heading { min-width: 0; flex: 1 1 320px; }
.hero-meta { margin: 0; font-size: .85rem; }
.hero-heading h2 { margin: 4px 0 0; font-size: clamp(1.35rem, 1.1rem + .8vw, 1.9rem); line-height: 1.25; overflow-wrap: anywhere; }
.hero-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stage-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: var(--gold-soft); color: var(--gold-dark); white-space: nowrap; }
.stage-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stage-pill.new { background: var(--red-soft); color: var(--red); }
.stage-pill.work { background: #e8eef6; color: #2c4f7c; }
.stage-pill.done { background: var(--success-soft); color: var(--success); }

.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 20px 0; padding: 0; list-style: none; counter-reset: step; }
.stepper li { position: relative; padding-top: 14px; font-size: .8rem; color: var(--muted); counter-increment: step; }
.stepper li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; border-radius: 3px; background: var(--line); }
.stepper li.done { color: var(--ink); }
.stepper li.done::before { background: var(--gold); }
.stepper li.current { color: var(--ink); font-weight: 700; }
.stepper li.current::before { background: linear-gradient(90deg, var(--gold) 50%, var(--line) 50%); }

.status-progress { margin-top: 16px; }
.status-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); gap: 2px; }
.status-segment { flex-basis: 0; background: var(--line); }
.status-segment.sold, .status-legend .sold::before { background: var(--success); }
.status-segment.for_sale, .status-legend .for_sale::before { background: var(--gold); }
.status-segment.repair, .status-legend .repair::before { background: var(--gold-light); }
.status-segment.purchased, .status-legend .purchased::before { background: #7d96b8; }
.status-segment.in_collection, .status-legend .in_collection::before { background: #c9c1b4; }
.status-segment.failed, .status-legend .failed::before { background: var(--red); }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: .82rem; color: var(--muted); }
.status-legend li { display: inline-flex; align-items: center; gap: 6px; }
.status-legend li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }

@media (max-width: 600px) {
  #investorPortal > nav { position: static; }
  .investor-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .investor-tabs button { flex: none; }
  .stepper { grid-template-columns: repeat(5, minmax(56px, 1fr)); overflow-x: auto; }
  .stepper li { font-size: .72rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .hero-side { width: 100%; justify-content: space-between; }
}
#investorPortal > nav > span { align-self: center; padding: 0 12px 0 8px; font-weight: 600; color: var(--gold-dark); white-space: nowrap; }
@media (max-width: 600px) { #investorPortal > nav > span { display: none; } }

.flash-success { margin: 0 0 16px; padding: 14px 18px; border-radius: 12px; border-left: 4px solid var(--success); background: var(--success-soft); color: var(--success); font-weight: 600; scroll-margin-top: 90px; }
#investorPortal h1, .investor-collection { scroll-margin-top: 90px; }
@media (max-width: 600px) { .flash-success { scroll-margin-top: 16px; } #investorPortal h1, .investor-collection { scroll-margin-top: 16px; } }
.cancel-approval { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 16px clamp(18px, 2vw, 28px) 20px; border-top: 1px solid var(--line-soft); }
.cancel-approval p { margin: 0; flex: 1 1 320px; }
input:disabled, select:disabled { background: var(--page); color: var(--muted); border-style: dashed; cursor: not-allowed; }
.report-purchase { font-weight: 600; color: var(--ink); }
