:root { --bg:#06031a; --panel:#10072e; --line:rgba(154,134,255,.28); --ink:#eef2ff; --muted:#a89fd8; --mag:#e75cf0; --blue:#5b4dff; --ok:#3ddc84; --warn:#ffb27a; --red:#ff6b86; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: radial-gradient(70% 40% at 90% -5%, rgba(91,77,255,.25), transparent 70%), var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; }
.wrap { width: min(1180px, 100% - 24px); margin: 0 auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 700; background: linear-gradient(120deg, var(--blue), #c23ee0); color: #fff; box-shadow: 0 0 18px -6px rgba(194,62,224,.8); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: rgba(255,107,134,.14); color: var(--red); box-shadow: inset 0 0 0 1px rgba(255,107,134,.4); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 0; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--line); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--mag); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--mag); }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 22px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line), 0 0 60px -20px rgba(231,92,240,.5); }
.login-card h1 { margin: 0; font-size: 22px; }
.err { color: var(--red); min-height: 1.4em; font-size: 14px; }

/* шапка */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(6,3,26,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 0; }
.brand { font-weight: 800; letter-spacing: -.01em; }
.brand b { color: var(--mag); }
.chip { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.chip.dirty { background: rgba(255,178,122,.16); color: var(--warn); }
.chip.clean { background: rgba(61,220,132,.14); color: var(--ok); }
.spacer { flex: 1; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 0; scrollbar-width: none; }
.tab { flex: none; padding: 9px 16px; border-radius: 12px 12px 0 0; background: rgba(255,255,255,.05); font-weight: 700; color: var(--muted); }
.tab.on { background: var(--panel); color: #fff; box-shadow: inset 0 2px 0 var(--mag); }
main.body { padding: 16px 0 80px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.bar input[type=search] { flex: 1; min-width: 160px; }

/* таблица товаров */
.rows { display: grid; gap: 8px; }
.row { display: grid; grid-template-columns: 56px minmax(0,2fr) 250px 150px 170px 200px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.row.head { background: none; box-shadow: none; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-block: 0; }
.row.hid { opacity: .5; }
.thumb { width: 56px; height: 56px; border-radius: 10px; background: #fff linear-gradient(160deg, #fff, #e6e1ff); display: grid; place-items: center; overflow: hidden; color: #9a86ff; font-size: 11px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.nm { font-weight: 700; cursor: pointer; overflow-wrap: anywhere; }
.nm small { display: block; color: var(--muted); font-weight: 400; }
.c-price { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.c-checks { display: flex; gap: 14px; }
.cell-label { display: none; font-size: 11px; color: var(--muted); }
.acts { display: flex; gap: 6px; justify-content: flex-end; }
.price-in { text-align: right; }
.saved { color: var(--ok); font-size: 12px; opacity: 0; transition: opacity .3s; }
.saved.on { opacity: 1; }

/* подписки */
.sub { margin-bottom: 18px; padding: 14px; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.sub h3 { margin: 0 0 4px; }
.tier-row { display: grid; grid-template-columns: minmax(120px,1fr) repeat(3, 120px); gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(154,134,255,.15); }

/* окно редактирования */
dialog { width: min(720px, 100% - 16px); max-height: 92vh; overflow: auto; padding: 0; border: 0; border-radius: 20px; background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), 0 30px 120px rgba(0,0,0,.8); }
dialog::backdrop { background: rgba(3,1,14,.75); }
.dlg { display: grid; gap: 14px; padding: 18px; }
.dlg h2 { margin: 0; font-size: 19px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.checks label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.drop { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 14px; border: 1px dashed var(--line); }
.drop.over { border-color: var(--mag); background: rgba(231,92,240,.08); }
.drop .thumb { width: 110px; height: 110px; }
.dlg-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
pre.log { max-height: 200px; overflow: auto; background: rgba(0,0,0,.4); padding: 10px; border-radius: 10px; font-size: 12px; white-space: pre-wrap; }
.hist { display: grid; gap: 8px; }
.hist-i { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.t { padding: 10px 16px; border-radius: 12px; background: #1b0f4a; box-shadow: inset 0 0 0 1px var(--mag), 0 10px 40px rgba(0,0,0,.6); animation: tin .25s ease; }
.t.bad { box-shadow: inset 0 0 0 1px var(--red); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
.busy { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(3,1,14,.7); }
.busy div { padding: 20px 28px; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--mag); text-align: center; }

@media (max-width: 860px) {
  .row.head { display: none; }
  .row { grid-template-columns: 56px 1fr; grid-template-areas: 'th nm' 'pr pr' 'st st' 'ck ck' 'ac ac'; gap: 8px 10px; }
  .row .thumb { grid-area: th; } .row .nm { grid-area: nm; }
  .row .c-price { grid-area: pr; }
  .row .c-stock { grid-area: st; } .row .c-checks { grid-area: ck; gap: 16px; }
  .row .acts { grid-area: ac; justify-content: flex-start; }
  .cell-label { display: block; }
  .tier-row { grid-template-columns: 1fr 1fr 1fr; } .tier-row > :first-child { grid-column: 1 / -1; font-weight: 700; }
  .grid2 { grid-template-columns: 1fr; }
  .drop { grid-template-columns: 1fr; }
}

.c-checks { flex-wrap: nowrap; align-items: center; gap: 12px; }
.c-checks .checks { flex-wrap: nowrap; gap: 6px; white-space: nowrap; }

/* блоки и формы по схеме */
.brow { grid-template-columns: 34px minmax(0,2fr) 150px 220px; cursor: default; }
.brow[draggable="true"] { cursor: grab; }
.brow.dragging { opacity: .4; } .brow.over { box-shadow: inset 0 0 0 2px var(--mag); }
.brow .num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(231,92,240,.15); color: var(--mag); font-weight: 800; font-size: 13px; }
.fields { display: grid; gap: 12px; }
.items { display: grid; gap: 10px; margin: 8px 0; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); }
.item-acts { display: flex; flex-direction: column; gap: 6px; }
.items-fld > .f { margin-bottom: 4px; }
form.sub .fields { max-width: 760px; }
/* заявки */
.order { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.order-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.order ul { margin: 0; padding-left: 18px; }
@media (max-width: 860px) { .brow { grid-template-columns: 34px 1fr; grid-template-areas: 'n nm' 'sh sh' 'ac ac'; } .brow .num { grid-area: n; } .brow .nm { grid-area: nm; } .brow .checks { grid-area: sh; } .brow .acts { grid-area: ac; justify-content: flex-start; } .item { grid-template-columns: 1fr; } .item-acts { flex-direction: row; } }
