/* MoySklad clone: layout and tokens follow docs/DESIGN.md (snapshot of online.moysklad.ru). */
:root {
  --top-bg: #1F75A8;
  --top-text: #C6DDEA;
  --link: #186999;
  --link-new: #1F75A8;
  --text: #222;
  --muted: #999;
  --border: #BFBFBF;
  --grid-line: #E3E3E3;
  --accent: #EE644A;
  --green: #A2C617;
  --green-border: #8FAE14;
  --progress: #82B54B;
  --tab-blue: #036CE5;
  --pos-head: #5F6D79;
  --pos-text: #091739;
  --hl: #E8541E;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-grid: Tahoma, Arial, sans-serif;
  --font-new: "ALS Hauss", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 12px var(--font); color: var(--text); background: #fff; }
a { color: var(--link); }
button { font: inherit; }
input, textarea, select { font: 12px Arial, sans-serif; color: #000; }
textarea { font-family: var(--font); color: var(--text); }
.hidden { display: none !important; }
svg.ic { display: inline-block; vertical-align: middle; flex: none; }

/* ------------------------------------------------------------ top bar */
#top { height: 58px; background: var(--top-bg); display: flex; align-items: stretch; color: #fff; position: relative; z-index: 20; }
#top .logo { width: 58px; display: flex; align-items: center; justify-content: center; }
#top .menu { display: flex; align-items: stretch; }
.top-item { min-width: 68px; padding: 0 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--top-text); font-size: 11px; text-decoration: none; cursor: pointer; white-space: nowrap; border-radius: 3px 3px 0 0; }
.top-item:hover { color: #fff; }
.top-item.selected { background: rgba(0, 0, 0, .15); color: #fff; }
.top-item.off { opacity: .45; cursor: default; }
.top-item.off:hover { color: var(--top-text); }
#top .right { margin-left: auto; display: flex; align-items: center; gap: 18px; padding-right: 30px; }
#top .user { text-align: right; cursor: pointer; line-height: 14px; position: relative; }
#top .user .name { font-size: 12px; color: #fff; }
#top .user .login { font-size: 11px; color: var(--top-text); }
#top .avatar { width: 36px; height: 36px; border-radius: 50%; background: #C9D7E1; display: flex; align-items: center; justify-content: center; }

/* ------------------------------------------------------------ sub menu */
#sub { min-height: 40px; border-bottom: 1px solid #ECECEC; display: flex; flex-wrap: wrap; padding: 0 0 0 20px; background: #fff; }
.sub-item { height: 40px; line-height: 38px; margin-right: 40px; font-size: 13px; color: var(--link-new); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.sub-item.active { border-bottom-color: var(--top-bg); color: var(--top-bg); }
.sub-item.off { color: #9DBCD0; cursor: default; }

#page { padding-bottom: 40px; }

/* ------------------------------------------------------------ buttons */
.btn { height: 28px; padding: 0 10px; border: 1px solid #CCC; border-radius: 3px; background: linear-gradient(#FDFDFD, #EDEDED);
  font-size: 12px; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: linear-gradient(#FFF, #E4E4E4); }
.btn:disabled, .btn.disabled { color: #B5B5B5; cursor: default; background: linear-gradient(#FDFDFD, #F2F2F2); }
.btn.primary { background: linear-gradient(#B3D334, var(--green)); border-color: var(--green-border); color: #fff; }
.btn.primary:hover { background: linear-gradient(#BEDC45, #97BA12); }
.btn .caret { width: 0; height: 0; border: 4px solid transparent; border-top-color: #555; border-bottom: 0; margin-left: 2px; }
.btn.primary .caret { border-top-color: #fff; }
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; margin-left: -1px; }
.btn-group > .btn:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.btn-group > .btn:last-child { border-radius: 0 3px 3px 0; }
.btn .plus { width: 14px; height: 14px; border-radius: 50%; background: #1E88D3; position: relative; flex: none; }
.btn .plus.orange { background: #F2A019; }
.btn .plus::before, .btn .plus::after { content: ""; position: absolute; background: #fff; left: 3px; right: 3px; top: 6px; height: 2px; }
.btn .plus::after { left: 6px; right: auto; width: 2px; top: 3px; bottom: 3px; height: auto; }
.sel-count { width: 48px; height: 28px; border: 1px solid #CCC; border-radius: 3px 0 0 3px; display: inline-flex; align-items: center; justify-content: center; background: #fff; }
.icon-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--link-new); display: inline-flex; align-items: center; }
.link { color: var(--link); cursor: pointer; text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; }
.link-new { color: var(--link-new); cursor: pointer; background: none; border: 0; padding: 0; font: 14px var(--font-new); }

/* ------------------------------------------------------------ inputs */
.inp { height: 21px; border: 1px solid var(--border); border-radius: 0; padding: 0 3px; background: #fff; outline: none; }
.inp:focus, .ta:focus { border-color: #5B9DD9; box-shadow: 0 0 2px #5B9DD9; }
.inp.num { text-align: right; }
.inp.err, .ref.err, .date.err { border-color: #E2453C; background: #FFF3F2; }
.ta { border: 1px solid var(--border); padding: 3px; resize: vertical; outline: none; min-height: 36px; }
.inp:disabled, .ta:disabled { background: #EEE; }
.search { width: 206px; height: 23px; border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; font: 12px Arial, sans-serif; outline: none; }

/* reference select: text, × and ▾ in one frame, pencil or + beside it */
.ref, .date { display: inline-flex; align-items: center; height: 21px; border: 1px solid var(--border); background: #fff; vertical-align: middle; flex: none; }
.ref input, .date input { flex: 1; min-width: 0; height: 19px; border: 0; padding: 0 3px; background: transparent; outline: none; }
.ref:focus-within, .date:focus-within { border-color: #5B9DD9; box-shadow: 0 0 2px #5B9DD9; }
.ref.dis { background: #EEE; }
.ref .clear { width: 7px; height: 19px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #999; font: bold 14px Arial, sans-serif; }
.ref .open { width: 18px; height: 19px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ref .open::after { content: ""; border-style: solid; border-width: 5px 4px 0; border-color: #7B7B7B transparent transparent; }
.field-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: 5px; }
.gl { display: inline-flex; }
.gl svg { display: block; }

.dd { position: absolute; z-index: 100; background: #fff; border: 1px solid #C5C5C5; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); max-height: 320px; overflow-y: auto; min-width: 160px; }
.dd .opt { padding: 4px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd .opt:hover, .dd .opt.cur { background: #E5F1F8; }
.dd .opt.empty { color: var(--muted); cursor: default; background: none; }
.dd .opt .sub { color: var(--muted); margin-left: 6px; }

/* date input: calendar glyph and the text in one frame */
.date { height: 22px; }
.date .cal { display: flex; cursor: pointer; padding-left: 1px; }
.date.plain { border-color: transparent; }
.date.plain:hover, .date.plain:focus-within { border-color: var(--border); }
.calendar { position: absolute; z-index: 110; background: #fff; border: 1px solid #C5C5C5; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); padding: 6px; font-size: 12px; }
.calendar .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-weight: bold; }
.calendar .head button { background: none; border: 0; cursor: pointer; font-size: 14px; color: var(--link); }
.calendar table { border-collapse: collapse; }
.calendar td, .calendar th { width: 26px; height: 22px; text-align: center; }
.calendar th { color: var(--muted); font-weight: normal; }
.calendar td { cursor: pointer; }
.calendar td:hover { background: #E5F1F8; }
.calendar td.other { color: #BBB; }
.calendar td.sel { background: var(--top-bg); color: #fff; }
.calendar td.today { outline: 1px solid var(--top-bg); }
.calendar .time { margin-top: 6px; display: flex; gap: 6px; align-items: center; }

/* popup menu */
.menu-pop { position: absolute; z-index: 120; background: #fff; border: 1px solid #C5C5C5; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); padding: 4px 0; min-width: 150px; }
.menu-pop .mi { padding: 5px 14px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.menu-pop .mi:hover { background: #E5F1F8; }
.menu-pop .mi.dis { color: #B5B5B5; cursor: default; background: none; }
.menu-pop .sep { border-top: 1px solid #E3E3E3; margin: 4px 0; }
.menu-pop .swatch { width: 10px; height: 10px; flex: none; }

/* toast and modal */
#toasts { position: fixed; right: 20px; top: 70px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 10px 14px; background: #fff; border-left: 4px solid var(--progress); box-shadow: 0 3px 10px rgba(0, 0, 0, .25); font-size: 13px; white-space: pre-line; }
.toast.err { border-left-color: #E2453C; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.modal { background: #fff; min-width: 420px; max-width: 92vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); }
.modal .mh { padding: 14px 20px; font-size: 18px; border-bottom: 1px solid #E3E3E3; display: flex; justify-content: space-between; }
.modal .mh .x { cursor: pointer; color: #777; }
.modal .mb { padding: 16px 20px; overflow: auto; }
.modal .mf { padding: 12px 20px; border-top: 1px solid #E3E3E3; display: flex; gap: 8px; }

/* ------------------------------------------------------------ list pages */
.list-head { display: flex; align-items: center; gap: 10px; padding: 24px 20px 0 20px; flex-wrap: wrap; }
.list-head h1 { font-size: 20px; margin: 0 4px 0 0; font-weight: bold; display: flex; align-items: center; gap: 8px; }
.list-head .grow { flex: 1; }
.help { width: 16px; height: 16px; border: 1px solid #A9CBE0; border-radius: 50%; background: #F0F7FC; color: #1F75A8; font: bold 11px Arial, sans-serif; display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: help; }
.refresh { cursor: pointer; color: #888; display: inline-flex; }
.filter-panel { margin: 14px 20px 0; padding: 14px 16px; background: #F5F5F5; border: 1px solid #E3E3E3; display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 8px 30px; }
.filter-panel label { display: flex; align-items: center; gap: 8px; }
.filter-panel label > span:first-child { width: 110px; flex: none; }
.filter-panel .actions { grid-column: 1 / -1; display: flex; gap: 8px; }

.grid-wrap { margin: 20px 0 0 30px; overflow-x: auto; }
table.grid { border-collapse: collapse; font: 11px var(--font-grid); min-width: calc(100% - 10px); }
table.grid th { text-align: left; font-weight: normal; color: var(--link); padding: 8px 6px; border-bottom: 2px solid var(--top-bg); white-space: nowrap; cursor: default; position: relative; }
table.grid th.sort { cursor: pointer; text-decoration: underline; }
table.grid th .mark { position: absolute; top: -2px; left: 50%; font-size: 8px; color: #555; text-decoration: none; }
table.grid td { padding: 0 6px; height: 31px; border-bottom: 1px solid var(--grid-line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; position: relative; }
table.grid tr:hover td { background: #F5F9FC; }
table.grid tr.sel td { background: #FFF8D9; }
table.grid tr.unposted td { color: #9A9A9A; font-style: italic; }
table.grid tr.unposted td a { color: #8AAEC6; }
table.grid td.r, table.grid th.r { text-align: right; }
table.grid td.cb, table.grid th.cb { width: 26px; padding: 0 4px; text-decoration: none; }
table.grid .bar { position: absolute; left: 4px; right: 4px; bottom: 1px; height: 4px; }
table.grid .bar i { display: block; height: 4px; background: var(--progress); }
table.grid .empty td { text-align: center; color: var(--muted); height: 60px; }
.state { display: inline-block; padding: 2px 6px; color: #fff; font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

.pager { position: fixed; left: 0; right: 0; bottom: 0; height: 26px; background: #fff; border-top: 1px solid var(--grid-line); display: flex; align-items: center; padding: 0 40px; gap: 10px; z-index: 10; font-size: 11px; }
.pager .pg { width: 13px; height: 13px; border: 1px solid #9DB4C4; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: var(--link-new); cursor: pointer; background: #fff; padding: 0; }
.pager .pg:disabled { color: #CCC; border-color: #DDD; cursor: default; }
.pager .info { margin: 0 14px; }
.pager .totals { margin-left: auto; color: var(--link-new); font-size: 13px; cursor: pointer; background: none; border: 0; }
.pager .sum { margin-left: 20px; color: #444; }

/* goods: folder tree + grid */
.goods-body { display: flex; align-items: flex-start; margin-top: 20px; }
.tree { width: 300px; flex: none; font-size: 12px; padding-left: 16px; }
.tree .node { position: relative; height: 32px; line-height: 32px; padding-left: 48px; color: var(--link-new); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree .node .tw { position: absolute; left: 34px; width: 12px; text-align: center; color: #999; font-size: 9px; }
.tree .node.root { padding-left: 24px; }
.tree .node.cur { background: #E5F1F8; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.goods-body .grid-wrap { flex: 1; margin: 0 0 0 30px; }

/* ------------------------------------------------------------ cards */
.card { padding: 22px 40px 40px 40px; max-width: 1440px; }
.card-tools { display: flex; align-items: center; gap: 10px; }
/* owner and group, then the last change, right after the buttons */
.card-tools .right { margin-left: 0; display: flex; align-items: center; gap: 28px; font-size: 12px; color: var(--muted); }
.card-tools .right .who { text-align: right; line-height: 14px; }
.card-tools .right .who .v { font-size: 10px; color: var(--link); line-height: 11px; }
.card-tools .right .ava { width: 28px; height: 28px; border-radius: 50%; background: #DDE3E8; margin-left: -20px; }
.owner { width: 120px; color: var(--link); text-align: center; line-height: 14px; cursor: default; }
.owner .chev { display: inline-block; width: 5px; height: 5px; border: solid var(--link); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: 0 0 3px 7px; }
.owner small { display: block; color: #909090; font-size: 10px; line-height: 11px; }
.doc-title { display: flex; align-items: center; margin: 22px 0 18px; font-size: 18px; flex-wrap: wrap; row-gap: 8px; }
.doc-title .no { height: 24px; font: 18px Arial, sans-serif; border: 1px solid transparent; padding: 0 5px; background: transparent; outline: none; }
.doc-title .no:hover, .doc-title .no:focus { border-color: var(--border); }
.doc-title .ot { margin: 0 4px 0 6px; }
.doc-title .date { height: 26px; }
.doc-title .date input { height: 24px; font-size: 18px; }
.doc-title .date .cal { padding: 0 1px 0 2px; }
.doc-title > .pill { margin-left: 5px; }
.doc-title > .pill.pay { margin-left: 15px; }
.doc-title > .pill.pay + .pill { margin-left: 12px; }
.pill { height: 26px; padding: 0 10px; border-radius: 3px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: default; white-space: nowrap; }
.pill.pay { border: 1px solid #CCC; background: #fff; }
.pill.pay .o { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #F2A019; }
.pill.pay.part .o { border-color: #F2A019; background: linear-gradient(90deg, #F2A019 50%, #fff 50%); }
.pill.pay.paid .o { border-color: var(--progress); background: var(--progress); }
.pill.state-btn { color: #fff; cursor: pointer; padding: 0 12px; border-radius: 0; }
.pill.state-btn .caret { border: 4px solid transparent; border-top-color: #fff; border-bottom: 0; }
.pill.red { background: #E9262E; color: #fff; border-radius: 0; text-transform: uppercase; }
.pill.ok { background: var(--progress); color: #fff; border-radius: 0; text-transform: uppercase; }
.posted { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-left: 40px; }
.posted .help { margin-right: 2px; }
.card input[type=checkbox] { appearance: none; width: 16px; height: 16px; margin: 0; border: 1px solid #C5CBD3; border-radius: 4px; background: #fff; cursor: pointer; flex: none; vertical-align: middle; }
.card input[type=checkbox]:checked { border-color: #036CE5; background: #036CE5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E") center/11px no-repeat; }

/* document header: columns 1-2 share rows (labels as wide as the longest),
   column 3 and the currency row stand apart; spacing measured on the original */
.dochead { display: flex; align-items: flex-start; }
.fleft { display: flex; flex-direction: column; gap: 10px; }
.fgrid { --c1: 288px; display: grid; grid-template-columns: max-content minmax(var(--c1), max-content) max-content minmax(291px, max-content); column-gap: 11px; row-gap: 10px; align-items: start; }
.dochead.pay .fgrid { --c1: 296px; }
.fcur { display: grid; grid-template-columns: max-content max-content; column-gap: 11px; }
.fgrid3 { display: grid; grid-template-columns: 97px max-content; column-gap: 11px; row-gap: 13px; margin-left: 11px; align-items: start; }
.dochead .lbl, .attrs .lbl { position: relative; line-height: 14px; margin-top: 4px; white-space: nowrap; }
.dochead .lbl.req::before, .attrs .lbl.req::before { content: "*"; color: #FF4444; position: absolute; left: -7px; top: -1px; }
.dochead .ctl { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.dochead .line { display: flex; align-items: center; }
.dochead .ot { margin: 0 6px; }
.dochead .note { font-size: 12px; line-height: 17px; color: var(--text); }
.dochead .note .neg { color: #F00; }
.fcol { display: flex; flex-direction: column; gap: 10px; }
.frow { display: flex; align-items: flex-start; min-height: 21px; }
.frow > .lbl { width: 120px; flex: none; padding-top: 3px; position: relative; }
.frow > .lbl.req::before { content: "*"; color: #E2453C; position: absolute; left: -7px; top: 2px; }
.frow > .ctl { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.frow > .ctl > .line { display: flex; align-items: center; }
.frow .note { font-size: 12px; }
.frow .note .neg { color: #E2453C; }
/* custom fields: dealt over three columns, each a grid of its own */
.attrs { display: flex; align-items: flex-start; margin-top: 10px; }
.attrs .acol { display: grid; grid-template-columns: max-content max-content; column-gap: 10px; row-gap: 12px; align-items: start; margin-right: 50px; }
.attrs.wide .acol { column-gap: 15px; }
.attrs .lbl { margin-top: 2px; }
.attrs .lbl .help { position: absolute; left: -24px; top: -1px; }
.attrs .ctl { min-height: 21px; display: flex; align-items: center; }
.attrs .ctl.tall { padding-bottom: 3px; }
.attrs .ctl > textarea { display: block; }
.panel .attrs { display: block; }
.panel .attrs .acol { grid-template-columns: 160px minmax(0, 1fr); row-gap: 8px; }
.panel .attrs .lbl { color: #666; white-space: normal; }

/* tabs: new widgets (order) and classic (other documents) */
.tabs-new { display: flex; align-items: flex-end; gap: 22px; border-bottom: 1px solid #E3E3E3; margin-top: 26px; font: 14px var(--font-new); }
.tabs-new .tab { padding: 0 0 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; border-bottom: 3px solid transparent; margin-bottom: -1px; color: #222; }
.tabs-new .tab.cur { border-bottom-color: var(--tab-blue); }
.tabs-new .right { margin-left: auto; display: flex; gap: 20px; align-items: center; padding-bottom: 8px; }
.btn-outline { height: 30px; padding: 0 16px; border: 1px solid var(--tab-blue); border-radius: 6px; background: #fff; color: var(--tab-blue); font: 14px var(--font-new); cursor: pointer; }
.tabs-old { display: flex; margin-top: 24px; border-bottom: 1px solid #1F75A8; }
.tabs-old .tab { padding: 5px 10px; cursor: pointer; color: var(--link); border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; font-size: 13px; }
.tabs-old .tab.cur { border-color: #1F75A8; background: #fff; font-weight: bold; color: #222; border-bottom: 1px solid #fff; }

/* positions grid (order) */
.pos-tools { display: flex; align-items: center; gap: 30px; padding: 10px 0; border-bottom: 1px solid #E3E3E3; font: 14px var(--font-new); }
.pos-tools .pg-group { display: flex; align-items: center; background: #F2F4F7; border-radius: 6px; height: 30px; padding: 0 12px; gap: 18px; }
.pos-tools .pg-group .all { padding-right: 12px; border-right: 1px solid #C9CFD6; }
.pos-tools .pg-group button { color: var(--tab-blue); background: none; border: 0; cursor: pointer; font: 14px var(--font-new); padding: 0; }
.pos-tools .psearch { width: 312px; height: 28px; border: 1px solid #C9CFD6; border-radius: 6px; padding: 0 10px; font: 14px var(--font-new); outline: none; }
.pos-tools .right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle i { width: 28px; height: 16px; border-radius: 8px; background: #C9CFD6; position: relative; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on i { background: var(--tab-blue); }
.toggle.on i::after { left: 14px; }
table.pgrid { width: 100%; border-collapse: collapse; font: 12px var(--font-new); color: var(--pos-text); }
table.pgrid th { color: var(--pos-head); font-weight: normal; text-align: left; padding: 10px 8px; border-bottom: 1px solid #E3E3E3; white-space: nowrap; }
table.pgrid td { padding: 0 8px; height: 29px; border-bottom: 1px solid #EEF0F3; white-space: nowrap; }
table.pgrid .r { text-align: right; }
table.pgrid .no { width: 30px; text-align: right; color: var(--pos-text); }
table.pgrid .name { white-space: normal; min-width: 260px; }
table.pgrid .name a { color: var(--pos-text); text-decoration: none; }
table.pgrid .name a:hover { text-decoration: underline; }
table.pgrid .dots { color: #888; cursor: pointer; width: 30px; text-align: center; letter-spacing: 1px; }
table.pgrid input.cell { width: 100%; min-width: 50px; height: 22px; border: 1px solid transparent; background: transparent; text-align: right; font: 12px var(--font-new); color: var(--pos-text); padding: 0 3px; outline: none; }
table.pgrid input.cell:hover { border-color: #C9CFD6; }
table.pgrid input.cell:focus { border-color: var(--tab-blue); background: #fff; }
table.pgrid .uom { color: var(--pos-text); padding-left: 2px; }
table.pgrid .stock-low { color: #E2453C; }
table.pgrid tr.add td { height: 40px; border-bottom: 1px solid #E3E3E3; }
.add-wrap { position: relative; display: flex; align-items: center; gap: 14px; }
.add-wrap .plus-big { font-size: 26px; color: var(--tab-blue); line-height: 20px; cursor: pointer; width: 22px; text-align: center; font-weight: 300; }
.add-input { width: 480px; height: 24px; border: 1px solid #C9CFD6; border-radius: 6px; padding: 0 16px; font: 14px var(--font-new); outline: none; }
.add-input:focus { border-color: #091739; }
.counts { text-align: right; font: bold 14px var(--font-new); white-space: nowrap; }
.counts span { margin-left: 18px; }
.add-dd { position: absolute; left: 48px; z-index: 100; width: 736px; background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); font: 14px var(--font-new); }
.add-dd .hd { padding: 10px 16px; border-bottom: 1px solid #E3E3E3; display: flex; align-items: center; gap: 8px; }
.add-dd .it { padding: 7px 40px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; letter-spacing: .2px; }
.add-dd .it:hover, .add-dd .it.cur { background: #F2F4F7; }
.add-dd .it .nm { flex: 1; white-space: normal; }
.add-dd .it .hl { color: var(--hl); }
.add-dd .it .badge { background: #FDE2E0; color: #E2453C; border-radius: 4px; padding: 0 6px; font-size: 13px; }
.add-dd .it .badge.ok { background: #E6F2DA; color: #4E8A1D; }
.add-dd .more { padding: 7px 40px; color: var(--tab-blue); cursor: pointer; }
.add-dd .ft { padding: 10px 12px; border-top: 1px solid #E3E3E3; color: var(--tab-blue); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.add-dd .ft b { font-weight: 300; font-size: 24px; line-height: 16px; }
.add-dd .empty { padding: 10px 40px; color: var(--muted); }

/* positions grid (classic documents) */
table.pgrid.classic { font: 12px Arial, sans-serif; color: #222; }
table.pgrid.classic th { color: #222; font-size: 11px; padding: 8px 6px; border-bottom: 1px solid #1F75A8; }
table.pgrid.classic td { border-bottom: 1px solid #DDD; height: 29px; }
table.pgrid.classic input.cell { font: 12px Arial, sans-serif; color: #222; }
.classic-add { display: flex; gap: 20px; align-items: center; padding: 8px 0; border-bottom: 1px solid #1F75A8; position: relative; }
.classic-add .add-input { border-radius: 0; font: italic 12px Arial, sans-serif; width: 506px; height: 25px; padding: 0 4px; border-color: #BFBFBF; }
.classic-add .add-dd { left: 0; }

.doc-bottom { display: flex; gap: 60px; margin-top: 24px; align-items: flex-start; }
.doc-bottom .comment { flex: 1; min-height: 64px; font: 14px var(--font-new); padding: 8px; border: 1px solid #C9CFD6; resize: vertical; }
.totals { font: 14px var(--font-new); display: grid; grid-template-columns: auto auto; column-gap: 24px; row-gap: 10px; align-items: baseline; justify-items: end; min-width: 300px; }
.totals .big { font-size: 20px; font-weight: bold; }
.totals.classic { font: bold 18px Arial, sans-serif; }
.ext-code { margin-top: 24px; font: 14px var(--font-new); }

.related { margin-top: 10px; }
.related table.grid { min-width: 0; width: 100%; }
.empty-note { color: var(--muted); padding: 16px 0; }

/* catalog cards (product, counterparty) */
.big-name-label { margin-top: 24px; font-size: 12px; color: var(--muted); position: relative; padding-left: 10px; }
.big-name-label::before { content: "*"; color: #E2453C; position: absolute; left: 3px; }
.big-name { width: 100%; max-width: 1265px; height: 32px; font-size: 20px; font-weight: bold; border: 1px solid #5B9DD9; padding: 0 6px; margin-top: 6px; outline: none; }
.cat-body { display: flex; gap: 32px; margin-top: 16px; align-items: flex-start; }
.panels { width: 464px; flex: none; display: flex; flex-direction: column; gap: 12px; }
.panel { background: #F5F5F5; padding: 16px 32px 20px 32px; position: relative; }
.panel::before { content: "⠿"; position: absolute; left: 6px; top: 6px; color: #BBB; font-size: 10px; }
.panel .ph { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: bold; cursor: pointer; }
.panel .ph::after { content: ""; border: 5px solid transparent; border-top-color: #444; border-bottom: 0; }
.panel.closed .ph::after { transform: rotate(-90deg); }
.panel.closed .pb { display: none; }
.panel .pb { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.panel .frow > .lbl { width: 160px; color: #666; }
.panel .sep { border-top: 1px solid #E0E0E0; margin: 6px 0; }
.panel .sub-card { background: #fff; border: 1px solid #E3E3E3; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cat-right { flex: 1; min-width: 0; max-width: 770px; }
.tabs-gray { display: flex; }
.tabs-gray .tab { flex: 1; height: 40px; display: flex; align-items: center; justify-content: center; background: #E3E3E3; border-right: 1px solid #fff; cursor: pointer; font-size: 12px; white-space: nowrap; padding: 0 8px; }
.tabs-gray .tab.cur { background: var(--top-bg); color: #fff; }
.tab-body { padding-top: 28px; }
.prices { display: grid; grid-template-columns: 170px 140px 140px 20px; gap: 6px 8px; align-items: center; }
.prices .gap { grid-column: 1 / -1; height: 14px; }
.kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; border-top: 1px solid #E3E3E3; padding-top: 24px; margin-top: 24px; }
.kpi h4 { margin: 0 0 10px; font-size: 12px; }
.kpi .row { display: flex; gap: 10px; color: #999; margin-bottom: 6px; }
.kpi .row b { color: #222; font-weight: normal; }
.kpi .row .k { width: 90px; }

/* stock report */
.seg { display: inline-flex; border: 1px solid #CCC; border-radius: 3px; overflow: hidden; }
.seg button { height: 26px; padding: 0 12px; border: 0; background: linear-gradient(#FDFDFD, #EDEDED); cursor: pointer; font-size: 12px; }
.seg button.cur { background: #D7E6F0; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .15); }
table.grid td.img { width: 40px; padding: 0 4px; }
table.grid td.img img { max-width: 32px; max-height: 26px; vertical-align: middle; }

/* login */
.login-page { min-height: 100vh; background: #F0F3F5; display: flex; align-items: center; justify-content: center; }
.login-box { width: 360px; background: #fff; padding: 34px 36px; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.login-box h1 { font-size: 20px; margin: 0 0 22px; display: flex; align-items: center; gap: 10px; }
.login-box label { display: block; margin-bottom: 14px; color: #666; }
.login-box input { width: 100%; height: 32px; margin-top: 4px; border: 1px solid var(--border); padding: 0 8px; font-size: 14px; }
.login-box .btn { width: 100%; height: 34px; justify-content: center; font-size: 14px; margin-top: 6px; }
.login-box .err { color: #E2453C; min-height: 18px; margin-top: 10px; }
