@font-face {
  font-family: Inter;
  src: url('/fonts/inter-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/plex-mono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/plex-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  font:16px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:#19191d;
  background:var(--canvas);
  --canvas:#f0f0f2;
  --sidebar:#ebebef;
  --paper:#fefefe;
  --muted:#59575c;
  --subtle:#69676e;
  --line:#dedde3;
  --cell-line:#e9e8ed;
  --control:#aaa8b3;
  --accent:#5140d7;
  --accent-hover:#4232bd;
  --tint:#e7e2fb;
  --green:#237143;
  --green-bg:#e3f0e7;
  --danger:#a42233;
  --red-bg:#f5e1e4;
  --mono:"IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sidebar-width:228px;
  --check-width:43px;
  --group-height:34px;
}
* {box-sizing:border-box}
body {margin:0}
[hidden] {display:none!important}
a {color:inherit;text-decoration:none}
button,input,select,textarea {font:inherit;color:inherit}
button {cursor:pointer}
button:disabled {cursor:wait;opacity:.65}
:focus-visible {outline:2px solid var(--accent);outline-offset:3px}
svg {width:20px;height:20px;display:block}
.shell {display:grid;grid-template-columns:var(--sidebar-width) minmax(0,1fr);min-height:100dvh}
.sidebar {position:sticky;top:0;height:100dvh;display:flex;flex-direction:column;background:var(--sidebar);border-right:1px solid var(--line);padding:19px 13px 15px}
.brand {display:flex;align-items:center;gap:11px;padding:0 6px;font-weight:730;letter-spacing:-.03em;white-space:nowrap}
.brand small {display:block;color:var(--muted);font-size:.6875rem;font-weight:500;letter-spacing:0;margin-top:2px}
.brand-mark,.avatar {display:grid;place-items:center;flex:none;width:35px;height:35px;border-radius:9px}
.brand-mark {color:#f9f8ff;background:#262237}
.brand-mark svg {width:19px;height:19px}
.sidebar nav {display:grid;gap:5px;margin-top:27px}
.sidebar nav a {display:flex;align-items:center;gap:12px;padding:11px 10px;border-radius:8px;color:var(--muted);font-size:.875rem;font-weight:560;white-space:nowrap}
.sidebar nav a:hover {background:#e3e1e8;color:#222126}
.sidebar nav a[aria-current] {background:var(--tint);color:#322382;font-weight:670}
.sidebar nav a[aria-current] svg {color:var(--accent)}
.sidebar nav svg {width:18px;height:18px}
.side-footer {display:flex;align-items:center;gap:10px;border-top:1px solid var(--line);margin-top:auto;padding:14px 5px 0;color:var(--muted);font-size:.8125rem}
.avatar {width:29px;height:29px;border-radius:50%;font-weight:700;font-size:.6875rem;background:#dad5ee;color:#40336a}
.side-footer button {border:0;background:none;color:inherit;padding:5px;cursor:pointer}
.side-footer button:hover {text-decoration:underline}
main {padding:23px clamp(22px,2.4vw,36px) 96px;min-width:0}
.path {display:flex;align-items:center;gap:8px;color:var(--muted);font-size:.8125rem}
.path svg {width:13px;height:13px}
.path strong {color:#17171b;font-weight:650}
.pagehead {display:flex;align-items:end;justify-content:space-between;gap:18px;margin:20px 0 23px}
h1,h2,p {margin:0}
h1 {font-size:clamp(1.7rem,2.6vw,2.05rem);line-height:1.13;font-weight:760;letter-spacing:-.04em}
h2 {font-size:1.35rem;letter-spacing:-.035em}
.pagehead p,dialog header p {margin-top:8px;color:var(--muted);font-size:.875rem}
.button,.icon-button {display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:38px;padding:8px 13px;border:1px solid var(--control);border-radius:10px;background:var(--paper);font-size:.875rem;font-weight:620;white-space:nowrap}
.button:hover,.icon-button:hover {background:#f0eef5}
.button svg {width:17px;height:17px}
.primary {background:var(--accent);border-color:var(--accent);color:white}
.primary:hover {background:var(--accent-hover);border-color:var(--accent-hover)}
.icon-button {width:35px;min-height:35px;padding:0}
.filters {display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:19px}
.search,.select {display:flex;align-items:center;gap:9px;border:1px solid var(--control);background:var(--paper);border-radius:10px;min-height:38px;font-size:.875rem;position:relative}
.search {flex:1 1 270px;max-width:440px;padding:0 12px;color:var(--muted)}
.search svg {width:17px;height:17px}
.search input {width:100%;border:0;background:transparent;outline:none;padding:8px 0;color:#19191d}
.search input::placeholder {color:var(--subtle)}
.search:focus-within,.select:focus-within {outline:2px solid var(--accent);outline-offset:1px}
.select select {appearance:none;border:0;background:transparent;padding:8px 32px 8px 12px;width:100%;outline:none}
.select span {position:absolute;right:9px;pointer-events:none;color:var(--muted)}
.select svg {width:15px;height:15px}
#count {margin-left:auto;color:var(--muted);font-size:.8125rem}
.grid-card {border:1px solid var(--line);border-radius:14px;background:var(--paper);overflow:hidden}
.scroll {overflow:auto;max-height:68vh;scrollbar-color:#cac8d2 transparent;scrollbar-width:thin}
table {border-collapse:separate;border-spacing:0;width:100%;font-size:.875rem}
thead th {position:sticky;top:0;background:#faf9fb;color:var(--muted);font-size:.8125rem;text-align:left;font-weight:640;z-index:2;white-space:nowrap}
th,td {padding:11px 13px;border-bottom:1px solid var(--cell-line)}
tr:last-child td {border-bottom:0}
tbody tr:hover td {background:#f7f6fb}
tbody tr[data-selected] td {background:#f0ebff}
thead .group-row th {height:var(--group-height)}
thead th.group {border-left:1px solid var(--cell-line);border-bottom-width:2px;padding:6px 12px}
thead th.group-cost {border-bottom-color:#a9a0bb}
thead th.group-wb {border-bottom-color:#7055cc}
thead th.group-oz {border-bottom-color:#478d71}
.grouped thead tr:nth-child(2) th {top:var(--group-height)}
.group-start {border-left:1px solid var(--cell-line)}
td.check,th.check {position:sticky;left:0;min-width:var(--check-width);width:var(--check-width);text-align:center;padding:10px;background:var(--paper);z-index:1}
td.product,th.product {position:sticky;left:0;min-width:195px;max-width:275px;background:var(--paper);z-index:1;box-shadow:1px 0 var(--cell-line)}
th.product,th.check {z-index:3;background:#faf9fb}
.with-check .product {left:var(--check-width)}
input[type=checkbox] {width:15px;height:15px;accent-color:var(--accent);vertical-align:middle;margin:0}
.product-button {border:0;padding:0;background:none;text-align:left;font-weight:630;cursor:pointer;overflow-wrap:anywhere;hyphens:auto}
.product-button:hover {color:var(--accent);text-decoration:underline}
.product .sku {display:block;color:var(--accent);margin-bottom:3px;font:500 .75rem/1.4 var(--mono)}
.number {text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
td.number {font-family:var(--mono);font-weight:500}
td.number:has(> .positive) {background:var(--green-bg)}
td.number:has(> .negative) {background:var(--red-bg)}
.positive {color:var(--green)}
.negative {color:var(--danger)}
.strong {font-weight:650}
.empty {color:var(--subtle)}
.pill {display:inline-block;padding:3px 8px;border-radius:6px;white-space:nowrap;font-size:.75rem;font-weight:620;background:#efedf1;color:var(--muted)}
.pill.wb {background:#f1e7f4;color:#733d79}
.pill.oz {background:#e9ecfa;color:#34558e}
.pill.ready {background:var(--green-bg);color:var(--green)}
.link {display:inline-flex;align-items:center;gap:4px;font-weight:610;color:var(--accent);white-space:nowrap}
.link svg {width:14px;height:14px}
.link:hover {text-decoration:underline}
.table-action {min-height:32px;padding:5px 10px;font-size:.8125rem;border-color:var(--line);border-radius:8px}
#empty:not(:empty) {min-height:252px;display:grid;place-items:center;padding:30px;text-align:center}
.empty-icon {width:48px;height:48px;margin:0 auto 13px;display:grid;place-items:center;background:var(--tint);border-radius:12px;color:var(--accent)}
.empty-icon svg {width:24px;height:24px}
.empty-content strong {font-size:1.05rem}
.empty-content p {max-width:370px;color:var(--muted);margin:7px auto 15px;font-size:.875rem}
.table-foot {border-top:1px solid var(--cell-line);padding:10px 14px;color:var(--muted);font-size:.8125rem}
.bulk {position:fixed;z-index:5;bottom:18px;left:calc(50% + var(--sidebar-width)/2);translate:-50% 0;display:flex;gap:9px;align-items:center;white-space:nowrap;padding:9px 11px;border:1px solid var(--line);background:var(--paper);border-radius:12px;box-shadow:0 10px 26px #25203b24;font-size:.875rem}
.bulk strong {padding:0 7px}
#notice {border:1px solid #c9ded0;background:var(--green-bg);color:var(--green);padding:10px 13px;border-radius:8px;margin-bottom:14px;font-size:.875rem}
#notice.error {border-color:#e5c4ca;background:var(--red-bg);color:var(--danger)}
dialog {width:min(690px,100%);max-width:100%;height:100dvh;max-height:100dvh;margin:0 0 0 auto;border:0;padding:0;box-shadow:-10px 0 36px #25203b35;color:#19191d}
dialog::backdrop {background:#28253165}
dialog form {display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%}
dialog header,dialog footer {display:flex;justify-content:space-between;align-items:start;gap:12px;padding:19px 24px;border-bottom:1px solid var(--line)}
dialog footer {align-items:center;justify-content:end;border-bottom:0;border-top:1px solid var(--line)}
#editor-body {overflow:auto;padding:19px 24px 24px}
#form-message {margin-right:auto;font-size:.8125rem;color:var(--danger);overflow-wrap:anywhere}
.fields {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}
.fields label,.fields .field {display:grid;gap:5px;font-weight:620;font-size:.8125rem;align-self:start}
.fields input,.fields select,.fields textarea,.login-card input {min-width:0;width:100%;background:#fff;border:1px solid var(--control);border-radius:8px;padding:9px 10px;font-size:.9375rem;font-weight:450}
.fields textarea {min-height:70px;resize:vertical}
.wide {grid-column:1/-1}
.link-input {display:flex;gap:8px}
.hint {font-size:.8125rem;color:var(--muted);font-weight:450}
#lookup-result {min-height:1em}
details {border:1px solid var(--line);border-radius:9px;margin:12px 0}
details summary {cursor:pointer;padding:12px 13px;font-size:.875rem;font-weight:650}
details .fields {padding:2px 13px 15px}
.metrics {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0}
.metric {border:1px solid var(--line);border-radius:8px;background:#faf9fb;padding:9px 10px;min-width:0}
.metric span {display:block;font-size:.75rem;color:var(--muted)}
.metric strong {display:block;font:500 .875rem/1.4 var(--mono);margin-top:3px;overflow-wrap:anywhere}
.login-layout {min-height:100dvh;display:grid;place-items:center;padding:20px}
.login-card {width:min(100%,410px);padding:clamp(20px,5vw,36px);background:var(--paper);border:1px solid var(--line);border-radius:14px}
.login-card p {margin-top:7px;color:var(--muted)}
.login-card form {display:grid;gap:14px;margin-top:24px}
.login-card label {display:grid;gap:5px;font-size:.875rem;font-weight:650}
.login-card input {padding:10px 12px;font-size:1rem}
.login-card .login-error {margin:0;color:var(--danger);font-size:.875rem}
@media (max-width:820px) {
  .shell {grid-template-columns:minmax(0,1fr)}
  .sidebar {height:auto;position:static;flex-direction:row;align-items:center;justify-content:space-between;gap:6px;padding:10px 13px;border-right:0;border-bottom:1px solid var(--line)}
  .sidebar nav {display:flex;margin:0;gap:5px}
  .sidebar nav a {padding:8px 9px}
  .side-footer {margin:0;border:0;padding:0}
  .avatar,.brand small {display:none}
  .bulk {left:50%}
}
@media (max-width:520px) {
  main {padding:17px 12px 100px}
  .sidebar {flex-wrap:wrap}
  .brand {font-size:.8125rem;gap:6px;padding:0}
  .brand-mark {width:28px;height:28px;border-radius:7px}
  .brand-mark svg {width:15px;height:15px}
  .sidebar nav {order:1;flex:0 0 100%}
  .sidebar nav a {font-size:.8125rem;gap:6px;padding:7px 9px}
  .sidebar nav svg {width:15px;height:15px}
  .pagehead {align-items:start;flex-direction:column;margin:17px 0}
  .search {flex-basis:100%}
  th,td {padding:10px}
  td.product,th.product {min-width:138px;max-width:165px}
  .bulk {gap:4px;max-width:calc(100% - 12px);bottom:9px;padding:6px}
  .bulk .button {font-size:.75rem;padding:6px 7px}
  .bulk strong {font-size:.75rem;padding:0 3px}
  #editor-body,dialog header,dialog footer {padding:14px}
  .fields {gap:10px}
}
