:root {
  --bg: #f6f4f0; --card: #fff; --ink: #24201b; --dim: #7b746b; --line: #e4dfd6; --accent: #8C6A45; --accent-ink: #fff;
  --free: #1f9d55; --reserved: #d98a00; --sold: #c0392b; --off: #9a948b; --hidden: #5b6470; --owner: #f3ecff;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button, .btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: #cbbfae; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
button.link { border: 0; background: none; padding: 0 4px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
button.link.b { font-weight: 600; text-decoration: none; color: var(--ink); }
.danger { color: var(--sold) !important; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #d9c6ad; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--dim); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.dim { color: var(--dim); } .small { font-size: 12.5px; } .r { text-align: right; } .grow { flex: 1; }
.warn { color: var(--reserved); } .up { color: var(--sold); } .down { color: var(--free); }
code { background: #f1ede6; padding: 1px 5px; border-radius: 4px; } code.big { font-size: 18px; padding: 4px 8px; user-select: all; }
.boot { padding: 40px; text-align: center; color: var(--dim); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { background: #fff; padding: 32px; border-radius: 16px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 40px #0001; }
.login h1 { margin: 0 0 6px; font-size: 22px; } .login .logo { font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.err { color: var(--sold); margin: 0; } .note.err { background: #fdecea; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px 60px; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0; flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { display: flex; flex-direction: column; line-height: 1.2; } .brand b { font-size: 17px; }
.draft { display: flex; gap: 8px; align-items: center; } .draft > span { cursor: pointer; color: var(--dim); font-size: 13px; }
.draft.dirty > span { color: var(--reserved); font-weight: 600; } .draft.dirty > span::before { content: '● '; }
.usermenu { position: relative; } .usermenu .menu { position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 220px; box-shadow: 0 8px 30px #0002; z-index: 10; }
.usermenu .menu p { margin: 0 0 4px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 9px 12px; color: var(--dim); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); background: none; font-weight: 600; }

.card { background: var(--card); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; border: 1px solid var(--line); }
.card h3 { margin: 0 0 10px; font-size: 16px; } .card.owner { background: var(--owner); }
h4 { margin: 14px 0 8px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; } .row.wrap, .wrap.row { flex-wrap: wrap; }
.row.wrap > label, .row > label { min-width: 130px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.note { background: #fff7e6; border: 1px solid #f3dfb5; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { flex-direction: column; align-items: flex-start; gap: 0; min-width: 110px; padding: 8px 14px; border-left: 4px solid var(--c, var(--off)); font-size: 12.5px; color: var(--dim); }
.stat.wide { min-width: 160px; cursor: default; background: var(--card); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 8px; }
.stat b { font-size: 20px; color: var(--ink); }
.stat.on { outline: 2px solid var(--ink); background: #fff; color: var(--dim); }
.s-free { border-left-color: var(--free); } .s-reserved { border-left-color: var(--reserved); } .s-sold { border-left-color: var(--sold); } .s-hidden { border-left-color: var(--hidden); } .s-promo { border-left-color: #E4572E; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters input[type=search] { width: 200px; }
.bulk { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: #fffbe9; border: 1px solid #efe2a8; padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; position: sticky; top: 64px; z-index: 4; }
.bulk label { flex-direction: row; align-items: center; gap: 6px; }

.tablewrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 10px; border-bottom: 1px solid #f0ece5; text-align: left; vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--dim); font-weight: 500; background: #faf8f4; position: sticky; top: 0; }
table.units tr.sel { background: #fffbe9; }
table.units tr.st-sold td, table.units tr.st-off td { color: #8b857c; } table.units tr.st-hidden td { color: #a7a29a; font-style: italic; }
table.hist td { white-space: normal; } table.hist tr.b td { font-weight: 600; } tr.off td { opacity: .5; }
input.num { width: 120px; text-align: right; font-variant-numeric: tabular-nums; } input.num.s { width: 90px; }
.pill { border-radius: 999px; padding: 3px 10px; font-size: 12.5px; border: 0; background: #eee; color: #333; display: inline-block; }
select.pill { padding-right: 22px; cursor: pointer; }
.p-free { background: #dcf3e5; color: #116236; } .p-reserved { background: #ffeec8; color: #8a5500; } .p-sold { background: #f9dcd8; color: #8c2116; } .p-off { background: #ece9e4; color: #5e584f; } .p-hidden { background: #dfe3e8; color: #39424e; }
.promo { color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.tag { font-size: 11px; background: #eef4ea; color: #3c6b2c; border-radius: 4px; padding: 0 5px; margin-left: 6px; } .tag.ok { background: #dcf3e5; color: #116236; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bannerprev { color: #fff; padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.selrow { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }

.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-bottom: 12px; }
.mod { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; background: #fff; }
.mod input { flex: none; } .mod span { flex: 1; min-width: 0; }
.mod small { width: 100%; color: var(--dim); font-size: 11.5px; padding-left: 24px; } .mod.locked { background: #f7f5f1; color: var(--dim); }
ol.order { padding-left: 20px; max-width: 460px; } ol.order li { padding: 4px 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--line); }
ol.order li span { display: flex; gap: 4px; } ol.order button { padding: 2px 8px; }

.modal-bg { position: fixed; inset: 0; background: #0006; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 18px 22px; width: min(460px, 100%); max-height: 92vh; overflow: auto; }
.modal.wide { width: min(900px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; } .modal h3 { margin: 0; } .modal .x { border: 0; font-size: 22px; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: #1d3b2a; color: #fff; padding: 10px 14px; border-radius: 10px; max-width: 420px; box-shadow: 0 6px 20px #0003; }
.toast.err { background: #7a1f16; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .draft > span { display: none; }
  .top { position: static; }
  .bulk { top: 0; }
}

/* ---- этапы 2–3 и база лотов ---- */
.groups { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.groups button { border-radius: 999px; padding: 7px 16px; font-weight: 600; }
.groups button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: #E4572E; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 10px; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); padding: 6px 12px; }
.seg button:last-child { border-right: 0; } .seg button.on { background: var(--ink); color: #fff; }
.filters .seg { margin-bottom: 0; }
button.th { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; white-space: nowrap; }
.colgroup { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.passport { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 24px; }
.passport dl, dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 13.5px; }
.passport dt, dl.kv dt { color: var(--dim); } .passport dd, dl.kv dd { margin: 0; }
.chess-card { overflow: hidden; } .chesswrap { overflow-x: auto; }
table.chess { border-collapse: separate; border-spacing: 3px; width: auto; }
table.chess th, table.chess td { border: 0; padding: 0; text-align: center; font-size: 11px; color: var(--dim); background: none; position: static; }
table.chess th { padding: 0 6px; }
.cc { display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 84px; min-height: 58px; padding: 4px 6px; border-radius: 6px; border: 0; border-left: 5px solid var(--cc); background: color-mix(in srgb, var(--cc) 16%, var(--card)); font-size: 11px; line-height: 1.25; position: relative; color: var(--ink); }
.cc b { font-size: 12.5px; } .cc span { color: var(--dim); }
.cc.sel { outline: 2px solid var(--ink); } .cc.faded { opacity: .3; }
.cc .pm { position: absolute; right: 4px; top: 4px; width: 8px; height: 8px; border-radius: 50%; }
.cells { display: flex; flex-wrap: wrap; gap: 4px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); min-width: 160px; margin-bottom: 3px; } .bar i { display: block; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; } .kpi b { font-size: 24px; } .kpi span { color: var(--dim); font-size: 13px; }
.daychart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 14px; overflow-x: auto; }
.dc { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.dc i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.dc em { position: absolute; top: 0; font-style: normal; font-size: 10px; color: #E4572E; font-weight: 700; } .dc span { font-size: 10px; color: var(--dim); }
.funnel { display: grid; gap: 6px; } .fs { display: grid; grid-template-columns: 170px minmax(0, 1fr) 60px 50px; gap: 10px; align-items: center; font-size: 14px; }
.fb { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; } .fb i { display: block; height: 100%; background: var(--accent); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cards2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.scene { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; } .scene.off { opacity: .55; }
.thumb { position: relative; display: inline-flex; flex-direction: column; align-items: center; } .thumb img { width: 90px; height: 64px; object-fit: cover; border-radius: 6px; }
.logo-prev { height: 40px; max-width: 160px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.btn.upl { cursor: pointer; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; z-index: 4; border-top: 1px solid var(--line); }
.msg { background: #f6f3ee; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }
tr.new td { background: #fff8ea; }
.mono { font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 760px) { .kpis, .grid3, .cards2 { grid-template-columns: minmax(0, 1fr); } .fs { grid-template-columns: 110px minmax(0, 1fr) 40px; } .fs > :last-child { display: none; } }
