/* Mirauto · Управленческий учёт — оформление */
:root {
  --bg: #EEF1F4; --surface: #FFFFFF; --ink: #1B2631; --muted: #5B6875; --faint: #8794A1;
  --line: #DCE1E6; --line2: #EDF0F3; --field: #C9D1D9;
  --side: #17222E; --side2: #243241; --side-ink: #C9D3DC; --top: #0F1922;
  --acc: #0E6E62; --acc-d: #0A5249; --acc-l: #E3F1EE; --row: #F4FAF8; --sel: #D6EDE8;
  --neg: #B42318; --warn-bg: #FEF3E7; --warn: #7A2E0B; --info-bg: #EAF0F6; --info: #2B4A66;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); } a:hover { color: var(--acc-d); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .mono { font-family: var(--mono); font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
.neg { color: var(--neg); }
.muted { color: var(--muted); }

/* кнопки */
.btn { height: 32px; padding: 0 12px; border: 1px solid var(--field); background: var(--surface); border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.btn:hover { background: #F3F6F8; }
a.btn { text-decoration: none; color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.p { background: var(--acc); border-color: var(--acc); color: #fff; font-weight: 500; }
.btn.p:hover { background: var(--acc-d); }
.btn.danger { color: var(--neg); }
.ico { width: 30px; height: 30px; border: 0; background: none; border-radius: 5px; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico:hover { background: var(--bg); color: var(--ink); }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* вход */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 20px; }
.logo { width: 30px; height: 30px; border-radius: 6px; background: var(--acc); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }

/* CRM */
.crmfeed { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; margin-top: 6px; }
.crmfeed .fe { background: var(--bg); border-radius: 6px; padding: 6px 8px; font-size: 13px; white-space: pre-wrap; }
.crmfeed .fe.doc { background: none; border: 1px dashed var(--line); cursor: pointer; } .crmfeed .fe.doc:hover { background: #eef4fa; }
.stage { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #eef1f5; margin-bottom: 6px; }
.st-КП_отправлено { background: #e6f0ff; } .st-Частично_оплачен { background: #fff4d6; } .st-Оплачен { background: #e3f6e8; }
.st-Отгружен { background: #d9f2df; } .st-Отказ { background: #fde2e2; }

/* задачи */
.tcnt { margin-left: auto; background: #3a4a5a; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.tcnt.hot { background: #e2410f; }
table.tasks tr { cursor: pointer; } table.tasks tr.over td:nth-child(2) b { color: var(--neg); }
table.tasks tr.closed b { text-decoration: line-through; color: var(--muted); } table.tasks tr.unseen { background: #fff8e1; }
.urg { display: inline-block; background: #e2410f; color: #fff; border-radius: 4px; font-size: 11px; padding: 0 5px; margin-right: 6px; vertical-align: 1px; }
.tquick { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.tcomm { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; margin-bottom: 8px; }
.tcomm .tc { background: var(--bg); border-radius: 6px; padding: 6px 8px; font-size: 13px; white-space: pre-wrap; }
.trem { border-bottom: 1px solid var(--line); padding: 8px 0; } .trem:last-child { border-bottom: 0; }
td.editable { cursor: pointer; } td.editable:hover { background: #eef4fa; text-decoration: underline dotted; }

/* компактная шапка документа (как в УНФ) */
.fgrid.compact { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.3fr) minmax(150px, 1fr) minmax(180px, 1fr); gap: 8px 14px; }
.fgrid.compact .span2 { grid-column: span 2; }
.inp.autonum { background: var(--bg); color: var(--muted); }
.cpbal { font-size: 12px; margin-top: 3px; } .cpbal .neg { color: var(--neg); } .cpbal .pos { color: #13a34a; }
.cpbal .risk { font-weight: 700; padding: 4px 8px; border-radius: 6px; margin-bottom: 3px; } .cpbal .risk.grey { background: #fff4d6; color: #8a5a00; } .cpbal .risk.black { background: #fde2e2; color: #a40000; }
details.fmore { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
details.fmore > summary { cursor: pointer; color: var(--acc); font-size: 13px; list-style: none; }
details.fmore > summary:before { content: '▸ '; } details.fmore[open] > summary:before { content: '▾ '; }
details.fmore[open] > summary { margin-bottom: 6px; }
@media (max-width: 900px) { .fgrid.compact { grid-template-columns: 1fr; } .fgrid.compact .span2 { grid-column: auto; } }

/* экран входа */
.lg { min-height: 100vh; display: flex; flex-direction: column; background: #fff; color: #1d2330; }
.lg-top { background: #0f4f86; text-align: center; padding: 7px 16px; font-size: 13px; }
.lg-top a { color: #d8e8f6; text-decoration: none; } .lg-top a:hover { color: #fff; text-decoration: underline; }
.lg-head { background: linear-gradient(90deg, #0a6fbf, #1590dc); color: #fff; padding: 16px 60px; display: flex; align-items: center; gap: 14px; }
.lg-head img { height: 52px; width: auto; background: #fff; border-radius: 50%; padding: 2px; }
.lg-head .logo { width: 48px; height: 48px; border-radius: 50%; background: #fff; color: #0a6fbf; font-size: 20px; }
.lg-head b { font-size: 22px; display: block; line-height: 1.1; } .lg-head small { opacity: .85; font-size: 13px; }
.lg-idle { background: #fbf1c4; border-bottom: 1px solid #eadc9a; padding: 10px 24px; font-weight: 600; font-size: 14px; display: flex; gap: 16px; align-items: center; }
.lg-idle span { flex: 1; text-align: center; } .lg-idle button { border: 0; background: none; font-size: 20px; line-height: 1; color: #555; cursor: pointer; }
.lg-hero { position: relative; overflow: hidden; background: linear-gradient(120deg, #0d3e6e 0%, #1675bf 60%, #2a8fd8 100%);
  display: flex; align-items: center; gap: 60px; padding: 64px 120px; min-height: 520px; flex: 1; }
.lg-hero:before { content: ''; position: absolute; right: -120px; top: -140px; width: 720px; height: 720px; border-radius: 50%; border: 80px solid rgba(255,255,255,.05); }
.lg-hero:after { content: ''; position: absolute; left: 28%; bottom: -280px; width: 520px; height: 520px; border-radius: 50%; border: 60px solid rgba(255,255,255,.04); }
.lg-slides { position: relative; z-index: 1; color: #fff; flex: 1; max-width: 600px; display: grid; }
.lg-slide { grid-area: 1 / 1; opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; pointer-events: none; }
.lg-slide.on { opacity: 1; transform: none; pointer-events: auto; }
.lg-kick { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #ffd27a; margin-bottom: 12px; }
.lg-slide h2 { font-size: 38px; line-height: 1.15; margin: 0 0 14px; font-weight: 700; }
.lg-slide p { font-size: 17px; opacity: .92; margin: 0 0 22px; line-height: 1.5; }
.lg-pill { display: inline-block; border: 1.5px solid rgba(255,255,255,.9); border-radius: 6px; padding: 8px 14px; margin: 0 8px 8px 0; font-weight: 600; font-size: 14px; }
.lg-dots { grid-area: 2 / 1; display: flex; gap: 8px; margin-top: 18px; }
.lg-dots button { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; background: transparent; padding: 0; cursor: pointer; }
.lg-dots button.on { background: #fff; }
.lg-card { position: relative; z-index: 1; margin-left: auto; width: 380px; max-width: 100%; background: #fff; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,20,60,.3); padding: 30px; display: flex; flex-direction: column; gap: 6px; }
.lg-card h1 { margin: 0; font-size: 22px; } .lg-card .sub { margin: 0 0 8px; color: #667; font-size: 13px; }
.lg-card label { font-size: 12px; color: #556; margin-top: 8px; }
.lg-card .inp { height: 44px; font-size: 15px; }
.lg-card .go { height: 46px; margin-top: 16px; border: 0; border-radius: 8px; background: #f4511e; color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.lg-card .go:hover { background: #e2410f; } .lg-card .go:disabled { opacity: .7; cursor: default; }
.lg-tiles { display: flex; justify-content: center; gap: 56px; padding: 30px 16px 36px; flex-wrap: wrap; }
.lg-tiles div { text-align: center; font-weight: 600; color: #0f4f86; font-size: 14px; }
.lg-tiles i { display: flex; align-items: center; justify-content: center; width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 50%; background: #eef4fa; border: 2px solid #d4e3f1; color: #1588d8; }
.lg-tiles svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) {
  .lg-head { padding: 14px 16px; } .lg-hero { flex-direction: column; padding: 28px 16px; gap: 28px; align-items: stretch; }
  .lg-slide h2 { font-size: 24px; } .lg-slide p { font-size: 15px; } .lg-pill { display: none; } .lg-card { margin: 0 auto; order: -1; } .lg-tiles { gap: 24px; }
  .lg-idle { font-size: 13px; padding: 10px 16px; }
}

/* каркас */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.top { height: 52px; background: var(--top); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 12px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { font-size: 14px; display: block; }
.brand small { font-size: 11px; color: #9FB0BF; display: block; }
.gsearch { position: relative; flex: 1 1 300px; max-width: 560px; }
.gsearch label { display: flex; align-items: center; gap: 8px; height: 34px; background: #1D2A36; border-radius: 6px; padding: 0 10px; color: #9FB0BF; }
.gsearch input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: #fff; font-size: 13px; }
.drop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 28px rgba(15,25,34,.16); max-height: 420px; overflow: auto; z-index: 40; padding: 4px 0; }
.drop button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; }
.drop button:hover, .drop button.on { background: var(--row); }
.drop small { color: var(--faint); font-size: 12px; }
.drop .empty { padding: 8px 12px; color: var(--muted); }
.topr { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; color: #9FB0BF; }
.topr .rates span { margin-left: 8px; white-space: nowrap; }
.topr .me { color: #fff; background: none; border: 0; font-size: 13px; padding: 6px 8px; border-radius: 6px; }
.topr .me:hover { background: #1D2A36; }
.menu-btn { display: none; color: #fff; }
.menu-btn:hover { background: #1D2A36; color: #fff; }

.body { flex: 1; display: flex; min-height: 0; }
.side { width: 232px; flex-shrink: 0; background: var(--side); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav { width: 100%; text-align: left; background: none; border: 0; color: var(--side-ink); padding: 7px 12px; border-radius: 6px; display: flex; align-items: center; gap: 10px; }
.nav:hover { background: var(--side2); color: #fff; }
.nav.on { background: var(--acc); color: #fff; }
.side hr { border: 0; height: 1px; background: #2A3947; margin: 10px 6px; }
.side h6 { margin: 2px 12px 4px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #6F8293; font-weight: 500; }
.win { width: 100%; display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.win > button:first-child { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: #9FB0BF; padding: 6px 12px; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win:hover, .win.on { background: var(--side2); }
.win.on > button:first-child, .win:hover > button:first-child { color: #fff; }
.win .x { width: 24px; height: 24px; border: 0; background: none; color: #6F8293; border-radius: 4px; display: none; align-items: center; justify-content: center; }
.win:hover .x, .win.on .x { display: inline-flex; }
.win .x:hover { color: #fff; background: #31414F; }
.main { flex: 1; min-width: 0; padding: 16px 20px 28px; }
.view { display: none; flex-direction: column; gap: 12px; }
.view.on { display: flex; }

/* заголовок окна */
.vh { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vh h1 { margin: 0; font-size: 21px; font-weight: 600; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 10px; background: var(--acc-l); color: var(--acc-d); white-space: nowrap; }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.grey { background: #EDF0F3; color: var(--muted); }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar .grow { flex: 1; }
.lsearch { display: flex; align-items: center; gap: 8px; height: 32px; border: 1px solid var(--field); border-radius: 6px; background: var(--surface);
  padding: 0 10px; flex: 0 1 320px; min-width: 200px; margin-left: auto; color: var(--muted); }
.lsearch input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 13px; color: var(--ink); }

/* раздел */
.sec { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--acc); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.links button { display: block; border: 0; background: none; padding: 4px 0; color: var(--ink); text-align: left; }
.links button:hover { color: var(--acc); text-decoration: underline; }
.links .soon { display: block; padding: 4px 0; color: var(--faint); }
.links .soon small { font-size: 11px; margin-left: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.kpi small { color: var(--muted); display: block; }
.kpi b { font-size: 22px; font-weight: 600; font-family: var(--mono); display: block; margin-top: 4px; }

/* список */
.lwrap { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.tbox { flex: 999 1 600px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: calc(100vh - 200px); }
table { border-collapse: collapse; width: 100%; }
th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: left; padding: 8px 10px; background: #F6F8FA; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1; user-select: none; }
th.sort { cursor: pointer; } th.sort:hover { color: var(--ink); }
td { padding: 7px 10px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbox td { white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: default; }
tbody tr:hover td { background: var(--row); }
tbody tr.sel td { background: var(--sel); }
tr.del td { color: var(--faint); text-decoration: line-through; }
tfoot td { position: sticky; bottom: 0; background: #F6F8FA; font-weight: 600; border-top: 1px solid var(--line); }
.more { padding: 10px; text-align: center; }
.filt { flex: 0 1 260px; max-width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.filt h4 { margin: 0; font-size: 14px; }
.lwrap.nofilt .filt { display: none; }
.btn.on { background: var(--acc-l); border-color: var(--acc); color: var(--acc-d); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--field); background: var(--surface); font-size: 13px; }
.pill.on { background: var(--acc); border-color: var(--acc); color: #fff; }

/* форма */
.fwrap { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.fmain { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fside { flex: 1 1 260px; max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.grid { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 16px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { font-size: 12px; color: var(--muted); }
.fld > span .req { color: var(--neg); }
.inp { height: 32px; border: 1px solid var(--field); border-radius: 6px; background: var(--surface); padding: 0 10px; width: 100%; min-width: 0; outline: none; }
.inp:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(14,110,98,.15); }
.inp[readonly] { background: #F6F8FA; }
textarea.inp { height: 64px; padding: 6px 10px; resize: vertical; }
.fld.err .inp { border-color: var(--neg); }
.fld .msg { font-size: 12px; color: var(--neg); }
.refw { display: flex; gap: 2px; align-items: center; }
.refw .inp { flex: 1; }
.chk { display: flex; align-items: center; gap: 8px; height: 32px; }
.chk input { width: 16px; height: 16px; accent-color: var(--acc); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.kv:last-child { border-bottom: 0; }
.note { padding: 10px; border-radius: 6px; font-size: 13px; line-height: 1.45; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: var(--info-bg); color: var(--info); }
.note.ok { background: var(--acc-l); color: var(--acc-d); }
.tabs { display: flex; gap: 20px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tabs span { padding: 9px 2px; border-bottom: 2px solid var(--acc); font-weight: 500; }

/* окна поверх */
.modal-bg { position: fixed; inset: 0; background: rgba(15,25,34,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border-radius: 10px; box-shadow: 0 16px 40px rgba(15,25,34,.25); }
.modal header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 17px; }
.modal header .ico { margin-left: auto; }
.modal .mb { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: calc(100vw - 32px); box-sizing: border-box; overflow-wrap: anywhere; background: var(--top); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 80;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; }
.toast.err { background: var(--neg); }
.placeholder { background: var(--surface); border: 1px dashed var(--field); border-radius: 8px; padding: 28px; color: var(--muted); text-align: center; }

.me-ini { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .brand small, .topr .rates { display: none; }
  .top { gap: 8px; } .brand > div:last-child { display: none; }
  .me-full { display: none; } .me-ini { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; background: #1D2A36; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
  button.me { padding: 0; background: none; border: 0; }
  .gsearch { flex: 1 1 auto; min-width: 0; }
  .side { position: fixed; top: 52px; bottom: 0; left: 0; z-index: 50; transform: translateX(-100%); transition: transform .15s; overflow: auto; }
  .side.open { transform: none; }
  .main { padding: 12px; }
  .filt, .fside { max-width: none; }
  .tbox { max-height: none; }
}

/* поля формы по группам, как в УНФ */
.grid.grouped { display: block; }
.grid.grouped .fgroup { margin: 14px 0 8px; font-size: 15px; font-weight: 600; color: var(--acc); }
.grid.grouped .fgroup:first-child { margin-top: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 16px; }

/* документ: компактная шапка, большая таблица товаров, итоги и комментарий внизу (как в 1С) */
.grid.dochead { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 14px; padding: 10px 14px; }
.grid.dochead .inp { height: 30px; }
.lines-ed { display: flex; flex-direction: column; min-height: calc(100vh - 400px); }
.lines-scroll { flex: 1; overflow: auto; }
.lines-ed td { padding-top: 4px; padding-bottom: 4px; }
.lines-ed td .inp { height: 30px; }
.grid.fbottom { padding: 10px 14px; }
@media (max-width: 760px) { .lines-ed { min-height: 0; } }
.tabs .tabb { border: 0; background: none; padding: 9px 2px; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; cursor: pointer; }
.tabs .tabb.on { border-bottom-color: var(--acc); color: var(--ink); font-weight: 500; }

/* номенклатура (как в УНФ) */
.ibw { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
.ibtable { max-height: calc(100vh - 190px); }
.ibtable td.ibdesc { max-width: 320px; }
.ibside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 64px; }
.ibtree { max-height: 38vh; overflow: auto; font-size: 13px; }
.ibnode { display: flex; align-items: center; gap: 6px; padding: 4px 8px; cursor: pointer; white-space: nowrap; }
.ibnode:hover { background: var(--row); }
.ibnode.on { background: var(--acc); color: #fff; }
.ibnode svg { width: 15px; height: 15px; flex-shrink: 0; }
.ibtg { width: 16px; height: 16px; border: 0; background: none; padding: 0; color: inherit; font-size: 13px; line-height: 1; flex-shrink: 0; }
.ibinfo { font-size: 13px; max-height: calc(62vh - 140px); min-height: 160px; overflow: auto; }
.ibinfo .ibtitle { display: block; font-size: 15px; font-weight: 600; color: var(--acc); margin-bottom: 8px; text-decoration: none; }
.ibphoto { width: 100%; max-height: 170px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.ibstock { width: 100%; font-size: 13px; }
.ibstock th, .ibstock td { padding: 4px 6px; }
.ibinfo .kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
@media (max-width: 1100px) { .ibw { grid-template-columns: 1fr; } .ibside { position: static; } .ibtable { max-height: 60vh; } }
.ibtable td a { text-decoration: none; color: inherit; } .ibtable td a:hover { color: var(--acc); text-decoration: underline; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; } .cards3 .kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
/* ABC и панель товара */
.abc-A { background: #2E9E5B; } .abc-B { background: #E5B92E; } .abc-C { background: #D9534F; }
.ibtable td.abcs { width: 6px; padding: 0; } .ibtable td.abcs i { display: block; width: 6px; min-height: 30px; }
.abcl { display: inline-block; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 4px; color: #fff; text-align: center; font-size: 12px; line-height: 20px; font-weight: 700; }
.ibinfo { padding: 0; max-height: none; }
.ibinfo .ibtitle { padding: 12px 14px 2px; margin: 0; cursor: default; user-select: none; }
.ibinfo .tabs { padding: 0 14px; }
.ibpane { padding: 10px 14px 14px; max-height: calc(62vh - 150px); overflow: auto; }
.ibpane h3 { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--acc); margin: 2px 0 6px; }
.ibpane .fside { max-width: none; } .ibpane .fside .card { border: 0; padding: 0; }
.ibstock tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
tr.ibprice { cursor: pointer; } tr.ibprice:hover td { background: #FFF8E6; }
.drop .dropft { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 6px 12px; position: sticky; bottom: -4px; background: var(--surface); }
.drop .dropft a { color: var(--acc); } .drop .dropft .btn { height: 28px; padding: 0 8px; }
.picker { width: 100%; max-width: 1400px; height: 90vh; background: var(--bg); border-radius: 10px; box-shadow: 0 16px 40px rgba(15,25,34,.3); display: flex; flex-direction: column; overflow: hidden; }
.picker header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.picker header h2 { margin: 0; font-size: 17px; }
.pickbody { flex: 1; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.pickbody .ibtable { max-height: calc(90vh - 170px); }
.drop .dropft .btn { width: auto; flex-direction: row; display: inline-flex; }
.pos { color: #1E7B45; } .pstbl td { vertical-align: middle; } .pstbl td .inp { height: 30px; }
.signprev { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; text-align: center; background-image: linear-gradient(transparent 70%, #c9d2da 70%, #c9d2da 71%, transparent 71%); } .signprev img { max-width: 100%; max-height: 90px; }
/* прайс-лист */
.plwrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.plside { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 64px; }
.plchk { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.plhead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; } .plhead h2 { margin: 0; font-size: 20px; }
.pltbl { max-height: calc(100vh - 230px); }
.pltbl tr.plg td { background: #F6F8FA; font-weight: 600; border-top: 1px solid var(--line); }
.pltbl tr.plg0 td { font-size: 15px; background: #EDF2F5; } .pltbl tr.plg1 td { font-size: 14px; }
@media (max-width: 1000px) { .plwrap { grid-template-columns: 1fr; } .plside { position: static; order: -1; } }
/* меню «Печать ▾», «Доп. расход ▾» */
.popmenu { position: fixed; z-index: 300; background: var(--surface); border: 1px solid #C9D2DA; border-radius: 8px; box-shadow: 0 10px 28px rgba(15,25,34,.18); padding: 4px 0; min-width: 220px; }
.popmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.popmenu button:hover { background: var(--row); }
.popmenu .popsep { height: 1px; background: var(--line); margin: 4px 0; }
/* реализация: вкладки и доп. расходы */
.stabs { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.stabs > .dtabs { padding: 0 14px; }
.stabs > div > .card { border: 0; border-radius: 0 0 8px 8px; }
.dlv { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.dlv .kv2 { display: grid; grid-template-columns: 150px 1fr; gap: 8px; }
.xsum { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 10px 14px; background: #FFF8E6; border-color: #F5D9A6; }
.xchip { display: inline-flex; align-items: center; gap: 4px; }
.xchip .ico { width: 24px; height: 24px; }
.stabs .card > .tabs { display: none; } .stabs .lines-ed > .tabs { display: none; }
/* низ документа как в 1С: комментарий + ответственный */
.grid.fbottom { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 10px 16px; align-items: start; border-top: 1px solid var(--line, #E3E8EE); margin-top: 8px; }
.grid.fbottom > * { grid-column: auto !important; }
.grid.fbottom .fb-text textarea { min-height: 54px; }
@media (max-width: 700px) { .grid.fbottom { grid-template-columns: 1fr; } }
.grid.fbottom .fb-ref .inp { min-width: 0; }
.seg { display: flex; gap: 6px; }
.fside hr { border: 0; border-top: 1px solid var(--line, #E3E8EE); margin: 8px 0; }

/* карточка товара: комплект, сопряжённые детали, аналоги, кросс-номера */
.ilinks { margin-top: 12px; }
.ilinks table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ilinks th, .ilinks td { padding: 6px 8px; border-bottom: 1px solid var(--line, #E3E8EE); text-align: left; }
.iladd { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; flex-wrap: wrap; }
.iladd .grow { flex: 1 1 260px; min-width: 200px; }
.iladd > input, .iladd textarea { flex: 1 1 160px; }
.iladd > input.num { flex: 0 0 80px; }
.modal:has(.hist) { width: min(980px, 96vw); max-width: none; }

.pbar { height: 6px; background: var(--line, #E3E8EE); border-radius: 3px; overflow: hidden; margin-top: 3px; min-width: 80px; }
.pbar i { display: block; height: 100%; background: var(--acc, #0E6E5C); }

/* склад: отбор и размещение */
.wms .wms-scan{font-size:18px;height:44px;flex:1}
.wms .wms-row{display:flex;flex-direction:column;align-items:flex-start;width:100%;height:auto;padding:10px;margin-bottom:6px;text-align:left;gap:2px}
.wms tr.wms-done td{background:#E8F5EE;color:#5b6b63}
.wms tr.wms-short td{background:#FDECEC}
@media (max-width:700px){.wms table td,.wms table th{font-size:14px;padding:8px 6px}}

tr.due td{background:#FFF6E0}
/* дни рождения, контактные лица */
.modal.wide { max-width: 860px; }
.modal footer { flex-wrap: wrap; }
.bdwrap { display: grid; grid-template-columns: 1fr 270px; gap: 14px; align-items: start; }
.bdprev canvas { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.18); display: block; }
@media (max-width: 700px) { .bdwrap { grid-template-columns: 1fr; } .bdprev { max-width: 260px; } }
.cnt { padding: 6px 4px; border-bottom: 1px solid var(--line2); cursor: pointer; font-size: 13px; }
.cnt:hover { background: var(--row); }
.bdtoday { color: var(--neg); font-weight: 600; }
.bdsoon { color: var(--warn); }

/* состояние документа как в 1С */
.dstate { display: inline-flex; vertical-align: -3px; margin-right: 6px; }
.badge.state { display: inline-flex; align-items: center; gap: 2px; }
.badge.state .dstate { margin-right: 2px; }
.badge.ok { background: #E3F4E8; color: #1F7A3C; }

/* связанные товары плитками (как у Donaldson) */
.ltiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ltile { position: relative; border: 1px solid var(--line, #e2e5e9); border-radius: 8px; padding: 8px; background: #fff; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.ltile.click { cursor: pointer; }
.ltile.click:hover { border-color: #0f6f5c; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.ltile-pic { height: 120px; display: flex; align-items: center; justify-content: center; background: #f6f7f8; border-radius: 6px; overflow: hidden; }
.ltile-pic img { max-width: 100%; max-height: 120px; object-fit: contain; }
.ltile-nopic { font-size: 34px; opacity: .35; }
.ltile-num { font-weight: 700; margin-top: 4px; }
.ltile-name { color: #444; line-height: 1.25; max-height: 3.8em; overflow: hidden; }
.ltile-note { font-style: italic; color: #8a5a00; font-size: 12px; }
.ltile-qty { font-size: 12px; }
.ltile-av { margin-top: auto; padding-top: 4px; font-size: 12px; }
.ltile-del { position: absolute; top: 4px; right: 4px; background: #fff; }

.btn.help-q { width: 28px; height: 28px; min-width: 28px; padding: 0; border-radius: 50%; font-weight: 700; justify-content: center; }
.modal.wide { max-width: 820px; }
.helptext { max-height: 70vh; overflow: auto; font-size: 14px; line-height: 1.5; }
.helptext h1 { font-size: 18px; margin: 0 0 8px; }
.helptext h2 { font-size: 16px; margin: 16px 0 6px; }
.helptext p, .helptext ol { margin: 6px 0; }
.helptext blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--acc); background: var(--acc-l); }
.helptext table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.helptext th, .helptext td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
table.payslip { border-collapse: collapse; width: 100%; max-width: 520px; font-size: 14px; }
table.payslip td { padding: 4px 6px; border-bottom: 1px solid var(--line2); }
.phours { display: flex; gap: 1px; }
.phours span { display: inline-block; width: 6px; height: 14px; background: var(--acc); border-radius: 1px; }

.bell { position: relative; background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; margin-right: 6px; display: inline-flex; align-items: center; }
.bell-cnt { position: absolute; top: 0; right: -2px; background: #d33; color: #fff; border-radius: 9px; font-size: 11px; line-height: 16px; min-width: 16px; padding: 0 4px; text-align: center; font-weight: 700; }
.bell-pop { position: fixed; top: 52px; right: 12px; width: min(420px, calc(100vw - 24px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); color: var(--text, #111); border-radius: 10px; box-shadow: 0 16px 40px rgba(15,25,34,.3); z-index: 70; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-list { overflow: auto; }
.bell-item { padding: 8px 12px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.bell-item:hover { background: var(--acc-l); }
.bell-item.unread { border-left: 3px solid var(--acc); }
.bell-item.unread .bell-t { font-weight: 700; }
.bell-x { font-size: 12px; color: var(--muted, #667); white-space: pre-wrap; max-height: 3.6em; overflow: hidden; }
.bell-at { font-size: 11px; color: var(--faint, #99a); margin-top: 2px; }
.logo-img { width: 32px; height: 32px; border-radius: 50%; object-fit: contain; background: #fff; flex-shrink: 0; }
.card.bkaud.bad { border-left: 4px solid #d33; }
.card.bkaud.ok { border-left: 4px solid var(--acc); }
/* кнопка «?» — вся инструкция по программе УУ */
.help-top { border: 1.5px solid #8FA3B5 !important; border-radius: 50% !important; width: 28px; height: 28px; padding: 0 !important; color: #E6EEF5 !important; font-weight: 700; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.help-top:hover { background: rgba(255,255,255,.12) !important; }
